From 7df3d98b242a15afb526fe8a7c8b0a5d28415f33 Mon Sep 17 00:00:00 2001 From: Patrick Scott Date: Mon, 17 Aug 2009 14:43:53 -0400 Subject: Check for a null request in the policy callbacks. The gtk platform also does this check to ensure that the request url is not empty or null. --- .../WebCoreSupport/FrameLoaderClientAndroid.cpp | 25 +++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp index 7554a84..3ea7e49 100644 --- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp @@ -426,9 +426,15 @@ static bool TreatAsAttachment(const String& content_disposition) { } void FrameLoaderClientAndroid::dispatchDecidePolicyForMIMEType(FramePolicyFunction func, - const String& MIMEType, const ResourceRequest&) { + const String& MIMEType, const ResourceRequest& request) { ASSERT(m_frame); ASSERT(func); + if (!func) + return; + if (request.isNull()) { + (m_frame->loader()->*func)(PolicyIgnore); + return; + } // Default to Use (display internally). PolicyAction action = PolicyUse; // Check if we should Download instead. @@ -461,13 +467,20 @@ void FrameLoaderClientAndroid::dispatchDecidePolicyForMIMEType(FramePolicyFuncti } void FrameLoaderClientAndroid::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction func, - const NavigationAction&, const ResourceRequest& req, + const NavigationAction&, const ResourceRequest& request, PassRefPtr formState, const String& frameName) { ASSERT(m_frame); + ASSERT(func); + if (!func) + return; + if (request.isNull()) { + (m_frame->loader()->*func)(PolicyIgnore); + return; + } // If we get to this point it means that a link has a target that was not // found by the frame tree. Instead of creating a new frame, return the // current frame in dispatchCreatePage. - if (canHandleRequest(req)) + if (canHandleRequest(request)) (m_frame->loader()->*func)(PolicyUse); else (m_frame->loader()->*func)(PolicyIgnore); @@ -486,6 +499,12 @@ void FrameLoaderClientAndroid::dispatchDecidePolicyForNavigationAction(FramePoli PassRefPtr formState) { ASSERT(m_frame); ASSERT(func); + if (!func) + return; + if (request.isNull()) { + (m_frame->loader()->*func)(PolicyIgnore); + return; + } if (action.type() == NavigationTypeFormResubmitted) { m_webFrame->decidePolicyForFormResubmission(func); return; -- cgit v1.1