Changeset 225292 in webkit
- Timestamp:
- Nov 29, 2017 1:41:59 PM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r225290 r225292 1 2017-11-29 Alex Christensen <achristensen@webkit.org> 2 3 Make WebFrameLoaderClient more robust against null pointer dereferencing 4 https://bugs.webkit.org/show_bug.cgi?id=180157 5 <rdar://problem/34895616> 6 7 Reviewed by Tim Horton. 8 9 There has always been rare null pointer crashes in this code, but they have become more common 10 now that we are waiting for completion handlers for redirects, which makes it more likely that 11 we are hitting this code after we have detached from the core frame. 12 13 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 14 (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): 15 (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): 16 (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): 17 * WebProcess/WebPage/WebFrame.cpp: 18 (WebKit::WebFrame::page const): 19 1 20 2017-11-29 Alex Christensen <achristensen@webkit.org> 2 21 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r225142 r225292 693 693 void WebFrameLoaderClient::dispatchDecidePolicyForResponse(const ResourceResponse& response, const ResourceRequest& request, FramePolicyFunction&& function) 694 694 { 695 WebPage* webPage = m_frame ->page();695 WebPage* webPage = m_frame ? m_frame->page() : nullptr; 696 696 if (!webPage) { 697 697 function(PolicyAction::Ignore); … … 722 722 Ref<WebFrame> protect(*m_frame); 723 723 WebCore::Frame* coreFrame = m_frame->coreFrame(); 724 if (!coreFrame) 725 return function(PolicyAction::Ignore); 724 726 auto navigationID = static_cast<WebDocumentLoader&>(*coreFrame->loader().provisionalDocumentLoader()).navigationID(); 725 727 if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForResponseSync(m_frame->frameID(), SecurityOriginData::fromFrame(coreFrame), navigationID, response, request, canShowMIMEType, listenerID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())), Messages::WebPageProxy::DecidePolicyForResponseSync::Reply(receivedPolicyAction, policyAction, downloadID), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend)) { … … 735 737 void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(const NavigationAction& navigationAction, const ResourceRequest& request, FormState* formState, const String& frameName, FramePolicyFunction&& function) 736 738 { 737 WebPage* webPage = m_frame ->page();739 WebPage* webPage = m_frame ? m_frame->page() : nullptr; 738 740 if (!webPage) { 739 741 function(PolicyAction::Ignore); … … 822 824 void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const NavigationAction& navigationAction, const ResourceRequest& request, bool didReceiveRedirectResponse, FormState* formState, FramePolicyFunction&& function) 823 825 { 824 WebPage* webPage = m_frame ->page();826 WebPage* webPage = m_frame ? m_frame->page() : nullptr; 825 827 if (!webPage) { 826 828 function(PolicyAction::Ignore); … … 836 838 RefPtr<API::Object> userData; 837 839 838 Ref Ptr<InjectedBundleNavigationAction> action = InjectedBundleNavigationAction::create(m_frame, navigationAction, formState);839 840 // Notify the bundle client. 841 WKBundlePagePolicyAction policy = webPage->injectedBundlePolicyClient().decidePolicyForNavigationAction(webPage, m_frame, action. get(), request, userData);840 Ref<InjectedBundleNavigationAction> action = InjectedBundleNavigationAction::create(m_frame, navigationAction, formState); 841 842 // Notify the bundle client. 843 WKBundlePagePolicyAction policy = webPage->injectedBundlePolicyClient().decidePolicyForNavigationAction(webPage, m_frame, action.ptr(), request, userData); 842 844 if (policy == WKBundlePagePolicyActionUse) { 843 845 function(PolicyAction::Use); … … 875 877 876 878 WebCore::Frame* coreFrame = m_frame->coreFrame(); 879 if (!coreFrame) 880 return function(PolicyAction::Ignore); 877 881 WebDocumentLoader* documentLoader = static_cast<WebDocumentLoader*>(coreFrame->loader().policyDocumentLoader()); 878 882 if (!documentLoader) { -
trunk/Source/WebKit/WebProcess/WebPage/WebFrame.cpp
r225282 r225292 172 172 173 173 WebPage* WebFrame::page() const 174 { 175 if (!m_coreFrame) 176 return 0;174 { 175 if (!m_coreFrame) 176 return nullptr; 177 177 178 178 if (Page* page = m_coreFrame->page()) 179 179 return WebPage::fromCorePage(page); 180 180 181 return 0;181 return nullptr; 182 182 } 183 183
Note: See TracChangeset
for help on using the changeset viewer.