[BlackBerry] Authentication credentials lost when opening a new tab
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Mar 2013 18:05:24 +0000 (18:05 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Mar 2013 18:05:24 +0000 (18:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=111445

PR 286627

Patch by Otto Derek Cheung <otcheung@rim.com> on 2013-03-05
Reviewed by Rob Buis.
Internally Reviewed by Lianghui Chen.

Prevent changing the private mode boolean value in didChangeSettings if the value
hasn't changed.

Setting the private mode value of credentialstorage every time didChangeSettings gets
called causes the session credential mapping to be cleared on every tab change in
non-private mode.

Tested changing tabs after logging into a site using the HTTP Basic Auth protocol to see
if the credentials are cleared. Also ensured the functionality of private mode is not changed.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::didChangeSettings):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@144772 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/ChangeLog

index e92260f..48736a4 100644 (file)
@@ -5929,7 +5929,6 @@ void WebPagePrivate::didChangeSettings(WebSettings* webSettings)
     coreSettings->setLoadsImagesAutomatically(webSettings->loadsImagesAutomatically());
     coreSettings->setShouldDrawBorderWhileLoadingImages(webSettings->shouldDrawBorderWhileLoadingImages());
     coreSettings->setScriptEnabled(webSettings->isJavaScriptEnabled());
-    coreSettings->setPrivateBrowsingEnabled(webSettings->isPrivateBrowsingEnabled());
     coreSettings->setDeviceSupportsMouse(webSettings->deviceSupportsMouse());
     coreSettings->setDefaultFixedFontSize(webSettings->defaultFixedFontSize());
     coreSettings->setDefaultFontSize(webSettings->defaultFontSize());
@@ -5958,6 +5957,12 @@ void WebPagePrivate::didChangeSettings(WebSettings* webSettings)
     coreSettings->setUseCache(webSettings->useWebKitCache());
     coreSettings->setCookieEnabled(webSettings->areCookiesEnabled());
 
+    if (coreSettings->privateBrowsingEnabled() != webSettings->isPrivateBrowsingEnabled()) {
+        coreSettings->setPrivateBrowsingEnabled(webSettings->isPrivateBrowsingEnabled());
+        cookieManager().setPrivateMode(webSettings->isPrivateBrowsingEnabled());
+        CredentialStorage::setPrivateMode(webSettings->isPrivateBrowsingEnabled());
+    }
+
 #if ENABLE(SQL_DATABASE)
     // DatabaseManager can only be initialized for once, so it doesn't
     // make sense to change database path after DatabaseManager has
@@ -6014,10 +6019,6 @@ void WebPagePrivate::didChangeSettings(WebSettings* webSettings)
     coreSettings->setWebSecurityEnabled(!webSettings->allowCrossSiteRequests());
     coreSettings->setApplyPageScaleFactorInCompositor(webSettings->applyDeviceScaleFactorInCompositor());
 
-    cookieManager().setPrivateMode(webSettings->isPrivateBrowsingEnabled());
-
-    CredentialStorage::setPrivateMode(webSettings->isPrivateBrowsingEnabled());
-
     if (m_mainFrame && m_mainFrame->view()) {
         Color backgroundColor(webSettings->backgroundColor());
         m_mainFrame->view()->updateBackgroundRecursively(backgroundColor, backgroundColor.hasAlpha());
index eae1642..bd8fe70 100644 (file)
@@ -1,3 +1,26 @@
+2013-03-05  Otto Derek Cheung  <otcheung@rim.com>
+
+        [BlackBerry] Authentication credentials lost when opening a new tab
+        https://bugs.webkit.org/show_bug.cgi?id=111445
+
+        PR 286627
+
+        Reviewed by Rob Buis.
+        Internally Reviewed by Lianghui Chen.
+
+        Prevent changing the private mode boolean value in didChangeSettings if the value
+        hasn't changed.
+
+        Setting the private mode value of credentialstorage every time didChangeSettings gets
+        called causes the session credential mapping to be cleared on every tab change in
+        non-private mode.
+
+        Tested changing tabs after logging into a site using the HTTP Basic Auth protocol to see
+        if the credentials are cleared. Also ensured the functionality of private mode is not changed.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::didChangeSettings):
+
 2013-03-05  Tiancheng Jiang  <tijiang@rim.com>
 
         [BlackBerry] FatFinger pairs the wrong element with fatfinger rect part.