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

Unified Diff: third_party/WebKit/Source/core/dom/ModuleScript.cpp

Issue 2844413003: Introduce ModuleScript::CreateInternal() (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/ModuleScript.h ('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/dom/ModuleScript.cpp
diff --git a/third_party/WebKit/Source/core/dom/ModuleScript.cpp b/third_party/WebKit/Source/core/dom/ModuleScript.cpp
index 6ad544341ed9ae73c21e26fb21a973df4c8e7846..a04137be3b75c4c03f251c90b4bdb5b8d3eba300 100644
--- a/third_party/WebKit/Source/core/dom/ModuleScript.cpp
+++ b/third_party/WebKit/Source/core/dom/ModuleScript.cpp
@@ -18,6 +18,7 @@ ModuleScript* ModuleScript::Create(
ParserDisposition parser_state,
WebURLRequest::FetchCredentialsMode credentials_mode,
AccessControlStatus access_control_status) {
+ // https://html.spec.whatwg.org/#creating-a-module-script
// Step 1. Let script be a new module script that this algorithm will
// subsequently initialize.
// Step 2. Set script's settings object to the environment settings object
@@ -30,6 +31,19 @@ ModuleScript* ModuleScript::Create(
// Step 6: "...return null, and abort these steps."
if (result.IsNull())
return nullptr;
+
+ return CreateInternal(modulator, result, base_url, nonce, parser_state,
+ credentials_mode);
+}
+
+ModuleScript* ModuleScript::CreateInternal(
+ Modulator* modulator,
+ ScriptModule result,
+ const KURL& base_url,
+ const String& nonce,
+ ParserDisposition parser_state,
+ WebURLRequest::FetchCredentialsMode credentials_mode) {
+ // https://html.spec.whatwg.org/#creating-a-module-script
// Step 7. Set script's module record to result.
// Step 8. Set script's base URL to the script base URL provided.
// Step 9. Set script's cryptographic nonce to the cryptographic nonce
@@ -41,6 +55,17 @@ ModuleScript* ModuleScript::Create(
credentials_mode);
}
+ModuleScript* ModuleScript::CreateForTest(
+ Modulator* modulator,
+ ScriptModule record,
+ const KURL& base_url,
+ const String& nonce,
+ ParserDisposition parser_state,
+ WebURLRequest::FetchCredentialsMode credentials_mode) {
+ return CreateInternal(modulator, record, base_url, nonce, parser_state,
+ credentials_mode);
+}
+
void ModuleScript::SetInstantiationErrorAndClearRecord(ScriptValue error) {
// Implements Step 7.1 of:
// https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-script-graph-fetching-procedure
« no previous file with comments | « third_party/WebKit/Source/core/dom/ModuleScript.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698