Merge pull request #4892 from deepak1556/v8_util_patch
common: use v8::private symbols as identifiers for object properties
This commit is contained in:
commit
c307478d5d
2 changed files with 31 additions and 7 deletions
|
@ -39,7 +39,11 @@ bool GetIPCObject(v8::Isolate* isolate,
|
|||
v8::Local<v8::Context> context,
|
||||
v8::Local<v8::Object>* ipc) {
|
||||
v8::Local<v8::String> key = mate::StringToV8(isolate, "ipc");
|
||||
v8::Local<v8::Value> value = context->Global()->GetHiddenValue(key);
|
||||
v8::Local<v8::Private> privateKey = v8::Private::ForApi(isolate, key);
|
||||
v8::Local<v8::Object> global_object = context->Global();
|
||||
v8::Local<v8::Value> value;
|
||||
if (!global_object->GetPrivate(context, privateKey).ToLocal(&value))
|
||||
return false;
|
||||
if (value.IsEmpty() || !value->IsObject())
|
||||
return false;
|
||||
*ipc = value->ToObject();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue