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

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

Issue 2653923008: Reland of Split PendingScript into PendingScript and ClassicPendingScript (Closed)
Patch Set: Fix file header Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp
index 0f8ce8351fa2e732f830745d68fb7c54db898d06..560d94224dfaa398a4b5a056faa53af4e45c11ab 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp
@@ -31,6 +31,7 @@
#include "bindings/core/v8/ScriptSourceCode.h"
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8PerIsolateData.h"
+#include "core/dom/ClassicPendingScript.h"
#include "core/dom/ClassicScript.h"
#include "core/dom/DocumentParserTiming.h"
#include "core/dom/Element.h"
@@ -335,7 +336,7 @@ void HTMLParserScriptRunner::possiblyFetchBlockedDocWriteScript(
return;
if (!pendingScript->errorOccurred()) {
- emitWarningForDocWriteScripts(pendingScript->resource()->url().getString(),
+ emitWarningForDocWriteScripts(pendingScript->url().getString(),
*m_document);
return;
}
@@ -344,13 +345,12 @@ void HTMLParserScriptRunner::possiblyFetchBlockedDocWriteScript(
// ERR_CACHE_MISS but other errors are rare with
// WebCachePolicy::ReturnCacheDataDontLoad.
- emitErrorForDocWriteScripts(pendingScript->resource()->url().getString(),
- *m_document);
+ emitErrorForDocWriteScripts(pendingScript->url().getString(), *m_document);
TextPosition startingPosition = parserBlockingScript()->startingPosition();
bool isParserInserted = scriptLoader->isParserInserted();
// Remove this resource entry from memory cache as the new request
// should not join onto this existing entry.
- memoryCache()->remove(pendingScript->resource());
+ // memoryCache()->remove(pendingScript->resource());
fetchBlockedDocWriteScript(element, isParserInserted, startingPosition);
}
@@ -362,7 +362,7 @@ void HTMLParserScriptRunner::pendingScriptFinished(
// script execution to signal an abrupt stop (e.g., window.close().)
//
// The parser is unprepared to be told, and doesn't need to be.
- if (isExecutingScript() && pendingScript->resource()->wasCanceled()) {
+ if (isExecutingScript() && pendingScript->wasCanceled()) {
pendingScript->dispose();
if (pendingScript == parserBlockingScript()) {
@@ -504,7 +504,7 @@ bool HTMLParserScriptRunner::executeScriptsWaitingForParsing() {
while (!m_scriptsToExecuteAfterParsing.isEmpty()) {
DCHECK(!isExecutingScript());
DCHECK(!hasParserBlockingScript());
- DCHECK(m_scriptsToExecuteAfterParsing.front()->resource());
+ DCHECK(m_scriptsToExecuteAfterParsing.front()->isExternal());
// 1. "Spin the event loop until the first script in the list of scripts
// that will execute when the document has finished parsing
@@ -549,8 +549,6 @@ void HTMLParserScriptRunner::requestParsingBlockingScript(Element* element) {
if (!parserBlockingScript())
return;
- DCHECK(parserBlockingScript()->resource());
-
// We only care about a load callback if resource is not already in the cache.
// Callers will attempt to run the m_parserBlockingScript if possible before
// returning control to the parser.
@@ -572,8 +570,6 @@ void HTMLParserScriptRunner::requestDeferredScript(Element* element) {
ScriptStreamer::Deferred);
}
- DCHECK(pendingScript->resource());
-
// "Add the element to the end of the list of scripts that will execute
// when the document has finished parsing associated with the Document
// of the parser that created the element."
@@ -589,7 +585,10 @@ PendingScript* HTMLParserScriptRunner::requestPendingScript(
// ScriptLoader::fetchScript() should have returned false and
// thus the control shouldn't have reached here.
CHECK(resource);
- return PendingScript::create(scriptElement, resource);
+ ClassicPendingScript* pendingScript =
+ ClassicPendingScript::create(scriptElement, resource);
+ DCHECK(pendingScript->resource());
+ return pendingScript;
}
// The initial steps for 'An end tag whose tag name is "script"'
@@ -647,7 +646,7 @@ void HTMLParserScriptRunner::processScriptElementInternal(
// (There can only be one such script per Document at a time.)"
CHECK(!m_parserBlockingScript);
m_parserBlockingScript =
- PendingScript::create(element, scriptStartPosition);
+ ClassicPendingScript::create(element, scriptStartPosition);
} else {
// 6th Clause of Step 23.
// "Immediately execute the script block,

Powered by Google App Engine
This is Rietveld 408576698