Title: [129567] trunk
Revision
129567
Author
jp...@apple.com
Date
2012-09-25 16:00:25 -0700 (Tue, 25 Sep 2012)

Log Message

Add WebKit1 SPI for storage blocking preference
https://bugs.webkit.org/show_bug.cgi?id=97356

Reviewed by Brady Eidson.

Source/WebKit/mac:

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences setStorageBlockingPolicy:]):
(-[WebPreferences storageBlockingPolicy]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

LayoutTests:

* http/tests/security/cross-origin-local-storage-wk1-expected.txt: Added.
* http/tests/security/cross-origin-local-storage-wk1.html: Added.
* platform/chromium/TestExpectations: Test currently fails on Chromium.
* platform/mac-wk2/http/tests/security/cross-origin-local-storage-wk1-expected.txt: Added.
* platform/mac/http/tests/security/cross-origin-local-storage-wk1-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (129566 => 129567)


--- trunk/LayoutTests/ChangeLog	2012-09-25 22:54:30 UTC (rev 129566)
+++ trunk/LayoutTests/ChangeLog	2012-09-25 23:00:25 UTC (rev 129567)
@@ -1,3 +1,16 @@
+2012-09-24  Jeffrey Pfau  <jp...@apple.com>
+
+        Add WebKit1 SPI for storage blocking preference
+        https://bugs.webkit.org/show_bug.cgi?id=97356
+
+        Reviewed by Brady Eidson.
+
+        * http/tests/security/cross-origin-local-storage-wk1-expected.txt: Added.
+        * http/tests/security/cross-origin-local-storage-wk1.html: Added.
+        * platform/chromium/TestExpectations: Test currently fails on Chromium.
+        * platform/mac-wk2/http/tests/security/cross-origin-local-storage-wk1-expected.txt: Added.
+        * platform/mac/http/tests/security/cross-origin-local-storage-wk1-expected.txt: Added.
+
 2012-09-25  Beth Dakin  <bda...@apple.com>
 
         Moving this test which was added with

Added: trunk/LayoutTests/http/tests/security/cross-origin-local-storage-wk1-expected.txt (0 => 129567)


--- trunk/LayoutTests/http/tests/security/cross-origin-local-storage-wk1-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/security/cross-origin-local-storage-wk1-expected.txt	2012-09-25 23:00:25 UTC (rev 129567)
@@ -0,0 +1,16 @@
+This iframe should return a security error:
+
+
+This iframe should not return any errors:
+
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+No exception
+
+--------
+Frame: '<!--framePath //<!--frame1-->-->'
+--------
+No exception

Added: trunk/LayoutTests/http/tests/security/cross-origin-local-storage-wk1.html (0 => 129567)


--- trunk/LayoutTests/http/tests/security/cross-origin-local-storage-wk1.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/security/cross-origin-local-storage-wk1.html	2012-09-25 23:00:25 UTC (rev 129567)
@@ -0,0 +1,24 @@
+<html>
+<head>
+<script>
+var frames = 2;
+if (window.testRunner) {
+	testRunner.dumpAsText();
+	testRunner.dumpChildFramesAsText();
+	testRunner.overridePreference('WebKitStorageBlockingPolicy', 1);
+}
+
+function decrement() {
+	--frames;
+	if (!frames && window.testRunner)
+		testRunner.overridePreference('WebKitStorageBlockingPolicy', 0);
+}
+</script>
+</head>
+<body>
+<p>This iframe should return a security error:</p>
+<iframe src="" _onload_="decrement()"></iframe>
+<p>This iframe should not return any errors:</p>
+<iframe src="" _onload_="decrement()"></iframe>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (129566 => 129567)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-09-25 22:54:30 UTC (rev 129566)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-09-25 23:00:25 UTC (rev 129567)
@@ -3562,6 +3562,9 @@
 # The test should pass after harfbuzz transition.
 webkit.org/b/97296 [ Linux Win ] fast/text/international/hebrew-selection.html [ ImageOnlyFailure ]
 
+# Expected to fail until storage blocking settings have a WebKit1 API in Chromium.
+webkit.org/b/97491 http/tests/security/cross-origin-local-storage-wk1.html [ Failure Pass ]
+
 # Expected to fail until WebGL extension implementation lands
 webkit.org/b/96961 fast/canvas/webgl/oes-vertex-array-object.html [ Failure Pass ]
 webkit.org/b/96961 platform/chromium/virtual/gpu/fast/canvas/webgl/oes-vertex-array-object.html [ Failure Pass ]

Added: trunk/LayoutTests/platform/mac/http/tests/security/cross-origin-local-storage-wk1-expected.txt (0 => 129567)


--- trunk/LayoutTests/platform/mac/http/tests/security/cross-origin-local-storage-wk1-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/http/tests/security/cross-origin-local-storage-wk1-expected.txt	2012-09-25 23:00:25 UTC (rev 129567)
@@ -0,0 +1,16 @@
+This iframe should return a security error:
+
+
+This iframe should not return any errors:
+
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+SECURITY_ERR
+
+--------
+Frame: '<!--framePath //<!--frame1-->-->'
+--------
+No exception

Added: trunk/LayoutTests/platform/mac-wk2/http/tests/security/cross-origin-local-storage-wk1-expected.txt (0 => 129567)


--- trunk/LayoutTests/platform/mac-wk2/http/tests/security/cross-origin-local-storage-wk1-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/http/tests/security/cross-origin-local-storage-wk1-expected.txt	2012-09-25 23:00:25 UTC (rev 129567)
@@ -0,0 +1,16 @@
+This iframe should return a security error:
+
+
+This iframe should not return any errors:
+
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+No exception
+
+--------
+Frame: '<!--framePath //<!--frame1-->-->'
+--------
+No exception

Modified: trunk/Source/WebKit/mac/ChangeLog (129566 => 129567)


--- trunk/Source/WebKit/mac/ChangeLog	2012-09-25 22:54:30 UTC (rev 129566)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-09-25 23:00:25 UTC (rev 129567)
@@ -1,3 +1,19 @@
+2012-09-21  Jeffrey Pfau  <jp...@apple.com>
+
+        Add WebKit1 SPI for storage blocking preference
+        https://bugs.webkit.org/show_bug.cgi?id=97356
+
+        Reviewed by Brady Eidson.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences setStorageBlockingPolicy:]):
+        (-[WebPreferences storageBlockingPolicy]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2012-09-24  Simon Fraser  <simon.fra...@apple.com>
 
         <rdar://problem/12351906> Have DumpRenderTree and WebKitTestRunner crash logs show which test crashed

Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (129566 => 129567)


--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2012-09-25 22:54:30 UTC (rev 129566)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2012-09-25 23:00:25 UTC (rev 129567)
@@ -126,6 +126,7 @@
 #define WebKitRequestAnimationFrameEnabledPreferenceKey @"WebKitRequestAnimationFrameEnabled"
 #define WebKitDiagnosticLoggingEnabledKey @"WebKitDiagnosticLoggingEnabled"
 #define WebKitScreenFontSubstitutionEnabledKey @"WebKitScreenFontSubstitutionEnabled"
+#define WebKitStorageBlockingPolicyKey @"WebKitStorageBlockingPolicy"
 
 // These are private both because callers should be using the cover methods and because the
 // cover methods themselves are private.

Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (129566 => 129567)


--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2012-09-25 22:54:30 UTC (rev 129566)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2012-09-25 23:00:25 UTC (rev 129567)
@@ -400,6 +400,7 @@
         [NSNumber numberWithBool:NO],   WebKitWantsBalancedSetDefersLoadingBehaviorKey,
         [NSNumber numberWithBool:NO],   WebKitDiagnosticLoggingEnabledKey,
         [NSNumber numberWithBool:YES],  WebKitScreenFontSubstitutionEnabledKey,
+        [NSNumber numberWithInt:WebAllowAllStorage], WebKitStorageBlockingPolicyKey,
 
         [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
         [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota,
@@ -1750,6 +1751,16 @@
     [self _setBoolValue:enabled forKey:WebKitScreenFontSubstitutionEnabledKey];
 }
 
+- (void)setStorageBlockingPolicy:(WebStorageBlockingPolicy)storageBlockingPolicy
+{
+    [self _setIntegerValue:storageBlockingPolicy forKey:WebKitStorageBlockingPolicyKey];
+}
+
+- (WebStorageBlockingPolicy)storageBlockingPolicy
+{
+    return static_cast<WebStorageBlockingPolicy>([self _integerValueForKey:WebKitStorageBlockingPolicyKey]);
+}
+
 @end
 
 @implementation WebPreferences (WebInternal)

Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (129566 => 129567)


--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2012-09-25 22:54:30 UTC (rev 129566)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2012-09-25 23:00:25 UTC (rev 129567)
@@ -43,6 +43,12 @@
     WebTextDirectionSubmenuAlwaysIncluded
 } WebTextDirectionSubmenuInclusionBehavior;
 
+typedef enum {
+    WebAllowAllStorage = 0,
+    WebBlockThirdPartyStorage,
+    WebBlockAllStorage
+} WebStorageBlockingPolicy;
+
 extern NSString *WebPreferencesChangedNotification;
 extern NSString *WebPreferencesRemovedNotification;
 extern NSString *WebPreferencesChangedInternalNotification;
@@ -308,4 +314,7 @@
 - (BOOL)screenFontSubstitutionEnabled;
 - (void)setScreenFontSubstitutionEnabled:(BOOL)enabled;
 
+- (void)setStorageBlockingPolicy:(WebStorageBlockingPolicy)storageBlockingPolicy;
+- (WebStorageBlockingPolicy)storageBlockingPolicy;
+
 @end

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (129566 => 129567)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2012-09-25 22:54:30 UTC (rev 129566)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2012-09-25 23:00:25 UTC (rev 129567)
@@ -1563,6 +1563,18 @@
     settings->setNeedsDidFinishLoadOrderQuirk(needsDidFinishLoadOrderQuirk());
     settings->setDiagnosticLoggingEnabled([preferences diagnosticLoggingEnabled]);
 
+    switch ([preferences storageBlockingPolicy]) {
+    case WebAllowAllStorage:
+        settings->setStorageBlockingPolicy(SecurityOrigin::AllowAllStorage);
+        break;
+    case WebBlockThirdPartyStorage:
+        settings->setStorageBlockingPolicy(SecurityOrigin::BlockThirdPartyStorage);
+        break;
+    case WebBlockAllStorage:
+        settings->setStorageBlockingPolicy(SecurityOrigin::BlockAllStorage);
+        break;
+    }
+
     // We have enabled this setting in WebKit2 for the sake of some ScrollingCoordinator work.
     // To avoid possible rendering differences, we should enable it for WebKit1 too.
     settings->setFixedPositionCreatesStackingContext(true);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to