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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 281 |
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 Microtask::performCheckpoint(); | 290 Microtask::performCheckpoint(); |
| 291 StableState::provide(); |
290 | 292 |
291 InsertionPointRecord insertionPointRecord(m_host->inputStream()); | 293 InsertionPointRecord insertionPointRecord(m_host->inputStream()); |
292 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); | 294 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); |
293 | 295 |
294 scriptLoader->prepareScript(scriptStartPosition); | 296 scriptLoader->prepareScript(scriptStartPosition); |
295 | 297 |
296 if (!scriptLoader->willBeParserExecuted()) | 298 if (!scriptLoader->willBeParserExecuted()) |
297 return; | 299 return; |
298 | 300 |
299 if (scriptLoader->willExecuteWhenDocumentFinishedParsing()) { | 301 if (scriptLoader->willExecuteWhenDocumentFinishedParsing()) { |
300 requestDeferredScript(script); | 302 requestDeferredScript(script); |
301 } else if (scriptLoader->readyToBeParserExecuted()) { | 303 } else if (scriptLoader->readyToBeParserExecuted()) { |
302 if (m_scriptNestingLevel == 1) { | 304 if (m_scriptNestingLevel == 1) { |
303 m_parserBlockingScript.setElement(script); | 305 m_parserBlockingScript.setElement(script); |
304 m_parserBlockingScript.setStartingPosition(scriptStartPosition); | 306 m_parserBlockingScript.setStartingPosition(scriptStartPosition); |
305 } else { | 307 } else { |
306 ScriptSourceCode sourceCode(script->textContent(), documentURLFo
rScriptExecution(m_document), scriptStartPosition); | 308 ScriptSourceCode sourceCode(script->textContent(), documentURLFo
rScriptExecution(m_document), scriptStartPosition); |
307 scriptLoader->executeScript(sourceCode); | 309 scriptLoader->executeScript(sourceCode); |
308 } | 310 } |
309 } else { | 311 } else { |
310 requestParsingBlockingScript(script); | 312 requestParsingBlockingScript(script); |
311 } | 313 } |
312 } | 314 } |
313 } | 315 } |
314 | 316 |
315 } | 317 } |
OLD | NEW |