Diff
Modified: trunk/Source/WebKit2/ChangeLog (219377 => 219378)
--- trunk/Source/WebKit2/ChangeLog 2017-07-12 00:25:38 UTC (rev 219377)
+++ trunk/Source/WebKit2/ChangeLog 2017-07-12 00:25:41 UTC (rev 219378)
@@ -1,3 +1,24 @@
+2017-07-11 Ansh Shukla <[email protected]>
+
+ WKWindowFeatures needs to expose scrollbar, fullscreen, and dialog configuration properties
+ https://bugs.webkit.org/show_bug.cgi?id=174239
+
+ Reviewed by Brady Eidson.
+
+ Add a new private header to expose getters for window feature properties already available
+ in the TFB APIWindowFeatures class. These properties are necessary for Safari to adopt more
+ modern API.
+
+ * UIProcess/API/Cocoa/WKWindowFeatures.mm:
+ (-[WKWindowFeatures _locationBarVisibility]):
+ (-[WKWindowFeatures _scrollbarsVisibility]):
+ (-[WKWindowFeatures _fullscreenDisplay]):
+ (-[WKWindowFeatures _dialogDisplay]):
+ * UIProcess/API/Cocoa/WKWindowFeaturesInternal.h: Expose some window features as read-only
+ properties.
+ * UIProcess/API/Cocoa/WKWindowFeaturesPrivate.h:
+ * WebKit2.xcodeproj/project.pbxproj:
+
2017-07-11 Chris Dumez <[email protected]>
Avoid duplicating default parameter values in [WKWebsiteDataStore _resourceLoadStatisticsResetToConsistentState]
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWindowFeatures.mm (219377 => 219378)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWindowFeatures.mm 2017-07-12 00:25:38 UTC (rev 219377)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWindowFeatures.mm 2017-07-12 00:25:41 UTC (rev 219378)
@@ -101,4 +101,28 @@
@end
+@implementation WKWindowFeatures (WKPrivate)
+
+- (NSNumber *)_locationBarVisibility
+{
+ return @(_windowFeatures->windowFeatures().locationBarVisible);
+}
+
+- (NSNumber *)_scrollbarsVisibility
+{
+ return @(_windowFeatures->windowFeatures().scrollbarsVisible);
+}
+
+- (NSNumber *)_fullscreenDisplay
+{
+ return @(_windowFeatures->windowFeatures().fullscreen);
+}
+
+- (NSNumber *)_dialogDisplay
+{
+ return @(_windowFeatures->windowFeatures().dialog);
+}
+
+@end
+
#endif
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWindowFeaturesInternal.h (219377 => 219378)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWindowFeaturesInternal.h 2017-07-12 00:25:38 UTC (rev 219377)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWindowFeaturesInternal.h 2017-07-12 00:25:41 UTC (rev 219378)
@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import "WKWindowFeatures.h"
+#import "WKWindowFeaturesPrivate.h"
#if WK_API_ENABLED
Copied: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWindowFeaturesPrivate.h (from rev 219376, trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWindowFeaturesInternal.h) (0 => 219378)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWindowFeaturesPrivate.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWindowFeaturesPrivate.h 2017-07-12 00:25:41 UTC (rev 219378)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017 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 <WebKit/WKWindowFeatures.h>
+
+#if WK_API_ENABLED
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface WKWindowFeatures (WKPrivate)
+
+@property (nullable, nonatomic, readonly) NSNumber *_locationBarVisibility WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+@property (nullable, nonatomic, readonly) NSNumber *_scrollbarsVisibility WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+@property (nullable, nonatomic, readonly) NSNumber *_fullscreenDisplay WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+@property (nullable, nonatomic, readonly) NSNumber *_dialogDisplay WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (219377 => 219378)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2017-07-12 00:25:38 UTC (rev 219377)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2017-07-12 00:25:41 UTC (rev 219378)
@@ -1189,6 +1189,7 @@
6501BD1A12F1243400E9F248 /* WKBundleInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65B86F1712F11D7B00B7DD8A /* WKBundleInspector.cpp */; };
659C551E130006410025C0C2 /* InjectedBundlePageResourceLoadClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6546A82913000164000CEB1C /* InjectedBundlePageResourceLoadClient.cpp */; };
65B86F1E12F11DE300B7DD8A /* WKBundleInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 6A5080BF1F0EDAAA00E617C5 /* WKWindowFeaturesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 6A5080BE1F0EDAAA00E617C5 /* WKWindowFeaturesPrivate.h */; settings = {ATTRIBUTES = (Public, ); }; };
6B821DDC1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B821DDA1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.h */; };
6B821DDD1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B821DDB1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.cpp */; };
6BE969C11E54D452008B7483 /* corePrediction_model in Resources */ = {isa = PBXBuildFile; fileRef = 6BE969C01E54D452008B7483 /* corePrediction_model */; };
@@ -3472,6 +3473,7 @@
6546A82A13000164000CEB1C /* InjectedBundlePageResourceLoadClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageResourceLoadClient.h; sourceTree = "<group>"; };
65B86F1712F11D7B00B7DD8A /* WKBundleInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleInspector.cpp; sourceTree = "<group>"; };
65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleInspector.h; sourceTree = "<group>"; };
+ 6A5080BE1F0EDAAA00E617C5 /* WKWindowFeaturesPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKWindowFeaturesPrivate.h; sourceTree = "<group>"; };
6B821DDA1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebResourceLoadStatisticsTelemetry.h; sourceTree = "<group>"; };
6B821DDB1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebResourceLoadStatisticsTelemetry.cpp; sourceTree = "<group>"; };
6BE969C01E54D452008B7483 /* corePrediction_model */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = corePrediction_model; sourceTree = "<group>"; };
@@ -5740,6 +5742,7 @@
1A66BF8E18A052ED002071B4 /* WKWebViewInternal.h */,
26F9A83A18A3463F00AEB88A /* WKWebViewPrivate.h */,
1AD60F5C18E20F4C0020C034 /* WKWindowFeatures.h */,
+ 6A5080BE1F0EDAAA00E617C5 /* WKWindowFeaturesPrivate.h */,
1AD60F5B18E20F4C0020C034 /* WKWindowFeatures.mm */,
1AD60F5F18E20F740020C034 /* WKWindowFeaturesInternal.h */,
);
@@ -8765,6 +8768,7 @@
CDA29A2B1CBEB67A00901CCF /* WebPlaybackSessionManagerProxyMessages.h in Headers */,
31D5929F166E060000E6BF02 /* WebPlugInClient.h in Headers */,
BC5744F012638FB3006F0F12 /* WebPopupItem.h in Headers */,
+ 6A5080BF1F0EDAAA00E617C5 /* WKWindowFeaturesPrivate.h in Headers */,
D3B9484711FF4B6500032B39 /* WebPopupMenu.h in Headers */,
BC574E631267D080006F0F12 /* WebPopupMenuProxy.h in Headers */,
BC5750971268F3C6006F0F12 /* WebPopupMenuProxyMac.h in Headers */,
Modified: trunk/Tools/ChangeLog (219377 => 219378)
--- trunk/Tools/ChangeLog 2017-07-12 00:25:38 UTC (rev 219377)
+++ trunk/Tools/ChangeLog 2017-07-12 00:25:41 UTC (rev 219378)
@@ -1,3 +1,18 @@
+2017-07-11 Ansh Shukla <[email protected]>
+
+ WKWindowFeatures needs to expose scrollbar, fullscreen, and dialog configuration properties
+ https://bugs.webkit.org/show_bug.cgi?id=174239
+
+ Reviewed by Brady Eidson.
+
+ Create windows with specific features set and make sure those are properly reflected in the
+ WKWindowFeatures object.
+
+ * TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm:
+ (resetToConsistentState):
+ (-[CheckWindowFeaturesUIDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]):
+ (TEST):
+
2017-07-11 Jonathan Bedard <[email protected]>
Do not duplicate files when deleting directories with svn 1.9
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm (219377 => 219378)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm 2017-07-12 00:25:38 UTC (rev 219377)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm 2017-07-12 00:25:41 UTC (rev 219378)
@@ -30,6 +30,7 @@
#import <WebKit/WKUIDelegatePrivate.h>
#import <WebKit/WKWebView.h>
#import <WebKit/WKWebViewConfiguration.h>
+#import <WebKit/WKWindowFeaturesPrivate.h>
#import <wtf/RetainPtr.h>
#if WK_API_ENABLED
@@ -36,11 +37,14 @@
@class OpenAndCloseWindowUIDelegate;
@class OpenAndCloseWindowUIDelegateAsync;
+@class CheckWindowFeaturesUIDelegate;
static bool isDone;
static RetainPtr<WKWebView> openedWebView;
+static RetainPtr<WKWindowFeatures> openWindowFeatures;
static RetainPtr<OpenAndCloseWindowUIDelegate> sharedUIDelegate;
static RetainPtr<OpenAndCloseWindowUIDelegateAsync> sharedUIDelegateAsync;
+static RetainPtr<CheckWindowFeaturesUIDelegate> sharedCheckWindowFeaturesUIDelegate;
static void resetToConsistentState()
{
@@ -48,6 +52,7 @@
openedWebView = nil;
sharedUIDelegate = nil;
sharedUIDelegateAsync = nil;
+ sharedCheckWindowFeaturesUIDelegate = nil;
}
@interface OpenAndCloseWindowUIDelegate : NSObject <WKUIDelegate>
@@ -202,4 +207,82 @@
// EXPECT_EQ(caughtException, true);
//}
+
+@interface CheckWindowFeaturesUIDelegate : NSObject <WKUIDelegate>
+
+@property (nullable, nonatomic, readonly) NSNumber *menuBarVisibility;
+@property (nullable, nonatomic, readonly) NSNumber *statusBarVisibility;
+@property (nullable, nonatomic, readonly) NSNumber *toolbarsVisibility;
+
+@end
+
+@implementation CheckWindowFeaturesUIDelegate
+
+- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
+{
+ openWindowFeatures = windowFeatures;
+ isDone = true;
+
+ return nil;
+}
+
+@end
+
+TEST(WebKit2, OpenWindowFeatures)
+{
+ resetToConsistentState();
+
+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+
+ sharedCheckWindowFeaturesUIDelegate = adoptNS([[CheckWindowFeaturesUIDelegate alloc] init]);
+ [webView setUIDelegate:sharedCheckWindowFeaturesUIDelegate.get()];
+ [webView configuration].preferences._javascript_CanOpenWindowsAutomatically = YES;
+ NSString *windowOpenFormatString = @"window.open(\"about:blank\", \"_blank\", \"%@\")";
+
+ [webView evaluateJavaScript:@"window.open(\"about:blank\")" completionHandler:nil];
+ TestWebKitAPI::Util::run(&isDone);
+ isDone = false;
+
+// https://bugs.webkit.org/show_bug.cgi?id=174271 - WebCore currently doesn't distinguish between unspecified (nil) and false
+// for the following window features.
+// EXPECT_TRUE([openWindowFeatures menuBarVisibility] == nil);
+// EXPECT_TRUE([openWindowFeatures statusBarVisibility] == nil);
+// EXPECT_TRUE([openWindowFeatures toolbarsVisibility] == nil);
+// EXPECT_TRUE([openWindowFeatures allowsResizing] == nil);
+// EXPECT_TRUE([openWindowFeatures _locationBarVisibility] == nil);
+// EXPECT_TRUE([openWindowFeatures _scrollbarsVisibility] == nil);
+// EXPECT_TRUE([openWindowFeatures _fullscreenDisplay] == nil);
+// EXPECT_TRUE([openWindowFeatures _dialogDisplay] == nil);
+ openWindowFeatures = nullptr;
+
+ NSString *featuresStringAllSpecifiedAndTrue = @"menubar=yes,status=yes,toolbar=yes,resizable=yes,location=yes,scrollbars=yes,fullscreen=yes";
+ [webView evaluateJavaScript:[NSString stringWithFormat:windowOpenFormatString, featuresStringAllSpecifiedAndTrue] completionHandler:nil];
+ TestWebKitAPI::Util::run(&isDone);
+ isDone = false;
+
+ EXPECT_TRUE([openWindowFeatures menuBarVisibility].boolValue);
+ EXPECT_TRUE([openWindowFeatures statusBarVisibility].boolValue);
+ EXPECT_TRUE([openWindowFeatures toolbarsVisibility].boolValue);
+ EXPECT_TRUE([openWindowFeatures allowsResizing].boolValue);
+ EXPECT_TRUE([openWindowFeatures _locationBarVisibility].boolValue);
+ EXPECT_TRUE([openWindowFeatures _scrollbarsVisibility].boolValue);
+ EXPECT_TRUE([openWindowFeatures _fullscreenDisplay].boolValue);
+ openWindowFeatures = nullptr;
+
+ NSString *featuresStringAllSpecifiedAndFalse = @"menubar=no,status=no,toolbar=no,resizable=no,location=no,scrollbars=no,fullscreen=no";
+ [webView evaluateJavaScript:[NSString stringWithFormat:windowOpenFormatString, featuresStringAllSpecifiedAndFalse] completionHandler:nil];
+ TestWebKitAPI::Util::run(&isDone);
+ isDone = false;
+
+ EXPECT_FALSE([openWindowFeatures menuBarVisibility].boolValue);
+ EXPECT_FALSE([openWindowFeatures statusBarVisibility ].boolValue);
+ EXPECT_FALSE([openWindowFeatures toolbarsVisibility].boolValue);
+// https://bugs.webkit.org/show_bug.cgi?id=174388 - This property doesn't accurately reflect the parameters passed by the webpage.
+// EXPECT_FALSE([openWindowFeatures allowsResizing].boolValue);
+ EXPECT_FALSE([openWindowFeatures _locationBarVisibility].boolValue);
+ EXPECT_FALSE([openWindowFeatures _scrollbarsVisibility].boolValue);
+ EXPECT_FALSE([openWindowFeatures _fullscreenDisplay].boolValue);
+ openWindowFeatures = nullptr;
+}
+
#endif