Modified: trunk/Source/WebKit/ChangeLog (276310 => 276311)
--- trunk/Source/WebKit/ChangeLog 2021-04-20 17:17:24 UTC (rev 276310)
+++ trunk/Source/WebKit/ChangeLog 2021-04-20 17:19:02 UTC (rev 276311)
@@ -1,3 +1,13 @@
+2021-04-20 Alex Christensen <[email protected]>
+
+ Fix use-after-move introduced in r275407
+ https://bugs.webkit.org/show_bug.cgi?id=224045
+
+ Reviewed by Darin Adler.
+
+ * UIProcess/ios/WKGeolocationProviderIOS.mm:
+ (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
+
2021-04-20 Marco Felsch <[email protected]>
[WPE] QML WPEView dynamic loading fails
Modified: trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm (276310 => 276311)
--- trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm 2021-04-20 17:17:24 UTC (rev 276310)
+++ trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm 2021-04-20 17:19:02 UTC (rev 276311)
@@ -197,7 +197,7 @@
return;
}
- auto policyListener = adoptNS([[WKWebAllowDenyPolicyListener alloc] initWithCompletionHandler:WTFMove(request.completionHandler)]);
+ auto policyListener = adoptNS([[WKWebAllowDenyPolicyListener alloc] initWithCompletionHandler:WTFMove(decisionHandler)]);
WebKit::decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin::create(request.url).get(), request.url, policyListener.get(), request.view.get());
}
Modified: trunk/Tools/ChangeLog (276310 => 276311)
--- trunk/Tools/ChangeLog 2021-04-20 17:17:24 UTC (rev 276310)
+++ trunk/Tools/ChangeLog 2021-04-20 17:19:02 UTC (rev 276311)
@@ -1,3 +1,17 @@
+2021-04-20 Alex Christensen <[email protected]>
+
+ Fix use-after-move introduced in r275407
+ https://bugs.webkit.org/show_bug.cgi?id=224045
+
+ Reviewed by Darin Adler.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/Geolocation.mm:
+ (-[FakeWebGeolocationPolicyDecider receivedRequest]):
+ (-[FakeWebGeolocationPolicyDecider decidePolicyForGeolocationRequestFromOrigin:requestingURL:window:listener:]):
+ (fakeWebGeolocationPolicyDecider):
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/ios/UIKitSPI.h:
+
2021-04-20 Marco Felsch <[email protected]>
[WPE][Qt] Fix build failure after r270690
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Geolocation.mm (276310 => 276311)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Geolocation.mm 2021-04-20 17:17:24 UTC (rev 276310)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Geolocation.mm 2021-04-20 17:19:02 UTC (rev 276311)
@@ -27,14 +27,19 @@
#if PLATFORM(IOS_FAMILY)
+#import "ClassMethodSwizzler.h"
#import "PlatformUtilities.h"
+#import "TestUIDelegate.h"
#import "TestWKWebView.h"
+#import "UIKitSPI.h"
#import <CoreLocation/CLLocation.h>
#import <WebKit/WKProcessPoolPrivate.h>
#import <WebKit/WKUIDelegatePrivate.h>
+#import <WebKit/WebAllowDenyPolicyListener.h>
#import <WebKit/_WKGeolocationCoreLocationProvider.h>
#import <WebKit/_WKGeolocationPosition.h>
#import <wtf/MainThread.h>
+#import <wtf/NeverDestroyed.h>
#import <wtf/RetainPtr.h>
static bool hasReceivedAlert;
@@ -134,8 +139,28 @@
@end
+@interface FakeWebGeolocationPolicyDecider : NSObject
+- (bool)receivedRequest;
+@end
+@implementation FakeWebGeolocationPolicyDecider {
+ bool _receivedRequest;
+}
+- (bool)receivedRequest
+{
+ return _receivedRequest;
+}
+- (void)decidePolicyForGeolocationRequestFromOrigin:(id)securityOrigin requestingURL:(NSURL *)requestingURL window:(UIWindow *)window listener:(id<WebAllowDenyPolicyListener>)listener
+{
+ _receivedRequest = true;
+ [listener allow];
+}
+@end
-using namespace std;
+static FakeWebGeolocationPolicyDecider *fakeWebGeolocationPolicyDecider()
+{
+ static NeverDestroyed<RetainPtr<FakeWebGeolocationPolicyDecider>> decider = adoptNS([FakeWebGeolocationPolicyDecider new]);
+ return decider.get().get();
+}
namespace TestWebKitAPI {
@@ -143,7 +168,7 @@
// view. Without this, the web process would wait until the page is visible before sending
// the requests to the UI process.
-TEST(WebKit, GeolocationDeniedByLocationProvider)
+TEST(Geolocation, DeniedByLocationProvider)
{
auto uiDelegate = adoptNS([[GeolocationTestUIDelegate alloc] init]);
auto coreLocationProvider = adoptNS([[TestCoreLocationProvider alloc] init]);
@@ -167,7 +192,7 @@
EXPECT_FALSE(uiDelegate.get().authorizationWasRequested);
}
-TEST(WebKit, GeolocationDeniedByAPI)
+TEST(Geolocation, DeniedByAPI)
{
auto uiDelegate = adoptNS([[GeolocationTestUIDelegate alloc] init]);
auto coreLocationProvider = adoptNS([[TestCoreLocationProvider alloc] init]);
@@ -191,7 +216,7 @@
EXPECT_TRUE(uiDelegate.get().authorizationWasRequested);
}
-TEST(WebKit, GeolocationAllowedByAPI)
+TEST(Geolocation, AllowedByAPI)
{
auto uiDelegate = adoptNS([[GeolocationTestUIDelegate alloc] init]);
auto coreLocationProvider = adoptNS([[TestCoreLocationProvider alloc] init]);
@@ -215,7 +240,7 @@
EXPECT_TRUE(uiDelegate.get().authorizationWasRequested);
}
-TEST(WebKit, GeolocationError)
+TEST(Geolocation, Error)
{
auto uiDelegate = adoptNS([[GeolocationTestUIDelegate alloc] init]);
auto coreLocationProvider = adoptNS([[TestCoreLocationProvider alloc] init]);
@@ -240,7 +265,7 @@
EXPECT_TRUE(uiDelegate.get().authorizationWasRequested);
}
-TEST(WebKit, DuplicateGeolocationAuthorizationCallbackCalls)
+TEST(Geolocation, DuplicateAuthorizationCallbackCalls)
{
auto uiDelegate = adoptNS([[GeolocationTestUIDelegate alloc] init]);
auto coreLocationProvider = adoptNS([[TestCoreLocationProvider alloc] init]);
@@ -265,6 +290,23 @@
EXPECT_TRUE(uiDelegate.get().authorizationWasRequested);
}
+TEST(Geolocation, DelegateNotImplemented)
+{
+ auto coreLocationProvider = adoptNS([TestCoreLocationProvider new]);
+ coreLocationProvider.get().shouldAuthorizeGeolocation = YES;
+ auto processPool = adoptNS([WKProcessPool new]);
+ processPool.get()._coreLocationProvider = coreLocationProvider.get();
+ auto config = adoptNS([WKWebViewConfiguration new]);
+ config.get().processPool = processPool.get();
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:config.get()]);
+ ClassMethodSwizzler swizzler([UIWebGeolocationPolicyDecider class], @selector(sharedPolicyDecider), reinterpret_cast<IMP>(fakeWebGeolocationPolicyDecider));
+ EXPECT_FALSE(fakeWebGeolocationPolicyDecider().receivedRequest);
+ [webView loadTestPageNamed:@"GeolocationGetCurrentPositionResult"];
+ EXPECT_WK_STREQ([webView _test_waitForAlert], "SUCCESS");
+ EXPECT_TRUE(coreLocationProvider.get().authorizationWasRequested);
+ EXPECT_TRUE(fakeWebGeolocationPolicyDecider().receivedRequest);
+}
+
} // namespace TestWebKitAPI
#endif // PLATFORM(IOS_FAMILY)
Modified: trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h (276310 => 276311)
--- trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h 2021-04-20 17:17:24 UTC (rev 276310)
+++ trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h 2021-04-20 17:19:02 UTC (rev 276311)
@@ -308,4 +308,11 @@
- (void)_share:(id)sender;
@end
+@interface UIWebGeolocationPolicyDecider : NSObject
+@end
+
+@interface UIWebGeolocationPolicyDecider ()
++ (instancetype)sharedPolicyDecider;
+@end
+
#endif // PLATFORM(IOS_FAMILY)