Title: [114263] trunk
Revision
114263
Author
commit-qu...@webkit.org
Date
2012-04-16 08:53:15 -0700 (Mon, 16 Apr 2012)

Log Message

[BlackBerry] Add ability for DRT to handle HTTP authentication challenges.
https://bugs.webkit.org/show_bug.cgi?id=84031

Patch by Jonathan Dong <jonathan.d...@torchmobile.com.cn> on 2012-04-16
Reviewed by Rob Buis.

Source/WebKit/blackberry:

Added the interface function didReceivedAuthenticaitonChallenge()
in interface class DumpRenderTreeClient;
Called m_dumpRenderTree->didReceiveAuthenticationChallenge() in
WebPagePrivate::authenticationChallenge() when DRT is enabled.

Test: reuse existing test cases:
http/tests/loading/basic-credentials-sent-automatically.html
http/tests/loading/basic-auth-resend-wrong-credentials.html

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

Tools:

Implemented interface function didReceiveAuthenticationChallenge in class
DumpRenderTree.

* DumpRenderTree/blackberry/DumpRenderTree.cpp:
(drtCredentialDescription):
(BlackBerry::WebKit::DumpRenderTree::didReceiveAuthenticationChallenge):
(WebKit):
* DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h:
(WebCore):
(DumpRenderTree):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h (114262 => 114263)


--- trunk/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h	2012-04-16 15:51:07 UTC (rev 114262)
+++ trunk/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h	2012-04-16 15:53:15 UTC (rev 114263)
@@ -25,6 +25,7 @@
 #include <_javascript_Core/JSObjectRef.h>
 
 namespace WebCore {
+class Credential;
 class Frame;
 class DOMWrapperWorld;
 class NavigationAction;
@@ -81,6 +82,7 @@
     virtual bool shouldInsertNode(WebCore::Node*, WebCore::Range*, int insertAction) = 0;
     virtual bool shouldInsertText(const WTF::String&, WebCore::Range*, int insertAction) = 0;
     virtual bool isSelectTrailingWhitespaceEnabled() const = 0;
+    virtual bool didReceiveAuthenticationChallenge(WebCore::Credential&) = 0;
 
 };
 }

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (114262 => 114263)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-04-16 15:51:07 UTC (rev 114262)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-04-16 15:53:15 UTC (rev 114263)
@@ -2028,6 +2028,11 @@
     WebString username;
     WebString password;
 
+#if ENABLE_DRT
+    if (m_dumpRenderTree)
+        return m_dumpRenderTree->didReceiveAuthenticationChallenge(inputCredential);
+#endif
+
 #if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
     if (!m_webSettings->isPrivateBrowsingEnabled())
         credentialManager().autofillAuthenticationChallenge(protectionSpace, username, password);

Modified: trunk/Source/WebKit/blackberry/ChangeLog (114262 => 114263)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-04-16 15:51:07 UTC (rev 114262)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-04-16 15:53:15 UTC (rev 114263)
@@ -1,3 +1,24 @@
+2012-04-16  Jonathan Dong  <jonathan.d...@torchmobile.com.cn>
+
+        [BlackBerry] Add ability for DRT to handle HTTP authentication challenges.
+        https://bugs.webkit.org/show_bug.cgi?id=84031
+
+        Reviewed by Rob Buis.
+
+        Added the interface function didReceivedAuthenticaitonChallenge()
+        in interface class DumpRenderTreeClient;
+        Called m_dumpRenderTree->didReceiveAuthenticationChallenge() in
+        WebPagePrivate::authenticationChallenge() when DRT is enabled.
+
+        Test: reuse existing test cases:
+        http/tests/loading/basic-credentials-sent-automatically.html
+        http/tests/loading/basic-auth-resend-wrong-credentials.html
+
+        * Api/DumpRenderTreeClient.h:
+        (WebCore):
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::authenticationChallenge):
+
 2012-04-16  Arvid Nilsson  <anils...@rim.com>
 
         [BlackBerry] Accelerated compositing layers fail to render in direct rendering mode

Modified: trunk/Tools/ChangeLog (114262 => 114263)


--- trunk/Tools/ChangeLog	2012-04-16 15:51:07 UTC (rev 114262)
+++ trunk/Tools/ChangeLog	2012-04-16 15:53:15 UTC (rev 114263)
@@ -1,3 +1,21 @@
+2012-04-16  Jonathan Dong  <jonathan.d...@torchmobile.com.cn>
+
+        [BlackBerry] Add ability for DRT to handle HTTP authentication challenges.
+        https://bugs.webkit.org/show_bug.cgi?id=84031
+
+        Reviewed by Rob Buis.
+
+        Implemented interface function didReceiveAuthenticationChallenge in class
+        DumpRenderTree.
+
+        * DumpRenderTree/blackberry/DumpRenderTree.cpp:
+        (drtCredentialDescription):
+        (BlackBerry::WebKit::DumpRenderTree::didReceiveAuthenticationChallenge):
+        (WebKit):
+        * DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h:
+        (WebCore):
+        (DumpRenderTree):
+
 2012-04-16  Philippe Normand  <pnorm...@igalia.com>
 
         build-webkit --gtk --no-webkit2 builds WK2

Modified: trunk/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp (114262 => 114263)


--- trunk/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp	2012-04-16 15:51:07 UTC (rev 114262)
+++ trunk/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp	2012-04-16 15:53:15 UTC (rev 114263)
@@ -23,6 +23,7 @@
 #include "BackForwardController.h"
 #include "BackForwardListImpl.h"
 #include "CString.h"
+#include "Credential.h"
 #include "DatabaseTracker.h"
 #include "DocumentLoader.h"
 #include "DumpRenderTree/GCController.h"
@@ -121,6 +122,11 @@
     return "frame (anonymous)";
 }
 
+static WTF::String drtCredentialDescription(WebCore::Credential&)
+{
+    return "<unknown>";
+}
+
 static bool shouldLogFrameLoadDelegates(const WTF::String& url)
 {
     return url.contains("loading/");
@@ -807,8 +813,22 @@
         printf("%s has MIME type %s\n", response.url().lastPathComponent().utf8().data(), response.mimeType().utf8().data());
 }
 
+bool DumpRenderTree::didReceiveAuthenticationChallenge(WebCore::Credential& credential)
+{
+    if (!gLayoutTestController->handlesAuthenticationChallenges()) {
+        credential = WebCore::Credential();
+        printf("%s - didReceiveAuthenticationChallenge - Simulating cancelled authentication\n", drtCredentialDescription(credential).utf8().data());
+        return false;
+    }
+    const char* user = gLayoutTestController->authenticationUsername().c_str();
+    const char* password = gLayoutTestController->authenticationPassword().c_str();
+    credential = WebCore::Credential(user, password, WebCore::CredentialPersistenceForSession);
+    printf("%s - didReceiveAuthenticationChallenge - Responding with %s:%s\n", drtCredentialDescription(credential).utf8().data(), user, password);
+    return true;
 }
+
 }
+}
 
 // Static dump() function required by cross-platform DRT code.
 void dump()

Modified: trunk/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h (114262 => 114263)


--- trunk/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h	2012-04-16 15:51:07 UTC (rev 114262)
+++ trunk/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h	2012-04-16 15:53:15 UTC (rev 114263)
@@ -28,8 +28,9 @@
 #include <wtf/Vector.h>
 
 namespace WebCore {
+class Credential;
+class DOMWrapperWorld;
 class Frame;
-class DOMWrapperWorld;
 class Range;
 }
 
@@ -101,6 +102,7 @@
 
     bool isSelectTrailingWhitespaceEnabled() const { return s_selectTrailingWhitespaceEnabled; }
     void setSelectTrailingWhitespaceEnabled(bool enabled) { s_selectTrailingWhitespaceEnabled = enabled; }
+    bool didReceiveAuthenticationChallenge(WebCore::Credential&);
 
 private:
     void runTest(const WTF::String& url);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to