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

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

Issue 2850673002: Move a RegisterModuleScript() call to ModuleScript::Create() (Closed)
Patch Set: Fix tests 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 a04137be3b75c4c03f251c90b4bdb5b8d3eba300..bd911121cc17913fda9ebeac47216eabb09c04be 100644
--- a/third_party/WebKit/Source/core/dom/ModuleScript.cpp
+++ b/third_party/WebKit/Source/core/dom/ModuleScript.cpp
@@ -6,6 +6,7 @@
#include "bindings/core/v8/ScriptState.h"
#include "bindings/core/v8/ScriptValue.h"
+#include "core/dom/ScriptModuleResolver.h"
#include "v8/include/v8.h"
namespace blink {
@@ -51,8 +52,14 @@ ModuleScript* ModuleScript::CreateInternal(
// 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);
+ ModuleScript* module_script = new ModuleScript(
+ modulator, result, base_url, nonce, parser_state, credentials_mode);
+
+ // Step 5, a part of ParseModule(): Passing script as the last parameter
+ // here ensures result.[[HostDefined]] will be script.
+ modulator->GetScriptModuleResolver()->RegisterModuleScript(module_script);
+
+ return module_script;
}
ModuleScript* ModuleScript::CreateForTest(
« no previous file with comments | « third_party/WebKit/Source/core/dom/ModuleMap.cpp ('k') | third_party/WebKit/Source/core/testing/DummyModulator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698