From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Wed, 4 Mar 2020 11:18:03 -0800 Subject: feat: add onclose to MessagePort This adds the 'onclose' event to MessagePort. Can be removed once https://bugs.chromium.org/p/chromium/issues/detail?id=1495616 is fixed. diff --git a/third_party/blink/renderer/core/messaging/message_port.cc b/third_party/blink/renderer/core/messaging/message_port.cc index 2f2a5b60423af1dbc425c44283cc2f2934bffa18..dbbe04b2447aa0769beca25c60d404b4f2209e43 100644 --- a/third_party/blink/renderer/core/messaging/message_port.cc +++ b/third_party/blink/renderer/core/messaging/message_port.cc @@ -195,6 +195,7 @@ void MessagePort::close() { Entangle(pipe.TakePort0(), nullptr); } closed_ = true; + DispatchEvent(*Event::Create(event_type_names::kClose)); } void MessagePort::Entangle(MessagePortDescriptor port_descriptor, diff --git a/third_party/blink/renderer/core/messaging/message_port.idl b/third_party/blink/renderer/core/messaging/message_port.idl index 9df43655b569428a6abc54341b4b0023e159f99b..3f1f181d9b8a66997136f870f55c97c08294b6eb 100644 --- a/third_party/blink/renderer/core/messaging/message_port.idl +++ b/third_party/blink/renderer/core/messaging/message_port.idl @@ -40,5 +40,5 @@ // event handlers attribute EventHandler onmessage; attribute EventHandler onmessageerror; - [RuntimeEnabled=MessagePortCloseEvent] attribute EventHandler onclose; + attribute EventHandler onclose; };