author Dennis Jackson <>
Sun, 26 Mar 2023 07:31:40 +0000
changeset 657950 dee1eb3308521b4cb7c8a3afe44520efcf582650
parent 542857 ce92439ba700befeea989a2c3b5f0f13abcd7344
permissions -rw-r--r--
Bug 1822876: Add H3 ECH Telemetry. r=kershaw,necko-reviewers This patch adds telemetry which records when H3 connections succeed / fail and what kind of ECH they used. Our H3 ECH tests are extended to test these different modes and that the telemetry is recorded correctly. Differential Revision:

  <title>Test the decodeAudioData Errors</title>

  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  <script src="webaudio.js"></script>
<pre id="test">
<script class="testbody" type="text/javascript">

addLoadEvent(function() {

var finished = 0;

var ctx = new AudioContext();

function errorExpectedWithFile(file, errorMsg) {
  var xhr = new XMLHttpRequest();
  function test(e) {
    ok(e instanceof DOMException,
      "The exception should be an instance of DOMException");
    ok( == "EncodingError",
      "The exception name should be EncodingError");
    ok(e.message == errorMsg,
       "The exception message is not the one intended.\n" +
       "\tExpected : " + errorMsg + "\n" +
       "\tGot      : " + e.message );
  }"GET", file, true);
  xhr.responseType = "arraybuffer";
  xhr.onload = function() {
    ctx.decodeAudioData(xhr.response, buffer => {
      ok(false, "You should not be able to decode that");
    }, e => test(e))
    .then(buffer => {
      ok(false, "You should not be able to decode that");
    .catch(e => test(e));

function finish() {
  if (++finished == 4) {

// Unknown Content
errorExpectedWithFile("404", "The buffer passed to decodeAudioData contains an unknown content type.");

// Invalid Content
errorExpectedWithFile("invalidContent.flac", "The buffer passed to decodeAudioData contains invalid content which cannot be decoded successfully.");

// No Audio
// # Bug 1656032
// Think about increasing the finish counter to 6 when activating this line
// errorExpectedWithFile("noaudio.webm", "The buffer passed to decodeAudioData does not contain any audio.");

// Unknown Error
// errorExpectedWithFile("There is no file we can't handle", "An unknown error occurred while processing decodeAudioData.");