Title: [152081] trunk
Revision
152081
Author
carlo...@webkit.org
Date
2013-06-27 00:00:00 -0700 (Thu, 27 Jun 2013)

Log Message

[BlackBerry] Handle testRunner.setCustomPolicyDelegate()
https://bugs.webkit.org/show_bug.cgi?id=117982

Patch by Carlos Garcia Campos <cargar...@blackberry.com> on 2013-06-26
Reviewed by Rob Buis.

Source/WebKit/blackberry:

Take custom policy into account when deciding the policy for
navigation actions.

Fixes test fast/loader/onload-policy-ignore-for-frame.html.

* Api/DumpRenderTreeClient.h:
* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::dispatchDecidePolicyForNavigationAction):
If custom policy is enabled ignore the navigation action when it's
not permissive.

Tools:

* DumpRenderTree/blackberry/DumpRenderTree.cpp:
(BlackBerry::WebKit::DumpRenderTree::DumpRenderTree): Initialize
m_policyDelegateIsPermissive.
(BlackBerry::WebKit::DumpRenderTree::resetToConsistentStateBeforeTesting):
Reset m_policyDelegateIsPermissive.
(BlackBerry::WebKit::DumpRenderTree::setCustomPolicyDelegate): Set
m_policyDelegateIsPermissive.
* DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h:
(BlackBerry::WebKit::DumpRenderTree::policyDelegateEnabled):
Return whether custom policy is enabled.
(BlackBerry::WebKit::DumpRenderTree::policyDelegateIsPermissive):
Return whether custom policy is permissive.

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h (152080 => 152081)


--- trunk/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h	2013-06-27 06:21:54 UTC (rev 152080)
+++ trunk/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h	2013-06-27 07:00:00 UTC (rev 152081)
@@ -60,6 +60,8 @@
     virtual void didDecidePolicyForResponse(const WebCore::ResourceResponse&) = 0;
     virtual void didDispatchWillPerformClientRedirect() = 0;
     virtual void didHandleOnloadEventsForFrame(WebCore::Frame*) = 0;
+    virtual bool policyDelegateIsPermissive() const = 0;
+    virtual bool policyDelegateEnabled() const = 0;
 
     // ChromeClient delegates
     virtual void addMessageToConsole(const String& message, unsigned lineNumber, unsigned columnNumber, const String& sourceID) = 0;

Modified: trunk/Source/WebKit/blackberry/ChangeLog (152080 => 152081)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-06-27 06:21:54 UTC (rev 152080)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-06-27 07:00:00 UTC (rev 152081)
@@ -1,3 +1,21 @@
+2013-06-26  Carlos Garcia Campos  <cargar...@blackberry.com>
+
+        [BlackBerry] Handle testRunner.setCustomPolicyDelegate()
+        https://bugs.webkit.org/show_bug.cgi?id=117982
+
+        Reviewed by Rob Buis.
+
+        Take custom policy into account when deciding the policy for
+        navigation actions.
+
+        Fixes test fast/loader/onload-policy-ignore-for-frame.html.
+
+        * Api/DumpRenderTreeClient.h:
+        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+        (WebCore::FrameLoaderClientBlackBerry::dispatchDecidePolicyForNavigationAction):
+        If custom policy is enabled ignore the navigation action when it's
+        not permissive.
+
 2013-06-26  Kangil Han  <kangil....@samsung.com>
 
         Adopt is/toHTMLAreaElement for code cleanup

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp (152080 => 152081)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp	2013-06-27 06:21:54 UTC (rev 152080)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp	2013-06-27 07:00:00 UTC (rev 152081)
@@ -222,8 +222,11 @@
     if (decision == PolicyIgnore)
         dispatchDidCancelClientRedirect();
 
-    if (m_webPagePrivate->m_dumpRenderTree)
+    if (m_webPagePrivate->m_dumpRenderTree) {
         m_webPagePrivate->m_dumpRenderTree->didDecidePolicyForNavigationAction(action, request, m_frame);
+        if (m_webPagePrivate->m_dumpRenderTree->policyDelegateEnabled())
+            decision = m_webPagePrivate->m_dumpRenderTree->policyDelegateIsPermissive() ? PolicyUse : PolicyIgnore;
+    }
 
     (m_frame->loader()->policyChecker()->*function)(decision);
 }

Modified: trunk/Tools/ChangeLog (152080 => 152081)


--- trunk/Tools/ChangeLog	2013-06-27 06:21:54 UTC (rev 152080)
+++ trunk/Tools/ChangeLog	2013-06-27 07:00:00 UTC (rev 152081)
@@ -1,3 +1,23 @@
+2013-06-26  Carlos Garcia Campos  <cargar...@blackberry.com>
+
+        [BlackBerry] Handle testRunner.setCustomPolicyDelegate()
+        https://bugs.webkit.org/show_bug.cgi?id=117982
+
+        Reviewed by Rob Buis.
+
+        * DumpRenderTree/blackberry/DumpRenderTree.cpp:
+        (BlackBerry::WebKit::DumpRenderTree::DumpRenderTree): Initialize
+        m_policyDelegateIsPermissive.
+        (BlackBerry::WebKit::DumpRenderTree::resetToConsistentStateBeforeTesting):
+        Reset m_policyDelegateIsPermissive.
+        (BlackBerry::WebKit::DumpRenderTree::setCustomPolicyDelegate): Set
+        m_policyDelegateIsPermissive.
+        * DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h:
+        (BlackBerry::WebKit::DumpRenderTree::policyDelegateEnabled):
+        Return whether custom policy is enabled.
+        (BlackBerry::WebKit::DumpRenderTree::policyDelegateIsPermissive):
+        Return whether custom policy is permissive.
+
 2013-06-26  Anders Carlsson  <ander...@apple.com>
 
         Deprecate StringImpl::charactersWithNullTermination

Modified: trunk/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp (152080 => 152081)


--- trunk/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp	2013-06-27 06:21:54 UTC (rev 152080)
+++ trunk/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp	2013-06-27 07:00:00 UTC (rev 152081)
@@ -183,6 +183,7 @@
     , m_workTimer(this, &DumpRenderTree::processWork)
     , m_acceptsEditing(true)
     , m_policyDelegateEnabled(false)
+    , m_policyDelegateIsPermissive(false)
 {
     const char* workerNumber = getenv("WORKER_NUMBER") ? getenv("WORKER_NUMBER") : "0";
     String sdcardPath = SDCARD_PATH;
@@ -298,6 +299,7 @@
     topLoadingFrame = 0;
     m_loadFinished = false;
     m_policyDelegateEnabled = false;
+    m_policyDelegateIsPermissive = false;
     waitForPolicy = false;
     testDone = false;
     WorkQueue::shared()->clear();
@@ -969,7 +971,7 @@
 void DumpRenderTree::setCustomPolicyDelegate(bool setDelegate, bool permissive)
 {
     m_policyDelegateEnabled = setDelegate;
-    UNUSED_PARAM(permissive);
+    m_policyDelegateIsPermissive = permissive;
 }
 }
 }

Modified: trunk/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h (152080 => 152081)


--- trunk/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h	2013-06-27 06:21:54 UTC (rev 152080)
+++ trunk/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h	2013-06-27 07:00:00 UTC (rev 152081)
@@ -77,6 +77,8 @@
     void didDispatchWillPerformClientRedirect();
     void didHandleOnloadEventsForFrame(WebCore::Frame*);
     void didReceiveResponseForFrame(WebCore::Frame*, const WebCore::ResourceResponse&);
+    bool policyDelegateEnabled() const { return m_policyDelegateEnabled; }
+    bool policyDelegateIsPermissive() const { return m_policyDelegateIsPermissive; }
 
     // ChromeClient delegates
     void addMessageToConsole(const String& message, unsigned lineNumber, const String& sourceID);
@@ -148,6 +150,7 @@
     bool m_acceptsEditing;
     bool m_loadFinished;
     bool m_policyDelegateEnabled;
+    bool m_policyDelegateIsPermissive;
 };
 }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to