diff --git a/shell/browser/api/message_port.cc b/shell/browser/api/message_port.cc index d30866c1ed3a..f531f052176f 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;