W3C home > Mailing lists > Public > public-html@w3.org > January 2011

Re: script execution corner case: timing of running a script created from a javascript: URL inside an IFRAME

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 19 Jan 2011 01:09:33 -0500
Message-ID: <4D36801D.6080900@mit.edu>
To: "Hallvord R. M. Steen" <hallvord@opera.com>
CC: public-html@w3.org
On 1/18/11 11:53 PM, Hallvord R. M. Steen wrote:
> Chrome takes a very predictable approach: the javascript: URL *and* the
> script inside the IFRAME run immediately, before the appending script
> continues. Current releases of Opera run the javascript: URL immediately
> but postphone the frame script until after the current thread (we'll
> probably change that to postphone the javascript: URL too). IE and
> Firefox first finish both inline scripts, then deal with the IFRAME -
> this may be timing-sensitive, I don't know how they would behave if,
> say, there was an external script after the inserted IFRAME, or many
> inline scripts.

In the case of Gecko, we just treat javascript: like every other 
protocol handler: it runs asynchronously.  That means that inserting the 
iframe in this case posts an event to the event loop to run the script, 
and does nothing else.

Now how this orders with the inline scripts will depend on what other 
events were already in the event loop when this one got posted and 
whatnot.  Just like the situation for an iframe pointing to an HTTP URI 
that had an inline script.

> Does it even make sense to try to standardise the behaviour here?

Imo, yes.  At least the sync-vs-async thing for javascript: could use 

Received on Wednesday, 19 January 2011 06:10:37 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:45:29 UTC