| 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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 DCHECK(pendingScript->resource()); | 573 DCHECK(pendingScript->resource()); |
| 574 | 574 |
| 575 // "Add the element to the end of the list of scripts that will execute | 575 // "Add the element to the end of the list of scripts that will execute |
| 576 // when the document has finished parsing associated with the Document | 576 // when the document has finished parsing associated with the Document |
| 577 // of the parser that created the element." | 577 // of the parser that created the element." |
| 578 m_scriptsToExecuteAfterParsing.append(pendingScript); | 578 m_scriptsToExecuteAfterParsing.append(pendingScript); |
| 579 } | 579 } |
| 580 | 580 |
| 581 PendingScript* HTMLParserScriptRunner::requestPendingScript( | 581 PendingScript* HTMLParserScriptRunner::requestPendingScript( |
| 582 Element* element) const { | 582 Element* element) const { |
| 583 // This should correctly return 0 for empty or invalid srcValues. | |
| 584 ScriptResource* resource = toScriptLoaderIfPossible(element)->resource(); | 583 ScriptResource* resource = toScriptLoaderIfPossible(element)->resource(); |
| 585 if (!resource) { | 584 // Here |resource| should be non-null. If it were nullptr, |
| 586 DVLOG(1) << "Not implemented."; // Dispatch error event. | 585 // ScriptLoader::fetchScript() should have returned false and |
| 587 return nullptr; | 586 // thus the control shouldn't have reached here. |
| 588 } | 587 CHECK(resource); |
| 589 | |
| 590 return PendingScript::create(element, resource); | 588 return PendingScript::create(element, resource); |
| 591 } | 589 } |
| 592 | 590 |
| 593 // The initial steps for 'An end tag whose tag name is "script"' | 591 // The initial steps for 'An end tag whose tag name is "script"' |
| 594 // https://html.spec.whatwg.org/#scriptEndTag | 592 // https://html.spec.whatwg.org/#scriptEndTag |
| 595 void HTMLParserScriptRunner::processScriptElementInternal( | 593 void HTMLParserScriptRunner::processScriptElementInternal( |
| 596 Element* script, | 594 Element* script, |
| 597 const TextPosition& scriptStartPosition) { | 595 const TextPosition& scriptStartPosition) { |
| 598 DCHECK(m_document); | 596 DCHECK(m_document); |
| 599 DCHECK(!hasParserBlockingScript()); | 597 DCHECK(!hasParserBlockingScript()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 | 676 |
| 679 DEFINE_TRACE(HTMLParserScriptRunner) { | 677 DEFINE_TRACE(HTMLParserScriptRunner) { |
| 680 visitor->trace(m_document); | 678 visitor->trace(m_document); |
| 681 visitor->trace(m_host); | 679 visitor->trace(m_host); |
| 682 visitor->trace(m_parserBlockingScript); | 680 visitor->trace(m_parserBlockingScript); |
| 683 visitor->trace(m_scriptsToExecuteAfterParsing); | 681 visitor->trace(m_scriptsToExecuteAfterParsing); |
| 684 PendingScriptClient::trace(visitor); | 682 PendingScriptClient::trace(visitor); |
| 685 } | 683 } |
| 686 | 684 |
| 687 } // namespace blink | 685 } // namespace blink |
| OLD | NEW |