Skip to content

Restrict SpeechRecognition and friends to secure contexts #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ The term "interim result" indicates a SpeechRecognitionResult in which the final
</dl>

<xmp class="idl">
[Exposed=Window]
[SecureContext, Exposed=Window]
interface SpeechRecognition : EventTarget {
constructor();

Expand Down Expand Up @@ -223,7 +223,7 @@ enum AvailabilityStatus {
"available"
};

[Exposed=Window]
[SecureContext, Exposed=Window]
interface SpeechRecognitionErrorEvent : Event {
constructor(DOMString type, SpeechRecognitionErrorEventInit eventInitDict);
readonly attribute SpeechRecognitionErrorCode error;
Expand All @@ -236,29 +236,29 @@ dictionary SpeechRecognitionErrorEventInit : EventInit {
};

// Item in N-best list
[Exposed=Window]
[SecureContext, Exposed=Window]
interface SpeechRecognitionAlternative {
readonly attribute DOMString transcript;
readonly attribute float confidence;
};

// A complete one-shot simple response
[Exposed=Window]
[SecureContext, Exposed=Window]
interface SpeechRecognitionResult {
readonly attribute unsigned long length;
getter SpeechRecognitionAlternative item(unsigned long index);
readonly attribute boolean isFinal;
};

// A collection of responses (used in continuous mode)
[Exposed=Window]
[SecureContext, Exposed=Window]
interface SpeechRecognitionResultList {
readonly attribute unsigned long length;
getter SpeechRecognitionResult item(unsigned long index);
};

// A full response, which could be interim or final, part of a continuous response or not
[Exposed=Window]
[SecureContext, Exposed=Window]
interface SpeechRecognitionEvent : Event {
constructor(DOMString type, SpeechRecognitionEventInit eventInitDict);
readonly attribute unsigned long resultIndex;
Expand All @@ -271,15 +271,15 @@ dictionary SpeechRecognitionEventInit : EventInit {
};

// The object representing a phrase for contextual biasing.
[Exposed=Window]
[SecureContext, Exposed=Window]
interface SpeechRecognitionPhrase {
constructor(DOMString phrase, optional float boost = 1.0);
readonly attribute DOMString phrase;
readonly attribute float boost;
};

// The object representing a list of phrases for contextual biasing.
[Exposed=Window]
[SecureContext, Exposed=Window]
interface SpeechRecognitionPhraseList {
constructor(sequence<SpeechRecognitionPhrase> phrases);
readonly attribute unsigned long length;
Expand Down