tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_fail_add_task.js (767B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 function rejectOnNextTick(error) {
      7  return new Promise((resolve, reject) => executeSoon(() => reject(error)));
      8 }
      9 
     10 add_task(async function failWithoutError() {
     11  await rejectOnNextTick(undefined);
     12 });
     13 
     14 add_task(async function failWithString() {
     15  await rejectOnNextTick("This is a string");
     16 });
     17 
     18 add_task(async function failWithInt() {
     19  await rejectOnNextTick(42);
     20 });
     21 
     22 // This one should display a stack trace
     23 add_task(async function failWithError() {
     24  await rejectOnNextTick(new Error("This is an error"));
     25 });
     26 
     27 add_task(async function failWithAbort() {
     28  testSignal.addEventListener("abort", () => {
     29    throw new Error("err");
     30  });
     31 });