Title: [286498] trunk/Source/WebKit
- Revision
- 286498
- Author
- [email protected]
- Date
- 2021-12-03 09:45:21 -0800 (Fri, 03 Dec 2021)
Log Message
Web Inspector: Web Inspector^2 crashes after closing if Web Inspector^1 closed first
https://bugs.webkit.org/show_bug.cgi?id=233293
<rdar://problem/85526508>
Reviewed by Devin Rousso.
Cache the inspected page's identifier. During frontend teardown, use the cached indentifier
to remove the message receiver that was added to receive messages from the inspected page.
Other operations using m_inspectedPage should be guarded in case that the inspected
page already been closed and destroyed.
* UIProcess/Inspector/WebInspectorUIProxy.cpp:
(WebKit::WebInspectorUIProxy::createFrontendPage):
(WebKit::WebInspectorUIProxy::closeFrontendPageAndWindow):
* UIProcess/Inspector/WebInspectorUIProxy.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (286497 => 286498)
--- trunk/Source/WebKit/ChangeLog 2021-12-03 17:36:07 UTC (rev 286497)
+++ trunk/Source/WebKit/ChangeLog 2021-12-03 17:45:21 UTC (rev 286498)
@@ -1,5 +1,25 @@
2021-12-03 BJ Burg <[email protected]>
+ Web Inspector: Web Inspector^2 crashes after closing if Web Inspector^1 closed first
+ https://bugs.webkit.org/show_bug.cgi?id=233293
+ <rdar://problem/85526508>
+
+ Reviewed by Devin Rousso.
+
+ Cache the inspected page's identifier. During frontend teardown, use the cached indentifier
+ to remove the message receiver that was added to receive messages from the inspected page.
+
+ Other operations using m_inspectedPage should be guarded in case that the inspected
+ page already been closed and destroyed.
+
+ * UIProcess/Inspector/WebInspectorUIProxy.cpp:
+ (WebKit::WebInspectorUIProxy::createFrontendPage):
+ (WebKit::WebInspectorUIProxy::closeFrontendPageAndWindow):
+ * UIProcess/Inspector/WebInspectorUIProxy.h:
+
+
+2021-12-03 BJ Burg <[email protected]>
+
[Cocoa] Web Inspector: fix completion handler type signature for _WKInspectorExtension methods
https://bugs.webkit.org/show_bug.cgi?id=233792
<rdar://problem/85995314>
Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.cpp (286497 => 286498)
--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.cpp 2021-12-03 17:36:07 UTC (rev 286497)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.cpp 2021-12-03 17:45:21 UTC (rev 286498)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2021 Apple Inc. All rights reserved.
* Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -225,6 +225,8 @@
ASSERT(!m_inspectedPage);
m_inspectedPage = &inspectedPage;
+ m_inspectedPageIdentifier = m_inspectedPage->identifier();
+
m_inspectedPage->process().addMessageReceiver(Messages::WebInspectorUIProxy::messageReceiverName(), m_inspectedPage->webPageID(), *this);
if (m_inspectorPage)
@@ -419,7 +421,7 @@
// Make sure the inspected page has a running WebProcess so we can inspect it.
m_inspectedPage->launchInitialProcessIfNecessary();
- m_inspectorPage->process().addMessageReceiver(Messages::WebInspectorUIProxy::messageReceiverName(), m_inspectedPage->identifier(), *this);
+ m_inspectorPage->process().addMessageReceiver(Messages::WebInspectorUIProxy::messageReceiverName(), m_inspectedPageIdentifier, *this);
#if ENABLE(INSPECTOR_EXTENSIONS)
m_extensionController = WebInspectorUIExtensionControllerProxy::create(*m_inspectorPage);
@@ -529,7 +531,8 @@
SetForScope<bool> reentrancyProtector(m_closing, true);
// Notify WebKit client when a local inspector closes so it can clear _WKInspectorDelegate and perform other cleanup.
- m_inspectedPage->uiClient().willCloseLocalInspector(*m_inspectedPage, *this);
+ if (m_inspectedPage)
+ m_inspectedPage->uiClient().willCloseLocalInspector(*m_inspectedPage, *this);
m_isVisible = false;
m_isProfilingPage = false;
@@ -539,13 +542,13 @@
untrackInspectorPage(m_inspectorPage);
m_inspectorPage->send(Messages::WebInspectorUI::SetIsVisible(m_isVisible));
- m_inspectorPage->process().removeMessageReceiver(Messages::WebInspectorUIProxy::messageReceiverName(), m_inspectedPage->identifier());
+ m_inspectorPage->process().removeMessageReceiver(Messages::WebInspectorUIProxy::messageReceiverName(), m_inspectedPageIdentifier);
- if (m_isActiveFrontend) {
- m_isActiveFrontend = false;
+ if (m_inspectedPage && m_isActiveFrontend)
m_inspectedPage->inspectorController().disconnectFrontend(*this);
- }
+ m_isActiveFrontend = false;
+
if (m_isAttached)
platformDetach();
Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.h (286497 => 286498)
--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.h 2021-12-03 17:36:07 UTC (rev 286497)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.h 2021-12-03 17:45:21 UTC (rev 286498)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2021 Apple Inc. All rights reserved.
* Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,6 +31,7 @@
#include "DebuggableInfoData.h"
#include "MessageReceiver.h"
#include "WebInspectorUtilities.h"
+#include "WebPageProxyIdentifier.h"
#include <_javascript_Core/InspectorFrontendChannel.h>
#include <WebCore/FloatRect.h>
#include <WebCore/InspectorClient.h>
@@ -288,6 +289,7 @@
WebPageProxy* m_inspectedPage { nullptr };
WebPageProxy* m_inspectorPage { nullptr };
std::unique_ptr<API::InspectorClient> m_inspectorClient;
+ WebPageProxyIdentifier m_inspectedPageIdentifier;
#if ENABLE(INSPECTOR_EXTENSIONS)
RefPtr<WebInspectorUIExtensionControllerProxy> m_extensionController;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes