Backed out changeset 6fe5dd5c3f33 (bug 1178738)

This commit is contained in:
Sebastian Hengst 2016-06-02 20:32:46 +02:00
Родитель 4263412d7e
Коммит 083d5ca092
9 изменённых файлов: 11 добавлений и 38 удалений

Просмотреть файл

@ -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 () {