diff --git a/shell/browser/api/message_port.cc b/shell/browser/api/message_port.cc index a607349cbb4b..998376eed22e 100644 --- a/shell/browser/api/message_port.cc +++ b/shell/browser/api/message_port.cc @@ -30,12 +30,12 @@ namespace electron { namespace { -bool IsValidWrappable(const v8::Local& obj) { - v8::Local port = v8::Local::Cast(obj); - - if (!port->IsObject()) +bool IsValidWrappable(const v8::Local& val) { + if (!val->IsObject()) return false; + v8::Local port = val.As(); + if (port->InternalFieldCount() != gin::kNumberOfInternalFields) return false;