Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp

Issue 2692863013: Assert that |resource| is always non-null in requestPendingScript() (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698