Commit 18cba094 authored by Sam Sebree's avatar Sam Sebree Committed by Commit Bot

[SyntheticModules] Implements ValueWrapperSyntheticModuleScript::EvaluationSteps

This change implements the EvaluationSteps Callback which is intended to be used by v8 during SyntheticModule::Evaluate.
ValueWrapperSyntheticModuleScript::EvaluationSteps is responsible for setting the default export of the provided module to the value wrapped by the ValueWrapperSyntheticModuleScript

Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=967018
Change-Id: I07b3be40832b9497169ed0a38a1fcc251e681f79
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1725472Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Commit-Queue: Sam Sebree <sasebree@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#682351}
parent 4fa34add
......@@ -126,12 +126,27 @@ ValueWrapperSyntheticModuleScript::ValueWrapperSyntheticModuleScript(
fetch_options),
export_value_(v8::Isolate::GetCurrent(), value) {}
// TODO(sasebree) Implement this method
// This is the definition of [[EvaluationSteps]] As per the synthetic module
// spec https://heycam.github.io/webidl/#synthetic-module-records
// It is responsible for setting the default export of the provided module to
// the value wrapped by the ValueWrapperSyntheticModuleScript
v8::MaybeLocal<v8::Value> ValueWrapperSyntheticModuleScript::EvaluationSteps(
v8::Local<v8::Context> context,
v8::Local<v8::Module> module) {
NOTREACHED();
return v8::MaybeLocal<v8::Value>();
v8::Isolate* isolate = context->GetIsolate();
ScriptState* script_state = ScriptState::From(context);
Modulator* modulator = Modulator::From(script_state);
ModuleRecord record = ModuleRecord(isolate, module, KURL());
ModuleRecordResolver* module_record_resolver =
modulator->GetModuleRecordResolver();
const ValueWrapperSyntheticModuleScript*
value_wrapper_synthetic_module_script =
static_cast<const ValueWrapperSyntheticModuleScript*>(
module_record_resolver->GetModuleScriptFromModuleRecord(record));
module->SetSyntheticModuleExport(
V8String(isolate, "default"),
value_wrapper_synthetic_module_script->export_value_.NewLocal(isolate));
return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
}
String ValueWrapperSyntheticModuleScript::InlineSourceTextForCSP() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment