Title: [250461] trunk/Source/WebKit
Revision
250461
Author
timothy_hor...@apple.com
Date
2019-09-27 14:56:21 -0700 (Fri, 27 Sep 2019)

Log Message

Adopt new UIWebGeolocationPolicyDecider SPI to pass a view instead of a window
https://bugs.webkit.org/show_bug.cgi?id=202329
<rdar://problem/25963823>

Reviewed by Wenson Hsieh.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/WKGeolocationProviderIOS.mm:
(-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
* UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm:
(WebKit::decidePolicyForGeolocationRequestFromOrigin):
Switch to newer SPI that takes a UIView instead of a UIWindow, so that
UIWebGeolocationPolicyDecider can find the correct presenting view controller.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (250460 => 250461)


--- trunk/Source/WebKit/ChangeLog	2019-09-27 21:52:37 UTC (rev 250460)
+++ trunk/Source/WebKit/ChangeLog	2019-09-27 21:56:21 UTC (rev 250461)
@@ -1,3 +1,19 @@
+2019-09-27  Tim Horton  <timothy_hor...@apple.com>
+
+        Adopt new UIWebGeolocationPolicyDecider SPI to pass a view instead of a window
+        https://bugs.webkit.org/show_bug.cgi?id=202329
+        <rdar://problem/25963823>
+
+        Reviewed by Wenson Hsieh.
+
+        * Platform/spi/ios/UIKitSPI.h:
+        * UIProcess/ios/WKGeolocationProviderIOS.mm:
+        (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
+        * UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm:
+        (WebKit::decidePolicyForGeolocationRequestFromOrigin):
+        Switch to newer SPI that takes a UIView instead of a UIWindow, so that
+        UIWebGeolocationPolicyDecider can find the correct presenting view controller.
+
 2019-09-27  Zalan Bujtas  <za...@apple.com>
 
         [iPadOS] Can’t use RalphLauren.com on iPad because hover menus don’t stay up

Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (250460 => 250461)


--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2019-09-27 21:52:37 UTC (rev 250460)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2019-09-27 21:56:21 UTC (rev 250461)
@@ -1109,6 +1109,10 @@
 @property (nonatomic, readonly) NSInteger _gsModifierFlags;
 @end
 
+@interface UIWebGeolocationPolicyDecider (Staging_25963823)
+- (void)decidePolicyForGeolocationRequestFromOrigin:(id)securityOrigin requestingURL:(NSURL *)requestingURL view:(UIView *)view listener:(id)listener;
+@end
+
 @interface UIColor (IPI)
 + (UIColor *)insertionPointColor;
 @end

Modified: trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm (250460 => 250461)


--- trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm	2019-09-27 21:52:37 UTC (rev 250460)
+++ trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm	2019-09-27 21:56:21 UTC (rev 250461)
@@ -68,7 +68,7 @@
 @end
 
 namespace WebKit {
-void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin*, const String& urlString, id<WebAllowDenyPolicyListener>, UIWindow*);
+void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin*, const String& urlString, id<WebAllowDenyPolicyListener>, UIView*);
 };
 
 struct GeolocationRequestData {
@@ -211,7 +211,7 @@
 
         if (requiresUserAuthorization) {
             RetainPtr<WKWebAllowDenyPolicyListener> policyListener = adoptNS([[WKWebAllowDenyPolicyListener alloc] initWithCompletionHandler:WTFMove(request.completionHandler)]);
-            WebKit::decidePolicyForGeolocationRequestFromOrigin(request.origin.get(), request.frame->url(), policyListener.get(), [request.view window]);
+            WebKit::decidePolicyForGeolocationRequestFromOrigin(request.origin.get(), request.frame->url(), policyListener.get(), request.view.get());
         } else
             request.completionHandler(true);
     }

Modified: trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm (250460 => 250461)


--- trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm	2019-09-27 21:52:37 UTC (rev 250460)
+++ trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm	2019-09-27 21:56:21 UTC (rev 250461)
@@ -30,7 +30,6 @@
 
 #import "UIKitSPI.h"
 #import <Foundation/NSURL.h>
-#import <UIKit/UIWindow.h>
 #import <WebCore/SecurityOrigin.h>
 #import <wtf/RetainPtr.h>
 #import <wtf/text/WTFString.h>
@@ -45,13 +44,17 @@
 
 namespace WebKit {
 
-void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin*, const String& urlString, id<WebAllowDenyPolicyListener>, UIWindow* window);
+void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin*, const String& urlString, id<WebAllowDenyPolicyListener>, UIView *);
 
-void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin* origin, const String& urlString, id<WebAllowDenyPolicyListener> listener, UIWindow* window)
+void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin* origin, const String& urlString, id<WebAllowDenyPolicyListener> listener, UIView *view)
 {
     RetainPtr<WebSecurityOrigin> securityOrigin = adoptNS([[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]);
     RetainPtr<NSURL> requestUrl = adoptNS([[NSURL alloc] initWithString:urlString]);
-    [[UIWebGeolocationPolicyDecider sharedPolicyDecider] decidePolicyForGeolocationRequestFromOrigin:securityOrigin.get() requestingURL:requestUrl.get() window:window listener:listener];
+    RetainPtr<UIWebGeolocationPolicyDecider> decider = [UIWebGeolocationPolicyDecider sharedPolicyDecider];
+    if ([decider respondsToSelector:@selector(decidePolicyForGeolocationRequestFromOrigin:requestingURL:view:listener:)])
+        [decider decidePolicyForGeolocationRequestFromOrigin:securityOrigin.get() requestingURL:requestUrl.get() view:view listener:listener];
+    else
+        [decider decidePolicyForGeolocationRequestFromOrigin:securityOrigin.get() requestingURL:requestUrl.get() window:view.window listener:listener];
 }
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to