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

Side by Side Diff: third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp

Issue 2694943002: DCHECK: load event is dispatched after executeScript() iff m_isExternalScript
Patch Set: Rebase 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 | « third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp ('k') | 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) 2000 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2005, 2006, 2008, 2014 Apple Inc. All rights reserved. 3 * Copyright (C) 2005, 2006, 2008, 2014 Apple Inc. All rights reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2008 Holger Hans Peter Freyther 7 * Copyright (C) 2008 Holger Hans Peter Freyther
8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 if (errorOccurred) { 454 if (errorOccurred) {
455 scriptLoader->dispatchErrorEvent(); 455 scriptLoader->dispatchErrorEvent();
456 } else if (!wasCanceled) { 456 } else if (!wasCanceled) {
457 if (scriptParserBlockingTime > 0.0) { 457 if (scriptParserBlockingTime > 0.0) {
458 DocumentParserTiming::from(*document()) 458 DocumentParserTiming::from(*document())
459 .recordParserBlockedOnScriptLoadDuration( 459 .recordParserBlockedOnScriptLoadDuration(
460 monotonicallyIncreasingTime() - scriptParserBlockingTime, 460 monotonicallyIncreasingTime() - scriptParserBlockingTime,
461 scriptLoader->wasCreatedDuringDocumentWrite()); 461 scriptLoader->wasCreatedDuringDocumentWrite());
462 } 462 }
463 463
464 #if DCHECK_IS_ON()
465 DCHECK(scriptLoader->isExternalScript());
466 #endif
464 if (!scriptLoader->executeScript(sourceCode)) 467 if (!scriptLoader->executeScript(sourceCode))
465 scriptLoader->dispatchErrorEvent(); 468 scriptLoader->dispatchErrorEvent();
466 else 469 else
467 scriptLoader->dispatchLoadEvent(); 470 scriptLoader->dispatchLoadEvent();
468 } 471 }
469 472
470 m_scriptElement = nullptr; 473 m_scriptElement = nullptr;
471 474
472 if (!isDetached() && !m_requestingScript) 475 if (!isDetached() && !m_requestingScript)
473 resumeParsing(); 476 resumeParsing();
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 DCHECK(!m_pendingScript); 1109 DCHECK(!m_pendingScript);
1107 m_requestingScript = true; 1110 m_requestingScript = true;
1108 1111
1109 if (scriptLoader->prepareScript( 1112 if (scriptLoader->prepareScript(
1110 m_scriptStartPosition, 1113 m_scriptStartPosition,
1111 ScriptLoader::AllowLegacyTypeInTypeAttribute)) { 1114 ScriptLoader::AllowLegacyTypeInTypeAttribute)) {
1112 // FIXME: Script execution should be shared between 1115 // FIXME: Script execution should be shared between
1113 // the libxml2 and Qt XMLDocumentParser implementations. 1116 // the libxml2 and Qt XMLDocumentParser implementations.
1114 1117
1115 if (scriptLoader->readyToBeParserExecuted()) { 1118 if (scriptLoader->readyToBeParserExecuted()) {
1119 #if DCHECK_IS_ON()
1120 DCHECK(!scriptLoader->isExternalScript());
1121 #endif
1116 if (!scriptLoader->executeScript( 1122 if (!scriptLoader->executeScript(
1117 ScriptSourceCode(scriptLoader->scriptContent(), document()->url(), 1123 ScriptSourceCode(scriptLoader->scriptContent(), document()->url(),
1118 m_scriptStartPosition))) { 1124 m_scriptStartPosition))) {
1119 scriptLoader->dispatchErrorEvent(); 1125 scriptLoader->dispatchErrorEvent();
1120 return; 1126 return;
1121 } 1127 }
1122 } else if (scriptLoader->willBeParserExecuted()) { 1128 } else if (scriptLoader->willBeParserExecuted()) {
1123 m_pendingScript = scriptLoader->resource(); 1129 m_pendingScript = scriptLoader->resource();
1124 DCHECK_EQ(m_parserBlockingPendingScriptLoadStartTime, 0.0); 1130 DCHECK_EQ(m_parserBlockingPendingScriptLoadStartTime, 0.0);
1125 m_parserBlockingPendingScriptLoadStartTime = 1131 m_parserBlockingPendingScriptLoadStartTime =
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 RefPtr<XMLParserContext> parser = 1715 RefPtr<XMLParserContext> parser =
1710 XMLParserContext::createStringParser(&sax, &state); 1716 XMLParserContext::createStringParser(&sax, &state);
1711 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1717 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1712 parseChunk(parser->context(), parseString); 1718 parseChunk(parser->context(), parseString);
1713 finishParsing(parser->context()); 1719 finishParsing(parser->context());
1714 attrsOK = state.gotAttributes; 1720 attrsOK = state.gotAttributes;
1715 return state.attributes; 1721 return state.attributes;
1716 } 1722 }
1717 1723
1718 } // namespace blink 1724 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698