Changeset 285873 in webkit
- Timestamp:
- Nov 16, 2021, 10:27:57 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r285869 r285873 1 2021-11-16 Chris Dumez <cdumez@apple.com> 2 3 [iOS] Do not require the web browser entitlement to opt into captive portal mode 4 https://bugs.webkit.org/show_bug.cgi?id=233191 5 6 Reviewed by Brent Fulgham. 7 8 Do not require the web browser entitlement to opt into captive portal mode on iOS, only require 9 it to opt out. 10 11 * UIProcess/API/Cocoa/WKWebpagePreferences.mm: 12 (-[WKWebpagePreferences _setCaptivePortalModeEnabled:]): 13 1 14 2021-11-16 Per Arne Vollan <pvollan@apple.com> 2 15 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm
r285739 r285873 394 394 - (void)_setCaptivePortalModeEnabled:(BOOL)captivePortalModeEnabled 395 395 { 396 if (_websitePolicies->captivePortalModeEnabled() == captivePortalModeEnabled) 397 return; 398 396 399 #if PLATFORM(IOS_FAMILY) 397 if (!WTF::processHasEntitlement("com.apple.developer.web-browser")) 398 return; 399 #endif 400 // On iOS, the web browser entitlement is required to disable captive portal mode. 401 if (!captivePortalModeEnabled && !WTF::processHasEntitlement("com.apple.developer.web-browser")) 402 [NSException raise:NSInternalInconsistencyException format:@"The 'com.apple.developer.web-browser' restricted entitlement is required to disable captive portal mode"]; 403 #endif 404 400 405 _websitePolicies->setCaptivePortalModeEnabled(!!captivePortalModeEnabled); 401 406 } -
trunk/Tools/ChangeLog
r285872 r285873 1 2021-11-16 Chris Dumez <cdumez@apple.com> 2 3 [iOS] Do not require the web browser entitlement to opt into captive portal mode 4 https://bugs.webkit.org/show_bug.cgi?id=233191 5 6 Reviewed by Brent Fulgham. 7 8 Update API test coverage accordingly. 9 10 * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: 11 1 12 2021-11-16 Andres Gonzalez <andresg_22@apple.com> 2 13 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm
r285739 r285873 7627 7627 } 7628 7628 7629 // On iOS, toggling the captive portal mode requires the browser entitlement, which TestWebKit API doesn't have.7630 // Also, some API tests rely on the browser entitlement not being present.7631 #if !PLATFORM(IOS)7632 7633 7629 static bool isJITEnabled(WKWebView *webView) 7634 7630 { … … 7724 7720 } 7725 7721 7722 #if PLATFORM(IOS) 7723 7724 TEST(ProcessSwap, CannotDisableCaptivePortalModeWithoutBrowserEntitlement) 7725 { 7726 auto webViewConfiguration = adoptNS([WKWebViewConfiguration new]); 7727 EXPECT_FALSE(webViewConfiguration.get().defaultWebpagePreferences._captivePortalModeEnabled); 7728 [webViewConfiguration.get().defaultWebpagePreferences _setCaptivePortalModeEnabled:YES]; 7729 [webViewConfiguration.get().preferences _setMediaDevicesEnabled:YES]; 7730 webViewConfiguration.get().preferences._mediaCaptureRequiresSecureConnection = NO; 7731 7732 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]); 7733 auto delegate = adoptNS([TestNavigationDelegate new]); 7734 [webView setNavigationDelegate:delegate.get()]; 7735 7736 EXPECT_FALSE(isJITEnabled(webView.get())); 7737 checkSettingsControlledByCaptivePortalMode(webView.get(), ShouldBeEnabled::No, IsShowingInitialEmptyDocument::Yes); 7738 pid_t pid1 = [webView _webProcessIdentifier]; 7739 7740 __block bool finishedNavigation = false; 7741 delegate.get().didFinishNavigation = ^(WKWebView *, WKNavigation *) { 7742 finishedNavigation = true; 7743 }; 7744 7745 delegate.get().decidePolicyForNavigationActionWithPreferences = ^(WKNavigationAction *action, WKWebpagePreferences *preferences, void (^completionHandler)(WKNavigationActionPolicy, WKWebpagePreferences *)) { 7746 EXPECT_TRUE(preferences._captivePortalModeEnabled); 7747 bool didThrowWhenTryingToDisableCaptivePortalMode = false; 7748 // TestWebKitAPI doesn't have the web browser entitlement and thus shouldn't be able to disable captive portal mode. 7749 @try { 7750 [preferences _setCaptivePortalModeEnabled:NO]; 7751 } @catch (NSException *exception) { 7752 didThrowWhenTryingToDisableCaptivePortalMode = true; 7753 } 7754 EXPECT_TRUE(didThrowWhenTryingToDisableCaptivePortalMode); 7755 completionHandler(WKNavigationActionPolicyAllow, preferences); 7756 }; 7757 7758 NSURL *url = [[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; 7759 [webView loadRequest:[NSURLRequest requestWithURL:url]]; 7760 TestWebKitAPI::Util::run(&finishedNavigation); 7761 7762 EXPECT_EQ(pid1, [webView _webProcessIdentifier]); // Shouldn't have process-swapped since we're staying in captive portal mode. 7763 EXPECT_FALSE(isJITEnabled(webView.get())); 7764 checkSettingsControlledByCaptivePortalMode(webView.get(), ShouldBeEnabled::No); 7765 } 7766 7767 #else 7768 7726 7769 TEST(ProcessSwap, CaptivePortalModeEnabledByDefaultThenOptOut) 7727 7770 {
Note:
See TracChangeset
for help on using the changeset viewer.