[BlackBerry] Clear local storage won't take effect until browser exit and relaunch
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Apr 2012 10:52:47 +0000 (10:52 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Apr 2012 10:52:47 +0000 (10:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83253

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

.:

RIM PR: #146871
Added a manual test case to test the behavior when press
button "Clear Local Storage" from browser settings.
It has to be a manual test as it requires user interaction.

* ManualTests/blackberry/clear-localstorage.html: Added.

Source/WebKit/blackberry:

RIM PR: #146871
Cleared the local storage namespace of a WebPage's PageGroup
when WebPage::clearLocalStorage() get called.
Also deleted unused global function clearLocalStorage().

* Api/BlackBerryGlobal.cpp:
* Api/BlackBerryGlobal.h:
(WebKit):
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPage::clearLocalStorage):

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

ChangeLog
ManualTests/blackberry/clear-localstorage.html [new file with mode: 0644]
Source/WebKit/blackberry/Api/BlackBerryGlobal.cpp
Source/WebKit/blackberry/Api/BlackBerryGlobal.h
Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/ChangeLog

index 90b4f62..512325b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2012-04-05  Jonathan Dong  <jonathan.dong@torchmobile.com.cn>
+
+        [BlackBerry] Clear local storage won't take effect until browser exit and relaunch
+        https://bugs.webkit.org/show_bug.cgi?id=83253
+
+        Reviewed by Rob Buis.
+
+        RIM PR: #146871
+        Added a manual test case to test the behavior when press
+        button "Clear Local Storage" from browser settings.
+        It has to be a manual test as it requires user interaction.
+
+        * ManualTests/blackberry/clear-localstorage.html: Added.
+
 2012-04-04  Kent Tamura  <tkent@chromium.org>
 
         Add JavaScript and CSS code for the calendar picker implementation
diff --git a/ManualTests/blackberry/clear-localstorage.html b/ManualTests/blackberry/clear-localstorage.html
new file mode 100644 (file)
index 0000000..92e85f4
--- /dev/null
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+  <body>
+    <p>This test case is used to test the function of clear local storage by clicking "Clear Local Storage" button
+    from Settings -> Privacy & Security. This is for <a href="https://bugs.webkit.org/show_bug.cgi?id=83253">https://bugs.webkit.org/show_bug.cgi?id=83253</a></p>
+    <div>
+    <script type="text/javascript">
+      if (!sessionStorage.getItem("key")) {
+        // initialize test case
+        document.write("Status: <span style='color:yellow'>Initial</span>");
+        sessionStorage.setItem("key", "value");
+        localStorage.setItem("key", "value");
+
+        // notify to clear the local storage and refresh the page.
+        document.write("<p>Please clear the local storage from Settings -> Privacy & Security by pressing \"Clear Local Storage\" button, then reload this page to see the result.</p>");
+      } else {
+        document.write("Result: ");
+        if (!localStorage.getItem("key")) {
+          // success
+          document.write("<span style='color:green'>PASS</span>");
+        } else {
+          // fail
+          document.write("<span style='color:red'>FAIL</span>");
+        }
+        document.write("<p>If you want to run this test case again, please restart the browser.</p>");
+      }
+    </script>
+    </div>
+  </body>
+</html>
index 6258a3c..495d8f7 100644 (file)
@@ -136,10 +136,6 @@ void clearAppCache(const WebString& pageGroupName)
     cacheStorage().empty();
 }
 
-void clearLocalStorage(const WebString& pageGroupName)
-{
-}
-
 void clearDatabase(const WebString& pageGroupName)
 {
 }
index e794fb9..fd706bd 100644 (file)
@@ -37,8 +37,6 @@ BLACKBERRY_EXPORT void clearMemoryCaches();
 void clearAppCache(const WebString& pageGroupName);
 void reopenAllAppCaches();
 void closeAllAppCaches();
-void clearLocalStorage(const WebString& pageGroupName);
-void closeAllLocalStorages();
 void clearDatabase(const WebString& pageGroupName);
 void reopenAllTrackerDatabases();
 void closeAllTrackerDatabases();
index 9235008..eba10fb 100644 (file)
@@ -4871,8 +4871,10 @@ void WebPage::clearCookies()
 
 void WebPage::clearLocalStorage()
 {
-    BlackBerry::WebKit::clearLocalStorage(d->m_page->groupName());
-    clearDatabase(d->m_page->groupName());
+    if (PageGroup* group = d->m_page->groupPtr()) {
+        if (StorageNamespace* storage = group->localStorage())
+            storage->clearAllOriginsForDeletion();
+    }
 }
 
 void WebPage::clearCredentials()
index 45c972c..24d57c1 100644 (file)
@@ -1,3 +1,21 @@
+2012-04-05  Jonathan Dong  <jonathan.dong@torchmobile.com.cn>
+
+        [BlackBerry] Clear local storage won't take effect until browser exit and relaunch
+        https://bugs.webkit.org/show_bug.cgi?id=83253
+
+        Reviewed by Rob Buis.
+
+        RIM PR: #146871
+        Cleared the local storage namespace of a WebPage's PageGroup
+        when WebPage::clearLocalStorage() get called.
+        Also deleted unused global function clearLocalStorage().
+
+        * Api/BlackBerryGlobal.cpp:
+        * Api/BlackBerryGlobal.h:
+        (WebKit):
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPage::clearLocalStorage):
+
 2012-04-04  Rob Buis  <rbuis@rim.com>
 
         [BlackBerry] Make the switch statement in WebPage::notifyAppActivationStateChange() stronger