Web Inspector: Remote inspector can crash if attempting to navigate inspector page
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jan 2019 22:13:28 +0000 (22:13 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jan 2019 22:13:28 +0000 (22:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193204
<rdar://problem/45550428>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2019-01-07
Reviewed by Devin Rousso.

* UIProcess/mac/RemoteWebInspectorProxyMac.mm:
(WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
* UIProcess/mac/WKInspectorViewController.mm:
(-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239697 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/mac/RemoteWebInspectorProxyMac.mm
Source/WebKit/UIProcess/mac/WKInspectorViewController.mm

index eb8e5ef..4c59df2 100644 (file)
@@ -1,3 +1,16 @@
+2019-01-07  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Remote inspector can crash if attempting to navigate inspector page
+        https://bugs.webkit.org/show_bug.cgi?id=193204
+        <rdar://problem/45550428>
+
+        Reviewed by Devin Rousso.
+
+        * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
+        (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
+        * UIProcess/mac/WKInspectorViewController.mm:
+        (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]):
+
 2019-01-07  Eric Carlson  <eric.carlson@apple.com>
 
         Deactivate audio session whenever possible
index caee26b..ebd6a39 100644 (file)
@@ -85,7 +85,7 @@ WebPageProxy* RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow()
 {
     m_objCAdapter = adoptNS([[WKRemoteWebInspectorProxyObjCAdapter alloc] initWithRemoteWebInspectorProxy:this]);
 
-    m_inspectorView = adoptNS([[WKInspectorViewController alloc] initWithInspectedPage:nil]);
+    m_inspectorView = adoptNS([[WKInspectorViewController alloc] initWithInspectedPage:nullptr]);
     [m_inspectorView.get() setDelegate:m_objCAdapter.get()];
 
     m_window = WebInspectorProxy::createFrontendWindow(NSZeroRect);
index c531ddf..6cb6c2a 100644 (file)
     decisionHandler(WKNavigationActionPolicyCancel);
     
     // And instead load it in the inspected page.
-    _inspectedPage->loadRequest(navigationAction.request);
+    if (_inspectedPage)
+        _inspectedPage->loadRequest(navigationAction.request);
 }
 
 // MARK: WKInspectorWKWebViewDelegate methods