[Webkit-unassigned] [Bug 42365] HTML5 Parser: document.write in a asynchronous script which is specified to load before page finish blows away document

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 15 07:11:02 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=42365





--- Comment #3 from Johnny Ding <jnd at chromium.org>  2010-07-15 07:11:02 PST ---
When talking with Adam for this issue, he told me to read a related W3C bug. (http://www.w3.org/Bugs/Public/show_bug.cgi?id=9767)

In the comment#10 of that bug, Ian provided a solution: "It would need a flag on the <script> element set when the element is added to the document, based on
whether the parser is on the stack, and then for the script execution to set a
similar flag".
According to Ian's solution, if script is added when document's parser is on the stack, which means the author of the webpage wants to execute the script in current document, and the document.write in that script should not blow way the document. This solution looks reasonable for me.

My thought to fix this bug is
1.Add a flag in ScriptElementData to indicate whether the script is added when document's parser is on the stack. (the ScriptElementData::m_createByParser is right flag to use?)
2. in Document.write, if a script is running (check both HTMLDocumentParser::m_scriptRunner and Document::m_scriptsToExecuteSoon), and if the script was added when document's parser was on the stack, ignore this document.write. Otherwise do write.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list