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

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

Issue 202813002: [HTML Import] Let script block by pending resources created by lifecycle callback (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Landing Created 6 years, 9 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 | Annotate | Revision Log
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 void HTMLScriptRunner::executePendingScriptAndDispatchEvent(PendingScript& pendi ngScript) 119 void HTMLScriptRunner::executePendingScriptAndDispatchEvent(PendingScript& pendi ngScript)
120 { 120 {
121 bool errorOccurred = false; 121 bool errorOccurred = false;
122 ScriptSourceCode sourceCode = sourceFromPendingScript(pendingScript, errorOc curred); 122 ScriptSourceCode sourceCode = sourceFromPendingScript(pendingScript, errorOc curred);
123 123
124 // Stop watching loads before executeScript to prevent recursion if the scri pt reloads itself. 124 // Stop watching loads before executeScript to prevent recursion if the scri pt reloads itself.
125 if (pendingScript.resource() && pendingScript.watchingForLoad()) 125 if (pendingScript.resource() && pendingScript.watchingForLoad())
126 stopWatchingForLoad(pendingScript); 126 stopWatchingForLoad(pendingScript);
127 127
128 if (!isExecutingScript()) 128 if (!isExecutingScript()) {
129 Microtask::performCheckpoint(); 129 Microtask::performCheckpoint();
130 m_hasScriptsWaitingForResources = !m_document->haveStylesheetsAndImports Loaded();
131 if (m_hasScriptsWaitingForResources)
132 return;
133 }
130 134
131 // Clear the pending script before possible rentrancy from executeScript() 135 // Clear the pending script before possible rentrancy from executeScript()
132 RefPtr<Element> element = pendingScript.releaseElementAndClear(); 136 RefPtr<Element> element = pendingScript.releaseElementAndClear();
133 if (ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element.get())) { 137 if (ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element.get())) {
134 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); 138 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel);
135 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrem enter(m_document); 139 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrem enter(m_document);
136 if (errorOccurred) 140 if (errorOccurred)
137 scriptLoader->dispatchErrorEvent(); 141 scriptLoader->dispatchErrorEvent();
138 else { 142 else {
139 ASSERT(isExecutingScript()); 143 ASSERT(isExecutingScript());
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 ScriptSourceCode sourceCode(script->textContent(), documentURLFo rScriptExecution(m_document), scriptStartPosition); 313 ScriptSourceCode sourceCode(script->textContent(), documentURLFo rScriptExecution(m_document), scriptStartPosition);
310 scriptLoader->executeScript(sourceCode); 314 scriptLoader->executeScript(sourceCode);
311 } 315 }
312 } else { 316 } else {
313 requestParsingBlockingScript(script); 317 requestParsingBlockingScript(script);
314 } 318 }
315 } 319 }
316 } 320 }
317 321
318 } 322 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698