Commit 96ad91a6 authored by yukishiino's avatar yukishiino Committed by Commit bot

Makes FunctionTemplate::HasInstance return true for a global proxy.

Makes FunctionTemplate::HasInstance follow the hidden prototype chain
for a global proxy object and return true if the global object passes
the test.

BUG=

Review-Url: https://codereview.chromium.org/2500363002
Cr-Commit-Position: refs/heads/master@{#40989}
parent 961a45da
......@@ -6386,7 +6386,16 @@ MaybeLocal<v8::Object> FunctionTemplate::NewRemoteInstance() {
bool FunctionTemplate::HasInstance(v8::Local<v8::Value> value) {
auto self = Utils::OpenHandle(this);
auto obj = Utils::OpenHandle(*value);
return obj->IsJSObject() && self->IsTemplateFor(i::JSObject::cast(*obj));
if (obj->IsJSObject() && self->IsTemplateFor(i::JSObject::cast(*obj))) {
return true;
}
if (obj->IsJSGlobalProxy()) {
// If it's a global proxy object, then test with the global object.
i::PrototypeIterator iter(i::JSObject::cast(*obj)->map());
if (iter.IsAtEnd()) return false;
return self->IsTemplateFor(iter.GetCurrent<i::JSGlobalObject>());
}
return false;
}
......
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