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

Unified Diff: src/api.cc

Issue 2500363002: Makes FunctionTemplate::HasInstance return true for a global proxy. (Closed)
Patch Set: 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..653549a668766adf1110667da6b15df0bb99d28d 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.
+ auto map = i::JSGlobalProxy::cast(*obj)->map();
+ return map->has_hidden_prototype() &&
+ self->IsTemplateFor(i::JSGlobalObject::cast(map->prototype()));
+ }
Toon Verwaest 2016/11/15 12:13:43 style nit, what about something like: if (obj->
Yuki 2016/11/15 12:34:01 Done.
+ 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