Bug 1167542 - Implement SpeechSynthesisErrorEvent. r=smaug

This commit is contained in:
Kelly Davis 2015-07-01 04:49:00 -04:00
parent 37bf3f1d6d
commit 466d14756f
5 changed files with 47 additions and 0 deletions

View File

@ -435,6 +435,12 @@ const kEventConstructors = {
return new SpeechRecognitionEvent(aName, aProps);
},
},
SpeechSynthesisErrorEvent: { create: function (aName, aProps) {
aProps.error = "synthesis-unavailable";
aProps.utterance = new SpeechSynthesisUtterance("Hello World");
return new SpeechSynthesisErrorEvent(aName, aProps);
},
},
SpeechSynthesisEvent: { create: function (aName, aProps) {
aProps.utterance = new SpeechSynthesisUtterance("Hello World");
return new SpeechSynthesisEvent(aName, aProps);

View File

@ -27,6 +27,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=525444
ok(SpeechSynthesis, "SpeechSynthesis exists in global scope");
ok(SpeechSynthesisVoice, "SpeechSynthesisVoice exists in global scope");
ok(SpeechSynthesisErrorEvent, "SpeechSynthesisErrorEvent exists in global scope");
ok(SpeechSynthesisEvent, "SpeechSynthesisEvent exists in global scope");
// SpeechSynthesisUtterance is the only type that has a constructor

View File

@ -964,6 +964,8 @@ var interfaceNamesInGlobalScope =
{name: "SourceBuffer", linux: false, release: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "SourceBufferList", linux: false, release: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "SpeechSynthesisErrorEvent", b2g: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "SpeechSynthesisEvent", b2g: true},
// IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -0,0 +1,36 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
enum SpeechSynthesisErrorCode {
"canceled",
"interrupted",
"audio-busy",
"audio-hardware",
"network",
"synthesis-unavailable",
"synthesis-failed",
"language-unavailable",
"voice-unavailable",
"text-too-long",
"invalid-argument",
};
[Constructor(DOMString type, optional SpeechSynthesisErrorEventInit eventInitDict),
Pref="media.webspeech.synth.enabled"]
interface SpeechSynthesisErrorEvent : SpeechSynthesisEvent {
readonly attribute SpeechSynthesisErrorCode error;
};
dictionary SpeechSynthesisErrorEventInit : SpeechSynthesisEventInit
{
required SpeechSynthesisErrorCode error;
};

View File

@ -611,6 +611,7 @@ if CONFIG['MOZ_WEBSPEECH']:
'SpeechRecognitionResult.webidl',
'SpeechRecognitionResultList.webidl',
'SpeechSynthesis.webidl',
'SpeechSynthesisErrorEvent.webidl',
'SpeechSynthesisEvent.webidl',
'SpeechSynthesisUtterance.webidl',
'SpeechSynthesisVoice.webidl',
@ -788,6 +789,7 @@ GENERATED_EVENTS_WEBIDL_FILES = [
if CONFIG['MOZ_WEBSPEECH']:
GENERATED_EVENTS_WEBIDL_FILES += [
'SpeechRecognitionEvent.webidl',
'SpeechSynthesisErrorEvent.webidl',
'SpeechSynthesisEvent.webidl',
]