| OLD | NEW |
| 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 Loading... |
| 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 } | |
| 134 | 130 |
| 135 // Clear the pending script before possible rentrancy from executeScript() | 131 // Clear the pending script before possible rentrancy from executeScript() |
| 136 RefPtr<Element> element = pendingScript.releaseElementAndClear(); | 132 RefPtr<Element> element = pendingScript.releaseElementAndClear(); |
| 137 if (ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element.get())) { | 133 if (ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element.get())) { |
| 138 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); | 134 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); |
| 139 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrem
enter(m_document); | 135 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrem
enter(m_document); |
| 140 if (errorOccurred) | 136 if (errorOccurred) |
| 141 scriptLoader->dispatchErrorEvent(); | 137 scriptLoader->dispatchErrorEvent(); |
| 142 else { | 138 else { |
| 143 ASSERT(isExecutingScript()); | 139 ASSERT(isExecutingScript()); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 ScriptSourceCode sourceCode(script->textContent(), documentURLFo
rScriptExecution(m_document), scriptStartPosition); | 309 ScriptSourceCode sourceCode(script->textContent(), documentURLFo
rScriptExecution(m_document), scriptStartPosition); |
| 314 scriptLoader->executeScript(sourceCode); | 310 scriptLoader->executeScript(sourceCode); |
| 315 } | 311 } |
| 316 } else { | 312 } else { |
| 317 requestParsingBlockingScript(script); | 313 requestParsingBlockingScript(script); |
| 318 } | 314 } |
| 319 } | 315 } |
| 320 } | 316 } |
| 321 | 317 |
| 322 } | 318 } |
| OLD | NEW |