Title: [285731] trunk
Revision
285731
Author
[email protected]
Date
2021-11-12 10:29:14 -0800 (Fri, 12 Nov 2021)

Log Message

Disable MathML when in Captive Portal Mode
https://bugs.webkit.org/show_bug.cgi?id=233013
<rdar://84567129>

Reviewed by Brent Fulgham.

Source/WebCore:

Add runtime feature flag for MathML and update implementation in WebCore to only support
MathML when the flag is on.

* bindings/js/WebCoreBuiltinNames.h:
* dom/Document.cpp:
(WebCore::Document::createElement):
* mathml/MathMLElement.idl:
* mathml/MathMLMathElement.idl:

Source/WebKit:

Turn off MathML support when in Captive Portal Mode.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Source/WTF:

Add runtime feature flag for MathML.

* Scripts/Preferences/WebPreferences.yaml:

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (285730 => 285731)


--- trunk/Source/WTF/ChangeLog	2021-11-12 18:15:56 UTC (rev 285730)
+++ trunk/Source/WTF/ChangeLog	2021-11-12 18:29:14 UTC (rev 285731)
@@ -1,5 +1,17 @@
 2021-11-12  Chris Dumez  <[email protected]>
 
+        Disable MathML when in Captive Portal Mode
+        https://bugs.webkit.org/show_bug.cgi?id=233013
+        <rdar://84567129>
+
+        Reviewed by Brent Fulgham.
+
+        Add runtime feature flag for MathML.
+
+        * Scripts/Preferences/WebPreferences.yaml:
+
+2021-11-12  Chris Dumez  <[email protected]>
+
         Unreviewed, partial revert of r285565 to resolve a PLT5 regression.
         <rdar://85269156>
 

Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferences.yaml (285730 => 285731)


--- trunk/Source/WTF/Scripts/Preferences/WebPreferences.yaml	2021-11-12 18:15:56 UTC (rev 285730)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferences.yaml	2021-11-12 18:29:14 UTC (rev 285731)
@@ -1340,6 +1340,17 @@
     WebCore:
       default: false
 
+MathMLEnabled:
+  type: bool
+  condition: ENABLE(MATHML)
+  defaultValue:
+    WebKitLegacy:
+      default: true
+    WebKit:
+      default: true
+    WebCore:
+      default: true
+
 MaxParseDuration:
   type: double
   webKitLegacyPreferenceKey: WebKitMaxParseDurationPreferenceKey

Modified: trunk/Source/WebCore/ChangeLog (285730 => 285731)


--- trunk/Source/WebCore/ChangeLog	2021-11-12 18:15:56 UTC (rev 285730)
+++ trunk/Source/WebCore/ChangeLog	2021-11-12 18:29:14 UTC (rev 285731)
@@ -1,3 +1,20 @@
+2021-11-12  Chris Dumez  <[email protected]>
+
+        Disable MathML when in Captive Portal Mode
+        https://bugs.webkit.org/show_bug.cgi?id=233013
+        <rdar://84567129>
+
+        Reviewed by Brent Fulgham.
+
+        Add runtime feature flag for MathML and update implementation in WebCore to only support
+        MathML when the flag is on.
+
+        * bindings/js/WebCoreBuiltinNames.h:
+        * dom/Document.cpp:
+        (WebCore::Document::createElement):
+        * mathml/MathMLElement.idl:
+        * mathml/MathMLMathElement.idl:
+
 2021-11-11  Mark Lam  <[email protected]>
 
         Refactor allocateCell() and tryAllocateCell() to take VM& instead of Heap&.

Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (285730 => 285731)


--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2021-11-12 18:15:56 UTC (rev 285730)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2021-11-12 18:29:14 UTC (rev 285731)
@@ -197,6 +197,8 @@
     macro(KeyframeEffect) \
     macro(Lock) \
     macro(LockManager) \
+    macro(MathMLElement) \
+    macro(MathMLMathElement) \
     macro(MediaCapabilities) \
     macro(MediaCapabilitiesInfo) \
     macro(MediaDevices) \

Modified: trunk/Source/WebCore/dom/Document.cpp (285730 => 285731)


--- trunk/Source/WebCore/dom/Document.cpp	2021-11-12 18:15:56 UTC (rev 285730)
+++ trunk/Source/WebCore/dom/Document.cpp	2021-11-12 18:29:14 UTC (rev 285731)
@@ -1256,7 +1256,7 @@
     } else if (name.namespaceURI() == SVGNames::svgNamespaceURI)
         element = SVGElementFactory::createElement(name, *this, createdByParser);
 #if ENABLE(MATHML)
-    else if (name.namespaceURI() == MathMLNames::mathmlNamespaceURI)
+    else if (settings().mathMLEnabled() && name.namespaceURI() == MathMLNames::mathmlNamespaceURI)
         element = MathMLElementFactory::createElement(name, *this, createdByParser);
 #endif
 

Modified: trunk/Source/WebCore/mathml/MathMLElement.idl (285730 => 285731)


--- trunk/Source/WebCore/mathml/MathMLElement.idl	2021-11-12 18:15:56 UTC (rev 285730)
+++ trunk/Source/WebCore/mathml/MathMLElement.idl	2021-11-12 18:29:14 UTC (rev 285731)
@@ -25,6 +25,7 @@
 
 [
     Conditional=MATHML,
+    EnabledBySetting=MathMLEnabled,
     JSGenerateToNativeObject,
     Exposed=Window
 ] interface MathMLElement : Element {

Modified: trunk/Source/WebCore/mathml/MathMLMathElement.idl (285730 => 285731)


--- trunk/Source/WebCore/mathml/MathMLMathElement.idl	2021-11-12 18:15:56 UTC (rev 285730)
+++ trunk/Source/WebCore/mathml/MathMLMathElement.idl	2021-11-12 18:29:14 UTC (rev 285731)
@@ -25,6 +25,7 @@
 
 [
     Conditional=MATHML,
+    EnabledBySetting=MathMLEnabled,
     Exposed=Window
 ] interface MathMLMathElement : MathMLElement {
 };

Modified: trunk/Source/WebKit/ChangeLog (285730 => 285731)


--- trunk/Source/WebKit/ChangeLog	2021-11-12 18:15:56 UTC (rev 285730)
+++ trunk/Source/WebKit/ChangeLog	2021-11-12 18:29:14 UTC (rev 285731)
@@ -1,5 +1,18 @@
 2021-11-12  Chris Dumez  <[email protected]>
 
+        Disable MathML when in Captive Portal Mode
+        https://bugs.webkit.org/show_bug.cgi?id=233013
+        <rdar://84567129>
+
+        Reviewed by Brent Fulgham.
+
+        Turn off MathML support when in Captive Portal Mode.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
+2021-11-12  Chris Dumez  <[email protected]>
+
         Rename ProcessLauncherMac.mm to ProcessLauncherDarwin.mm
         https://bugs.webkit.org/show_bug.cgi?id=233045
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (285730 => 285731)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-11-12 18:15:56 UTC (rev 285730)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-11-12 18:29:14 UTC (rev 285731)
@@ -4074,6 +4074,9 @@
 #if ENABLE(WEB_RTC)
         settings.setPeerConnectionEnabled(false);
 #endif
+#if ENABLE(MATHML)
+        settings.setMathMLEnabled(false);
+#endif
     }
 
     m_page->settingsDidChange();

Modified: trunk/Tools/ChangeLog (285730 => 285731)


--- trunk/Tools/ChangeLog	2021-11-12 18:15:56 UTC (rev 285730)
+++ trunk/Tools/ChangeLog	2021-11-12 18:29:14 UTC (rev 285731)
@@ -1,5 +1,17 @@
 2021-11-12  Chris Dumez  <[email protected]>
 
+        Disable MathML when in Captive Portal Mode
+        https://bugs.webkit.org/show_bug.cgi?id=233013
+        <rdar://84567129>
+
+        Reviewed by Brent Fulgham.
+
+        Add API test coverage.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+
+2021-11-12  Chris Dumez  <[email protected]>
+
         WebKit is unable to recover if a WebProcess gets terminated while it is launching
         https://bugs.webkit.org/show_bug.cgi?id=233001
         <rdar://85302938>

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (285730 => 285731)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2021-11-12 18:15:56 UTC (rev 285730)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2021-11-12 18:29:14 UTC (rev 285731)
@@ -7670,6 +7670,10 @@
     EXPECT_EQ(runJSCheck("!!window.RTCPeerConnection"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // WebRTC Peer Connection.
     EXPECT_EQ(runJSCheck("!!navigator.mediaDevices"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // GetUserMedia (Media Capture).
     EXPECT_EQ(runJSCheck("!!navigator.getUserMedia"_s), false); // Legacy GetUserMedia (currently always disabled).
+    EXPECT_EQ(runJSCheck("!!window.MathMLElement"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // MathML.
+    EXPECT_EQ(runJSCheck("!!window.MathMLMathElement"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // MathML.
+    String mathMLCheck = makeString("document.createElementNS('http://www.w3.org/1998/Math/MathML','mspace').__proto__ == ", shouldBeEnabled == ShouldBeEnabled::Yes ? "MathMLElement" : "Element", ".prototype");
+    EXPECT_EQ(runJSCheck(mathMLCheck), true); // MathML.
 }
 
 TEST(ProcessSwap, NavigatingToCaptivePortalMode)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to