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 10 matching lines...) Expand all Loading... |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/html/parser/HTMLScriptRunner.h" | 27 #include "core/html/parser/HTMLScriptRunner.h" |
28 | 28 |
29 #include "bindings/v8/ScriptSourceCode.h" | 29 #include "bindings/v8/ScriptSourceCode.h" |
30 #include "core/dom/Element.h" | 30 #include "core/dom/Element.h" |
31 #include "core/events/Event.h" | |
32 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" | 31 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" |
33 #include "core/dom/Microtask.h" | 32 #include "core/dom/Microtask.h" |
34 #include "core/dom/ScriptLoader.h" | 33 #include "core/dom/ScriptLoader.h" |
| 34 #include "core/events/Event.h" |
35 #include "core/fetch/ScriptResource.h" | 35 #include "core/fetch/ScriptResource.h" |
| 36 #include "core/frame/Frame.h" |
| 37 #include "core/html/StableState.h" |
36 #include "core/html/parser/HTMLInputStream.h" | 38 #include "core/html/parser/HTMLInputStream.h" |
37 #include "core/html/parser/HTMLScriptRunnerHost.h" | 39 #include "core/html/parser/HTMLScriptRunnerHost.h" |
38 #include "core/html/parser/NestingLevelIncrementer.h" | 40 #include "core/html/parser/NestingLevelIncrementer.h" |
39 #include "core/frame/Frame.h" | |
40 #include "platform/NotImplemented.h" | 41 #include "platform/NotImplemented.h" |
41 | 42 |
42 namespace WebCore { | 43 namespace WebCore { |
43 | 44 |
44 using namespace HTMLNames; | 45 using namespace HTMLNames; |
45 | 46 |
46 HTMLScriptRunner::HTMLScriptRunner(Document* document, HTMLScriptRunnerHost* hos
t) | 47 HTMLScriptRunner::HTMLScriptRunner(Document* document, HTMLScriptRunnerHost* hos
t) |
47 : m_document(document) | 48 : m_document(document) |
48 , m_host(host) | 49 , m_host(host) |
49 , m_scriptNestingLevel(0) | 50 , m_scriptNestingLevel(0) |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 // This contains both and ASSERTION and a null check since we should not | 282 // This contains both and ASSERTION and a null check since we should not |
282 // be getting into the case of a null script element, but seem to be fro
m | 283 // be getting into the case of a null script element, but seem to be fro
m |
283 // time to time. The assertion is left in to help find those cases and | 284 // time to time. The assertion is left in to help find those cases and |
284 // is being tracked by <https://bugs.webkit.org/show_bug.cgi?id=60559>. | 285 // is being tracked by <https://bugs.webkit.org/show_bug.cgi?id=60559>. |
285 ASSERT(scriptLoader); | 286 ASSERT(scriptLoader); |
286 if (!scriptLoader) | 287 if (!scriptLoader) |
287 return; | 288 return; |
288 | 289 |
289 ASSERT(scriptLoader->isParserInserted()); | 290 ASSERT(scriptLoader->isParserInserted()); |
290 | 291 |
291 if (!isExecutingScript()) | 292 if (!isExecutingScript()) { |
292 Microtask::performCheckpoint(); | 293 Microtask::performCheckpoint(); |
| 294 StableState::provide(); |
| 295 } |
293 | 296 |
294 InsertionPointRecord insertionPointRecord(m_host->inputStream()); | 297 InsertionPointRecord insertionPointRecord(m_host->inputStream()); |
295 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); | 298 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); |
296 | 299 |
297 scriptLoader->prepareScript(scriptStartPosition); | 300 scriptLoader->prepareScript(scriptStartPosition); |
298 | 301 |
299 if (!scriptLoader->willBeParserExecuted()) | 302 if (!scriptLoader->willBeParserExecuted()) |
300 return; | 303 return; |
301 | 304 |
302 if (scriptLoader->willExecuteWhenDocumentFinishedParsing()) { | 305 if (scriptLoader->willExecuteWhenDocumentFinishedParsing()) { |
303 requestDeferredScript(script); | 306 requestDeferredScript(script); |
304 } else if (scriptLoader->readyToBeParserExecuted()) { | 307 } else if (scriptLoader->readyToBeParserExecuted()) { |
305 if (m_scriptNestingLevel == 1) { | 308 if (m_scriptNestingLevel == 1) { |
306 m_parserBlockingScript.setElement(script); | 309 m_parserBlockingScript.setElement(script); |
307 m_parserBlockingScript.setStartingPosition(scriptStartPosition); | 310 m_parserBlockingScript.setStartingPosition(scriptStartPosition); |
308 } else { | 311 } else { |
309 ScriptSourceCode sourceCode(script->textContent(), documentURLFo
rScriptExecution(m_document), scriptStartPosition); | 312 ScriptSourceCode sourceCode(script->textContent(), documentURLFo
rScriptExecution(m_document), scriptStartPosition); |
310 scriptLoader->executeScript(sourceCode); | 313 scriptLoader->executeScript(sourceCode); |
311 } | 314 } |
312 } else { | 315 } else { |
313 requestParsingBlockingScript(script); | 316 requestParsingBlockingScript(script); |
314 } | 317 } |
315 } | 318 } |
316 } | 319 } |
317 | 320 |
318 } | 321 } |
OLD | NEW |