Changeset 139790 in webkit
- Timestamp:
- Jan 15, 2013, 2:17:06 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r139789 r139790 1 2013-01-15 Elliott Sprehn <esprehn@gmail.com> 2 3 HTML parser should queue MutationRecords for its operations 4 https://bugs.webkit.org/show_bug.cgi?id=89351 5 6 Reviewed by Eric Seidel. 7 8 Add tests for parser generated mutations. 9 10 XXX: This needs a bunch more tests observing the adoption 11 agency algorithm to catch parserInsertBefore and parserRemoveChild 12 mutations. 13 14 * fast/dom/MutationObserver/parser-mutations-expected.txt: Added. 15 * fast/dom/MutationObserver/parser-mutations.html: Added. 16 1 17 2013-01-15 Ojan Vafai <ojan@chromium.org> 2 18 -
trunk/Source/WebCore/ChangeLog
r139789 r139790 1 2013-01-15 Elliott Sprehn <esprehn@gmail.com> 2 3 HTML parser should queue MutationRecords for its operations 4 https://bugs.webkit.org/show_bug.cgi?id=89351 5 6 Reviewed by Eric Seidel. 7 8 Generate mutation records inside the parser. This is done by using a 9 ChildListMutationScope in the ContainerNode::parser* methods and then 10 adding delivery before each <script> element would be processed by 11 the parser. 12 13 Test: fast/dom/MutationObserver/parser-mutations.html 14 15 * dom/ContainerNode.cpp: 16 (WebCore::ContainerNode::parserInsertBefore): 17 (WebCore::ContainerNode::parserRemoveChild): 18 (WebCore::ContainerNode::parserAppendChild): 19 * html/parser/HTMLScriptRunner.cpp: 20 (WebCore::HTMLScriptRunner::executeParsingBlockingScript): 21 (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent): 22 (WebCore::HTMLScriptRunner::execute): 23 (WebCore::HTMLScriptRunner::executeScriptsWaitingForLoad): 24 (WebCore::HTMLScriptRunner::executeScriptsWaitingForStylesheets): 25 (WebCore::HTMLScriptRunner::executeScriptsWaitingForParsing): 26 (WebCore::HTMLScriptRunner::runScript): 27 1 28 2013-01-15 Ojan Vafai <ojan@chromium.org> 2 29 -
trunk/Source/WebCore/dom/ContainerNode.cpp
r139132 r139790 332 332 insertBeforeCommon(nextChild, newChild.get()); 333 333 334 #if ENABLE(MUTATION_OBSERVERS) 335 ChildListMutationScope(this).childAdded(newChild.get()); 336 #endif 337 334 338 childrenChanged(true, newChild->previousSibling(), nextChild, 1); 335 339 ChildNodeInsertionNotifier(this).notify(newChild.get()); … … 552 556 Node* prev = oldChild->previousSibling(); 553 557 Node* next = oldChild->nextSibling(); 558 559 #if ENABLE(MUTATION_OBSERVERS) 560 ChildListMutationScope(this).willRemoveChild(oldChild); 561 oldChild->notifyMutationObserversNodeWillDetach(); 562 #endif 554 563 555 564 removeBetween(prev, next, oldChild); … … 697 706 treeScope()->adoptIfNeeded(newChild.get()); 698 707 } 708 709 #if ENABLE(MUTATION_OBSERVERS) 710 ChildListMutationScope(this).childAdded(newChild.get()); 711 #endif 699 712 700 713 childrenChanged(true, last, 0, 1); -
trunk/Source/WebCore/html/parser/HTMLScriptRunner.cpp
r122226 r139790 37 37 #include "HTMLScriptRunnerHost.h" 38 38 #include "IgnoreDestructiveWriteCountIncrementer.h" 39 #include "MutationObserver.h" 39 40 #include "NestingLevelIncrementer.h" 40 41 #include "NotImplemented.h" … … 111 112 { 112 113 ASSERT(m_document); 113 ASSERT(! m_scriptNestingLevel);114 ASSERT(!isExecutingScript()); 114 115 ASSERT(m_document->haveStylesheetsLoaded()); 115 116 ASSERT(isPendingScriptReady(m_parserBlockingScript)); … … 127 128 if (pendingScript.cachedScript() && pendingScript.watchingForLoad()) 128 129 stopWatchingForLoad(pendingScript); 130 131 #if ENABLE(MUTATION_OBSERVERS) 132 if (!isExecutingScript()) 133 MutationObserver::deliverAllMutations(); 134 #endif 129 135 130 136 // Clear the pending script before possible rentrancy from executeScript() … … 141 147 } 142 148 } 143 ASSERT(! m_scriptNestingLevel);149 ASSERT(!isExecutingScript()); 144 150 } 145 151 … … 171 177 172 178 if (hasParserBlockingScript()) { 173 if ( m_scriptNestingLevel)179 if (isExecutingScript()) 174 180 return; // Unwind to the outermost HTMLScriptRunner::execute before continuing parsing. 175 181 // If preload scanner got created, it is missing the source after the current insertion point. Append it and scan. … … 193 199 void HTMLScriptRunner::executeScriptsWaitingForLoad(CachedResource* cachedScript) 194 200 { 195 ASSERT(! m_scriptNestingLevel);201 ASSERT(!isExecutingScript()); 196 202 ASSERT(hasParserBlockingScript()); 197 203 ASSERT_UNUSED(cachedScript, m_parserBlockingScript.cachedScript() == cachedScript); … … 206 212 // to prevent parser or script re-entry during </style> parsing. 207 213 ASSERT(hasScriptsWaitingForStylesheets()); 208 ASSERT(! m_scriptNestingLevel);214 ASSERT(!isExecutingScript()); 209 215 ASSERT(m_document->haveStylesheetsLoaded()); 210 216 executeParsingBlockingScripts(); … … 214 220 { 215 221 while (!m_scriptsToExecuteAfterParsing.isEmpty()) { 216 ASSERT(! m_scriptNestingLevel);222 ASSERT(!isExecutingScript()); 217 223 ASSERT(!hasParserBlockingScript()); 218 224 ASSERT(m_scriptsToExecuteAfterParsing.first().cachedScript()); … … 275 281 ASSERT(!hasParserBlockingScript()); 276 282 { 277 InsertionPointRecord insertionPointRecord(m_host->inputStream());278 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel);279 280 283 ScriptElement* scriptElement = toScriptElement(script); 281 284 … … 287 290 if (!scriptElement) 288 291 return; 292 293 #if ENABLE(MUTATION_OBSERVERS) 294 // FIXME: This may be too agressive as we always deliver mutations at 295 // every script element, even if it's not ready to execute yet. There's 296 // unfortuantely no obvious way to tell if prepareScript is going to 297 // execute the script from out here. 298 if (!isExecutingScript()) 299 MutationObserver::deliverAllMutations(); 300 #endif 301 302 InsertionPointRecord insertionPointRecord(m_host->inputStream()); 303 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); 289 304 290 305 scriptElement->prepareScript(scriptStartPosition);
Note:
See TracChangeset
for help on using the changeset viewer.