[webkit-changes] [WebKit/WebKit] 42ffbe: Make SpeechSynthesisUtterance an ActiveDOMObject

Sihui noreply at github.com
Wed Aug 16 14:31:26 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 42ffbe195e69ce41e7c37707231efc7ed5e9b460
      https://github.com/WebKit/WebKit/commit/42ffbe195e69ce41e7c37707231efc7ed5e9b460
  Author: Sihui Liu <sihui_liu at apple.com>
  Date:   2023-08-16 (Wed, 16 Aug 2023)

  Changed paths:
    M Source/WebCore/Modules/speech/SpeechSynthesis.cpp
    M Source/WebCore/Modules/speech/SpeechSynthesis.h
    M Source/WebCore/Modules/speech/SpeechSynthesisUtterance.cpp
    M Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h
    M Source/WebCore/Modules/speech/SpeechSynthesisUtterance.idl

  Log Message:
  -----------
  Make SpeechSynthesisUtterance an ActiveDOMObject
https://bugs.webkit.org/show_bug.cgi?id=260214
rdar://113921763

Reviewed by Ryosuke Niwa.

Currently dispatching event to SpeechSynthesisUtterance can lead to crash due to GC. To fix that, we now keep wrapper
of SpeechSynthesisUtterance alive until there is no more event to be dispatched. This can happen in two cases:
1. SpeechSynthesisUtterance is not processed yet, and is removed from SpeechSynthesis's queue (i.e. the utterance will
not be processed).
2. SpeechSynthesisUtterance is being processed, and it finishes dispatching end or error event -- these two events are
the last events to be fired on an untterance according to spec: https://wicg.github.io/speech-api/#utterance-events.

* Source/WebCore/Modules/speech/SpeechSynthesis.cpp:
(WebCore::SpeechSynthesis::setPlatformSynthesizer):
(WebCore::SpeechSynthesis::cancel):
(WebCore::SpeechSynthesis::clearUtteranceQueue):
* Source/WebCore/Modules/speech/SpeechSynthesis.h:
* Source/WebCore/Modules/speech/SpeechSynthesisUtterance.cpp:
(WebCore::SpeechSynthesisUtterance::SpeechSynthesisUtterance):
(WebCore::SpeechSynthesisUtterance::eventOccurred):
(WebCore::SpeechSynthesisUtterance::errorEventOccurred):
(WebCore::SpeechSynthesisUtterance::dispatchEventAndUpdateState):
(WebCore::SpeechSynthesisUtterance::setIsActiveForEventDispatch):
(WebCore::SpeechSynthesisUtterance::activeDOMObjectName const):
(WebCore::SpeechSynthesisUtterance::virtualHasPendingActivity const):
* Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h:
* Source/WebCore/Modules/speech/SpeechSynthesisUtterance.idl:

Canonical link: https://commits.webkit.org/266959@main




More information about the webkit-changes mailing list