Commit 11a304ff authored by Maya Lekova's avatar Maya Lekova Committed by V8 LUCI CQ

[megadom] Fix crash in d8 when realm is entered

Bug: chromium:1329234
Change-Id: I59f171d3e2ab0c07f79f631971b1695b9f706600
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3677294Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80850}
parent a1c96c7b
...@@ -3002,7 +3002,9 @@ void Shell::NodeTypeCallback(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -3002,7 +3002,9 @@ void Shell::NodeTypeCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Isolate* isolate = args.GetIsolate(); v8::Isolate* isolate = args.GetIsolate();
// TODO(mslekova): Enable this once we have signature check in TF. // TODO(mslekova): Enable this once we have signature check in TF.
PerIsolateData* data = PerIsolateData::Get(isolate); PerIsolateData* data = PerIsolateData::Get(isolate);
CHECK(data->GetDomNodeCtor()->HasInstance(args.This())); if (!data->GetDomNodeCtor()->HasInstance(args.This())) {
isolate->ThrowError("Calling .nodeType on wrong instance type.");
}
args.GetReturnValue().Set(v8::Number::New(isolate, 1)); args.GetReturnValue().Set(v8::Number::New(isolate, 1));
} }
......
// Copyright 2022 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.
try {
Realm.createAllowCrossRealmAccess();
var div = new d8.dom.Div();
div['nodeType']();
} catch (err) {
console.log(err);
}
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