[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.dong@torchmobile.com.cn> on 2012-05-28
Reviewed by Rob Buis.

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.

Resubmit the patch reverted by r115104 after the digest infinite loop
issue for BlackBerry porting get identified and fixed.

Internally reviewed by Joe Mason <jmason@rim.com>

* platform/blackberry/PageClientBlackBerry.h:
* 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.

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

Resubmit the patch reverted by r115104 after the digest infinite loop
issue for BlackBerry porting get identified and fixed.

Internally reviewed by Joe Mason <jmason@rim.com>

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

Tools:

Implemented interface function didReceiveAuthenticationChallenge in class
DumpRenderTree.

Resubmit the patch reverted by r115104 after the digest infinite loop
issue for BlackBerry porting get identified and fixed.

Internally reviewed by Joe Mason <jmason@rim.com>

* 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@118719 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 10c0df24
2012-05-28 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.
Resubmit the patch reverted by r115104 after the digest infinite loop
issue for BlackBerry porting get identified and fixed.
Internally reviewed by Joe Mason <jmason@rim.com>
* platform/blackberry/PageClientBlackBerry.h:
* platform/network/blackberry/NetworkJob.cpp:
(WebCore::NetworkJob::sendRequestWithCredentials):
2012-05-28 Jonathan Dong <jonathan.dong@torchmobile.com.cn>
[BlackBerry] http authentication challenge issue when loading favicon
......
......@@ -70,7 +70,7 @@ public:
virtual int showAlertDialog(BlackBerry::WebKit::WebPageClient::AlertType) = 0;
virtual bool isActive() const = 0;
virtual bool isVisible() 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;
};
......
......@@ -772,9 +772,6 @@ bool NetworkJob::sendRequestWithCredentials(ProtectionSpaceServerType type, Prot
String username;
String password;
if (!m_frame || !m_frame->loader() || !m_frame->loader()->client())
return false;
if (type == ProtectionSpaceProxyHTTP) {
username = BlackBerry::Platform::Client::get()->getProxyUsername().c_str();
password = BlackBerry::Platform::Client::get()->getProxyPassword().c_str();
......@@ -791,15 +788,14 @@ 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);
Credential inputCredential;
if (!m_frame->page()->chrome()->client()->platformPageClient()->authenticationChallenge(newURL, protectionSpace, inputCredential))
return false;
username = inputCredential.user();
password = inputCredential.password();
}
}
if (username.isEmpty() && password.isEmpty())
return false;
credential = Credential(username, password, CredentialPersistenceForSession);
m_handle->getInternal()->m_currentWebChallenge = AuthenticationChallenge(protectionSpace, credential, 0, m_response, ResourceError());
......
......@@ -25,6 +25,7 @@
#include <JavaScriptCore/JSObjectRef.h>
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;
};
}
......
......@@ -2135,26 +2135,32 @@ 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;
#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);
#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);
if (!m_webSettings->isPrivateBrowsingEnabled())
credentialManager().saveCredentialIfConfirmed(this, CredentialTransformData(url, protectionSpace, inputCredential));
Credential credential(username, password, CredentialPersistencePermanent);
if (!m_webSettings->isPrivateBrowsingEnabled() && isConfirmed)
credentialManager().saveCredentialIfConfirmed(this, CredentialTransformData(url, protectionSpace, credential));
#else
Credential inputCredential(username, password, CredentialPersistenceNone);
Credential credential(username, password, CredentialPersistenceNone);
#endif
return inputCredential;
inputCredential = credential;
return isConfirmed;
}
PageClientBlackBerry::SaveCredentialType WebPagePrivate::notifyShouldSaveCredential(bool isNew)
......
......@@ -207,7 +207,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 void notifyPopupAutofillDialog(const std::vector<std::string>&, const Platform::IntRect&) = 0;
......
......@@ -183,7 +183,7 @@ public:
virtual int showAlertDialog(WebPageClient::AlertType atype);
virtual bool isActive() const;
virtual bool isVisible() const { return m_visible; }
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.
......
2012-05-28 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.
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
Resubmit the patch reverted by r115104 after the digest infinite loop
issue for BlackBerry porting get identified and fixed.
Internally reviewed by Joe Mason <jmason@rim.com>
* Api/DumpRenderTreeClient.h:
(WebCore):
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::authenticationChallenge):
* Api/WebPageClient.h:
* Api/WebPage_p.h:
(WebPagePrivate):
2012-05-28 Arvid Nilsson <anilsson@rim.com>
[BlackBerry] Always create a compositor
......
2012-05-28 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.
Implemented interface function didReceiveAuthenticationChallenge in class
DumpRenderTree.
Resubmit the patch reverted by r115104 after the digest infinite loop
issue for BlackBerry porting get identified and fixed.
Internally reviewed by Joe Mason <jmason@rim.com>
* DumpRenderTree/blackberry/DumpRenderTree.cpp:
(drtCredentialDescription):
(BlackBerry::WebKit::DumpRenderTree::didReceiveAuthenticationChallenge):
(WebKit):
* DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h:
(WebCore):
(DumpRenderTree):
2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled
......
......@@ -24,6 +24,7 @@
#include "BackForwardController.h"
#include "BackForwardListImpl.h"
#include "CString.h"
#include "Credential.h"
#include "DatabaseTracker.h"
#include "DocumentLoader.h"
#include "DumpRenderTree/GCController.h"
......@@ -124,6 +125,12 @@ static String drtFrameDescription(WebCore::Frame* frame)
return "frame (anonymous)";
}
static WTF::String drtCredentialDescription(WebCore::Credential&)
{
// TODO: Implementation needed.
return "<unknown>";
}
static bool shouldLogFrameLoadDelegates(const String& url)
{
return url.contains("loading/");
......@@ -857,6 +864,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;
}
}
}
......
......@@ -28,8 +28,9 @@
#include <wtf/Vector.h>
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 String& url);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment