Commit 10e713b6 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[d8] Fix Realm.eval script origin

Bug: v8:10604
Change-Id: If66656017e53da34aa69bbe19d915df08cf6f332
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2246564
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68368}
parent 8950a987
......@@ -1416,8 +1416,10 @@ void Shell::RealmEval(const v8::FunctionCallbackInfo<v8::Value>& args) {
Throw(args.GetIsolate(), "Invalid argument");
return;
}
ScriptOrigin origin(String::NewFromUtf8Literal(isolate, "(d8)",
NewStringType::kInternalized));
ScriptCompiler::Source script_source(
args[1]->ToString(isolate->GetCurrentContext()).ToLocalChecked());
args[1]->ToString(isolate->GetCurrentContext()).ToLocalChecked(), origin);
Local<UnboundScript> script;
if (!ScriptCompiler::CompileUnboundScript(isolate, &script_source)
.ToLocal(&script)) {
......
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(async function test() {
try {
import('does_not_exist.mjs');
assertUnreachable();
} catch {};
try {
await eval("import('does_not_exist.mjs')");
assertUnreachable();
} catch {};
try {
await Realm.eval(Realm.create(), "import('does_not_exist.mjs')");
assertUnreachable();
} catch {};
})();
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