Title: [286306] trunk/Source/WebKit
Revision
286306
Author
[email protected]
Date
2021-11-30 10:53:24 -0800 (Tue, 30 Nov 2021)

Log Message

Web Inspector: fix IPC race between unregistering an extension and Web Inspector closing
https://bugs.webkit.org/show_bug.cgi?id=233264

Reviewed by Devin Rousso.

* UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp:
(WebKit::WebInspectorUIExtensionControllerProxy::inspectorFrontendWillClose):
Remaining registrations will not be removed via unregisterExtension() if
the frontend is already in the midst of closing. Clear out the registry.

(WebKit::WebInspectorUIExtensionControllerProxy::registerExtension):
(WebKit::WebInspectorUIExtensionControllerProxy::unregisterExtension):
Bail out if the inspector has closed between the IPC message being sent
and receiving the async response.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (286305 => 286306)


--- trunk/Source/WebKit/ChangeLog	2021-11-30 18:15:46 UTC (rev 286305)
+++ trunk/Source/WebKit/ChangeLog	2021-11-30 18:53:24 UTC (rev 286306)
@@ -1,3 +1,20 @@
+2021-11-30  BJ Burg  <[email protected]>
+
+        Web Inspector: fix IPC race between unregistering an extension and Web Inspector closing
+        https://bugs.webkit.org/show_bug.cgi?id=233264
+
+        Reviewed by Devin Rousso.
+
+        * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp:
+        (WebKit::WebInspectorUIExtensionControllerProxy::inspectorFrontendWillClose):
+        Remaining registrations will not be removed via unregisterExtension() if
+        the frontend is already in the midst of closing. Clear out the registry.
+
+        (WebKit::WebInspectorUIExtensionControllerProxy::registerExtension):
+        (WebKit::WebInspectorUIExtensionControllerProxy::unregisterExtension):
+        Bail out if the inspector has closed between the IPC message being sent
+        and receiving the async response.
+
 2021-11-30  Youenn Fablet  <[email protected]>
 
         Migrate some WebSWClientConnection messages to async replies

Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp (286305 => 286306)


--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp	2021-11-30 18:15:46 UTC (rev 286305)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp	2021-11-30 18:53:24 UTC (rev 286306)
@@ -86,6 +86,8 @@
 
     m_inspectorPage->process().removeMessageReceiver(Messages::WebInspectorUIExtensionControllerProxy::messageReceiverName(), m_inspectorPage->webPageID());
     m_inspectorPage = nullptr;
+
+    m_extensionAPIObjectMap.clear();
 }
 
 // API
@@ -104,6 +106,11 @@
                 return;
             }
 
+            if (!strongThis->m_inspectorPage) {
+                completionHandler(makeUnexpected(Inspector::ExtensionError::ContextDestroyed));
+                return;
+            }
+
             RefPtr<API::InspectorExtension> extensionAPIObject = API::InspectorExtension::create(extensionID, strongThis.get());
             strongThis->m_extensionAPIObjectMap.set(extensionID, extensionAPIObject.copyRef());
 
@@ -126,6 +133,11 @@
                 return;
             }
 
+            if (!strongThis->m_inspectorPage) {
+                completionHandler(makeUnexpected(Inspector::ExtensionError::ContextDestroyed));
+                return;
+            }
+
             strongThis->m_extensionAPIObjectMap.take(extensionID);
 
             completionHandler(WTFMove(result));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to