RESOLVED FIXED 107975
Don't use the threaded HTML parser for javascript: URLs
https://bugs.webkit.org/show_bug.cgi?id=107975
Summary Don't use the threaded HTML parser for javascript: URLs
Tony Gentilcore
Reported 2013-01-25 12:09:16 PST
Don't use the threaded HTML parser for javascript: URLs
Attachments
Patch (2.39 KB, patch)
2013-01-25 12:14 PST, Tony Gentilcore
no flags
Patch (1.79 KB, patch)
2013-01-28 10:57 PST, Tony Gentilcore
no flags
Patch for landing (1.77 KB, patch)
2013-01-28 11:13 PST, Tony Gentilcore
no flags
Tony Gentilcore
Comment 1 2013-01-25 12:14:24 PST
Eric Seidel (no email)
Comment 2 2013-01-25 12:25:23 PST
Comment on attachment 184792 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=184792&action=review > Source/WebCore/ChangeLog:11 > + No new tests because covered by existing tests. Do you have an idea as to how many this causes to pass? > Source/WebCore/html/parser/HTMLDocumentParser.cpp:186 > +bool HTMLDocumentParser::shouldUseThreading() const > +{ > + return m_options.useThreading && !isParsingFragment() && !document()->url().isBlankURL(); > +} We had this exact logic in an earlier version, but removed it in favor of a solution which could handle empty documnts (in addition to about:blank, which just happens to be empty). I'm surprised javascript is counted as a blank url?
Tony Gentilcore
Comment 3 2013-01-25 12:31:13 PST
(In reply to comment #2) > (From update of attachment 184792 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=184792&action=review > > > Source/WebCore/ChangeLog:11 > > + No new tests because covered by existing tests. > > Do you have an idea as to how many this causes to pass? No. I only ran the tests in loading/ and it caused us to pick up 3 there. Not sure how many other tests like that are out there. > > > Source/WebCore/html/parser/HTMLDocumentParser.cpp:186 > > +bool HTMLDocumentParser::shouldUseThreading() const > > +{ > > + return m_options.useThreading && !isParsingFragment() && !document()->url().isBlankURL(); > > +} > > We had this exact logic in an earlier version, but removed it in favor of a solution which could handle empty documnts (in addition to about:blank, which just happens to be empty). I'm surprised javascript is counted as a blank url? Yeah, JavaScript is counted as a blank URL. The thing that gets piped to append() is the result of the JavaScript execution, not the JavaScript itself and at that time that document has an empty URL.
Adam Barth
Comment 4 2013-01-25 17:18:23 PST
> Yeah, JavaScript is counted as a blank URL. The thing that gets piped to append() is the result of the JavaScript execution, not the JavaScript itself and at that time that document has an empty URL. Maybe we should switch it to using insert instead?
Adam Barth
Comment 5 2013-01-25 17:20:16 PST
Comment on attachment 184792 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=184792&action=review > Source/WebCore/html/parser/HTMLDocumentParser.cpp:185 > + return m_options.useThreading && !isParsingFragment() && !document()->url().isBlankURL(); We should put this logic in HTMLParserOptions so that m_options reflects reality. IMHO, disabling threading for blank URLs makes sense. Given that we've wanted to do this twice, it's probably the right thing to do.
Tony Gentilcore
Comment 6 2013-01-28 10:57:37 PST
Tony Gentilcore
Comment 7 2013-01-28 10:58:16 PST
> > Source/WebCore/html/parser/HTMLDocumentParser.cpp:185 > > + return m_options.useThreading && !isParsingFragment() && !document()->url().isBlankURL(); > > We should put this logic in HTMLParserOptions so that m_options reflects reality. Done
Adam Barth
Comment 8 2013-01-28 11:09:29 PST
Comment on attachment 185009 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=185009&action=review > Source/WebCore/html/parser/HTMLParserOptions.cpp:44 > - useThreading = settings && settings->threadedHTMLParser(); > + useThreading = settings && settings->threadedHTMLParser() && (!document || !document->url().isBlankURL()); settings being non-zero implies that document is non-zero, so you can remove the check for !document.
Tony Gentilcore
Comment 9 2013-01-28 11:13:56 PST
Created attachment 185016 [details] Patch for landing
WebKit Review Bot
Comment 10 2013-01-28 11:37:13 PST
Comment on attachment 185016 [details] Patch for landing Clearing flags on attachment: 185016 Committed r140986: <http://trac.webkit.org/changeset/140986>
WebKit Review Bot
Comment 11 2013-01-28 11:37:17 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.