Changeset 61608 in webkit
- Timestamp:
- Jun 22, 2010 1:14:46 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r61605 r61608 1 2010-06-22 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Follow the HTML5 spec more closely w.r.t. when to save the insertion point 6 https://bugs.webkit.org/show_bug.cgi?id=40976 7 8 This test no longer asserts. The output is incorrect, however. I'll 9 fix the output in the next patch. 10 11 * fast/tokenizer/write-on-load-expected.txt: Added. 12 * fast/tokenizer/write-on-load.html: Added. 13 1 14 2010-06-21 Julien Chaffraix <jchaffraix@webkit.org> 2 15 -
trunk/WebCore/ChangeLog
r61607 r61608 1 2010-06-22 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Follow the HTML5 spec more closely w.r.t. when to save the insertion point 6 https://bugs.webkit.org/show_bug.cgi?id=40976 7 8 The spec always increments the nesting level and saves the insertion 9 point at the same time. In this patch, we now do those operations 10 packaged as a RAII. 11 12 As a side effect, the test case below no longer ASSERTs. (The output 13 is wrong, but we'll get to that next.) 14 15 Test: fast/tokenizer/write-on-load.html 16 17 * html/HTML5ScriptRunner.cpp: 18 (WebCore::NestScript::NestScript): 19 (WebCore::NestScript::~NestScript): 20 (WebCore::HTML5ScriptRunner::executePendingScript): 21 (WebCore::HTML5ScriptRunner::executeScript): 22 (WebCore::HTML5ScriptRunner::requestScript): 23 (WebCore::HTML5ScriptRunner::runScript): 24 * html/HTMLInputStream.h: 25 1 26 2010-06-22 Adam Barth <abarth@webkit.org> 2 27 -
trunk/WebCore/html/HTML5ScriptRunner.cpp
r61607 r61608 44 44 using namespace HTMLNames; 45 45 46 class NestScript : public Noncopyable { 47 public: 48 NestScript(unsigned& nestingLevel, HTMLInputStream& inputStream) 49 : m_nestingLevel(&nestingLevel) 50 , m_savedInsertionPoint(inputStream) 51 { 52 ++(*m_nestingLevel); 53 } 54 55 ~NestScript() 56 { 57 --(*m_nestingLevel); 58 } 59 60 private: 61 unsigned* m_nestingLevel; 62 InsertionPointRecord m_savedInsertionPoint; 63 }; 64 46 65 HTML5ScriptRunner::HTML5ScriptRunner(Document* document, HTML5ScriptRunnerHost* host) 47 66 : m_document(document) … … 115 134 RefPtr<Element> scriptElement = m_parsingBlockingScript.element.release(); 116 135 m_parsingBlockingScript = PendingScript(); 117 118 m_scriptNestingLevel++;119 if (errorOccurred)120 scriptElement->dispatchEvent(createScriptErrorEvent());121 else {122 executeScript(scriptElement.get(), sourceCode);123 scriptElement->dispatchEvent(createScriptLoadEvent());124 }125 m_scriptNestingLevel--;136 { 137 NestScript nestingLevel(m_scriptNestingLevel, m_host->inputStream()); 138 if (errorOccurred) 139 scriptElement->dispatchEvent(createScriptErrorEvent()); 140 else { 141 executeScript(scriptElement.get(), sourceCode); 142 scriptElement->dispatchEvent(createScriptLoadEvent()); 143 } 144 } 126 145 ASSERT(!m_scriptNestingLevel); 127 146 } … … 140 159 if (!m_document->frame()) 141 160 return; 142 143 InsertionPointRecord savedInsertionPoint(m_host->inputStream());144 161 m_document->frame()->script()->executeScript(sourceCode); 145 162 } … … 237 254 return; 238 255 // FIXME: We need to resolve the url relative to the element. 239 { 240 InsertionPointRecord savedInsertionPoint(m_host->inputStream()); 241 if (!script->dispatchBeforeLoadEvent(srcValue)) 242 return; 243 } 256 if (!script->dispatchBeforeLoadEvent(srcValue)) 257 return; 244 258 m_parsingBlockingScript.element = script; 245 259 // This should correctly return 0 for empty or invalid srcValues. … … 266 280 { 267 281 ASSERT(!haveParsingBlockingScript()); 268 m_scriptNestingLevel++; 269 // Check script type and language, current code uses ScriptElement::shouldExecuteAsJavaScript(), but that may not be HTML5 compliant. 270 notImplemented(); // event for support 271 272 if (script->hasAttribute(srcAttr)) { 273 // FIXME: Handle defer and async 274 requestScript(script); 275 } else { 276 // FIXME: We do not block inline <script> tags on stylesheets to match the 277 // old parser for now. See https://bugs.webkit.org/show_bug.cgi?id=40047 278 ScriptSourceCode sourceCode(script->textContent(), documentURLForScriptExecution(m_document), startingLineNumber); 279 executeScript(script, sourceCode); 280 } 281 m_scriptNestingLevel--; 282 } 283 284 } 282 { 283 NestScript nestingLevel(m_scriptNestingLevel, m_host->inputStream()); 284 285 // Check script type and language, current code uses ScriptElement::shouldExecuteAsJavaScript(), but that may not be HTML5 compliant. 286 notImplemented(); // event for support 287 288 if (script->hasAttribute(srcAttr)) { 289 // FIXME: Handle defer and async 290 requestScript(script); 291 } else { 292 // FIXME: We do not block inline <script> tags on stylesheets to match the 293 // old parser for now. See https://bugs.webkit.org/show_bug.cgi?id=40047 294 ScriptSourceCode sourceCode(script->textContent(), documentURLForScriptExecution(m_document), startingLineNumber); 295 executeScript(script, sourceCode); 296 } 297 } 298 } 299 300 } -
trunk/WebCore/html/HTMLInputStream.h
r61606 r61608 48 48 // The network adds data at the end of the InputStream, which appends 49 49 // them to the "last" string. 50 class HTMLInputStream {50 class HTMLInputStream : public Noncopyable { 51 51 public: 52 52 HTMLInputStream() … … 103 103 }; 104 104 105 class InsertionPointRecord {105 class InsertionPointRecord : public Noncopyable { 106 106 public: 107 107 explicit InsertionPointRecord(HTMLInputStream& inputStream)
Note: See TracChangeset
for help on using the changeset viewer.