AX: Crash at WebKit: WebKit::WebSpeechSynthesisClient::speak
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 May 2019 17:19:24 +0000 (17:19 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 May 2019 17:19:24 +0000 (17:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197761
<rdar://problem/50237614>

Reviewed by Per Arne Vollan.

Source/WebKit:

It's valid for the incoming voice to be nil, so we need to protect against that.

Tests: fast/speechsynthesis/speech-synthesis-real-client-version.html

* WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp:
(WebKit::WebSpeechSynthesisClient::speak):

LayoutTests:

* fast/speechsynthesis/speech-synthesis-real-client-version-expected.txt: Added.
* fast/speechsynthesis/speech-synthesis-real-client-version.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245178 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/speechsynthesis/speech-synthesis-real-client-version-expected.txt [new file with mode: 0644]
LayoutTests/fast/speechsynthesis/speech-synthesis-real-client-version.html [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp

index b959a6d..8bbf93e 100644 (file)
@@ -1,3 +1,14 @@
+2019-05-10  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Crash at WebKit: WebKit::WebSpeechSynthesisClient::speak
+        https://bugs.webkit.org/show_bug.cgi?id=197761
+        <rdar://problem/50237614>
+
+        Reviewed by Per Arne Vollan.
+
+        * fast/speechsynthesis/speech-synthesis-real-client-version-expected.txt: Added.
+        * fast/speechsynthesis/speech-synthesis-real-client-version.html: Added.
+
 2019-05-10  Antti Koivisto  <antti@apple.com>
 
         Event region generation needs to know about backing-sharing
diff --git a/LayoutTests/fast/speechsynthesis/speech-synthesis-real-client-version-expected.txt b/LayoutTests/fast/speechsynthesis/speech-synthesis-real-client-version-expected.txt
new file mode 100644 (file)
index 0000000..bcc9736
--- /dev/null
@@ -0,0 +1,10 @@
+This tests that we can dispatch a speech job using the real synthesizer without crashing.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS speechSynthesis.speaking is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/speechsynthesis/speech-synthesis-real-client-version.html b/LayoutTests/fast/speechsynthesis/speech-synthesis-real-client-version.html
new file mode 100644 (file)
index 0000000..94c84b1
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<div id="console"></div>
+
+<script>
+
+    description("This tests that we can dispatch a speech job using the real synthesizer without crashing.");
+
+    if (window.testRunner)
+        testRunner.waitUntilDone();
+
+    window.jsTestIsAsync = true;
+
+    // Start a very short speaking job that will finish quickly.
+    var u = new SpeechSynthesisUtterance("a");
+
+    u.addEventListener('end', function(e) { 
+       finishJSTest();
+    });
+
+    shouldBeFalse("speechSynthesis.speaking");
+    speechSynthesis.speak(u);
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
index 22958a5..8382293 100644 (file)
@@ -1,3 +1,18 @@
+2019-05-10  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Crash at WebKit: WebKit::WebSpeechSynthesisClient::speak
+        https://bugs.webkit.org/show_bug.cgi?id=197761
+        <rdar://problem/50237614>
+
+        Reviewed by Per Arne Vollan.
+
+        It's valid for the incoming voice to be nil, so we need to protect against that.
+
+        Tests: fast/speechsynthesis/speech-synthesis-real-client-version.html
+
+        * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp:
+        (WebKit::WebSpeechSynthesisClient::speak):
+
 2019-05-10  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         [WPE][GTK] Add webkit_frame_get_id() API
index 6508186..dbbe843 100644 (file)
@@ -58,7 +58,13 @@ void WebSpeechSynthesisClient::speak(RefPtr<WebCore::PlatformSpeechSynthesisUtte
     };
 
     auto voice = utterance->voice();
-    m_page.sendWithAsyncReply(Messages::WebPageProxy::SpeechSynthesisSpeak(utterance->text(), utterance->lang(), utterance->volume(), utterance->rate(), utterance->pitch(), utterance->startTime(), voice->voiceURI(), voice->name(), voice->lang(), voice->localService(), voice->isDefault()), WTFMove(completionHandler));
+    auto voiceURI = voice ? voice->voiceURI() : "";
+    auto name = voice ? voice->name() : "";
+    auto lang = voice ? voice->lang() : "";
+    auto localService = voice ? voice->localService() : false;
+    auto isDefault = voice ? voice->isDefault() : false;
+
+    m_page.sendWithAsyncReply(Messages::WebPageProxy::SpeechSynthesisSpeak(utterance->text(), utterance->lang(), utterance->volume(), utterance->rate(), utterance->pitch(), utterance->startTime(), voiceURI, name, lang, localService, isDefault), WTFMove(completionHandler));
 
     m_page.corePage()->speechSynthesisClient()->observer()->didStartSpeaking();
 }