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 |