[Bug 9767] Consider ignoring document.write() when IE ignores it if comes from the network task source

http://www.w3.org/Bugs/Public/show_bug.cgi?id=9767





--- Comment #8 from Henri Sivonen <hsivonen@iki.fi>  2010-06-21 08:23:43 ---
(In reply to comment #1)
> Potential solution: Ignoring document.write() if script is running from the
> network task source due to external script element completing fetch (as opposed
> to event handlers or timeouts) and the insertion point is undefined.

This condition is too broad because it would cause document.write() to be
ignored when an external script call document.write on another document (e.g.
an iframe child).

The Gecko patch that I wrote for this (neither reviewed nor landed) increments
a counter on the owner document of an external script right before evaluating
the external script and decrements the counter on the same document after (the
owner might have changed by now).

document.write() on occasions where previously a call to document.open() was
implied checks the above-mentioned counter on the document object first first.
If the counter is zero, a call to document.open() is implied as before.
Otherwise, document.write() returns right away and a warning is emitted to the
JS console.

(It seems to me that the counter should never be able to get values other than
0 or 1, but I can imagine alert() or sync XHR causing situations I haven't
thought through properly.)

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Monday, 21 June 2010 08:23:46 UTC