Skip to content

Commit

Permalink
[Lockdown Mode] Disable WebSpeech API (Speech Synthesis)
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=249346
<rdar://problem/103316392>

Reviewed by Chris Dumez.

Disable the speech synthesis portions of the Web Speech API in Lockdown Mode.
(We already disable the Speech Recognition portions).

* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::adjustSettingsForLockdownMode):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

Canonical link: https://commits.webkit.org/257933@main
  • Loading branch information
brentfulgham authored and Brent Fulgham committed Dec 15, 2022
1 parent 4b3c4dd commit f744bdf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Source/WebKit/WebProcess/WebPage/WebPage.cpp
Expand Up @@ -4153,6 +4153,9 @@ static void adjustSettingsForLockdownMode(Settings& settings, const WebPreferenc
settings.setPictureInPictureAPIEnabled(false);
#endif
settings.setSpeechRecognitionEnabled(false);
#if ENABLE(SPEECH_SYNTHESIS)
settings.setSpeechSynthesisAPIEnabled(false);
#endif
#if ENABLE(NOTIFICATIONS)
settings.setNotificationsEnabled(false);
#endif
Expand Down
Expand Up @@ -7877,6 +7877,9 @@ static void checkSettingsControlledByLockdownMode(WKWebView *webView, ShouldBeEn
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.
#if ENABLE(SPEECH_SYNTHESIS)
EXPECT_EQ(runJSCheck("!!window.SpeechSynthesisEvent"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Speech synthesis.
#endif
#if ENABLE(NOTIFICATIONS)
EXPECT_EQ(runJSCheck("!!window.Notification"_s), shouldBeEnabled == ShouldBeEnabled::Yes); // Notification API.
#endif
Expand Down

0 comments on commit f744bdf

Please sign in to comment.