From 56dc077af5890d0c9f435cdd825192ddff38c106 Mon Sep 17 00:00:00 2001 From: "commit-queue@webkit.org" Date: Mon, 16 Apr 2012 15:53:15 +0000 Subject: [PATCH] [BlackBerry] Add ability for DRT to handle HTTP authentication challenges. https://bugs.webkit.org/show_bug.cgi?id=84031 Patch by Jonathan Dong 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): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114263 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit/blackberry/Api/DumpRenderTreeClient.h | 2 ++ Source/WebKit/blackberry/Api/WebPage.cpp | 5 +++++ Source/WebKit/blackberry/ChangeLog | 21 +++++++++++++++++++++ Tools/ChangeLog | 18 ++++++++++++++++++ Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp | 20 ++++++++++++++++++++ .../blackberry/DumpRenderTreeBlackBerry.h | 4 +++- 6 files changed, 69 insertions(+), 1 deletion(-) diff --git a/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h b/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h index 03eb5bb..ce6dd27 100644 --- a/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h +++ b/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h @@ -25,6 +25,7 @@ #include namespace WebCore { +class Credential; class Frame; class DOMWrapperWorld; class NavigationAction; @@ -81,6 +82,7 @@ public: 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; }; } diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index d51cb45..6309f9d 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -2028,6 +2028,11 @@ bool WebPagePrivate::authenticationChallenge(const KURL& url, const ProtectionSp 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); diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index 398aea0..8b8e11c 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,24 @@ +2012-04-16 Jonathan Dong + + [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 [BlackBerry] Accelerated compositing layers fail to render in direct rendering mode diff --git a/Tools/ChangeLog b/Tools/ChangeLog index 7383ad3..abe173e 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,21 @@ +2012-04-16 Jonathan Dong + + [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 build-webkit --gtk --no-webkit2 builds WK2 diff --git a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp index 5c1e8f8..41b9920 100644 --- a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp @@ -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 @@ static WTF::String drtFrameDescription(WebCore::Frame* frame) return "frame (anonymous)"; } +static WTF::String drtCredentialDescription(WebCore::Credential&) +{ + return ""; +} + static bool shouldLogFrameLoadDelegates(const WTF::String& url) { return url.contains("loading/"); @@ -807,6 +813,20 @@ void DumpRenderTree::didReceiveResponseForFrame(WebCore::Frame* frame, const Web 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; +} + } } diff --git a/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h b/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h index db2f69a..22a0fa5 100644 --- a/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h +++ b/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h @@ -28,8 +28,9 @@ #include namespace WebCore { -class Frame; +class Credential; class DOMWrapperWorld; +class Frame; class Range; } @@ -101,6 +102,7 @@ public: bool isSelectTrailingWhitespaceEnabled() const { return s_selectTrailingWhitespaceEnabled; } void setSelectTrailingWhitespaceEnabled(bool enabled) { s_selectTrailingWhitespaceEnabled = enabled; } + bool didReceiveAuthenticationChallenge(WebCore::Credential&); private: void runTest(const WTF::String& url); -- 2.7.4