[BlackBerry] Anchor mailto: with target set won't launch Messaging application when...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Feb 2012 10:54:35 +0000 (10:54 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Feb 2012 10:54:35 +0000 (10:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=79318

Need to give the client a chance to decide how to handle the new window request.

Patch by Charles Wei <charles.wei@torchmobile.com.cn> on 2012-02-24
Reviewed by Rob Buis.

* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::dispatchDecidePolicyForNewWindowAction):

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

Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp

index fb39053..b910ff6 100644 (file)
@@ -1,3 +1,15 @@
+2012-02-24  Charles Wei  <charles.wei@torchmobile.com.cn>
+
+        [BlackBerry] Anchor mailto: with target set won't launch Messaging application when clicked
+        https://bugs.webkit.org/show_bug.cgi?id=79318
+
+        Need to give the client a chance to decide how to handle the new window request.
+
+        Reviewed by Rob Buis.
+
+        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+        (WebCore::FrameLoaderClientBlackBerry::dispatchDecidePolicyForNewWindowAction):
+
 2012-02-23  Mike Fenton  <mifenton@rim.com>
 
         [BlackBerry] Selection handler has compile failure with logs enabled.
index d0c72a0..afddd51 100644 (file)
@@ -270,13 +270,29 @@ void FrameLoaderClientBlackBerry::doPendingFragmentScroll()
     delayPolicyCheckUntilFragmentExists(fragment, function);
 }
 
-void FrameLoaderClientBlackBerry::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest& request, PassRefPtr<FormState>, const String& frameName)
+void FrameLoaderClientBlackBerry::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request, PassRefPtr<FormState>, const String& frameName)
 {
     if (request.isRequestedByPlugin() && ScriptController::processingUserGesture() && !m_webPagePrivate->m_pluginMayOpenNewTab)
         (m_frame->loader()->policyChecker()->*function)(PolicyIgnore);
 
     // A new window can never be a fragment scroll.
     PolicyAction decision = decidePolicyForExternalLoad(request, false);
+    // Let the client have a chance to say whether this navigation should
+    // be ignored or not.
+    BlackBerry::Platform::NetworkRequest platformRequest;
+    request.initializePlatformRequest(platformRequest, false /*isInitial*/);
+    if (isMainFrame() && !m_webPagePrivate->m_client->acceptNavigationRequest(
+        platformRequest, BlackBerry::Platform::NavigationType(action.type()))) {
+        if (action.type() == NavigationTypeFormSubmitted || action.type() == NavigationTypeFormResubmitted)
+            m_frame->loader()->resetMultipleFormSubmissionProtection();
+
+        if (action.type() == NavigationTypeLinkClicked && request.url().hasFragmentIdentifier()) {
+            ResourceRequest emptyRequest;
+            m_frame->loader()->activeDocumentLoader()->setLastCheckedRequest(emptyRequest);
+        }
+        decision = PolicyIgnore;
+    }
+
     (m_frame->loader()->policyChecker()->*function)(decision);
 }