Diff
Modified: trunk/LayoutTests/ChangeLog (274621 => 274622)
--- trunk/LayoutTests/ChangeLog 2021-03-18 08:08:14 UTC (rev 274621)
+++ trunk/LayoutTests/ChangeLog 2021-03-18 08:25:41 UTC (rev 274622)
@@ -1,3 +1,15 @@
+2021-03-18 Youenn Fablet <[email protected]>
+
+ Geolocation API does not work in WKWebView with custom URL scheme handler
+ https://bugs.webkit.org/show_bug.cgi?id=222861
+
+ Reviewed by Eric Carlson.
+
+ * TestExpectations: Skip WPT test that is using localhost so is actually secure.
+ Validated that behavior is consistent with Chrome and Firefox.
+ * http/tests/security/resources/geolocation-over-insecure-content.html:
+ Use internals API to mimick insecure context.
+
2021-03-18 Cathie Chen <[email protected]>
Import css/css-contain test from WPT
Modified: trunk/LayoutTests/TestExpectations (274621 => 274622)
--- trunk/LayoutTests/TestExpectations 2021-03-18 08:08:14 UTC (rev 274621)
+++ trunk/LayoutTests/TestExpectations 2021-03-18 08:25:41 UTC (rev 274622)
@@ -417,6 +417,7 @@
imported/w3c/web-platform-tests/clipboard-apis/feature-policy/clipboard-read/clipboard-read-enabled-by-feature-policy-cross-origin-tentative.https.sub.html [ Skip ]
imported/w3c/web-platform-tests/clipboard-apis/feature-policy/clipboard-read/clipboard-read-enabled-by-feature-policy.tentative.https.sub.html [ Skip ]
imported/w3c/web-platform-tests/clipboard-apis/feature-policy/clipboard-read/clipboard-read-enabled-on-self-origin-by-feature-policy.tentative.https.sub.html [ Skip ]
+imported/w3c/web-platform-tests/geolocation-API/non-secure-contexts.http.html [ Skip ]
imported/w3c/web-platform-tests/geolocation-API/getCurrentPosition_permission_allow.https.html [ Skip ]
imported/w3c/web-platform-tests/geolocation-API/getCurrentPosition_permission_deny.https.html [ Skip ]
imported/w3c/web-platform-tests/geolocation-API/watchPosition_permission_deny.https.html [ Skip ]
Modified: trunk/LayoutTests/http/tests/security/resources/geolocation-over-insecure-content.html (274621 => 274622)
--- trunk/LayoutTests/http/tests/security/resources/geolocation-over-insecure-content.html 2021-03-18 08:08:14 UTC (rev 274621)
+++ trunk/LayoutTests/http/tests/security/resources/geolocation-over-insecure-content.html 2021-03-18 08:25:41 UTC (rev 274622)
@@ -1,5 +1,7 @@
<body _onload_="loaded()">
<script>
+ if (window.internals)
+ internals.markContextAsInsecure();
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
}
Modified: trunk/Source/WebCore/ChangeLog (274621 => 274622)
--- trunk/Source/WebCore/ChangeLog 2021-03-18 08:08:14 UTC (rev 274621)
+++ trunk/Source/WebCore/ChangeLog 2021-03-18 08:25:41 UTC (rev 274622)
@@ -1,3 +1,18 @@
+2021-03-18 Youenn Fablet <[email protected]>
+
+ Geolocation API does not work in WKWebView with custom URL scheme handler
+ https://bugs.webkit.org/show_bug.cgi?id=222861
+ <rdar://problem/75394695>
+
+ Reviewed by Eric Carlson.
+
+ Covered by API tests.
+
+ * Modules/geolocation/Geolocation.cpp:
+ (WebCore::Geolocation::shouldBlockGeolocationRequests):
+ Use Document::isSecureContext to validate whether the document is secure.
+ This is consistent with other APIs.
+
2021-03-17 Devin Rousso <[email protected]>
don't copy `imageOverlay.css` or `meterElementShadow.css`
Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp (274621 => 274622)
--- trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp 2021-03-18 08:08:14 UTC (rev 274621)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp 2021-03-18 08:25:41 UTC (rev 274622)
@@ -353,7 +353,7 @@
bool Geolocation::shouldBlockGeolocationRequests()
{
- bool isSecure = SecurityOrigin::isSecure(document()->url());
+ bool isSecure = SecurityOrigin::isSecure(document()->url()) || document()->isSecureContext();
bool hasMixedContent = !document()->foundMixedContent().isEmpty();
bool isLocalOrigin = securityOrigin()->isLocal();
if (securityOrigin()->canRequestGeolocation()) {
Modified: trunk/Source/WebKit/ChangeLog (274621 => 274622)
--- trunk/Source/WebKit/ChangeLog 2021-03-18 08:08:14 UTC (rev 274621)
+++ trunk/Source/WebKit/ChangeLog 2021-03-18 08:25:41 UTC (rev 274622)
@@ -1,3 +1,16 @@
+2021-03-18 Youenn Fablet <[email protected]>
+
+ Geolocation API does not work in WKWebView with custom URL scheme handler
+ https://bugs.webkit.org/show_bug.cgi?id=222861
+ <rdar://problem/75394695>
+
+ Reviewed by Eric Carlson.
+
+ Update geolocation prompt origin to match getUserMedia and show the app name instead of custom scheme origin.
+
+ * UIProcess/Cocoa/MediaPermissionUtilities.mm:
+ (WebKit::alertMessageText):
+
2021-03-18 Wenson Hsieh <[email protected]>
[iOS] Web process sometimes crashes under WebPage::positionInformation() after r274031
Modified: trunk/Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm (274621 => 274622)
--- trunk/Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm 2021-03-18 08:08:14 UTC (rev 274621)
+++ trunk/Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm 2021-03-18 08:25:41 UTC (rev 274622)
@@ -138,7 +138,7 @@
case MediaPermissionReason::DeviceOrientation:
return [NSString stringWithFormat:WEB_UI_NSSTRING(@"“%@” Would Like to Access Motion and Orientation", @"Message for requesting access to the device motion and orientation"), visibleOrigin];
case MediaPermissionReason::Geolocation:
- return [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” to use your current location?", @"Message for geolocation prompt"), visibleDomain(origin.host)];
+ return [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” to use your current location?", @"Message for geolocation prompt"), visibleOrigin];
case MediaPermissionReason::SpeechRecognition:
return [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” to capture your audio and use it for speech recognition?", @"Message for spechrecognition prompt"), visibleDomain(origin.host)];
}
Modified: trunk/Tools/ChangeLog (274621 => 274622)
--- trunk/Tools/ChangeLog 2021-03-18 08:08:14 UTC (rev 274621)
+++ trunk/Tools/ChangeLog 2021-03-18 08:25:41 UTC (rev 274622)
@@ -1,3 +1,16 @@
+2021-03-18 Youenn Fablet <[email protected]>
+
+ Geolocation API does not work in WKWebView with custom URL scheme handler
+ https://bugs.webkit.org/show_bug.cgi?id=222861
+ <rdar://problem/75394695>
+
+ Reviewed by Eric Carlson.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
+ (-[GeolocationDelegate setValidationHandler:]):
+ (-[GeolocationDelegate _webView:requestGeolocationPermissionForFrame:decisionHandler:]):
+ (TEST):
+
2021-03-18 Kimmo Kinnunen <[email protected]>
WebGL conformance test update script does not use min_version and max_version in all cases
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm (274621 => 274622)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm 2021-03-18 08:08:14 UTC (rev 274621)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm 2021-03-18 08:25:41 UTC (rev 274622)
@@ -28,6 +28,7 @@
#import "HTTPServer.h"
#import "PlatformUtilities.h"
#import "TestNavigationDelegate.h"
+#import "TestURLSchemeHandler.h"
#import "TestWKWebView.h"
#import "Utilities.h"
#import "WKWebViewConfigurationExtras.h"
@@ -102,10 +103,11 @@
@interface GeolocationDelegate : NSObject <WKUIDelegatePrivate> {
bool _allowGeolocation;
+ Function<void(WKFrameInfo*)> _validationHandler;
}
- (id)initWithAllowGeolocation:(bool)allowGeolocation;
-
+- (void)setValidationHandler:(Function<void(WKFrameInfo*)>&&)validationHandler;
@end
@implementation GeolocationDelegate
@@ -118,13 +120,14 @@
return self;
}
+- (void)setValidationHandler:(Function<void(WKFrameInfo*)>&&)validationHandler {
+ _validationHandler = WTFMove(validationHandler);
+}
+
- (void)_webView:(WKWebView *)webView requestGeolocationPermissionForFrame:(WKFrameInfo *)frame decisionHandler:(void (^)(BOOL allowed))decisionHandler
{
- EXPECT_TRUE(frame.isMainFrame);
- EXPECT_STREQ(frame.request.URL.absoluteString.UTF8String, _allowGeolocation ? "https://example.org/" : "https://example.com/");
- EXPECT_EQ(frame.securityOrigin.port, 0);
- EXPECT_STREQ(frame.securityOrigin.protocol.UTF8String, "https");
- EXPECT_STREQ(frame.securityOrigin.host.UTF8String, _allowGeolocation ? "example.org" : "example.com");
+ if (_validationHandler)
+ _validationHandler(frame);
decisionHandler(_allowGeolocation);
}
@@ -159,17 +162,56 @@
auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
configuration.get().processPool = pool.get();
+
+ auto schemeHandler = adoptNS([[TestURLSchemeHandler alloc] init]);
+ [schemeHandler setStartURLSchemeTaskHandler:^(WKWebView *, id<WKURLSchemeTask> task) {
+ NSURL *requestURL = [task request].URL;
+ auto response = adoptNS([[NSURLResponse alloc] initWithURL:requestURL MIMEType:@"text/html" expectedContentLength:[html length] textEncodingName:nil]);
+ [task didReceiveResponse:response.get()];
+ [task didReceiveData:[html dataUsingEncoding:NSUTF8StringEncoding]];
+ [task didFinish];
+ }];
+ [configuration setURLSchemeHandler:schemeHandler.get() forURLScheme:@"custom"];
+
auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration.get()]);
+
auto delegate1 = adoptNS([[GeolocationDelegate alloc] initWithAllowGeolocation:false]);
[webView setUIDelegate:delegate1.get()];
+
+ done = false;
+ [delegate1 setValidationHandler:[](WKFrameInfo *frame) {
+ EXPECT_TRUE(frame.isMainFrame);
+ EXPECT_STREQ(frame.request.URL.absoluteString.UTF8String, "https://example.com/");
+ EXPECT_EQ(frame.securityOrigin.port, 0);
+ EXPECT_STREQ(frame.securityOrigin.protocol.UTF8String, "https");
+ EXPECT_STREQ(frame.securityOrigin.host.UTF8String, "example.com");
+ }];
[webView loadHTMLString:html baseURL:[NSURL URLWithString:@"https://example.com/"]];
TestWebKitAPI::Util::run(&done);
done = false;
auto delegate2 = adoptNS([[GeolocationDelegate alloc] initWithAllowGeolocation:true]);
+ [delegate2 setValidationHandler:[](WKFrameInfo *frame) {
+ EXPECT_TRUE(frame.isMainFrame);
+ EXPECT_STREQ(frame.request.URL.absoluteString.UTF8String, "https://example.org/");
+ EXPECT_EQ(frame.securityOrigin.port, 0);
+ EXPECT_STREQ(frame.securityOrigin.protocol.UTF8String, "https");
+ EXPECT_STREQ(frame.securityOrigin.host.UTF8String, "example.org");
+ }];
[webView setUIDelegate:delegate2.get()];
[webView loadHTMLString:html baseURL:[NSURL URLWithString:@"https://example.org/"]];
TestWebKitAPI::Util::run(&done);
+
+ done = false;
+ [delegate2 setValidationHandler:[](WKFrameInfo *frame) {
+ EXPECT_TRUE(frame.isMainFrame);
+ EXPECT_STREQ(frame.request.URL.absoluteString.UTF8String, "custom://localhost/mainframe.html");
+ EXPECT_EQ(frame.securityOrigin.port, 0);
+ EXPECT_STREQ(frame.securityOrigin.protocol.UTF8String, "custom");
+ EXPECT_STREQ(frame.securityOrigin.host.UTF8String, "localhost");
+ }];
+ [webView loadHTMLString:html baseURL:[NSURL URLWithString:@"custom://localhost/mainframe.html"]];
+ TestWebKitAPI::Util::run(&done);
}
@interface GeolocationDelegateNew : NSObject <WKUIDelegatePrivate>