W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2013

Re: [whatwg] Avoiding synchronous iframe load

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 17 Oct 2013 22:24:33 -0400
Message-ID: <52609BE1.9080408@mit.edu>
To: whatwg@lists.whatwg.org
On 10/17/13 4:04 AM, Ryosuke Niwa wrote:
> Iíll add that Firefox and Internet Explorer both load about:blank asynchronously.

Yes, but in the case of Firefox we consider that a bug.

In particular, we believe that the behavior web authors expect is for 
the document to be created synchronously.  When its onload fires is an 
open question; we believe for web compat that should be async.

Looking at your original testcase with javascript:

<script> var a = false; </script>
<iframe src="javascript:a=true" onload="a = true"></iframe>
<script> alert(a); /* or even setTimeout(function(){alert(a);},0); */ 
setTimeout(function(){alert(a);},10) </script>

What this does in Firefox (where javascript: loads async) depends on 
what the exact order of event delivery is.  The parsing of the <script> 
after the <iframe> races the async javascript: load, so this can alert 
either true or false for the first alert it makes.  For that matter, it 
can do the same for the second alert it makes.

I strongly believe that async loading of javascript: is desirable (which 
is why Gecko switched to it); if the spec requires something else I'm 
all in favor of changing the spec.

-Boris
Received on Friday, 18 October 2013 02:25:01 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:12 UTC