Title: [244970] trunk/Source/WebKit
Revision
244970
Author
commit-qu...@webkit.org
Date
2019-05-06 13:24:29 -0700 (Mon, 06 May 2019)

Log Message

Null check m_mainFrame in WebPageProxy.cpp
https://bugs.webkit.org/show_bug.cgi?id=197618
<rdar://problem/47463054>

Patch by Alex Christensen <achristen...@webkit.org> on 2019-05-06
Reviewed by Geoffrey Garen.

It's already null checked in some places, and the places where it isn't are causing crashes.
Let's fix all of them.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::createNewPage):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (244969 => 244970)


--- trunk/Source/WebKit/ChangeLog	2019-05-06 20:14:10 UTC (rev 244969)
+++ trunk/Source/WebKit/ChangeLog	2019-05-06 20:24:29 UTC (rev 244970)
@@ -1,3 +1,19 @@
+2019-05-06  Alex Christensen  <achristen...@webkit.org>
+
+        Null check m_mainFrame in WebPageProxy.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=197618
+        <rdar://problem/47463054>
+
+        Reviewed by Geoffrey Garen.
+
+        It's already null checked in some places, and the places where it isn't are causing crashes.
+        Let's fix all of them.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::decidePolicyForNavigationAction):
+        (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
+        (WebKit::WebPageProxy::createNewPage):
+
 2019-05-06  Brent Fulgham  <bfulg...@apple.com>
 
         Use more efficient path resolution logic

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (244969 => 244970)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-05-06 20:14:10 UTC (rev 244969)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-05-06 20:24:29 UTC (rev 244970)
@@ -4677,7 +4677,10 @@
             sourceFrameInfo = API::FrameInfo::create(originatingFrameInfoData, originatingPageID ? process->webPage(originatingPageID) : nullptr);
 
         auto userInitiatedActivity = process->userInitiatedActivity(navigationActionData.userGestureTokenIdentifier);
-        bool shouldOpenAppLinks = !m_shouldSuppressAppLinksInNextNavigationPolicyDecision && destinationFrameInfo->isMainFrame() && !hostsAreEqual(URL({ }, m_mainFrame->url()), request.url()) && navigationActionData.navigationType != WebCore::NavigationType::BackForward;
+        bool shouldOpenAppLinks = !m_shouldSuppressAppLinksInNextNavigationPolicyDecision
+            && destinationFrameInfo->isMainFrame()
+            && (m_mainFrame ? !hostsAreEqual(m_mainFrame->url(), request.url()) : false)
+            && navigationActionData.navigationType != WebCore::NavigationType::BackForward;
 
         auto navigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.get(), destinationFrameInfo.ptr(), WTF::nullopt, WTFMove(request), originalRequest.url(), shouldOpenAppLinks, WTFMove(userInitiatedActivity), mainFrameNavigation);
 
@@ -4807,7 +4810,7 @@
             sourceFrameInfo = API::FrameInfo::create(*frame, frameSecurityOrigin.securityOrigin());
 
         auto userInitiatedActivity = m_process->userInitiatedActivity(navigationActionData.userGestureTokenIdentifier);
-        bool shouldOpenAppLinks = !hostsAreEqual(URL({ }, m_mainFrame->url()), request.url());
+        bool shouldOpenAppLinks = m_mainFrame ? !hostsAreEqual(m_mainFrame->url(), request.url()) : false;
         auto navigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.get(), nullptr, frameName, WTFMove(request), URL { }, shouldOpenAppLinks, WTFMove(userInitiatedActivity));
 
         m_navigationClient->decidePolicyForNavigationAction(*this, navigationAction.get(), WTFMove(listener), m_process->transformHandlesToObjects(userData.object()).get());
@@ -4994,7 +4997,7 @@
 {
     MESSAGE_CHECK(m_process, m_process->webFrame(originatingFrameInfoData.frameID));
     auto originatingFrameInfo = API::FrameInfo::create(originatingFrameInfoData, m_process->webPage(originatingPageID));
-    auto mainFrameURL = m_mainFrame->url();
+    auto mainFrameURL = m_mainFrame ? m_mainFrame->url() : URL();
     auto completionHandler = [this, protectedThis = makeRef(*this), mainFrameURL, request, reply = WTFMove(reply)] (RefPtr<WebPageProxy> newPage) mutable {
         if (!newPage) {
             reply(0, WTF::nullopt);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to