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

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

Issue 2788573002: [ES6 modules] Introduce ScriptModule::moduleRequests to access record.[[RequestedModules]] (Closed)
Patch Set: add_tests Created 3 years, 9 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/bindings/core/v8/ScriptModule.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptModule.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptModule.cpp
index 3642e50d29e06bf845e1c80fa82a44cdbdc378f8..d220fb03d94fa7ca5416f30f3c0b19e815c83751 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptModule.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptModule.cpp
@@ -53,4 +53,22 @@ void ScriptModule::evaluate(ScriptState* scriptState) {
}
}
+Vector<String> ScriptModule::moduleRequests(ScriptState* scriptState) {
+ if (isNull())
+ return Vector<String>();
+
+ v8::Local<v8::Module> module = m_module->newLocal(scriptState->isolate());
+
+ Vector<String> ret;
+
+ int length = module->GetModuleRequestsLength();
+ ret.reserveInitialCapacity(length);
+ for (int i = 0; i < length; ++i) {
+ v8::Local<v8::String> v8Name = module->GetModuleRequest(i);
+ String name = toCoreString(v8Name);
+ ret.push_back(name);
haraken 2017/04/04 04:32:09 ret.push_back(toCoreString(v8Name));
+ }
+ return ret;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698