[BlackBerry] http authenticate dialog popup only once no matter authentication pass...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 31 Mar 2012 13:34:04 +0000 (13:34 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 31 Mar 2012 13:34:04 +0000 (13:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=80135

Patch by Jonathan Dong <jonathan.dong@torchmobile.com.cn> on 2012-03-31
Reviewed by Rob Buis.

.:

RIM PR: 145660
Added manual test for testing the behavior of http authentication
challenge dialog. Both of these two files should be served over http.

* ManualTests/blackberry/http-auth-challenge.html: Added.
* ManualTests/blackberry/http-auth-challenge.php: Added.

Source/WebCore:

RIM PR: 145660
Fixed a regression introduced by r111810, we should cancel the new
request when user press cancel button in http authentication challenge
dialog, and we should also allow sending empty username and password
with the request.
Also removed redundant codes which checked the existence of the
FrameLoaderClient pointer, as we've already moved authenticationChallenge()
out of class FrameLoaderClient, it is not needed.

Manual test added. Testing http authentication dialog relies on user interaction.

* platform/network/blackberry/NetworkJob.cpp:
(WebCore::NetworkJob::sendRequestWithCredentials):

Source/WebKit/blackberry:

RIM PR: 145660
Fixed a regression introduced by r111810, which used the wrong
credential object.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::authenticationChallenge):

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

ChangeLog
ManualTests/blackberry/http-auth-challenge.html [new file with mode: 0644]
ManualTests/blackberry/http-auth-challenge.php [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/network/blackberry/NetworkJob.cpp
Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/ChangeLog

index 0c69ede..d70d067 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2012-03-31  Jonathan Dong  <jonathan.dong@torchmobile.com.cn>
+
+        [BlackBerry] http authenticate dialog popup only once no matter authentication pass or fail
+        https://bugs.webkit.org/show_bug.cgi?id=80135
+
+        Reviewed by Rob Buis.
+
+        RIM PR: 145660
+        Added manual test for testing the behavior of http authentication
+        challenge dialog. Both of these two files should be served over http.
+
+        * ManualTests/blackberry/http-auth-challenge.html: Added.
+        * ManualTests/blackberry/http-auth-challenge.php: Added.
+
 2012-03-30  Eli Fidler  <efidler@rim.com>
 
         Enable OpenType Sanitizer for BlackBerry port.
diff --git a/ManualTests/blackberry/http-auth-challenge.html b/ManualTests/blackberry/http-auth-challenge.html
new file mode 100644 (file)
index 0000000..07de1a2
--- /dev/null
@@ -0,0 +1,24 @@
+<html>
+  <body>
+    <p>To run this test, both http-auth-challenge.html and http-auth-challenge.php must be served over http.</p>
+    <p>This test case is to test the behavior of http authentication challenge dialog. This is for <a href="https://bugs.webkit.org/show_bug.cgi?id=80135">https://bugs.webkit.org/show_bug.cgi?id=80135</a></p>
+    <p>
+      Please follow the following test procedure:
+      <ol>
+        <li>Test dialog behavior when press Cancel button</li>
+        <ol>
+          <li>Start test case, then press Cancel button when authentication dialog pops up;</li>
+        </ol>
+        <li>Test dialog behavior when press OK button</li>
+        <ol>
+          <li>Navigate back to the privious page;</li>
+          <li>Start test case again, then press Ok button without input anything when authentication dialog pops up;</li>
+          <li>When dialog pops up again, enter fake credential and press Ok button: username:"qqqq", password:"qqqq"</li>
+          <li>When dialog pops up agian, enter real credential and press Ok button: username:"aaaa", password:"aaaa"</li>
+        </ol>
+      </ol>
+      <a href="http-auth-challenge.php">Start test here</a>
+    </p>
+    
+  </body>
+</html>
diff --git a/ManualTests/blackberry/http-auth-challenge.php b/ManualTests/blackberry/http-auth-challenge.php
new file mode 100644 (file)
index 0000000..776396c
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+    session_start();
+    if (isset($_SESSION['triedTimes']))
+        $_SESSION['triedTimes'] = $_SESSION['triedTimes'] + 1;
+    else
+        $_SESSION['triedTimes'] = 1;
+
+    $username = $password = "aaaa";
+
+    if ($_SERVER['PHP_AUTH_USER'] == $username && $_SERVER['PHP_AUTH_PW'] == $password){
+        echo "Auth dialog behavior when press OK button: ";
+        if ($_SESSION['triedTimes'] == 5)
+            echo "<span style='color:green'>PASS</span>";
+        else
+            echo "<span style='color:red'>FAIL</span>";
+        exit;
+    } else {
+        header('WWW-Authenticate: Basic realm="My Realm"');
+        header('HTTP/1.0 401 Unauthorized');
+        echo "Auth dialog behavior when press Cancel button: ";
+        if ($_SESSION['triedTimes'] == 1)
+            echo "<span style='color:green'>PASS</span>";
+        else
+            echo "<span style='color:red'>FAIL</span>";
+        exit;
+    }
+?>
index 31b0b0e..a9d1e14 100644 (file)
@@ -1,3 +1,24 @@
+2012-03-31  Jonathan Dong  <jonathan.dong@torchmobile.com.cn>
+
+        [BlackBerry] http authenticate dialog popup only once no matter authentication pass or fail
+        https://bugs.webkit.org/show_bug.cgi?id=80135
+
+        Reviewed by Rob Buis.
+
+        RIM PR: 145660
+        Fixed a regression introduced by r111810, we should cancel the new
+        request when user press cancel button in http authentication challenge
+        dialog, and we should also allow sending empty username and password
+        with the request.
+        Also removed redundant codes which checked the existence of the
+        FrameLoaderClient pointer, as we've already moved authenticationChallenge()
+        out of class FrameLoaderClient, it is not needed.
+
+        Manual test added. Testing http authentication dialog relies on user interaction.
+
+        * platform/network/blackberry/NetworkJob.cpp:
+        (WebCore::NetworkJob::sendRequestWithCredentials):
+
 2012-03-31  Charles Wei  <charles.wei@torchmobile.com.cn>
 
         [BlackBerry] Upstream BlackBerry change to PlatformTouchEvent and PlatformTouchPoint
index 34863f6..a4bafd4 100644 (file)
@@ -849,9 +849,6 @@ bool NetworkJob::sendRequestWithCredentials(ProtectionSpaceServerType type, Prot
         String username;
         String password;
 
-        if (!m_frame || !m_frame->loader() || !m_frame->loader()->client())
-            return false;
-
         // Before asking the user for credentials, we check if the URL contains that.
         if (!m_handle->getInternal()->m_user.isEmpty() && !m_handle->getInternal()->m_pass.isEmpty()) {
             username = m_handle->getInternal()->m_user.utf8().data();
@@ -863,12 +860,12 @@ bool NetworkJob::sendRequestWithCredentials(ProtectionSpaceServerType type, Prot
             m_handle->getInternal()->m_pass = "";
         } else {
             Credential inputCredential;
-            bool isConfirmed = false;
-            do {
-                isConfirmed = m_frame->page()->chrome()->client()->platformPageClient()->authenticationChallenge(newURL, protectionSpace, inputCredential);
-                username = inputCredential.user();
-                password = inputCredential.password();
-            } while (isConfirmed && username.isEmpty() && password.isEmpty());
+            bool isConfirmed = m_frame->page()->chrome()->client()->platformPageClient()->authenticationChallenge(newURL, protectionSpace, inputCredential);
+            username = inputCredential.user();
+            password = inputCredential.password();
+
+            if (!isConfirmed)
+                return false;
         }
 
         credential = Credential(username, password, CredentialPersistenceForSession);
index 391300a..a07e8bf 100644 (file)
@@ -2026,7 +2026,7 @@ bool WebPagePrivate::authenticationChallenge(const KURL& url, const ProtectionSp
 #if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
     Credential credential(username, password, CredentialPersistencePermanent);
     if (!m_webSettings->isPrivateBrowsingEnabled())
-        credentialManager().saveCredentialIfConfirmed(this, CredentialTransformData(url, protectionSpace, inputCredential));
+        credentialManager().saveCredentialIfConfirmed(this, CredentialTransformData(url, protectionSpace, credential));
 #else
     Credential credential(username, password, CredentialPersistenceNone);
 #endif
index e9acf99..bbe56d5 100644 (file)
@@ -1,3 +1,17 @@
+2012-03-31  Jonathan Dong  <jonathan.dong@torchmobile.com.cn>
+
+        [BlackBerry] http authenticate dialog popup only once no matter authentication pass or fail
+        https://bugs.webkit.org/show_bug.cgi?id=80135
+
+        Reviewed by Rob Buis.
+
+        RIM PR: 145660
+        Fixed a regression introduced by r111810, which used the wrong
+        credential object.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::authenticationChallenge):
+
 2012-03-30  Mike Fenton  <mifenton@rim.com>
 
         [BlackBerry] Speed up processing of Selection region generation.