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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include <inttypes.h> | 49 #include <inttypes.h> |
50 #include <memory> | 50 #include <memory> |
51 | 51 |
52 namespace blink { | 52 namespace blink { |
53 | 53 |
54 namespace { | 54 namespace { |
55 | 55 |
56 // TODO(bmcquade): move this to a shared location if we find ourselves wanting | 56 // TODO(bmcquade): move this to a shared location if we find ourselves wanting |
57 // to trace similar data elsewhere in the codebase. | 57 // to trace similar data elsewhere in the codebase. |
58 std::unique_ptr<TracedValue> getTraceArgsForScriptElement( | 58 std::unique_ptr<TracedValue> getTraceArgsForScriptElement( |
59 Element* element, | 59 ScriptElementBase* element, |
60 const TextPosition& textPosition) { | 60 const TextPosition& textPosition) { |
61 std::unique_ptr<TracedValue> value = TracedValue::create(); | 61 std::unique_ptr<TracedValue> value = TracedValue::create(); |
62 ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element); | 62 ScriptLoader* scriptLoader = element->loader(); |
63 if (scriptLoader && scriptLoader->resource()) | 63 if (scriptLoader && scriptLoader->resource()) |
64 value->setString("url", scriptLoader->resource()->url().getString()); | 64 value->setString("url", scriptLoader->resource()->url().getString()); |
65 if (element->ownerDocument() && element->ownerDocument()->frame()) { | 65 if (element->document().frame()) { |
66 value->setString( | 66 value->setString( |
67 "frame", | 67 "frame", |
68 String::format("0x%" PRIx64, | 68 String::format("0x%" PRIx64, |
69 static_cast<uint64_t>(reinterpret_cast<intptr_t>( | 69 static_cast<uint64_t>(reinterpret_cast<intptr_t>( |
70 element->ownerDocument()->frame())))); | 70 element->document().frame())))); |
71 } | 71 } |
72 if (textPosition.m_line.zeroBasedInt() > 0 || | 72 if (textPosition.m_line.zeroBasedInt() > 0 || |
73 textPosition.m_column.zeroBasedInt() > 0) { | 73 textPosition.m_column.zeroBasedInt() > 0) { |
74 value->setInteger("lineNumber", textPosition.m_line.oneBasedInt()); | 74 value->setInteger("lineNumber", textPosition.m_line.oneBasedInt()); |
75 value->setInteger("columnNumber", textPosition.m_column.oneBasedInt()); | 75 value->setInteger("columnNumber", textPosition.m_column.oneBasedInt()); |
76 } | 76 } |
77 return value; | 77 return value; |
78 } | 78 } |
79 | 79 |
80 bool doExecuteScript(Element* scriptElement, | 80 bool doExecuteScript(ScriptElementBase* element, |
81 const ScriptSourceCode& sourceCode, | 81 const ScriptSourceCode& sourceCode, |
82 const TextPosition& textPosition) { | 82 const TextPosition& textPosition) { |
83 ScriptLoader* scriptLoader = toScriptLoaderIfPossible(scriptElement); | 83 ScriptLoader* scriptLoader = element->loader(); |
84 DCHECK(scriptLoader); | 84 DCHECK(scriptLoader); |
85 TRACE_EVENT_WITH_FLOW1( | 85 TRACE_EVENT_WITH_FLOW1("blink", "HTMLParserScriptRunner ExecuteScript", |
86 "blink", "HTMLParserScriptRunner ExecuteScript", scriptElement, | 86 element, TRACE_EVENT_FLAG_FLOW_IN, "data", |
87 TRACE_EVENT_FLAG_FLOW_IN, "data", | 87 getTraceArgsForScriptElement(element, textPosition)); |
88 getTraceArgsForScriptElement(scriptElement, textPosition)); | |
89 return scriptLoader->executeScript(sourceCode); | 88 return scriptLoader->executeScript(sourceCode); |
90 } | 89 } |
91 | 90 |
92 void traceParserBlockingScript(const PendingScript* pendingScript, | 91 void traceParserBlockingScript(const PendingScript* pendingScript, |
93 bool waitingForResources) { | 92 bool waitingForResources) { |
94 // The HTML parser must yield before executing script in the following | 93 // The HTML parser must yield before executing script in the following |
95 // cases: | 94 // cases: |
96 // * the script's execution is blocked on the completed load of the script | 95 // * the script's execution is blocked on the completed load of the script |
97 // resource | 96 // resource |
98 // (https://html.spec.whatwg.org/multipage/scripting.html#pending-parsing-bl
ocking-script) | 97 // (https://html.spec.whatwg.org/multipage/scripting.html#pending-parsing-bl
ocking-script) |
99 // * the script's execution is blocked on the load of a style sheet or other | 98 // * the script's execution is blocked on the load of a style sheet or other |
100 // resources that are blocking scripts | 99 // resources that are blocking scripts |
101 // (https://html.spec.whatwg.org/multipage/semantics.html#a-style-sheet-that
-is-blocking-scripts) | 100 // (https://html.spec.whatwg.org/multipage/semantics.html#a-style-sheet-that
-is-blocking-scripts) |
102 // | 101 // |
103 // Both of these cases can introduce significant latency when loading a | 102 // Both of these cases can introduce significant latency when loading a |
104 // web page, especially for users on slow connections, since the HTML parser | 103 // web page, especially for users on slow connections, since the HTML parser |
105 // must yield until the blocking resources finish loading. | 104 // must yield until the blocking resources finish loading. |
106 // | 105 // |
107 // We trace these parser yields here using flow events, so we can track | 106 // We trace these parser yields here using flow events, so we can track |
108 // both when these yields occur, as well as how long the parser had | 107 // both when these yields occur, as well as how long the parser had |
109 // to yield. The connecting flow events are traced once the parser becomes | 108 // to yield. The connecting flow events are traced once the parser becomes |
110 // unblocked when the script actually executes, in doExecuteScript. | 109 // unblocked when the script actually executes, in doExecuteScript. |
111 Element* element = pendingScript->element(); | 110 ScriptElementBase* element = pendingScript->element(); |
112 if (!element) | 111 if (!element) |
113 return; | 112 return; |
114 TextPosition scriptStartPosition = pendingScript->startingPosition(); | 113 TextPosition scriptStartPosition = pendingScript->startingPosition(); |
115 if (!pendingScript->isReady()) { | 114 if (!pendingScript->isReady()) { |
116 if (waitingForResources) { | 115 if (waitingForResources) { |
117 TRACE_EVENT_WITH_FLOW1( | 116 TRACE_EVENT_WITH_FLOW1( |
118 "blink", "YieldParserForScriptLoadAndBlockingResources", element, | 117 "blink", "YieldParserForScriptLoadAndBlockingResources", element, |
119 TRACE_EVENT_FLAG_FLOW_OUT, "data", | 118 TRACE_EVENT_FLAG_FLOW_OUT, "data", |
120 getTraceArgsForScriptElement(element, scriptStartPosition)); | 119 getTraceArgsForScriptElement(element, scriptStartPosition)); |
121 } else { | 120 } else { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // The parser cannot be unblocked as a microtask requested another | 217 // The parser cannot be unblocked as a microtask requested another |
219 // resource | 218 // resource |
220 if (!m_document->isScriptExecutionReady()) | 219 if (!m_document->isScriptExecutionReady()) |
221 return; | 220 return; |
222 } | 221 } |
223 } | 222 } |
224 | 223 |
225 TextPosition scriptStartPosition = pendingScript->startingPosition(); | 224 TextPosition scriptStartPosition = pendingScript->startingPosition(); |
226 double scriptParserBlockingTime = | 225 double scriptParserBlockingTime = |
227 pendingScript->parserBlockingLoadStartTime(); | 226 pendingScript->parserBlockingLoadStartTime(); |
228 Element* element = pendingScript->element(); | 227 ScriptElementBase* element = pendingScript->element(); |
229 | 228 |
230 // 1. "Let the script be the pending parsing-blocking script. | 229 // 1. "Let the script be the pending parsing-blocking script. |
231 // There is no longer a pending parsing-blocking script." | 230 // There is no longer a pending parsing-blocking script." |
232 // Clear the pending script before possible re-entrancy from executeScript() | 231 // Clear the pending script before possible re-entrancy from executeScript() |
233 pendingScript->dispose(); | 232 pendingScript->dispose(); |
234 pendingScript = nullptr; | 233 pendingScript = nullptr; |
235 | 234 |
236 if (pendingScriptType == ScriptStreamer::ParsingBlocking) { | 235 if (pendingScriptType == ScriptStreamer::ParsingBlocking) { |
237 m_parserBlockingScript = nullptr; | 236 m_parserBlockingScript = nullptr; |
238 } | 237 } |
239 | 238 |
240 if (ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element)) { | 239 if (ScriptLoader* scriptLoader = element->loader()) { |
241 // 7. "Increment the parser's script nesting level by one (it should be | 240 // 7. "Increment the parser's script nesting level by one (it should be |
242 // zero before this step, so this sets it to one)." | 241 // zero before this step, so this sets it to one)." |
243 HTMLParserReentryPermit::ScriptNestingLevelIncrementer | 242 HTMLParserReentryPermit::ScriptNestingLevelIncrementer |
244 nestingLevelIncrementer = | 243 nestingLevelIncrementer = |
245 m_reentryPermit->incrementScriptNestingLevel(); | 244 m_reentryPermit->incrementScriptNestingLevel(); |
246 | 245 |
247 IgnoreDestructiveWriteCountIncrementer | 246 IgnoreDestructiveWriteCountIncrementer |
248 ignoreDestructiveWriteCountIncrementer(m_document); | 247 ignoreDestructiveWriteCountIncrementer(m_document); |
249 | 248 |
250 // 8. "Execute the script." | 249 // 8. "Execute the script." |
251 if (errorOccurred) { | 250 if (errorOccurred) { |
252 TRACE_EVENT_WITH_FLOW1( | 251 TRACE_EVENT_WITH_FLOW1( |
253 "blink", "HTMLParserScriptRunner ExecuteScriptFailed", element, | 252 "blink", "HTMLParserScriptRunner ExecuteScriptFailed", element, |
254 TRACE_EVENT_FLAG_FLOW_IN, "data", | 253 TRACE_EVENT_FLAG_FLOW_IN, "data", |
255 getTraceArgsForScriptElement(element, scriptStartPosition)); | 254 getTraceArgsForScriptElement(element, scriptStartPosition)); |
256 scriptLoader->dispatchErrorEvent(); | 255 scriptLoader->dispatchErrorEvent(); |
257 } else { | 256 } else { |
258 DCHECK(isExecutingScript()); | 257 DCHECK(isExecutingScript()); |
259 if (scriptParserBlockingTime > 0.0) { | 258 if (scriptParserBlockingTime > 0.0) { |
260 DocumentParserTiming::from(*m_document) | 259 DocumentParserTiming::from(*m_document) |
261 .recordParserBlockedOnScriptLoadDuration( | 260 .recordParserBlockedOnScriptLoadDuration( |
262 monotonicallyIncreasingTime() - scriptParserBlockingTime, | 261 monotonicallyIncreasingTime() - scriptParserBlockingTime, |
263 scriptLoader->wasCreatedDuringDocumentWrite()); | 262 scriptLoader->wasCreatedDuringDocumentWrite()); |
264 } | 263 } |
265 if (!doExecuteScript(element, sourceCode, scriptStartPosition)) { | 264 if (!doExecuteScript(element, sourceCode, scriptStartPosition)) { |
266 scriptLoader->dispatchErrorEvent(); | 265 scriptLoader->dispatchErrorEvent(); |
267 } else { | 266 } else { |
268 element->dispatchEvent(Event::create(EventTypeNames::load)); | 267 element->dispatchLoadEvent(); |
269 } | 268 } |
270 } | 269 } |
271 | 270 |
272 // 9. "Decrement the parser's script nesting level by one. | 271 // 9. "Decrement the parser's script nesting level by one. |
273 // If the parser's script nesting level is zero | 272 // If the parser's script nesting level is zero |
274 // (which it always should be at this point), | 273 // (which it always should be at this point), |
275 // then set the parser pause flag to false." | 274 // then set the parser pause flag to false." |
276 // This is implemented by ~ScriptNestingLevelIncrementer(). | 275 // This is implemented by ~ScriptNestingLevelIncrementer(). |
277 } | 276 } |
278 | 277 |
279 DCHECK(!isExecutingScript()); | 278 DCHECK(!isExecutingScript()); |
280 } | 279 } |
281 | 280 |
282 void fetchBlockedDocWriteScript(Element* script, | 281 void fetchBlockedDocWriteScript(ScriptElementBase* element, |
283 bool isParserInserted, | 282 bool isParserInserted, |
284 const TextPosition& scriptStartPosition) { | 283 const TextPosition& scriptStartPosition) { |
285 DCHECK(script); | 284 DCHECK(element); |
286 | 285 |
287 ScriptLoader* scriptLoader = | 286 ScriptLoader* scriptLoader = |
288 ScriptLoader::create(script, isParserInserted, false, false); | 287 ScriptLoader::create(element, isParserInserted, false, false); |
289 DCHECK(scriptLoader); | 288 DCHECK(scriptLoader); |
290 scriptLoader->setFetchDocWrittenScriptDeferIdle(); | 289 scriptLoader->setFetchDocWrittenScriptDeferIdle(); |
291 scriptLoader->prepareScript(scriptStartPosition); | 290 scriptLoader->prepareScript(scriptStartPosition); |
292 } | 291 } |
293 | 292 |
294 void emitWarningForDocWriteScripts(const String& url, Document& document) { | 293 void emitWarningForDocWriteScripts(const String& url, Document& document) { |
295 String message = | 294 String message = |
296 "The Parser-blocking, cross site (i.e. different eTLD+1) " | 295 "The Parser-blocking, cross site (i.e. different eTLD+1) " |
297 "script, " + | 296 "script, " + |
298 url + | 297 url + |
(...skipping 21 matching lines...) Expand all Loading... |
320 PendingScript* pendingScript) { | 319 PendingScript* pendingScript) { |
321 // If the script was blocked as part of document.write intervention, | 320 // If the script was blocked as part of document.write intervention, |
322 // then send an asynchronous GET request with an interventions header. | 321 // then send an asynchronous GET request with an interventions header. |
323 | 322 |
324 if (!parserBlockingScript()) | 323 if (!parserBlockingScript()) |
325 return; | 324 return; |
326 | 325 |
327 if (parserBlockingScript() != pendingScript) | 326 if (parserBlockingScript() != pendingScript) |
328 return; | 327 return; |
329 | 328 |
330 Element* element = parserBlockingScript()->element(); | 329 ScriptElementBase* element = parserBlockingScript()->element(); |
331 | 330 |
332 ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element); | 331 ScriptLoader* scriptLoader = element->loader(); |
333 if (!scriptLoader || !scriptLoader->disallowedFetchForDocWrittenScript()) | 332 if (!scriptLoader || !scriptLoader->disallowedFetchForDocWrittenScript()) |
334 return; | 333 return; |
335 | 334 |
336 if (!pendingScript->errorOccurred()) { | 335 if (!pendingScript->errorOccurred()) { |
337 emitWarningForDocWriteScripts(pendingScript->resource()->url().getString(), | 336 emitWarningForDocWriteScripts(pendingScript->resource()->url().getString(), |
338 *m_document); | 337 *m_document); |
339 return; | 338 return; |
340 } | 339 } |
341 | 340 |
342 // Due to dependency violation, not able to check the exact error to be | 341 // Due to dependency violation, not able to check the exact error to be |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 } | 389 } |
391 | 390 |
392 // 'An end tag whose tag name is "script"' | 391 // 'An end tag whose tag name is "script"' |
393 // https://html.spec.whatwg.org/#scriptEndTag | 392 // https://html.spec.whatwg.org/#scriptEndTag |
394 // | 393 // |
395 // Script handling lives outside the tree builder to keep each class simple. | 394 // Script handling lives outside the tree builder to keep each class simple. |
396 void HTMLParserScriptRunner::processScriptElement( | 395 void HTMLParserScriptRunner::processScriptElement( |
397 Element* scriptElement, | 396 Element* scriptElement, |
398 const TextPosition& scriptStartPosition) { | 397 const TextPosition& scriptStartPosition) { |
399 DCHECK(scriptElement); | 398 DCHECK(scriptElement); |
400 TRACE_EVENT1( | 399 |
401 "blink", "HTMLParserScriptRunner::execute", "data", | |
402 getTraceArgsForScriptElement(scriptElement, scriptStartPosition)); | |
403 // FIXME: If scripting is disabled, always just return. | 400 // FIXME: If scripting is disabled, always just return. |
404 | 401 |
405 bool hadPreloadScanner = m_host->hasPreloadScanner(); | 402 bool hadPreloadScanner = m_host->hasPreloadScanner(); |
406 | 403 |
407 // Initial steps of 'An end tag whose tag name is "script"'. | 404 // Initial steps of 'An end tag whose tag name is "script"'. |
408 // Try to execute the script given to us. | 405 // Try to execute the script given to us. |
409 processScriptElementInternal(scriptElement, scriptStartPosition); | 406 processScriptElementInternal(scriptElement, scriptStartPosition); |
410 | 407 |
411 // "At this stage, if there is a pending parsing-blocking script, then:" | 408 // "At this stage, if there is a pending parsing-blocking script, then:" |
412 if (hasParserBlockingScript()) { | 409 if (hasParserBlockingScript()) { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 DCHECK(pendingScript->resource()); | 586 DCHECK(pendingScript->resource()); |
590 | 587 |
591 // "Add the element to the end of the list of scripts that will execute | 588 // "Add the element to the end of the list of scripts that will execute |
592 // when the document has finished parsing associated with the Document | 589 // when the document has finished parsing associated with the Document |
593 // of the parser that created the element." | 590 // of the parser that created the element." |
594 m_scriptsToExecuteAfterParsing.push_back(pendingScript); | 591 m_scriptsToExecuteAfterParsing.push_back(pendingScript); |
595 } | 592 } |
596 | 593 |
597 PendingScript* HTMLParserScriptRunner::requestPendingScript( | 594 PendingScript* HTMLParserScriptRunner::requestPendingScript( |
598 Element* element) const { | 595 Element* element) const { |
599 ScriptResource* resource = toScriptLoaderIfPossible(element)->resource(); | 596 ScriptElementBase* scriptElement = |
| 597 ScriptElementBase::fromElementIfPossible(element); |
| 598 ScriptResource* resource = scriptElement->loader()->resource(); |
600 // Here |resource| should be non-null. If it were nullptr, | 599 // Here |resource| should be non-null. If it were nullptr, |
601 // ScriptLoader::fetchScript() should have returned false and | 600 // ScriptLoader::fetchScript() should have returned false and |
602 // thus the control shouldn't have reached here. | 601 // thus the control shouldn't have reached here. |
603 CHECK(resource); | 602 CHECK(resource); |
604 return PendingScript::create(element, resource); | 603 return PendingScript::create(scriptElement, resource); |
605 } | 604 } |
606 | 605 |
607 // The initial steps for 'An end tag whose tag name is "script"' | 606 // The initial steps for 'An end tag whose tag name is "script"' |
608 // https://html.spec.whatwg.org/#scriptEndTag | 607 // https://html.spec.whatwg.org/#scriptEndTag |
609 void HTMLParserScriptRunner::processScriptElementInternal( | 608 void HTMLParserScriptRunner::processScriptElementInternal( |
610 Element* script, | 609 Element* script, |
611 const TextPosition& scriptStartPosition) { | 610 const TextPosition& scriptStartPosition) { |
612 DCHECK(m_document); | 611 DCHECK(m_document); |
613 DCHECK(!hasParserBlockingScript()); | 612 DCHECK(!hasParserBlockingScript()); |
614 { | 613 { |
615 ScriptLoader* scriptLoader = toScriptLoaderIfPossible(script); | 614 ScriptElementBase* element = |
| 615 ScriptElementBase::fromElementIfPossible(script); |
| 616 DCHECK(element); |
| 617 ScriptLoader* scriptLoader = element->loader(); |
| 618 DCHECK(scriptLoader); |
616 | 619 |
617 // This contains both a DCHECK and a null check since we should not | 620 // FIXME: Align trace event name and function name. |
618 // be getting into the case of a null script element, but seem to be from | 621 TRACE_EVENT1("blink", "HTMLParserScriptRunner::execute", "data", |
619 // time to time. The assertion is left in to help find those cases and | 622 getTraceArgsForScriptElement(element, scriptStartPosition)); |
620 // is being tracked by <https://bugs.webkit.org/show_bug.cgi?id=60559>. | |
621 DCHECK(scriptLoader); | |
622 if (!scriptLoader) | |
623 return; | |
624 | |
625 DCHECK(scriptLoader->isParserInserted()); | 623 DCHECK(scriptLoader->isParserInserted()); |
626 | 624 |
627 if (!isExecutingScript()) | 625 if (!isExecutingScript()) |
628 Microtask::performCheckpoint(V8PerIsolateData::mainThreadIsolate()); | 626 Microtask::performCheckpoint(V8PerIsolateData::mainThreadIsolate()); |
629 | 627 |
630 // "Let the old insertion point have the same value as the current | 628 // "Let the old insertion point have the same value as the current |
631 // insertion point. | 629 // insertion point. |
632 // Let the insertion point be just before the next input character." | 630 // Let the insertion point be just before the next input character." |
633 InsertionPointRecord insertionPointRecord(m_host->inputStream()); | 631 InsertionPointRecord insertionPointRecord(m_host->inputStream()); |
634 | 632 |
(...skipping 18 matching lines...) Expand all Loading... |
653 } else if (scriptLoader->readyToBeParserExecuted()) { | 651 } else if (scriptLoader->readyToBeParserExecuted()) { |
654 // 5th Clause of Step 23. | 652 // 5th Clause of Step 23. |
655 // "If ... it's an HTML parser | 653 // "If ... it's an HTML parser |
656 // whose script nesting level is not greater than one" | 654 // whose script nesting level is not greater than one" |
657 if (m_reentryPermit->scriptNestingLevel() == 1u) { | 655 if (m_reentryPermit->scriptNestingLevel() == 1u) { |
658 // "The element is the pending parsing-blocking script of the | 656 // "The element is the pending parsing-blocking script of the |
659 // Document of the parser that created the element. | 657 // Document of the parser that created the element. |
660 // (There can only be one such script per Document at a time.)" | 658 // (There can only be one such script per Document at a time.)" |
661 CHECK(!m_parserBlockingScript); | 659 CHECK(!m_parserBlockingScript); |
662 m_parserBlockingScript = | 660 m_parserBlockingScript = |
663 PendingScript::create(script, scriptStartPosition); | 661 PendingScript::create(element, scriptStartPosition); |
664 } else { | 662 } else { |
665 // 6th Clause of Step 23. | 663 // 6th Clause of Step 23. |
666 // "Immediately execute the script block, | 664 // "Immediately execute the script block, |
667 // even if other scripts are already executing." | 665 // even if other scripts are already executing." |
668 // TODO(hiroshige): Merge the block into ScriptLoader::prepareScript(). | 666 // TODO(hiroshige): Merge the block into ScriptLoader::prepareScript(). |
669 DCHECK_GT(m_reentryPermit->scriptNestingLevel(), 1u); | 667 DCHECK_GT(m_reentryPermit->scriptNestingLevel(), 1u); |
670 if (m_parserBlockingScript) | 668 if (m_parserBlockingScript) |
671 m_parserBlockingScript->dispose(); | 669 m_parserBlockingScript->dispose(); |
672 m_parserBlockingScript = nullptr; | 670 m_parserBlockingScript = nullptr; |
673 ScriptSourceCode sourceCode(script->textContent(), | 671 ScriptSourceCode sourceCode(script->textContent(), |
674 documentURLForScriptExecution(m_document), | 672 documentURLForScriptExecution(m_document), |
675 scriptStartPosition); | 673 scriptStartPosition); |
676 doExecuteScript(script, sourceCode, scriptStartPosition); | 674 doExecuteScript(element, sourceCode, scriptStartPosition); |
677 } | 675 } |
678 } else { | 676 } else { |
679 // 2nd Clause of Step 23. | 677 // 2nd Clause of Step 23. |
680 requestParsingBlockingScript(script); | 678 requestParsingBlockingScript(script); |
681 } | 679 } |
682 | 680 |
683 // "Decrement the parser's script nesting level by one. | 681 // "Decrement the parser's script nesting level by one. |
684 // If the parser's script nesting level is zero, then set the parser | 682 // If the parser's script nesting level is zero, then set the parser |
685 // pause flag to false." | 683 // pause flag to false." |
686 // Implemented by ~ScriptNestingLevelIncrementer(). | 684 // Implemented by ~ScriptNestingLevelIncrementer(). |
687 | 685 |
688 // "Let the insertion point have the value of the old insertion point." | 686 // "Let the insertion point have the value of the old insertion point." |
689 // Implemented by ~InsertionPointRecord(). | 687 // Implemented by ~InsertionPointRecord(). |
690 } | 688 } |
691 } | 689 } |
692 | 690 |
693 DEFINE_TRACE(HTMLParserScriptRunner) { | 691 DEFINE_TRACE(HTMLParserScriptRunner) { |
694 visitor->trace(m_document); | 692 visitor->trace(m_document); |
695 visitor->trace(m_host); | 693 visitor->trace(m_host); |
696 visitor->trace(m_parserBlockingScript); | 694 visitor->trace(m_parserBlockingScript); |
697 visitor->trace(m_scriptsToExecuteAfterParsing); | 695 visitor->trace(m_scriptsToExecuteAfterParsing); |
698 PendingScriptClient::trace(visitor); | 696 PendingScriptClient::trace(visitor); |
699 } | 697 } |
700 | 698 |
701 } // namespace blink | 699 } // namespace blink |
OLD | NEW |