зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 6fe5dd5c3f33 (bug 1178738)
This commit is contained in:
Родитель
4263412d7e
Коммит
083d5ca092
|
@ -9,7 +9,6 @@
|
|||
#include "nsGkAtoms.h"
|
||||
|
||||
#include "mozilla/dom/SpeechSynthesisEvent.h"
|
||||
#include "mozilla/dom/SpeechSynthesisErrorEvent.h"
|
||||
#include "mozilla/dom/SpeechSynthesisUtteranceBinding.h"
|
||||
#include "SpeechSynthesisUtterance.h"
|
||||
#include "SpeechSynthesisVoice.h"
|
||||
|
@ -175,24 +174,5 @@ SpeechSynthesisUtterance::DispatchSpeechSynthesisEvent(const nsAString& aEventTy
|
|||
DispatchTrustedEvent(event);
|
||||
}
|
||||
|
||||
void
|
||||
SpeechSynthesisUtterance::DispatchSpeechSynthesisErrorEvent(uint32_t aCharIndex,
|
||||
float aElapsedTime,
|
||||
SpeechSynthesisErrorCode aError)
|
||||
{
|
||||
SpeechSynthesisErrorEventInit init;
|
||||
init.mBubbles = false;
|
||||
init.mCancelable = false;
|
||||
init.mUtterance = this;
|
||||
init.mCharIndex = aCharIndex;
|
||||
init.mElapsedTime = aElapsedTime;
|
||||
init.mName = NS_LITERAL_STRING("");
|
||||
init.mError = aError;
|
||||
|
||||
RefPtr<SpeechSynthesisErrorEvent> event =
|
||||
SpeechSynthesisErrorEvent::Constructor(this, NS_LITERAL_STRING("error"), init);
|
||||
DispatchTrustedEvent(event);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -20,7 +20,6 @@ namespace dom {
|
|||
class SpeechSynthesisVoice;
|
||||
class SpeechSynthesis;
|
||||
class nsSynthVoiceRegistry;
|
||||
enum class SpeechSynthesisErrorCode : uint32_t;
|
||||
|
||||
class SpeechSynthesisUtterance final : public DOMEventTargetHelper
|
||||
{
|
||||
|
@ -100,10 +99,6 @@ private:
|
|||
uint32_t aCharIndex,
|
||||
float aElapsedTime, const nsAString& aName);
|
||||
|
||||
void DispatchSpeechSynthesisErrorEvent(uint32_t aCharIndex,
|
||||
float aElapsedTime,
|
||||
SpeechSynthesisErrorCode aError);
|
||||
|
||||
nsString mText;
|
||||
|
||||
nsString mLang;
|
||||
|
|
|
@ -29,7 +29,7 @@ async protocol PSpeechSynthesisRequest
|
|||
|
||||
child:
|
||||
|
||||
async OnEnd(bool aIsError, float aElapsedTime, uint32_t aCharIndex, uint32_t aError);
|
||||
async OnEnd(bool aIsError, float aElapsedTime, uint32_t aCharIndex);
|
||||
|
||||
async OnStart(nsString aUri);
|
||||
|
||||
|
|
|
@ -96,14 +96,13 @@ SpeechSynthesisRequestChild::RecvOnStart(const nsString& aUri)
|
|||
bool
|
||||
SpeechSynthesisRequestChild::RecvOnEnd(const bool& aIsError,
|
||||
const float& aElapsedTime,
|
||||
const uint32_t& aCharIndex,
|
||||
const uint32_t& aError)
|
||||
const uint32_t& aCharIndex)
|
||||
{
|
||||
SpeechSynthesisRequestChild* actor = mTask->mActor;
|
||||
mTask->mActor = nullptr;
|
||||
|
||||
if (aIsError) {
|
||||
mTask->DispatchErrorImpl(aElapsedTime, aCharIndex, aError);
|
||||
mTask->DispatchErrorImpl(aElapsedTime, aCharIndex, 0);
|
||||
} else {
|
||||
mTask->DispatchEndImpl(aElapsedTime, aCharIndex);
|
||||
}
|
||||
|
|
|
@ -56,8 +56,7 @@ protected:
|
|||
|
||||
bool RecvOnEnd(const bool& aIsError,
|
||||
const float& aElapsedTime,
|
||||
const uint32_t& aCharIndex,
|
||||
const uint32_t& aError) override;
|
||||
const uint32_t& aCharIndex) override;
|
||||
|
||||
bool RecvOnPause(const float& aElapsedTime, const uint32_t& aCharIndex) override;
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ SpeechTaskParent::DispatchEndImpl(float aElapsedTime, uint32_t aCharIndex)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if(NS_WARN_IF(!(mActor->SendOnEnd(false, aElapsedTime, aCharIndex, 0)))) {
|
||||
if(NS_WARN_IF(!(mActor->SendOnEnd(false, aElapsedTime, aCharIndex)))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ nsresult
|
|||
SpeechTaskParent::DispatchErrorImpl(float aElapsedTime, uint32_t aCharIndex, uint32_t aError)
|
||||
{
|
||||
MOZ_ASSERT(mActor);
|
||||
if(NS_WARN_IF(!(mActor->SendOnEnd(true, aElapsedTime, aCharIndex, aError)))) {
|
||||
if(NS_WARN_IF(!(mActor->SendOnEnd(true, aElapsedTime, aCharIndex)))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -533,8 +533,9 @@ nsSpeechTask::DispatchErrorImpl(float aElapsedTime, uint32_t aCharIndex, uint32_
|
|||
}
|
||||
|
||||
mUtterance->mState = SpeechSynthesisUtterance::STATE_ENDED;
|
||||
mUtterance->DispatchSpeechSynthesisErrorEvent(aCharIndex, aElapsedTime,
|
||||
SpeechSynthesisErrorCode(aError));
|
||||
mUtterance->DispatchSpeechSynthesisEvent(NS_LITERAL_STRING("error"),
|
||||
aCharIndex, aElapsedTime,
|
||||
EmptyString());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,7 @@ function synthTestQueue(aTestArgs, aEndFunc) {
|
|||
u.addEventListener('error',
|
||||
(function (expectedError) {
|
||||
return function onerror_handler(e) {
|
||||
ok(e instanceof SpeechSynthesisErrorEvent, "error event is of right type");
|
||||
is(expectedError, e.error, "Matched error type");
|
||||
ok(expectedError, "Error in speech utterance '" + e.target.text + "'");
|
||||
};
|
||||
})(aTestArgs[i][1] ? aTestArgs[i][1].err : false));
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ function testFunc(done_cb) {
|
|||
[{text: "How are you doing?", args: { lang: "en-GB" } },
|
||||
{ rate: 1, pitch: 1, uri: langUriMap['en-GB']}],
|
||||
[{text: "Come stai?", args: { lang: "it-IT-fail" } },
|
||||
{ rate: 1, pitch: 1, uri: langUriMap['it-IT-fail'], err: "synthesis-failed" }],
|
||||
{ rate: 1, pitch: 1, uri: langUriMap['it-IT-fail'], err: true }],
|
||||
[{text: "¡hasta mañana!", args: { lang: "es-MX" } },
|
||||
{ uri: langUriMap['es-MX'] }]],
|
||||
function () {
|
||||
|
|
Загрузка…
Ссылка в новой задаче