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

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

Issue 2820753002: Revert of Split PendingScript into PendingScript and ClassicPendingScript (Closed)
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptLoader.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1b94d33abc3e4bea927f444a3324cf0fb77a475e..6b2c3764eafe7678130d9f9001dd76297ac6771c 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp
@@ -31,7 +31,6 @@
#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"
@@ -49,6 +48,7 @@
#include "platform/WebFrameScheduler.h"
#include "platform/instrumentation/tracing/TraceEvent.h"
#include "platform/instrumentation/tracing/TracedValue.h"
+#include "platform/loader/fetch/MemoryCache.h"
#include "public/platform/Platform.h"
namespace blink {
@@ -335,12 +335,9 @@
if (!script_loader || !script_loader->DisallowedFetchForDocWrittenScript())
return;
- // We don't allow document.write() and its intervention with module scripts.
- CHECK_EQ(pending_script->GetScriptType(), ScriptType::kClassic);
-
if (!pending_script->ErrorOccurred()) {
- EmitWarningForDocWriteScripts(pending_script->Url().GetString(),
- *document_);
+ EmitWarningForDocWriteScripts(
+ pending_script->GetResource()->Url().GetString(), *document_);
return;
}
@@ -348,12 +345,13 @@
// ERR_CACHE_MISS but other errors are rare with
// WebCachePolicy::ReturnCacheDataDontLoad.
- EmitErrorForDocWriteScripts(pending_script->Url().GetString(), *document_);
+ EmitErrorForDocWriteScripts(pending_script->GetResource()->Url().GetString(),
+ *document_);
TextPosition starting_position = ParserBlockingScript()->StartingPosition();
bool is_parser_inserted = script_loader->IsParserInserted();
// Remove this resource entry from memory cache as the new request
// should not join onto this existing entry.
- pending_script->RemoveFromMemoryCache();
+ GetMemoryCache()->Remove(pending_script->GetResource());
FetchBlockedDocWriteScript(element, is_parser_inserted, starting_position);
}
@@ -365,7 +363,7 @@
// 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() && pending_script->WasCanceled()) {
+ if (IsExecutingScript() && pending_script->GetResource()->WasCanceled()) {
pending_script->Dispose();
if (pending_script == ParserBlockingScript()) {
@@ -507,7 +505,7 @@
while (!scripts_to_execute_after_parsing_.IsEmpty()) {
DCHECK(!IsExecutingScript());
DCHECK(!HasParserBlockingScript());
- DCHECK(scripts_to_execute_after_parsing_.front()->IsExternal());
+ DCHECK(scripts_to_execute_after_parsing_.front()->GetResource());
// 1. "Spin the event loop until the first script in the list of scripts
// that will execute when the document has finished parsing
@@ -553,7 +551,7 @@
if (!ParserBlockingScript())
return;
- DCHECK(ParserBlockingScript()->IsExternal());
+ DCHECK(ParserBlockingScript()->GetResource());
// 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
@@ -576,7 +574,7 @@
ScriptStreamer::kDeferred);
}
- DCHECK(pending_script->IsExternal());
+ DCHECK(pending_script->GetResource());
// "Add the element to the end of the list of scripts that will execute
// when the document has finished parsing associated with the Document
@@ -646,7 +644,7 @@
// (There can only be one such script per Document at a time.)"
CHECK(!parser_blocking_script_);
parser_blocking_script_ =
- ClassicPendingScript::Create(element, script_start_position);
+ PendingScript::Create(element, script_start_position);
} else {
// 6th Clause of Step 23.
// "Immediately execute the script block,
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698