Diff
Modified: trunk/Source/WebCore/ChangeLog (111545 => 111546)
--- trunk/Source/WebCore/ChangeLog 2012-03-21 14:51:12 UTC (rev 111545)
+++ trunk/Source/WebCore/ChangeLog 2012-03-21 15:23:33 UTC (rev 111546)
@@ -1,3 +1,24 @@
+2012-03-21 Jonathan Dong <[email protected]>
+
+ [BlackBerry] Credential save and autofill implemetation
+ https://bugs.webkit.org/show_bug.cgi?id=80401
+
+ Reviewed by Rob Buis.
+
+ Added interface function authenticationChallenge() and
+ notifyShouldSaveCredential() into PageClientBlackBerry.
+ As this class is our platform specific interface,
+ by doing this we don't need to add an interface function
+ in class FrameLoaderClient which is a platform
+ independent interface.
+
+ No new tests.
+
+ * platform/blackberry/PageClientBlackBerry.h:
+ (WebCore):
+ * platform/network/blackberry/NetworkJob.cpp:
+ (WebCore::NetworkJob::sendRequestWithCredentials):
+
2012-03-21 Ilya Tikhonovsky <[email protected]>
Web Inspector: HeapProfiler: DOM node id can overflow Int32.
Modified: trunk/Source/WebCore/platform/blackberry/PageClientBlackBerry.h (111545 => 111546)
--- trunk/Source/WebCore/platform/blackberry/PageClientBlackBerry.h 2012-03-21 14:51:12 UTC (rev 111545)
+++ trunk/Source/WebCore/platform/blackberry/PageClientBlackBerry.h 2012-03-21 15:23:33 UTC (rev 111546)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009, 2010, 2011 Research In Motion Limited. All rights reserved.
+ * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -19,6 +19,7 @@
#ifndef PageClientBlackBerry_h
#define PageClientBlackBerry_h
+#include "Credential.h"
#include "Cursor.h"
#include "WebPageClient.h"
@@ -34,11 +35,19 @@
namespace WebCore {
class IntRect;
class IntSize;
+ class KURL;
class PluginView;
+ class ProtectionSpace;
}
class PageClientBlackBerry {
public:
+ enum SaveCredentialType {
+ SaveCredentialNeverForThisSite = 0,
+ SaveCredentialNotNow,
+ SaveCredentialYes
+ };
+
virtual void setCursor(WebCore::PlatformCursor) = 0;
virtual BlackBerry::Platform::NetworkStreamFactory* networkStreamFactory() = 0;
virtual BlackBerry::Platform::Graphics::Window* platformWindow() const = 0;
@@ -60,6 +69,8 @@
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 SaveCredentialType notifyShouldSaveCredential(bool) = 0;
};
#endif // PageClientBlackBerry_h
Modified: trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp (111545 => 111546)
--- trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp 2012-03-21 14:51:12 UTC (rev 111545)
+++ trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp 2012-03-21 15:23:33 UTC (rev 111546)
@@ -21,6 +21,8 @@
#include "AboutData.h"
#include "Base64.h"
+#include "Chrome.h"
+#include "ChromeClient.h"
#include "CookieManager.h"
#include "CredentialStorage.h"
#include "Frame.h"
@@ -30,6 +32,7 @@
#include "MIMESniffing.h"
#include "MIMETypeRegistry.h"
#include "NetworkManager.h"
+#include "Page.h"
#include "ResourceHandleClient.h"
#include "ResourceHandleInternal.h"
#include "ResourceRequest.h"
@@ -868,8 +871,11 @@
// If they are correct, they will the put into CredentialStorage.
m_handle->getInternal()->m_user = "";
m_handle->getInternal()->m_pass = "";
- } else
- m_frame->loader()->client()->authenticationChallenge(realm, username, password);
+ } else {
+ Credential inputCredential = m_frame->page()->chrome()->client()->platformPageClient()->authenticationChallenge(newURL, protectionSpace);
+ username = inputCredential.user();
+ password = inputCredential.password();
+ }
if (username.isEmpty() && password.isEmpty())
return false;
Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (111545 => 111546)
--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-03-21 14:51:12 UTC (rev 111545)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-03-21 15:23:33 UTC (rev 111546)
@@ -31,6 +31,8 @@
#include "ChromeClientBlackBerry.h"
#include "ContextMenuClientBlackBerry.h"
#include "CookieManager.h"
+#include "CredentialManager.h"
+#include "CredentialTransformData.h"
#include "DOMSupport.h"
#include "Database.h"
#include "DatabaseSync.h"
@@ -2017,6 +2019,33 @@
return m_client->isActive();
}
+Credential WebPagePrivate::authenticationChallenge(const KURL& url, const ProtectionSpace& protectionSpace)
+{
+ WebString username;
+ WebString password;
+
+#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);
+
+#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
+ Credential inputCredential(username, password, CredentialPersistencePermanent);
+ if (!m_webSettings->isPrivateBrowsingEnabled())
+ credentialManager().saveCredentialIfConfirmed(this, CredentialTransformData(url, protectionSpace, inputCredential));
+#else
+ Credential inputCredential(username, password, CredentialPersistenceNone);
+#endif
+ return inputCredential;
+}
+
+PageClientBlackBerry::SaveCredentialType WebPagePrivate::notifyShouldSaveCredential(bool isNew)
+{
+ return static_cast<PageClientBlackBerry::SaveCredentialType>(m_client->notifyShouldSaveCredential(isNew));
+}
+
bool WebPagePrivate::useFixedLayout() const
{
return true;
Modified: trunk/Source/WebKit/blackberry/Api/WebPageClient.h (111545 => 111546)
--- trunk/Source/WebKit/blackberry/Api/WebPageClient.h 2012-03-21 14:51:12 UTC (rev 111545)
+++ trunk/Source/WebKit/blackberry/Api/WebPageClient.h 2012-03-21 15:23:33 UTC (rev 111546)
@@ -77,6 +77,12 @@
MediaInvalidError,
};
+ enum SaveCredentialType {
+ SaveCredentialNeverForThisSite = 0,
+ SaveCredentialNotNow,
+ SaveCredentialYes
+ };
+
virtual int getInstanceId() const = 0;
virtual void notifyLoadStarted() = 0;
@@ -206,6 +212,7 @@
virtual void setPreventsScreenIdleDimming(bool noDimming) = 0;
virtual void authenticationChallenge(const unsigned short* realm, unsigned int realmLength, WebString& username, WebString& password) = 0;
+ virtual SaveCredentialType notifyShouldSaveCredential(bool isNew) = 0;
virtual bool shouldPluginEnterFullScreen() = 0;
virtual void didPluginEnterFullScreen() = 0;
Modified: trunk/Source/WebKit/blackberry/Api/WebPage_p.h (111545 => 111546)
--- trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2012-03-21 14:51:12 UTC (rev 111545)
+++ trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2012-03-21 15:23:33 UTC (rev 111546)
@@ -176,6 +176,8 @@
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 SaveCredentialType notifyShouldSaveCredential(bool);
// Called from within WebKit via ChromeClientBlackBerry.
void enterFullscreenForNode(WebCore::Node*);
Modified: trunk/Source/WebKit/blackberry/ChangeLog (111545 => 111546)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-03-21 14:51:12 UTC (rev 111545)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-03-21 15:23:33 UTC (rev 111546)
@@ -1,3 +1,53 @@
+2012-03-21 Jonathan Dong <[email protected]>
+
+ [BlackBerry] Credential save and autofill implemetation
+ https://bugs.webkit.org/show_bug.cgi?id=80401
+
+ Reviewed by Rob Buis.
+
+ This patch is intended to implement the credential persist
+ and autofill feature for BlackBerry porting.
+
+ Moved interface authenticationChallenge() from class
+ FrameLoaderClientBlackBerry to WebPagePrivate (derived from
+ PageClientBlackBerry as changes made in its parent interface class);
+ Implemented notifyShouldSaveCredential() in WebPagePrivate
+ and WebPageClient as well.
+ Added credentialManager() to retrive CredentialManager instance
+ as a global singleton; removed its m_frameLoaderClient which is
+ replaced with a passed in PageClientBlackBerry pointer, and modified
+ the interface function accordingly.
+
+ For the http authentication, autofill the input dialog in
+ function authenticationChallenge() and save the credential
+ information in the same function;
+ For the in-form authentication, autofill the username and
+ password input fields in function dispatchDidFinishLoad(),
+ and save the credential information in function
+ dispatchWillSubmitForm() or dispatchWillSendSubmitEvent().
+
+ * Api/WebPage.cpp:
+ (BlackBerry::WebKit::WebPagePrivate::authenticationChallenge):
+ (WebKit):
+ (BlackBerry::WebKit::WebPagePrivate::notifyShouldSaveCredential):
+ * Api/WebPageClient.h:
+ * Api/WebPage_p.h:
+ (WebPagePrivate):
+ * WebCoreSupport/CredentialManager.cpp:
+ (WebCore::credentialManager):
+ (WebCore::CredentialManager::saveCredentialIfConfirmed):
+ * WebCoreSupport/CredentialManager.h:
+ (CredentialManager):
+ (WebCore::CredentialManager::CredentialManager):
+ (WebCore):
+ * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+ (WebCore::FrameLoaderClientBlackBerry::dispatchDidFinishLoad):
+ (WebCore::FrameLoaderClientBlackBerry::dispatchWillSubmitForm):
+ (WebCore::FrameLoaderClientBlackBerry::dispatchWillSendSubmitEvent):
+ (WebCore):
+ * WebCoreSupport/FrameLoaderClientBlackBerry.h:
+ (FrameLoaderClientBlackBerry):
+
2012-03-20 Jacky Jiang <[email protected]>
[BlackBerry] Dijit crash WebCore::CookieManager::getRawCookies
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/CredentialManager.cpp (111545 => 111546)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/CredentialManager.cpp 2012-03-21 14:51:12 UTC (rev 111545)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/CredentialManager.cpp 2012-03-21 15:23:33 UTC (rev 111546)
@@ -23,23 +23,22 @@
#include "CredentialBackingStore.h"
#include "CredentialTransformData.h"
-#include "FrameLoaderClientBlackBerry.h"
#include "HTMLFormElement.h"
#include "KURL.h"
#include "Logging.h"
-#include "WebPageClient.h"
-#include "WebPage_p.h"
+#include "PageClientBlackBerry.h"
#include "WebString.h"
-using BlackBerry::WebKit::WebPageClient;
using BlackBerry::WebKit::WebString;
namespace WebCore {
-CredentialManager::CredentialManager(FrameLoaderClientBlackBerry* frameLoaderClient)
- : m_frameLoaderClient(frameLoaderClient)
+CredentialManager& credentialManager()
{
- ASSERT(m_frameLoaderClient);
+ static CredentialManager *credentialManager = 0;
+ if (!credentialManager)
+ credentialManager = new CredentialManager();
+ return *credentialManager;
}
void CredentialManager::autofillAuthenticationChallenge(const ProtectionSpace& protectionSpace, WebString& username, WebString& password)
@@ -70,8 +69,10 @@
}
}
-void CredentialManager::saveCredentialIfConfirmed(const CredentialTransformData& data)
+void CredentialManager::saveCredentialIfConfirmed(PageClientBlackBerry* pageClient, const CredentialTransformData& data)
{
+ ASSERT(pageClient);
+
if (!data.isValid() || data.credential().isEmpty() || CredentialBackingStore::instance()->hasNeverRemember(data.protectionSpace()))
return;
@@ -79,13 +80,13 @@
if (savedCredential == data.credential())
return;
- WebPageClient::SaveCredentialType type = m_frameLoaderClient->m_webPagePrivate->m_client->notifyShouldSaveCredential(savedCredential.isEmpty());
- if (type == WebPageClient::SaveCredentialYes) {
+ PageClientBlackBerry::SaveCredentialType type = pageClient->notifyShouldSaveCredential(savedCredential.isEmpty());
+ if (type == PageClientBlackBerry::SaveCredentialYes) {
if (savedCredential.isEmpty())
CredentialBackingStore::instance()->addLogin(data.url(), data.protectionSpace(), data.credential());
else
CredentialBackingStore::instance()->updateLogin(data.url(), data.protectionSpace(), data.credential());
- } else if (type == WebPageClient::SaveCredentialNeverForThisSite) {
+ } else if (type == PageClientBlackBerry::SaveCredentialNeverForThisSite) {
CredentialBackingStore::instance()->addNeverRemember(data.url(), data.protectionSpace());
CredentialBackingStore::instance()->removeLogin(data.url(), data.protectionSpace());
}
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/CredentialManager.h (111545 => 111546)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/CredentialManager.h 2012-03-21 14:51:12 UTC (rev 111545)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/CredentialManager.h 2012-03-21 15:23:33 UTC (rev 111546)
@@ -24,6 +24,8 @@
#include "HTMLCollection.h"
#include <wtf/PassRefPtr.h>
+class PageClientBlackBerry;
+
namespace BlackBerry {
namespace WebKit {
class WebString;
@@ -31,23 +33,23 @@
}
namespace WebCore {
-class FrameLoaderClientBlackBerry;
class KURL;
class ProtectionSpace;
class CredentialTransformData;
class CredentialManager {
public:
- CredentialManager(FrameLoaderClientBlackBerry*);
-
void autofillAuthenticationChallenge(const ProtectionSpace&, BlackBerry::WebKit::WebString& username, BlackBerry::WebKit::WebString& password);
void autofillPasswordForms(PassRefPtr<HTMLCollection> docForms);
- void saveCredentialIfConfirmed(const CredentialTransformData&);
+ void saveCredentialIfConfirmed(PageClientBlackBerry*, const CredentialTransformData&);
-private:
- FrameLoaderClientBlackBerry* m_frameLoaderClient;
+ private:
+ friend CredentialManager& credentialManager();
+ CredentialManager() { }
};
+CredentialManager& credentialManager();
+
} // WebCore
#endif // ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp (111545 => 111546)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp 2012-03-21 14:51:12 UTC (rev 111545)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp 2012-03-21 15:23:33 UTC (rev 111546)
@@ -28,6 +28,9 @@
#include "ChromeClientBlackBerry.h"
#include "ClientExtension.h"
#include "CookieManager.h"
+#include "CredentialBackingStore.h"
+#include "CredentialManager.h"
+#include "CredentialTransformData.h"
#include "DumpRenderTreeClient.h"
#include "FrameNetworkingContextBlackBerry.h"
#include "FrameView.h"
@@ -50,6 +53,7 @@
#include "Page.h"
#include "PluginView.h"
#include "ProgressTracker.h"
+#include "ProtectionSpace.h"
#include "ScopePointer.h"
#include "SharedBuffer.h"
#include "TextEncoding.h"
@@ -602,6 +606,11 @@
m_webPagePrivate->m_client->setAlternateFeedDetails(title.utf8().data(), href.utf8().data());
}
}
+
+#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
+ if (!m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled())
+ credentialManager().autofillPasswordForms(m_frame->document()->forms());
+#endif
}
void FrameLoaderClientBlackBerry::dispatchDidFinishDocumentLoad()
@@ -694,12 +703,27 @@
}
}
-void FrameLoaderClientBlackBerry::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState>)
+void FrameLoaderClientBlackBerry::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState> formState)
{
+#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
+ if (!m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled())
+ credentialManager().saveCredentialIfConfirmed(m_webPagePrivate, CredentialTransformData(formState->form()));
+#endif
+
// FIXME: Stub.
(m_frame->loader()->policyChecker()->*function)(PolicyUse);
}
+void FrameLoaderClientBlackBerry::dispatchWillSendSubmitEvent(HTMLFormElement* form)
+{
+#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
+ if (!m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled())
+ credentialManager().saveCredentialIfConfirmed(m_webPagePrivate, CredentialTransformData(form));
+#else
+ notImplemented();
+#endif
+}
+
PassRefPtr<Frame> FrameLoaderClientBlackBerry::createFrame(const KURL& url, const String& name
, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight)
{
@@ -1125,17 +1149,6 @@
return FrameNetworkingContextBlackBerry::create(m_frame);
}
-void FrameLoaderClientBlackBerry::authenticationChallenge(const String& realm, String& username, String& password)
-{
- WebString webPageUsername;
- WebString webPagePassword;
-
- m_webPagePrivate->m_client->authenticationChallenge(realm.characters(), realm.length(), webPageUsername, webPagePassword);
-
- username = webPageUsername;
- password = webPagePassword;
-}
-
void FrameLoaderClientBlackBerry::startDownload(const ResourceRequest& request, const String& /*suggestedName*/)
{
// FIXME: use the suggestedName?
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h (111545 => 111546)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h 2012-03-21 14:51:12 UTC (rev 111545)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h 2012-03-21 15:23:33 UTC (rev 111546)
@@ -164,11 +164,10 @@
virtual void didDetectXSS(const KURL&, bool) { }
virtual void dispatchDidChangeIcons(IconType) { notImplemented(); };
- virtual void dispatchWillSendSubmitEvent(HTMLFormElement*) { notImplemented(); };
+ virtual void dispatchWillSendSubmitEvent(HTMLFormElement*);
virtual void willDeferLoading();
virtual void didResumeLoading();
- virtual void authenticationChallenge(const String& realm, String& username, String& password);
virtual PassRefPtr<FrameNetworkingContext> createNetworkingContext();