Changeset 285717 in webkit
- Timestamp:
- Nov 12, 2021, 6:57:30 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/WebProcess/WebPage/WebPage.cpp (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r285709 r285717 1 2021-11-12 Chris Dumez <cdumez@apple.com> 2 3 Disable getUserMedia() when in Captive Portal Mode 4 https://bugs.webkit.org/show_bug.cgi?id=233021 5 6 Reviewed by Brent Fulgham. 7 8 Disable getUserMedia() when in Captive Portal Mode. 9 10 No new tests, covered by updated API test. 11 12 * WebProcess/WebPage/WebPage.cpp: 13 (WebKit::WebPage::updatePreferences): 14 1 15 2021-11-11 Sergio Villar Senin <svillar@igalia.com> 2 16 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r285655 r285717 4065 4065 settings.setWebXRAugmentedRealityModuleEnabled(false); 4066 4066 #endif 4067 #if ENABLE(MEDIA_STREAM) 4068 settings.setMediaDevicesEnabled(false); 4069 #endif 4067 4070 #if ENABLE(WEB_AUDIO) 4068 4071 settings.setWebAudioEnabled(false); -
trunk/Tools/ChangeLog
r285698 r285717 1 2021-11-12 Chris Dumez <cdumez@apple.com> 2 3 Disable getUserMedia() when in Captive Portal Mode 4 https://bugs.webkit.org/show_bug.cgi?id=233021 5 6 Reviewed by Brent Fulgham. 7 8 Add API test coverage. 9 10 * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: 11 1 12 2021-11-11 Brent Fulgham <bfulgham@apple.com> 2 13 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm
r285672 r285717 7647 7647 static void checkSettingsControlledByCaptivePortalMode(WKWebView *webView, ShouldBeEnabled shouldBeEnabled, IsShowingInitialEmptyDocument isShowingInitialEmptyDocument = IsShowingInitialEmptyDocument::No) 7648 7648 { 7649 auto checkWindowPropertyExists = [&](ASCIILiteral property) -> bool {7649 auto runJSCheck = [&](const String& js) -> bool { 7650 7650 bool finishedRunningScript = false; 7651 bool propertyExists= false;7652 [webView evaluateJavaScript: makeString("!!window.", property)completionHandler:[&] (id result, NSError *error) {7651 bool checkResult = false; 7652 [webView evaluateJavaScript:js completionHandler:[&] (id result, NSError *error) { 7653 7653 EXPECT_NULL(error); 7654 propertyExists= [result boolValue];7654 checkResult = [result boolValue]; 7655 7655 finishedRunningScript = true; 7656 7656 }]; 7657 7657 TestWebKitAPI::Util::run(&finishedRunningScript); 7658 return propertyExists;7658 return checkResult; 7659 7659 }; 7660 7660 7661 EXPECT_EQ(checkWindowPropertyExists("WebGL2RenderingContext"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // WebGL2. 7662 EXPECT_EQ(checkWindowPropertyExists("Gamepad"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Gamepad API. 7663 EXPECT_EQ(checkWindowPropertyExists("RemotePlayback"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Remote Playback. 7664 EXPECT_EQ(checkWindowPropertyExists("FileSystemHandle"_s), isShowingInitialEmptyDocument != IsShowingInitialEmptyDocument::Yes && shouldBeEnabled == ShouldBeEnabled::Yes); // File System Access. 7665 EXPECT_EQ(checkWindowPropertyExists("EnterPictureInPictureEvent"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Picture in Picture API. 7666 EXPECT_EQ(checkWindowPropertyExists("SpeechRecognitionEvent"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Speech recognition. 7667 EXPECT_EQ(checkWindowPropertyExists("Notification"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Notification API. 7668 EXPECT_EQ(checkWindowPropertyExists("WebXRSystem"_s), false); // WebXR (currently always disabled). 7669 EXPECT_EQ(checkWindowPropertyExists("AudioContext"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // WebAudio. 7670 EXPECT_EQ(checkWindowPropertyExists("RTCPeerConnection"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // WebRTC Peer Connection. 7661 EXPECT_EQ(runJSCheck("!!window.WebGL2RenderingContext"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // WebGL2. 7662 EXPECT_EQ(runJSCheck("!!window.Gamepad"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Gamepad API. 7663 EXPECT_EQ(runJSCheck("!!window.RemotePlayback"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Remote Playback. 7664 EXPECT_EQ(runJSCheck("!!window.FileSystemHandle"_s), isShowingInitialEmptyDocument != IsShowingInitialEmptyDocument::Yes && shouldBeEnabled == ShouldBeEnabled::Yes); // File System Access. 7665 EXPECT_EQ(runJSCheck("!!window.EnterPictureInPictureEvent"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Picture in Picture API. 7666 EXPECT_EQ(runJSCheck("!!window.SpeechRecognitionEvent"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Speech recognition. 7667 EXPECT_EQ(runJSCheck("!!window.Notification"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Notification API. 7668 EXPECT_EQ(runJSCheck("!!window.WebXRSystem"_s), false); // WebXR (currently always disabled). 7669 EXPECT_EQ(runJSCheck("!!window.AudioContext"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // WebAudio. 7670 EXPECT_EQ(runJSCheck("!!window.RTCPeerConnection"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // WebRTC Peer Connection. 7671 EXPECT_EQ(runJSCheck("!!navigator.mediaDevices"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // GetUserMedia (Media Capture). 7672 EXPECT_EQ(runJSCheck("!!navigator.getUserMedia"_s), false); // Legacy GetUserMedia (currently always disabled). 7671 7673 } 7672 7674 7673 7675 TEST(ProcessSwap, NavigatingToCaptivePortalMode) 7674 7676 { 7675 auto webView = adoptNS([WKWebView new]); 7677 auto webViewConfiguration = adoptNS([WKWebViewConfiguration new]); 7678 EXPECT_FALSE(webViewConfiguration.get().defaultWebpagePreferences.captivePortalModeEnabled); 7679 [webViewConfiguration.get().preferences _setMediaDevicesEnabled:YES]; 7680 webViewConfiguration.get().preferences._mediaCaptureRequiresSecureConnection = NO; 7681 7682 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]); 7676 7683 auto delegate = adoptNS([TestNavigationDelegate new]); 7677 7684 [webView setNavigationDelegate:delegate.get()]; … … 7717 7724 EXPECT_FALSE(webViewConfiguration.get().defaultWebpagePreferences.captivePortalModeEnabled); 7718 7725 webViewConfiguration.get().defaultWebpagePreferences.captivePortalModeEnabled = YES; 7726 [webViewConfiguration.get().preferences _setMediaDevicesEnabled:YES]; 7727 webViewConfiguration.get().preferences._mediaCaptureRequiresSecureConnection = NO; 7719 7728 7720 7729 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]); … … 7770 7779 7771 7780 // captive portal mode should be disabled in new WebViews since it is not enabled globally. 7772 auto webView2 = adoptNS([WKWebView new]); 7781 auto webViewConfiguration2 = adoptNS([WKWebViewConfiguration new]); 7782 [webViewConfiguration2.get().preferences _setMediaDevicesEnabled:YES]; 7783 webViewConfiguration2.get().preferences._mediaCaptureRequiresSecureConnection = NO; 7784 auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration2.get()]); 7773 7785 [webView2 setNavigationDelegate:delegate.get()]; 7774 7786 EXPECT_TRUE(isJITEnabled(webView2.get()));
Note:
See TracChangeset
for help on using the changeset viewer.