Commit e7bb85dc authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[d8] Update realm_current_ and realm_switch_ in Realm.eval

This makes e.g., load(file) work within Realm.eval(realm, "load(file)") to load files into that realm.

Bug:

Change-Id: I85738f0dfab621f2a8c9e2703f4ce4b39dd882bf
Reviewed-on: https://chromium-review.googlesource.com/484379Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44887}
parent d06d4ce2
......@@ -1076,12 +1076,16 @@ void Shell::RealmEval(const v8::FunctionCallbackInfo<v8::Value>& args) {
}
Local<Context> realm = Local<Context>::New(isolate, data->realms_[index]);
realm->Enter();
int previous_index = data->realm_current_;
data->realm_current_ = data->realm_switch_ = index;
Local<Value> result;
if (!script->BindToCurrentContext()->Run(realm).ToLocal(&result)) {
realm->Exit();
data->realm_current_ = data->realm_switch_ = previous_index;
return;
}
realm->Exit();
data->realm_current_ = data->realm_switch_ = previous_index;
args.GetReturnValue().Set(result);
}
......
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