Skip to content

Commit

Permalink
Bug 1949266 [wpt PR 50810] - WebSpeech: start() throws if detached if…
Browse files Browse the repository at this point in the history
…rame, a=testonly

Automatic update from web-platform-tests
WebSpeech: start() throws if detached iframe

Spec PR: WebAudio/web-speech-api#138

Bug: 384797834
Change-Id: I553842e4427071dacc7693ea6f1f2503cb0cf0dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6237075
Reviewed-by: Evan Liu <[email protected]>
Commit-Queue: Fr <[email protected]>
Reviewed-by: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1422104}

--

wpt-commits: 247db68758a8b03474678dcc6ecfc1fc955227f6
wpt-pr: 50810
  • Loading branch information
beaufortfrancois authored and moz-wptsync-bot committed Feb 26, 2025
1 parent 84c79dd commit c27a2c6
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// META: title=SpeechRecognition in a detached iframe test

test(() => {
// Create the iframe and append it to the document.
const iframe = document.createElement("iframe");
document.body.appendChild(iframe);
const frameWindow = iframe.contentWindow;

// Detach the iframe.
iframe.remove();

assert_equals(
undefined,
frameWindow.SpeechRecognition || frameWindow.webkitSpeechRecognition,
);
}, "SpeechRecognition constructor does not exist in detached iframes");

test((t) => {
// Create the iframe and append it to the document.
const iframe = document.createElement("iframe");
document.body.appendChild(iframe);
const frameWindow = iframe.contentWindow;
const frameDOMException = frameWindow.DOMException;

frameWindow.SpeechRecognition =
frameWindow.SpeechRecognition || frameWindow.webkitSpeechRecognition;
const speechRecognition = new frameWindow.SpeechRecognition();

// Detach the iframe.
iframe.remove();

assert_throws_dom("InvalidStateError", frameDOMException, () =>
speechRecognition.start(),
);
}, "SpeechRecognition.start() on detached frame throws");

0 comments on commit c27a2c6

Please sign in to comment.