Title: [111810] trunk/Source
Revision
111810
Author
commit-qu...@webkit.org
Date
2012-03-22 19:24:00 -0700 (Thu, 22 Mar 2012)

Log Message

[BlackBerry] http authenticate dialog popup only once no matter authentication pass or fail
https://bugs.webkit.org/show_bug.cgi?id=80135

Patch by Jonathan Dong <jonathan.d...@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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (111809 => 111810)


--- trunk/Source/WebCore/ChangeLog	2012-03-23 02:19:50 UTC (rev 111809)
+++ trunk/Source/WebCore/ChangeLog	2012-03-23 02:24:00 UTC (rev 111810)
@@ -1,3 +1,27 @@
+2012-03-22  Jonathan Dong  <jonathan.d...@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....@torchmobile.com.cn>
 
         [BlackBerry] Synchronize platform/network/blackberry

Modified: trunk/Source/WebCore/platform/blackberry/PageClientBlackBerry.h (111809 => 111810)


--- trunk/Source/WebCore/platform/blackberry/PageClientBlackBerry.h	2012-03-23 02:19:50 UTC (rev 111809)
+++ trunk/Source/WebCore/platform/blackberry/PageClientBlackBerry.h	2012-03-23 02:24:00 UTC (rev 111810)
@@ -69,7 +69,7 @@
     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;
 };
 

Modified: trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp (111809 => 111810)


--- trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp	2012-03-23 02:19:50 UTC (rev 111809)
+++ trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp	2012-03-23 02:24:00 UTC (rev 111810)
@@ -749,9 +749,6 @@
     if (!m_handle)
         return false;
 
-    if (!m_handle->getInternal()->m_currentWebChallenge.isNull())
-        return false;
-
     if (header.isEmpty())
         return false;
 
@@ -873,14 +870,15 @@
             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());

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (111809 => 111810)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-03-23 02:19:50 UTC (rev 111809)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-03-23 02:24:00 UTC (rev 111810)
@@ -2019,7 +2019,7 @@
     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 @@
         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)

Modified: trunk/Source/WebKit/blackberry/Api/WebPageClient.h (111809 => 111810)


--- trunk/Source/WebKit/blackberry/Api/WebPageClient.h	2012-03-23 02:19:50 UTC (rev 111809)
+++ trunk/Source/WebKit/blackberry/Api/WebPageClient.h	2012-03-23 02:24:00 UTC (rev 111810)
@@ -211,7 +211,7 @@
     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;

Modified: trunk/Source/WebKit/blackberry/Api/WebPage_p.h (111809 => 111810)


--- trunk/Source/WebKit/blackberry/Api/WebPage_p.h	2012-03-23 02:19:50 UTC (rev 111809)
+++ trunk/Source/WebKit/blackberry/Api/WebPage_p.h	2012-03-23 02:24:00 UTC (rev 111810)
@@ -176,7 +176,7 @@
     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.

Modified: trunk/Source/WebKit/blackberry/ChangeLog (111809 => 111810)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-03-23 02:19:50 UTC (rev 111809)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-03-23 02:24:00 UTC (rev 111810)
@@ -1,3 +1,23 @@
+2012-03-22  Jonathan Dong  <jonathan.d...@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  <mlattan...@rim.com>
 
         [BlackBerry] DeviceDPI Scaling is broken on mobile.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to