Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Side by Side Diff: Source/core/html/parser/HTMLScriptRunner.cpp

Issue 14083009: Remove ENABLE_CUSTOM_ELEMENTS compile time flag (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebasing. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/features.gypi ('k') | Source/core/page/RuntimeEnabledFeatures.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 void HTMLScriptRunner::executePendingScriptAndDispatchEvent(PendingScript& pendi ngScript) 123 void HTMLScriptRunner::executePendingScriptAndDispatchEvent(PendingScript& pendi ngScript)
124 { 124 {
125 bool errorOccurred = false; 125 bool errorOccurred = false;
126 ScriptSourceCode sourceCode = sourceFromPendingScript(pendingScript, errorOc curred); 126 ScriptSourceCode sourceCode = sourceFromPendingScript(pendingScript, errorOc curred);
127 127
128 // Stop watching loads before executeScript to prevent recursion if the scri pt reloads itself. 128 // Stop watching loads before executeScript to prevent recursion if the scri pt reloads itself.
129 if (pendingScript.cachedScript() && pendingScript.watchingForLoad()) 129 if (pendingScript.cachedScript() && pendingScript.watchingForLoad())
130 stopWatchingForLoad(pendingScript); 130 stopWatchingForLoad(pendingScript);
131 131
132 if (!isExecutingScript()) { 132 if (!isExecutingScript()) {
133 #if ENABLE(CUSTOM_ELEMENTS)
134 CustomElementRegistry::deliverAllLifecycleCallbacks(); 133 CustomElementRegistry::deliverAllLifecycleCallbacks();
135 #endif
136 MutationObserver::deliverAllMutations(); 134 MutationObserver::deliverAllMutations();
137 } 135 }
138 136
139 // Clear the pending script before possible rentrancy from executeScript() 137 // Clear the pending script before possible rentrancy from executeScript()
140 RefPtr<Element> element = pendingScript.releaseElementAndClear(); 138 RefPtr<Element> element = pendingScript.releaseElementAndClear();
141 if (ScriptElement* scriptElement = toScriptElementIfPossible(element.get())) { 139 if (ScriptElement* scriptElement = toScriptElementIfPossible(element.get())) {
142 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); 140 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel);
143 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrem enter(m_document); 141 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrem enter(m_document);
144 if (errorOccurred) 142 if (errorOccurred)
145 scriptElement->dispatchErrorEvent(); 143 scriptElement->dispatchErrorEvent();
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 // is being tracked by <https://bugs.webkit.org/show_bug.cgi?id=60559>. 289 // is being tracked by <https://bugs.webkit.org/show_bug.cgi?id=60559>.
292 ASSERT(scriptElement); 290 ASSERT(scriptElement);
293 if (!scriptElement) 291 if (!scriptElement)
294 return; 292 return;
295 293
296 // FIXME: This may be too agressive as we always deliver mutations at 294 // FIXME: This may be too agressive as we always deliver mutations at
297 // every script element, even if it's not ready to execute yet. There's 295 // every script element, even if it's not ready to execute yet. There's
298 // unfortuantely no obvious way to tell if prepareScript is going to 296 // unfortuantely no obvious way to tell if prepareScript is going to
299 // execute the script from out here. 297 // execute the script from out here.
300 if (!isExecutingScript()) { 298 if (!isExecutingScript()) {
301 #if ENABLE(CUSTOM_ELEMENTS)
302 CustomElementRegistry::deliverAllLifecycleCallbacks(); 299 CustomElementRegistry::deliverAllLifecycleCallbacks();
303 #endif
304 MutationObserver::deliverAllMutations(); 300 MutationObserver::deliverAllMutations();
305 } 301 }
306 302
307 InsertionPointRecord insertionPointRecord(m_host->inputStream()); 303 InsertionPointRecord insertionPointRecord(m_host->inputStream());
308 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); 304 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel);
309 305
310 scriptElement->prepareScript(scriptStartPosition); 306 scriptElement->prepareScript(scriptStartPosition);
311 307
312 if (!scriptElement->willBeParserExecuted()) 308 if (!scriptElement->willBeParserExecuted())
313 return; 309 return;
314 310
315 if (scriptElement->willExecuteWhenDocumentFinishedParsing()) 311 if (scriptElement->willExecuteWhenDocumentFinishedParsing())
316 requestDeferredScript(script); 312 requestDeferredScript(script);
317 else if (scriptElement->readyToBeParserExecuted()) { 313 else if (scriptElement->readyToBeParserExecuted()) {
318 if (m_scriptNestingLevel == 1) { 314 if (m_scriptNestingLevel == 1) {
319 m_parserBlockingScript.setElement(script); 315 m_parserBlockingScript.setElement(script);
320 m_parserBlockingScript.setStartingPosition(scriptStartPosition); 316 m_parserBlockingScript.setStartingPosition(scriptStartPosition);
321 } else { 317 } else {
322 ScriptSourceCode sourceCode(script->textContent(), documentURLFo rScriptExecution(m_document), scriptStartPosition); 318 ScriptSourceCode sourceCode(script->textContent(), documentURLFo rScriptExecution(m_document), scriptStartPosition);
323 scriptElement->executeScript(sourceCode); 319 scriptElement->executeScript(sourceCode);
324 } 320 }
325 } else 321 } else
326 requestParsingBlockingScript(script); 322 requestParsingBlockingScript(script);
327 } 323 }
328 } 324 }
329 325
330 } 326 }
OLDNEW
« no previous file with comments | « Source/core/features.gypi ('k') | Source/core/page/RuntimeEnabledFeatures.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698