Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: src/api.cc

Issue 2500363002: Makes FunctionTemplate::HasInstance return true for a global proxy. (Closed)
Patch Set: Changed the style from Chromium to V8. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 8eca750f268727784f14142db40342640ba187c1..2861bd1fb15cfa11ec541a3532b1afe19e4f5404 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698