Title: [291579] trunk
Revision
291579
Author
bfulg...@apple.com
Date
2022-03-21 14:23:58 -0700 (Mon, 21 Mar 2022)

Log Message

Disable the <model> element in Captive Portal mode.
https://bugs.webkit.org/show_bug.cgi?id=238148
<rdar://90562002>

Reviewed by Chris Dumez.

Source/WebKit:

When displaying content in a captive portal, we should make sure the experimental
<model> element is unavailable.

Tests: TestWebKitAPI

* WebProcess/WebPage/WebPage.cpp:
(WebKit::adjustSettingsForCaptivePortal): Added. Also turn off <model> support.
(WebKit::WebPage::updatePreferences): Call new helper function.

Tools:

Update tests to check <model> element.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (291578 => 291579)


--- trunk/Source/WebKit/ChangeLog	2022-03-21 20:44:52 UTC (rev 291578)
+++ trunk/Source/WebKit/ChangeLog	2022-03-21 21:23:58 UTC (rev 291579)
@@ -1,3 +1,20 @@
+2022-03-21  Brent Fulgham  <bfulg...@apple.com>
+
+        Disable the <model> element in Captive Portal mode.
+        https://bugs.webkit.org/show_bug.cgi?id=238148
+        <rdar://90562002>
+
+        Reviewed by Chris Dumez.
+
+        When displaying content in a captive portal, we should make sure the experimental
+        <model> element is unavailable.
+
+        Tests: TestWebKitAPI
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::adjustSettingsForCaptivePortal): Added. Also turn off <model> support.
+        (WebKit::WebPage::updatePreferences): Call new helper function.
+
 2022-03-21  Per Arne Vollan  <pvol...@apple.com>
 
         [watchOS] Add required syscall

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (291578 => 291579)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2022-03-21 20:44:52 UTC (rev 291578)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2022-03-21 21:23:58 UTC (rev 291579)
@@ -3956,6 +3956,61 @@
     return false;
 }
 
+static void adjustSettingsForCaptivePortal(Settings& settings, const WebPreferencesStore& store)
+{
+    settings.setWebGLEnabled(false);
+#if ENABLE(WEBGL2)
+    settings.setWebGL2Enabled(false);
+#endif
+#if ENABLE(GAMEPAD)
+    settings.setGamepadsEnabled(false);
+#endif
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+    settings.setRemotePlaybackEnabled(false);
+#endif
+    settings.setFileSystemAccessEnabled(false);
+    settings.setAllowsPictureInPictureMediaPlayback(false);
+#if ENABLE(PICTURE_IN_PICTURE_API)
+    settings.setPictureInPictureAPIEnabled(false);
+#endif
+    settings.setSpeechRecognitionEnabled(false);
+#if ENABLE(NOTIFICATIONS)
+    settings.setNotificationsEnabled(false);
+#endif
+#if ENABLE(SERVICE_WORKER)
+    settings.setPushAPIEnabled(false);
+#endif
+#if ENABLE(WEBXR)
+    settings.setWebXREnabled(false);
+    settings.setWebXRAugmentedRealityModuleEnabled(false);
+#endif
+#if ENABLE(MODEL_ELEMENT)
+    settings.setModelElementEnabled(false);
+#endif
+#if ENABLE(MEDIA_STREAM)
+    settings.setMediaDevicesEnabled(false);
+#endif
+#if ENABLE(WEB_AUDIO)
+    settings.setWebAudioEnabled(false);
+#endif
+    settings.setDownloadableBinaryFontsEnabled(false);
+#if ENABLE(WEB_RTC)
+    settings.setPeerConnectionEnabled(false);
+#endif
+#if ENABLE(MATHML)
+    settings.setMathMLEnabled(false);
+#endif
+#if ENABLE(PDFJS)
+    settings.setPdfJSViewerEnabled(true);
+#endif
+
+    settings.setAllowedMediaContainerTypes(store.getStringValueForKey(WebPreferencesKey::mediaContainerTypesAllowedInCaptivePortalModeKey()));
+    settings.setAllowedMediaCodecTypes(store.getStringValueForKey(WebPreferencesKey::mediaCodecTypesAllowedInCaptivePortalModeKey()));
+    settings.setAllowedMediaVideoCodecIDs(store.getStringValueForKey(WebPreferencesKey::mediaVideoCodecIDsAllowedInCaptivePortalModeKey()));
+    settings.setAllowedMediaAudioCodecIDs(store.getStringValueForKey(WebPreferencesKey::mediaAudioCodecIDsAllowedInCaptivePortalModeKey()));
+    settings.setAllowedMediaCaptionFormatTypes(store.getStringValueForKey(WebPreferencesKey::mediaCaptionFormatTypesAllowedInCaptivePortalModeKey()));
+}
+
 void WebPage::updatePreferences(const WebPreferencesStore& store)
 {
     updatePreferencesGenerated(store);
@@ -4076,57 +4131,9 @@
 
     // FIXME: This should be automated by adding a new field in WebPreferences*.yaml
     // that indicates override state for captive portal mode. https://webkit.org/b/233100.
-    if (WebProcess::singleton().isCaptivePortalModeEnabled()) {
-        settings.setWebGLEnabled(false);
-#if ENABLE(WEBGL2)
-        settings.setWebGL2Enabled(false);
-#endif
-#if ENABLE(GAMEPAD)
-        settings.setGamepadsEnabled(false);
-#endif
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
-        settings.setRemotePlaybackEnabled(false);
-#endif
-        settings.setFileSystemAccessEnabled(false);
-        settings.setAllowsPictureInPictureMediaPlayback(false);
-#if ENABLE(PICTURE_IN_PICTURE_API)
-        settings.setPictureInPictureAPIEnabled(false);
-#endif
-        settings.setSpeechRecognitionEnabled(false);
-#if ENABLE(NOTIFICATIONS)
-        settings.setNotificationsEnabled(false);
-#endif
-#if ENABLE(SERVICE_WORKER)
-        settings.setPushAPIEnabled(false);
-#endif
-#if ENABLE(WEBXR)
-        settings.setWebXREnabled(false);
-        settings.setWebXRAugmentedRealityModuleEnabled(false);
-#endif
-#if ENABLE(MEDIA_STREAM)
-        settings.setMediaDevicesEnabled(false);
-#endif
-#if ENABLE(WEB_AUDIO)
-        settings.setWebAudioEnabled(false);
-#endif
-        settings.setDownloadableBinaryFontsEnabled(false);
-#if ENABLE(WEB_RTC)
-        settings.setPeerConnectionEnabled(false);
-#endif
-#if ENABLE(MATHML)
-        settings.setMathMLEnabled(false);
-#endif
-#if ENABLE(PDFJS)
-        settings.setPdfJSViewerEnabled(true);
-#endif
+    if (WebProcess::singleton().isCaptivePortalModeEnabled())
+        adjustSettingsForCaptivePortal(settings, store);
 
-        settings.setAllowedMediaContainerTypes(store.getStringValueForKey(WebPreferencesKey::mediaContainerTypesAllowedInCaptivePortalModeKey()));
-        settings.setAllowedMediaCodecTypes(store.getStringValueForKey(WebPreferencesKey::mediaCodecTypesAllowedInCaptivePortalModeKey()));
-        settings.setAllowedMediaVideoCodecIDs(store.getStringValueForKey(WebPreferencesKey::mediaVideoCodecIDsAllowedInCaptivePortalModeKey()));
-        settings.setAllowedMediaAudioCodecIDs(store.getStringValueForKey(WebPreferencesKey::mediaAudioCodecIDsAllowedInCaptivePortalModeKey()));
-        settings.setAllowedMediaCaptionFormatTypes(store.getStringValueForKey(WebPreferencesKey::mediaCaptionFormatTypesAllowedInCaptivePortalModeKey()));
-    }
-
 #if ENABLE(ARKIT_INLINE_PREVIEW)
     m_useARKitForModel = store.getBoolValueForKey(WebPreferencesKey::useARKitForModelKey());
 #endif

Modified: trunk/Tools/ChangeLog (291578 => 291579)


--- trunk/Tools/ChangeLog	2022-03-21 20:44:52 UTC (rev 291578)
+++ trunk/Tools/ChangeLog	2022-03-21 21:23:58 UTC (rev 291579)
@@ -1,3 +1,15 @@
+2022-03-21  Brent Fulgham  <bfulg...@apple.com>
+
+        Disable the <model> element in Captive Portal mode.
+        https://bugs.webkit.org/show_bug.cgi?id=238148
+        <rdar://90562002>
+
+        Reviewed by Chris Dumez.
+
+        Update tests to check <model> element.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+
 2022-03-21  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         [WebGPU] Set the WebGPU WKPreference to true in layout tests

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (291578 => 291579)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2022-03-21 20:44:52 UTC (rev 291578)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2022-03-21 21:23:58 UTC (rev 291579)
@@ -7822,6 +7822,7 @@
     EXPECT_EQ(runJSCheck("!!window.Gamepad"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Gamepad API.
     EXPECT_EQ(runJSCheck("!!window.RemotePlayback"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Remote Playback.
     EXPECT_EQ(runJSCheck("!!window.FileSystemHandle"_s), isShowingInitialEmptyDocument != IsShowingInitialEmptyDocument::Yes && shouldBeEnabled == ShouldBeEnabled::Yes); // File System Access.
+    EXPECT_EQ(runJSCheck("!!window.HTMLModelElement"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // AR (Model)
     EXPECT_EQ(runJSCheck("!!window.PictureInPictureEvent"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Picture in Picture API.
     EXPECT_EQ(runJSCheck("!!window.SpeechRecognitionEvent"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Speech recognition.
     EXPECT_EQ(runJSCheck("!!window.Notification"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Notification API.
@@ -7859,7 +7860,8 @@
     [config.preferences _setNotificationsEnabled:YES];
 
     for (_WKExperimentalFeature *feature in [WKPreferences _experimentalFeatures]) {
-        if ([feature.key isEqualToString:@"PushAPIEnabled"]) {
+        if ([feature.key isEqualToString:@"PushAPIEnabled"]
+            || [feature.key isEqualToString:@"ModelElementEnabled"]) {
             [config.preferences _setEnabled:YES forFeature:feature];
         }
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to