Title: [98509] trunk
Revision
98509
Author
wei...@apple.com
Date
2011-10-26 12:01:32 -0700 (Wed, 26 Oct 2011)

Log Message

Add initial setting to WKBrowsingContextGroup
https://bugs.webkit.org/show_bug.cgi?id=70942

Reviewed by Anders Carlsson.

Source/WebKit2: 

Test: WKBrowsingContextGroupTest.

* UIProcess/API/mac/WKBrowsingContextGroup.h:
* UIProcess/API/mac/WKBrowsingContextGroup.mm:
(-[WKBrowsingContextGroup isJavaScriptEnabled]):
(-[WKBrowsingContextGroup setJavaScriptEnabled:]):
Add setting to enabled/disable _javascript_. By default it is enabled. 

Tools: 

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextGroupTest.mm: Added.
Add basic test that setting the _javascript_Enabled setting takes. It is not
possible to test its effect quite yet.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (98508 => 98509)


--- trunk/Source/WebKit2/ChangeLog	2011-10-26 18:58:59 UTC (rev 98508)
+++ trunk/Source/WebKit2/ChangeLog	2011-10-26 19:01:32 UTC (rev 98509)
@@ -1,3 +1,18 @@
+2011-10-26  Sam Weinig  <s...@webkit.org>
+
+        Add initial setting to WKBrowsingContextGroup
+        https://bugs.webkit.org/show_bug.cgi?id=70942
+
+        Reviewed by Anders Carlsson.
+
+        Test: WKBrowsingContextGroupTest.
+
+        * UIProcess/API/mac/WKBrowsingContextGroup.h:
+        * UIProcess/API/mac/WKBrowsingContextGroup.mm:
+        (-[WKBrowsingContextGroup isJavaScriptEnabled]):
+        (-[WKBrowsingContextGroup setJavaScriptEnabled:]):
+        Add setting to enabled/disable _javascript_. By default it is enabled. 
+
 2011-10-25  Alexey Proskuryakov  <a...@apple.com>
 
         Embedded PDFs should be known to DocumentLoader

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.h (98508 => 98509)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.h	2011-10-26 18:58:59 UTC (rev 98508)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.h	2011-10-26 19:01:32 UTC (rev 98509)
@@ -36,4 +36,9 @@
 
 - (id)initWithIdentifier:(NSString *)identifier;
 
+
+/* Settings */
+
+@property(getter = isJavaScriptEnabled) BOOL _javascript_Enabled;
+
 @end

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.mm (98508 => 98509)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.mm	2011-10-26 18:58:59 UTC (rev 98508)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.mm	2011-10-26 19:01:32 UTC (rev 98509)
@@ -28,6 +28,7 @@
 #import "WKBrowsingContextGroupInternal.h"
 
 #import "WKPageGroup.h"
+#import "WKPreferences.h"
 #import "WKRetainPtr.h"
 #import "WKStringCF.h"
 
@@ -60,6 +61,16 @@
     [super dealloc];
 }
 
+- (BOOL)isJavaScriptEnabled
+{
+    return WKPreferencesGetJavaScriptEnabled(WKPageGroupGetPreferences(self.pageGroupRef));
+}
+
+- (void)setJavaScriptEnabled:(BOOL)_javascript_Enabled
+{
+    WKPreferencesSetJavaScriptEnabled(WKPageGroupGetPreferences(self.pageGroupRef), _javascript_Enabled);
+}
+
 @end
 
 @implementation WKBrowsingContextGroup (Internal)

Modified: trunk/Tools/ChangeLog (98508 => 98509)


--- trunk/Tools/ChangeLog	2011-10-26 18:58:59 UTC (rev 98508)
+++ trunk/Tools/ChangeLog	2011-10-26 19:01:32 UTC (rev 98509)
@@ -1,3 +1,15 @@
+2011-10-26  Sam Weinig  <s...@webkit.org>
+
+        Add initial setting to WKBrowsingContextGroup
+        https://bugs.webkit.org/show_bug.cgi?id=70942
+
+        Reviewed by Anders Carlsson.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextGroupTest.mm: Added.
+        Add basic test that setting the _javascript_Enabled setting takes. It is not
+        possible to test its effect quite yet.
+
 2011-10-26  Alejandro G. Castro  <a...@igalia.com>
 
         [GTK] [WK2] Add WebKit2 distcheck support

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (98508 => 98509)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2011-10-26 18:58:59 UTC (rev 98508)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2011-10-26 19:01:32 UTC (rev 98509)
@@ -44,6 +44,7 @@
 		BC2D004912A9FDFA00E732A3 /* PageLoadDidChangeLocationWithinPageForFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2D004812A9FDFA00E732A3 /* PageLoadDidChangeLocationWithinPageForFrame.cpp */; };
 		BC2D006412AA04CE00E732A3 /* file-with-anchor.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = BC2D004A12A9FEB300E732A3 /* file-with-anchor.html */; };
 		BC3C4C7214575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC3C4C7014575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm */; };
+		BC3C4C7F14587AA60025FB62 /* WKBrowsingContextGroupTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC3C4C7D14587AA60025FB62 /* WKBrowsingContextGroupTest.mm */; };
 		BC575A90126E74D3006F0F12 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCB9E9F011235BDE00A137E0 /* Cocoa.framework */; };
 		BC575A91126E74D3006F0F12 /* WebKit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCA61DB411700EFD00460D1E /* WebKit2.framework */; };
 		BC575A92126E74D3006F0F12 /* _javascript_Core.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC90964D1255620C00083756 /* _javascript_Core.framework */; };
@@ -180,6 +181,7 @@
 		BC2D004812A9FDFA00E732A3 /* PageLoadDidChangeLocationWithinPageForFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageLoadDidChangeLocationWithinPageForFrame.cpp; sourceTree = "<group>"; };
 		BC2D004A12A9FEB300E732A3 /* file-with-anchor.html */ = {isa = PBXFileReference; explicitFileType = text.html; fileEncoding = 4; path = "file-with-anchor.html"; sourceTree = "<group>"; };
 		BC3C4C7014575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKBrowsingContextLoadDelegateTest.mm; path = WebKit2ObjC/WKBrowsingContextLoadDelegateTest.mm; sourceTree = "<group>"; };
+		BC3C4C7D14587AA60025FB62 /* WKBrowsingContextGroupTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKBrowsingContextGroupTest.mm; path = WebKit2ObjC/WKBrowsingContextGroupTest.mm; sourceTree = "<group>"; };
 		BC575946126E7351006F0F12 /* InjectedBundleMain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleMain.cpp; sourceTree = "<group>"; };
 		BC575980126E74AF006F0F12 /* InjectedBundleTestWebKitAPI.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InjectedBundleTestWebKitAPI.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
 		BC575981126E74AF006F0F12 /* InjectedBundle-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "InjectedBundle-Info.plist"; sourceTree = "<group>"; };
@@ -325,6 +327,7 @@
 		BC3C4C6F14575B1D0025FB62 /* WebKit2 Objective-C */ = {
 			isa = PBXGroup;
 			children = (
+				BC3C4C7D14587AA60025FB62 /* WKBrowsingContextGroupTest.mm */,
 				BC3C4C7014575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm */,
 			);
 			name = "WebKit2 Objective-C";
@@ -637,6 +640,7 @@
 				C0991C51143C7D68007998F2 /* RetainPtrHashing.cpp in Sources */,
 				52CB47411448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp in Sources */,
 				BC3C4C7214575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm in Sources */,
+				BC3C4C7F14587AA60025FB62 /* WKBrowsingContextGroupTest.mm in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextGroupTest.mm (0 => 98509)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextGroupTest.mm	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextGroupTest.mm	2011-10-26 19:01:32 UTC (rev 98509)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "Test.h"
+
+#import <WebKit2/WKBrowsingContextGroup.h>
+
+TEST(WKBrowsingContextGroupTest, GetSetJavaScriptEnabled)
+{
+    WKBrowsingContextGroup *browsingContextGroup = [[WKBrowsingContextGroup alloc] initWithIdentifier:@"TestIdentifier"];
+    
+    ASSERT_TRUE(browsingContextGroup._javascript_Enabled);
+    ASSERT_TRUE([browsingContextGroup isJavaScriptEnabled]);
+
+    browsingContextGroup._javascript_Enabled = NO;
+
+    ASSERT_FALSE(browsingContextGroup._javascript_Enabled);
+    ASSERT_FALSE([browsingContextGroup isJavaScriptEnabled]);
+
+    [browsingContextGroup release];
+}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to