Browse Source

chore: return when electron::SerializeV8Value fails

Shelley Vohr 10 months ago
parent
commit
b285b4f050
1 changed files with 5 additions and 2 deletions
  1. 5 2
      shell/browser/api/message_port.cc

+ 5 - 2
shell/browser/api/message_port.cc

@@ -76,8 +76,11 @@ void MessagePort::PostMessage(gin::Arguments* args) {
     return;
   }
 
-  electron::SerializeV8Value(args->isolate(), message_value,
-                             &transferable_message);
+  if (!electron::SerializeV8Value(args->isolate(), message_value,
+                                  &transferable_message)) {
+    // SerializeV8Value sets an exception.
+    return;
+  }
 
   v8::Local<v8::Value> transferables;
   std::vector<gin::Handle<MessagePort>> wrapped_ports;