Allow LocalStorage by default for file URLs.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Jul 2016 19:57:47 +0000 (19:57 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Jul 2016 19:57:47 +0000 (19:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=160169

Reviewed by Brent Fulgham.

Source/WebCore:

Test: storage/domstorage/localstorage/file-can-access.html

* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::canAccessStorage): Remove the m_universalAccess check for local URLs.

LayoutTests:

* storage/domstorage/localstorage/blocked-file-access-expected.txt: Removed.
* storage/domstorage/localstorage/file-can-access-expected.txt: Added.
* storage/domstorage/localstorage/file-can-access.html: Renamed from LayoutTests/storage/domstorage/localstorage/blocked-file-access.html.
* storage/domstorage/localstorage/resources/unblocked-example.html: Renamed from LayoutTests/storage/domstorage/localstorage/resources/blocked-example.html.

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

LayoutTests/ChangeLog
LayoutTests/storage/domstorage/localstorage/blocked-file-access-expected.txt [deleted file]
LayoutTests/storage/domstorage/localstorage/file-can-access-expected.txt [new file with mode: 0644]
LayoutTests/storage/domstorage/localstorage/file-can-access.html [moved from LayoutTests/storage/domstorage/localstorage/blocked-file-access.html with 61% similarity]
LayoutTests/storage/domstorage/localstorage/resources/unblocked-example.html [moved from LayoutTests/storage/domstorage/localstorage/resources/blocked-example.html with 70% similarity]
Source/WebCore/ChangeLog
Source/WebCore/page/SecurityOrigin.cpp

index 88b2bdb..05879fa 100644 (file)
@@ -1,3 +1,15 @@
+2016-07-25  Brady Eidson  <beidson@apple.com>
+
+        Allow LocalStorage by default for file URLs.
+        https://bugs.webkit.org/show_bug.cgi?id=160169
+
+        Reviewed by Brent Fulgham.
+
+        * storage/domstorage/localstorage/blocked-file-access-expected.txt: Removed.
+        * storage/domstorage/localstorage/file-can-access-expected.txt: Added.
+        * storage/domstorage/localstorage/file-can-access.html: Renamed from LayoutTests/storage/domstorage/localstorage/blocked-file-access.html.
+        * storage/domstorage/localstorage/resources/unblocked-example.html: Renamed from LayoutTests/storage/domstorage/localstorage/resources/blocked-example.html.
+
 2016-07-25  Nan Wang  <n_wang@apple.com>
 
         AX: AccessibilityRenderObject is adding duplicated children when CSS first-letter is being used.
diff --git a/LayoutTests/storage/domstorage/localstorage/blocked-file-access-expected.txt b/LayoutTests/storage/domstorage/localstorage/blocked-file-access-expected.txt
deleted file mode 100644 (file)
index 95a04bb..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-CONSOLE MESSAGE: line 11: PASS: window.localStorage is NOT accessible
-CONSOLE MESSAGE: line 12: Exception: The operation is insecure.
-
-Test that we cannot access localStorage from a file URL if unversal access is turned off.
diff --git a/LayoutTests/storage/domstorage/localstorage/file-can-access-expected.txt b/LayoutTests/storage/domstorage/localstorage/file-can-access-expected.txt
new file mode 100644 (file)
index 0000000..6a142b4
--- /dev/null
@@ -0,0 +1,3 @@
+CONSOLE MESSAGE: line 8: PASS: window.localStorage WAS accessible
+
+Test that we can access localStorage from a file URL even if universal access is turned off.
@@ -9,8 +9,8 @@ if (window.testRunner) {
 </script>
 </head>
 <body>
-<iframe src="resources/blocked-example.html"></iframe>
+<iframe src="resources/unblocked-example.html"></iframe>
 <div id="results"></div>
-Test that we cannot access localStorage from a file URL if unversal access is turned off.
+Test that we can access localStorage from a file URL even if universal access is turned off.
 </body>
 </html>
@@ -5,10 +5,10 @@ function runTest()
 {
     try {
         if (window.localStorage) {
-            console.log("FAIL: window.localStorage WAS accessible");
+            console.log("PASS: window.localStorage WAS accessible");
         }
     } catch(e) {
-        console.log("PASS: window.localStorage is NOT accessible");
+        console.log("FAIL: window.localStorage is NOT accessible");
         console.log("Exception: " + e.message);
     }
     if (window.testRunner)
index 2adc881..07183b8 100644 (file)
@@ -1,3 +1,15 @@
+2016-07-25  Brady Eidson  <beidson@apple.com>
+
+        Allow LocalStorage by default for file URLs.
+        https://bugs.webkit.org/show_bug.cgi?id=160169
+
+        Reviewed by Brent Fulgham.
+
+        Test: storage/domstorage/localstorage/file-can-access.html
+
+        * page/SecurityOrigin.cpp:
+        (WebCore::SecurityOrigin::canAccessStorage): Remove the m_universalAccess check for local URLs.
+
 2016-07-25  Nan Wang  <n_wang@apple.com>
 
         AX: AccessibilityRenderObject is adding duplicated children when CSS first-letter is being used.
index 1ae7b9f..997a748 100644 (file)
@@ -375,9 +375,6 @@ bool SecurityOrigin::canAccessStorage(const SecurityOrigin* topOrigin, ShouldAll
     if (m_storageBlockingPolicy == BlockAllStorage)
         return false;
 
-    if (isLocal() && !m_universalAccess && shouldAllowFromThirdParty != AlwaysAllowFromThirdParty)
-        return false;
-
     // FIXME: This check should be replaced with an ASSERT once we can guarantee that topOrigin is not null.
     if (!topOrigin)
         return true;