Open Bug 284296 Opened 16 years ago Updated 10 years ago
DOMParser freezes Mozilla if the top element is html:script
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.6) Gecko/20050223 Firefox/1.0.1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.6) Gecko/20050223 Firefox/1.0.1 DOMParser freezes when parsing a string that the top element is HTML script, e.g. '<script xmlns="http://www.w3.org/1999/xhtml"/>'. Of course one can blame me for parser an incorrect string. But my string is a well-formatted so it should be parsed accordingly. The bug is still reproducible on Mozilla 1.8b1. P.S. If there is no xmlns, there is no problem (it is parsed as generic XML). For other elements like p, table, hr, there is no problem too. HTML script seems to be the only element that kills DOMParser. Reproducible: Always Steps to Reproduce: 1. Create a string like '<script xmlns="http://www.w3.org/1999/xhtml"/>' 2. Parse with DOMParser Actual Results: The browser freezes when it loads the line with parseFromString(). Expected Results: Should parse accordingly if the string is well formatted. I mark this bug as critical as it hangs the browser. But since usually people parse a correct string to DOMParser, the bug may be less critical.
Confirm on GNU/Linux with Moz 1.8b1 too
confirming with win2k3 and Mozilla 20050226
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 2000 → All
So there seem to be two issues here: 1) <script> as root doesn't load the script (see bug 88309) 2) The DOMParser code spins in a tight loop calling ProcessPendingEvents() on the event queue it pushed until the page loads (which is forever, in this case, since the parser is blocked and will never unblock). Is there a reason this can't use waitForEvent() and handleEvent()? That will at least not freeze up the whole app (though the parseFromString call will still never return).
Well... The fact that this code busy-waits while we're parsing seems wrong even if the parsing just takes "a while" instead of "forever". Consider a slow server such that fetching the script just takes 10-15 seconds....
*** Bug 318934 has been marked as a duplicate of this bug. ***
Only a short glitch while moving the window; WFM on Firefox 4.0b7 (32 bit Windows 7).
You need to log in before you can comment on or make changes to this bug.