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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp

Issue 2555653002: [WIP Prototype] ES6 https://html.spec.whatwg.org/#fetch-a-single-module-script implementation (Closed)
Patch Set: snapshot Dec19 Created 4 years 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/bindings/core/v8/ScriptController.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp
index f6d5d7586ecf06a6c36dad021dd0f9129e5f4b9e..a6ce07c1d2b81e62a5cb287c030005e109d90035 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp
@@ -32,6 +32,7 @@
#include "bindings/core/v8/ScriptController.h"
+#include "bindings/core/v8/ScriptModule.h"
#include "bindings/core/v8/ScriptSourceCode.h"
#include "bindings/core/v8/ScriptValue.h"
#include "bindings/core/v8/V8Binding.h"
@@ -441,4 +442,19 @@ void ScriptController::executeScriptInIsolatedWorld(
}
}
+ScriptModule ScriptController::compileModule(const String& script,
+ const String& urlStr) {
+ v8::Isolate* isolate = V8PerIsolateData::mainThreadIsolate();
+ v8::HandleScope handleScope(isolate);
+
+ ScriptState* scriptState = ScriptState::forMainWorld(frame());
+ if (!scriptState) {
+ printf("Failed to get ScriptState forMainWorld\n");
+ return ScriptModule();
+ }
+
+ ScriptState::Scope scope(scriptState);
+ return ScriptModule::compile(isolate, script, urlStr);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698