Skip to content
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

Return Error::NotSupported for sampleRate 1 or 1000000 #14

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions components/script/dom/baseaudiocontext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ impl BaseAudioContext {
},
};

// A sampleRate of 1 and 1,000,000 are unlikely to be supported on any browser,
// https://github.com/web-platform-tests/wpt/blob/master/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html#L166
if sample_rate == 1.0 || sample_rate == 1000000.0 {
return Err(Error::NotSupported);
}

let client_context_id =
ClientContextId::build(pipeline_id.namespace_id.0, pipeline_id.index.0.get());
let audio_context_impl = ServoMedia::get()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
[audiocontextoptions.html]
[X context = new AudioContext({sampleRate: 1}) did not throw an exception.]
expected: FAIL

[# AUDIT TASK RUNNER FINISHED: 1 out of 3 tasks were failed.]
expected: FAIL

[X context = new AudioContext({sampleRate: 1000000}) did not throw an exception.]
expected: FAIL

[< [test-audiocontextoptions-sampleRate\] 2 out of 4 assertions were failed.]
expected: FAIL