Changeset 143797 in webkit
- Timestamp:
- Feb 22, 2013 2:17:49 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r143796 r143797 1 2013-02-22 Adam Barth <abarth@webkit.org> 2 3 Threaded HTML parser should pass fast/parser/iframe-sets-parent-to-javascript-url.html 4 https://bugs.webkit.org/show_bug.cgi?id=110637 5 6 Reviewed by Eric Seidel. 7 8 With the main thread parser, we always parse the first chunk of content 9 returned as the result of evaluating a JavaScript URL synchronously. In 10 particular, if the first chunk has an inline script, we'll execute it 11 synchronously. 12 13 Previous to this patch, the threaded parser would always parse this 14 content asynchronously. It's conceivable that there could be some 15 content relying on the synchronous behavior, so this patch introduces 16 the notion of "pinning" a parser to the main thread and uses that 17 concept to force the result of JavaScript URLs to be parsed on the main 18 thread (which is probably desirable anyway because they're likely to be 19 quite short). 20 21 This patch fixes fast/parser/iframe-sets-parent-to-javascript-url.html 22 and fast/dom/javascript-url-crash-function.html with the threaded 23 parser with --enable-threaded-html-parser. 24 25 * dom/DocumentParser.h: 26 (WebCore::DocumentParser::pinToMainThread): 27 (DocumentParser): 28 * html/parser/HTMLDocumentParser.cpp: 29 (WebCore::HTMLDocumentParser::HTMLDocumentParser): 30 (WebCore): 31 (WebCore::HTMLDocumentParser::pinToMainThread): 32 * html/parser/HTMLDocumentParser.h: 33 (HTMLDocumentParser): 34 (WebCore::HTMLDocumentParser::shouldUseThreading): 35 * loader/DocumentWriter.cpp: 36 (WebCore::DocumentWriter::replaceDocument): 37 1 38 2013-02-22 Joe Mason <jmason@rim.com> 2 39 -
trunk/Source/WebCore/dom/DocumentParser.h
r140036 r143797 49 49 virtual void appendBytes(DocumentWriter*, const char* bytes, size_t length) = 0; 50 50 virtual void flush(DocumentWriter*) = 0; 51 52 virtual void pinToMainThread() { } 51 53 52 54 // FIXME: append() should be private, but DocumentWriter::replaceDocument -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp
r143685 r143797 90 90 #endif 91 91 , m_preloader(adoptPtr(new HTMLResourcePreloader(document))) 92 , m_isPinnedToMainThread(false) 92 93 , m_endWasDelayed(false) 93 94 , m_haveBackgroundParser(false) … … 109 110 , m_weakFactory(this) 110 111 #endif 112 , m_isPinnedToMainThread(true) 111 113 , m_endWasDelayed(false) 112 114 , m_haveBackgroundParser(false) … … 126 128 ASSERT(!m_haveBackgroundParser); 127 129 } 130 131 #if ENABLE(THREADED_HTML_PARSER) 132 void HTMLDocumentParser::pinToMainThread() 133 { 134 ASSERT(!m_haveBackgroundParser); 135 ASSERT(!m_tokenizer); 136 ASSERT(!m_token); 137 ASSERT(!m_isPinnedToMainThread); 138 m_isPinnedToMainThread = true; 139 m_token = adoptPtr(new HTMLToken); 140 m_tokenizer = HTMLTokenizer::create(m_options); 141 } 142 #endif 128 143 129 144 void HTMLDocumentParser::detach() -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.h
r143661 r143797 97 97 98 98 protected: 99 virtual void insert(const SegmentedString&) ;100 virtual void append(const SegmentedString&) ;101 virtual void finish() ;99 virtual void insert(const SegmentedString&) OVERRIDE; 100 virtual void append(const SegmentedString&) OVERRIDE; 101 virtual void finish() OVERRIDE; 102 102 103 103 HTMLDocumentParser(HTMLDocument*, bool reportErrors); … … 115 115 116 116 // DocumentParser 117 virtual void detach(); 118 virtual bool hasInsertionPoint(); 119 virtual bool processingData() const; 120 virtual void prepareToStopParsing(); 121 virtual void stopParsing(); 122 virtual bool isWaitingForScripts() const; 123 virtual bool isExecutingScript() const; 124 virtual void executeScriptsWaitingForStylesheets(); 117 #if ENABLE(THREADED_HTML_PARSER) 118 virtual void pinToMainThread() OVERRIDE; 119 #endif 120 virtual void detach() OVERRIDE; 121 virtual bool hasInsertionPoint() OVERRIDE; 122 virtual bool processingData() const OVERRIDE; 123 virtual void prepareToStopParsing() OVERRIDE; 124 virtual void stopParsing() OVERRIDE; 125 virtual bool isWaitingForScripts() const OVERRIDE; 126 virtual bool isExecutingScript() const OVERRIDE; 127 virtual void executeScriptsWaitingForStylesheets() OVERRIDE; 125 128 126 129 // HTMLScriptRunnerHost 127 virtual void watchForLoad(CachedResource*) ;128 virtual void stopWatchingForLoad(CachedResource*) ;130 virtual void watchForLoad(CachedResource*) OVERRIDE; 131 virtual void stopWatchingForLoad(CachedResource*) OVERRIDE; 129 132 virtual HTMLInputStream& inputStream() { return m_input; } 130 133 virtual bool hasPreloadScanner() const { return m_preloadScanner.get() && !shouldUseThreading(); } 131 virtual void appendCurrentInputStreamToPreloadScannerAndScan() ;134 virtual void appendCurrentInputStreamToPreloadScannerAndScan() OVERRIDE; 132 135 133 136 // CachedResourceClient … … 164 167 void end(); 165 168 166 bool shouldUseThreading() const { return m_options.useThreading && ! isParsingFragment(); }169 bool shouldUseThreading() const { return m_options.useThreading && !m_isPinnedToMainThread; } 167 170 168 171 bool isParsingFragment() const; … … 196 199 OwnPtr<HTMLResourcePreloader> m_preloader; 197 200 201 bool m_isPinnedToMainThread; 198 202 bool m_endWasDelayed; 199 203 bool m_haveBackgroundParser; -
trunk/Source/WebCore/loader/DocumentWriter.cpp
r125613 r143797 79 79 // FIXME: This should call DocumentParser::appendBytes instead of append 80 80 // to support RawDataDocumentParsers. 81 if (DocumentParser* parser = m_frame->document()->parser()) 81 if (DocumentParser* parser = m_frame->document()->parser()) { 82 parser->pinToMainThread(); 82 83 parser->append(source); 84 } 83 85 } 84 86
Note: See TracChangeset
for help on using the changeset viewer.