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

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

Issue 2845743003: Move "create a module script" from ModuleScriptLoader to ModuleScript (Closed)
Patch Set: Rebase 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/dom/ModuleScript.cpp
diff --git a/third_party/WebKit/Source/core/dom/ModuleScript.cpp b/third_party/WebKit/Source/core/dom/ModuleScript.cpp
index a0f6a396a78fb14fe72bdbab795330f2c96185aa..6ad544341ed9ae73c21e26fb21a973df4c8e7846 100644
--- a/third_party/WebKit/Source/core/dom/ModuleScript.cpp
+++ b/third_party/WebKit/Source/core/dom/ModuleScript.cpp
@@ -10,6 +10,37 @@
namespace blink {
+ModuleScript* ModuleScript::Create(
+ const String& source_text,
+ Modulator* modulator,
+ const KURL& base_url,
+ const String& nonce,
+ ParserDisposition parser_state,
+ WebURLRequest::FetchCredentialsMode credentials_mode,
+ AccessControlStatus access_control_status) {
+ // 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
+ // provided.
+ // Note: "script's settings object" will be "modulator".
+
+ // Delegate to Modulator::compileModule to process Steps 3-6.
+ ScriptModule result = modulator->CompileModule(
+ source_text, base_url.GetString(), access_control_status);
+ // Step 6: "...return null, and abort these steps."
+ if (result.IsNull())
+ return nullptr;
+ // 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
+ // provided.
+ // Step 10. Set script's parser state to the parser state.
+ // Step 11. Set script's credentials mode to the credentials mode provided.
+ // Step 12. Return script.
+ return new ModuleScript(modulator, result, 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') | third_party/WebKit/Source/core/dom/ScriptModuleResolverImplTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698