Opened 9 years ago

Closed 7 years ago

#11324 closed defect (wontfix)

dojo.io.iframe First request does not work in Opera.

Reported by: palko Owned by: Bryan Forbes
Priority: high Milestone: tbd
Component: IO Version: 1.4.3
Keywords: Cc:
Blocked By: Blocking:

Description

To recreate the bug, only simple HTML/JS is needed:

<form action="responseWithTextarea.html" method="post" enctype="multipart/form-data" id="imageForm">
    <input type="file" name="image" />
    <input type="button" onclick="submitImage()" value="Submit" />
</form>

<script type="text/javascript">
    function submitImage() {
        dojo.io.iframe.send({
            "form": dojo.byId("imageForm"),
            "load": function() {
                // E.g. show the uploaded image
            },
            "error": function(error) {
                alert(error);
            }
        });
    }
</script>

This works in IE 8.0.6001, FF 3.6.3, Chrome 5.0.375.70. However in Opera 10.53, I get for the first request error:

TypeError: Cannot convert 'ifd.getElementsByTagName("textarea")[0]' to object

After the first failure next requests work! I was able to workaround this problem by preparing the underlaying transport IFRAME manually before the first dojo.io.iframe.send() call.

Workaround function was:

/**
 * Prepare underlaying IFRAME transport.
 * Workaround for Opera's delayed DOM handling.
 */
_prepareTransport: function() {
    var dif = dojo.io.iframe;
    if (!dif._frame) {
        dif._frame = dif.create(dif._iframeName, dojo._scopeName +
                ".io.iframe._iframeOnload();");
    }
}

I am assuming that the problem is, that Opera is somehow delaying _creating_ the IFRAME element, so that it is not ready when the first request is finished.

I think the solution can be to first prepare the transport IFRAME and delay the first request when dojo.io.iframe.send() is called. The delay can be achieved with something small like this:

setTimeout(dojo.hitch(this, "_fireNextRequest"), 1);

Change History (3)

comment:1 Changed 9 years ago by palko

I was playing with this a little bit more:

IFRAME in Opera fires two 'onload' events. The first 'onload' belongs to the 'blank.html', which is the source page the IFRAME is created with.

Problem is, that when 'onload' is handled by dojo.io.iframe._iframeOnload(), there is an ongoing request and the handler is assuming that the 'onload' event must belong to the request.

Can someone please confirm this and write if it will be fixed. And will the fix be backported to 1.4.X? Thank you.

comment:2 Changed 8 years ago by bill

Owner: changed from James Burke to Bryan Forbes

Bulk change to reassign IO tickets to Bryan, since he is working on new dojo/request module. Some of these tickets should probably be closed as already fixed, invalid, or wontfix.

comment:3 Changed 7 years ago by bill

Resolution: wontfix
Status: newclosed

Given that Opera is being rebuilt based on WebKit?, we should probably close this as wontfix.

Note: See TracTickets for help on using tickets.