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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/ScriptModule.h" 5 #include "bindings/core/v8/ScriptModule.h"
6 6
7 #include "bindings/core/v8/V8Binding.h" 7 #include "bindings/core/v8/V8Binding.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 v8::TryCatch tryCatch(isolate); 46 v8::TryCatch tryCatch(isolate);
47 tryCatch.SetVerbose(true); 47 tryCatch.SetVerbose(true);
48 v8::Local<v8::Value> result; 48 v8::Local<v8::Value> result;
49 if (!v8Call(V8ScriptRunner::evaluateModule(m_module->newLocal(isolate), 49 if (!v8Call(V8ScriptRunner::evaluateModule(m_module->newLocal(isolate),
50 scriptState->context(), isolate), 50 scriptState->context(), isolate),
51 result, tryCatch)) { 51 result, tryCatch)) {
52 // TODO(adamk): report error 52 // TODO(adamk): report error
53 } 53 }
54 } 54 }
55 55
56 Vector<String> ScriptModule::moduleRequests(ScriptState* scriptState) {
57 if (isNull())
58 return Vector<String>();
59
60 v8::Local<v8::Module> module = m_module->newLocal(scriptState->isolate());
61
62 Vector<String> ret;
63
64 int length = module->GetModuleRequestsLength();
65 ret.reserveInitialCapacity(length);
66 for (int i = 0; i < length; ++i) {
67 v8::Local<v8::String> v8Name = module->GetModuleRequest(i);
68 String name = toCoreString(v8Name);
69 ret.push_back(name);
haraken 2017/04/04 04:32:09 ret.push_back(toCoreString(v8Name));
70 }
71 return ret;
72 }
73
56 } // namespace blink 74 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698