Newly-created browsing contexts and about:blank

I did some research on initial about:blank in newly-created browsing contexts:

Copying and pasting my conclusion:

 * When loading any URL in a browsing context, initially create the DOM of about:blank there synchronously, since all browsers seem to do roughly that.

 * Since synchronous events are bad and Firefox gets away with not firing load synchronously for about:blank, never fire the load event synchronously.

 * Fire a load event asynchronously for the document that is the destination of the navigation.

 * If about:blank is the destination of navigation for, use the initial synchronously-created DOM without overwriting it.

 * If about:blank is the destination of navigation for an iframe create the DOM synchronously ASAP as with 

I am not sure what to think of the case where about:blank is not the initial destination of navigation for an iframe. Creating a synchronous placeholder about:blank DOM would make the browsing context code the same as in the case and would provide an early document.body that scripts could accidentally poke without poking null. On the other hand, setting up such a DOM first and then letting the DOM be blown away by a later network task means that the presence of element nodes in the DOM would be racy relative to the network and to script getting appended to the DOM in the same parser task that appended the iframe. In that sense, the IE/Safari behavior would be nicer.

Opinions about the conclusion?

Henri Sivonen

Received on Wednesday, 2 March 2011 14:41:01 UTC