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

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

Source/WebCore:

Modified the interface function authenticationChallenge() in class
PageClientBlackBerry, moved Credential from return value to the
function's reference parameter, and returned a bool to indicate if
user pressed Ok button or not.
Removed the logic which checks m_currentWebChallenge not null,
because we should challenge user again if the last provided credential
is not valid; also added the logic that will popup challenge
dialog again immediately if user press Ok buttton directly without
inputting anything.

No new tests.

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

Source/WebKit/blackberry:

Modified the interface function authenticationChallenge() in
class WebPagePrivate by returning a bool to indicate if user
pressed Ok button or not, and moved the Credential from return
value to the reference parameter.
Also updated the corresponding interface functions in class
WebPageClient.

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

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

Source/WebCore/ChangeLog
Source/WebCore/platform/blackberry/PageClientBlackBerry.h
Source/WebCore/platform/network/blackberry/NetworkJob.cpp
Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/Api/WebPageClient.h
Source/WebKit/blackberry/Api/WebPage_p.h
Source/WebKit/blackberry/ChangeLog

index 72fcfa9..2d0be88 100644 (file)
@@ -1,3 +1,27 @@
+2012-03-22  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.
+
+        Modified the interface function authenticationChallenge() in class
+        PageClientBlackBerry, moved Credential from return value to the
+        function's reference parameter, and returned a bool to indicate if
+        user pressed Ok button or not.
+        Removed the logic which checks m_currentWebChallenge not null,
+        because we should challenge user again if the last provided credential
+        is not valid; also added the logic that will popup challenge
+        dialog again immediately if user press Ok buttton directly without
+        inputting anything.
+
+        No new tests.
+
+        * platform/blackberry/PageClientBlackBerry.h:
+        * platform/network/blackberry/NetworkJob.cpp:
+        (WebCore::NetworkJob::handleAuthHeader):
+        (WebCore::NetworkJob::sendRequestWithCredentials):
+
 2012-03-22  Jason Liu  <jason.liu@torchmobile.com.cn>
 
         [BlackBerry] Synchronize platform/network/blackberry
index 474e3d5..36dcd5c 100644 (file)
@@ -69,7 +69,7 @@ public:
     virtual WebCore::IntSize viewportSize() const = 0;
     virtual int showAlertDialog(BlackBerry::WebKit::WebPageClient::AlertType) = 0;
     virtual bool isActive() const = 0;
-    virtual WebCore::Credential authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&) = 0;
+    virtual bool authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&, WebCore::Credential&) = 0;
     virtual SaveCredentialType notifyShouldSaveCredential(bool) = 0;
 };
 
index 9e57314..ee74162 100644 (file)
@@ -749,9 +749,6 @@ bool NetworkJob::handleAuthHeader(const ProtectionSpaceServerType space, const S
     if (!m_handle)
         return false;
 
-    if (!m_handle->getInternal()->m_currentWebChallenge.isNull())
-        return false;
-
     if (header.isEmpty())
         return false;
 
@@ -873,14 +870,15 @@ bool NetworkJob::sendRequestWithCredentials(ProtectionSpaceServerType type, Prot
             m_handle->getInternal()->m_user = "";
             m_handle->getInternal()->m_pass = "";
         } else {
-            Credential inputCredential = m_frame->page()->chrome()->client()->platformPageClient()->authenticationChallenge(newURL, protectionSpace);
-            username = inputCredential.user();
-            password = inputCredential.password();
+            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());
         }
 
-        if (username.isEmpty() && password.isEmpty())
-            return false;
-
         credential = Credential(username, password, CredentialPersistenceForSession);
 
         m_handle->getInternal()->m_currentWebChallenge = AuthenticationChallenge(protectionSpace, credential, 0, m_response, ResourceError());
index 68b0240..7f1899f 100644 (file)
@@ -2019,7 +2019,7 @@ bool WebPagePrivate::isActive() const
     return m_client->isActive();
 }
 
-Credential WebPagePrivate::authenticationChallenge(const KURL& url, const ProtectionSpace& protectionSpace)
+bool WebPagePrivate::authenticationChallenge(const KURL& url, const ProtectionSpace& protectionSpace, Credential& inputCredential)
 {
     WebString username;
     WebString password;
@@ -2029,16 +2029,17 @@ Credential WebPagePrivate::authenticationChallenge(const KURL& url, const Protec
         credentialManager().autofillAuthenticationChallenge(protectionSpace, username, password);
 #endif
 
-    m_client->authenticationChallenge(protectionSpace.realm().characters(), protectionSpace.realm().length(), username, password);
+    bool isConfirmed = m_client->authenticationChallenge(protectionSpace.realm().characters(), protectionSpace.realm().length(), username, password);
 
 #if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
-    Credential inputCredential(username, password, CredentialPersistencePermanent);
+    Credential credential(username, password, CredentialPersistencePermanent);
     if (!m_webSettings->isPrivateBrowsingEnabled())
         credentialManager().saveCredentialIfConfirmed(this, CredentialTransformData(url, protectionSpace, inputCredential));
 #else
-    Credential inputCredential(username, password, CredentialPersistenceNone);
+    Credential credential(username, password, CredentialPersistenceNone);
 #endif
-    return inputCredential;
+    inputCredential = credential;
+    return isConfirmed;
 }
 
 PageClientBlackBerry::SaveCredentialType WebPagePrivate::notifyShouldSaveCredential(bool isNew)
index 30d1fde..04a5893 100644 (file)
@@ -211,7 +211,7 @@ public:
     virtual void animateBlockZoom(const Platform::FloatPoint& finalPoint, double finalScale) = 0;
 
     virtual void setPreventsScreenIdleDimming(bool noDimming) = 0;
-    virtual void authenticationChallenge(const unsigned short* realm, unsigned int realmLength, WebString& username, WebString& password) = 0;
+    virtual bool authenticationChallenge(const unsigned short* realm, unsigned int realmLength, WebString& username, WebString& password) = 0;
     virtual SaveCredentialType notifyShouldSaveCredential(bool isNew) = 0;
 
     virtual bool shouldPluginEnterFullScreen() = 0;
index d76b5ad..eb50b06 100644 (file)
@@ -176,7 +176,7 @@ public:
     virtual double currentZoomFactor() const;
     virtual int showAlertDialog(WebPageClient::AlertType atype);
     virtual bool isActive() const;
-    virtual WebCore::Credential authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&);
+    virtual bool authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&, WebCore::Credential&);
     virtual SaveCredentialType notifyShouldSaveCredential(bool);
 
     // Called from within WebKit via ChromeClientBlackBerry.
index fa3af48..fff2c85 100644 (file)
@@ -1,3 +1,23 @@
+2012-03-22  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.
+
+        Modified the interface function authenticationChallenge() in
+        class WebPagePrivate by returning a bool to indicate if user
+        pressed Ok button or not, and moved the Credential from return
+        value to the reference parameter.
+        Also updated the corresponding interface functions in class
+        WebPageClient.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::authenticationChallenge):
+        * Api/WebPageClient.h:
+        * Api/WebPage_p.h:
+        (WebPagePrivate):
+
 2012-03-22  Mike Lattanzio  <mlattanzio@rim.com>
 
         [BlackBerry] DeviceDPI Scaling is broken on mobile.