-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make SpeechSynthesis an ActiveDOMObject
https://bugs.webkit.org/show_bug.cgi?id=260207 Reviewed by Ryosuke Niwa. Keep wrapper of SpeechSynthesis alive when voiceschanged event might be fired and it has event handler. Test: fast/speechsynthesis/speech-synthesis-voiceschanged-gc.html. * LayoutTests/fast/speechsynthesis/speech-synthesis-voiceschanged-gc-expected.txt: Added. * LayoutTests/fast/speechsynthesis/speech-synthesis-voiceschanged-gc.html: Added. * Source/WebCore/Modules/speech/SpeechSynthesis.cpp: (WebCore::Ref<SpeechSynthesis>SpeechSynthesis::create): (WebCore::SpeechSynthesis::SpeechSynthesis): (WebCore::SpeechSynthesis::setPlatformSynthesizer): (WebCore::SpeechSynthesis::voicesDidChange): (WebCore::SpeechSynthesis::getVoices): (WebCore::SpeechSynthesis::resumeSynthesis): (WebCore::SpeechSynthesis::simulateVoicesListChange): (WebCore::SpeechSynthesis::activeDOMObjectName const): (WebCore::SpeechSynthesis::virtualHasPendingActivity const): (WebCore::SpeechSynthesis::eventListenersDidChange): (WebCore::SpeechSynthesis::resume): Deleted. * Source/WebCore/Modules/speech/SpeechSynthesis.h: * Source/WebCore/Modules/speech/SpeechSynthesis.idl: * Source/WebCore/testing/Internals.cpp: (WebCore::Internals::simulateSpeechSynthesizerVoiceListChange): * Source/WebCore/testing/Internals.h: * Source/WebCore/testing/Internals.idl: Canonical link: https://commits.webkit.org/267385@main
- Loading branch information
Showing
8 changed files
with
121 additions
and
16 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
LayoutTests/fast/speechsynthesis/speech-synthesis-voiceschanged-gc-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
This tests SpeechSynthesis can fire voiceschanged event without crash. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS speechSynthesis.testProperty !== undefined is true | ||
PASS speechSynthesis.testProperty is 1 | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
37 changes: 37 additions & 0 deletions
37
LayoutTests/fast/speechsynthesis/speech-synthesis-voiceschanged-gc.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../../resources/js-test-pre.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
description("This tests SpeechSynthesis can fire voiceschanged event without crash."); | ||
|
||
if (window.internals) | ||
window.internals.enableMockSpeechSynthesizer(); | ||
|
||
window.jsTestIsAsync = true; | ||
if (window.testRunner) | ||
testRunner.waitUntilDone(); | ||
|
||
speechSynthesis.testProperty = 1; | ||
const voices = speechSynthesis.getVoices(); | ||
speechSynthesis.onvoiceschanged = () => { | ||
shouldBeTrue("speechSynthesis.testProperty !== undefined"); | ||
shouldBe("speechSynthesis.testProperty", '1'); | ||
finishJSTest(); | ||
}; | ||
gc(); | ||
|
||
if (window.internals) { | ||
setTimeout(() => { | ||
if (window.internals) | ||
window.internals.simulateSpeechSynthesizerVoiceListChange(); | ||
}, 0); | ||
} else { | ||
debug("Test requires window.internals to run."); | ||
finishJSTest(); | ||
} | ||
</script> | ||
<script src="../../resources/js-test-post.js"></script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters