tor-browser

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

bug642772-2.js (3075B)


      1 function failWrapper(callback) {
      2    try {
      3        callback(); // this should fail
      4        throw "test-error"; // and if it didn't we have a problem`
      5    } catch (e) {
      6        if (e == "test-error")
      7            throw ("Testing error when running " + callback.toString());
      8    }
      9 }
     10 
     11 
     12 print ("Deleting standard classes");
     13 delete Function;
     14 delete Object;
     15 delete Array;
     16 delete Boolean;
     17 delete JSON;
     18 delete Date;
     19 delete Math;
     20 delete Number;
     21 delete String;
     22 delete Regexp;
     23 delete Reflect;
     24 delete Proxy;
     25 delete Error;
     26 delete Iterator;
     27 delete Generator;
     28 delete StopIteration;
     29 delete Float32Array;
     30 delete Float64Array;
     31 delete Int16Array;
     32 delete Int32Array;
     33 delete Int32Array;
     34 delete Uint16Array;
     35 delete Uint32Array;
     36 delete Uint8Array;
     37 delete Uint8ClampedArray;
     38 delete Weakmap;
     39 
     40 
     41 print ("Accessing standard classes shouldn't recreate them");
     42 failWrapper(function () { Function; });
     43 failWrapper(function () { Object; });
     44 failWrapper(function () { Array; });
     45 failWrapper(function () { Boolean; });
     46 failWrapper(function () { JSON; });
     47 failWrapper(function () { Date; });
     48 failWrapper(function () { Math; });
     49 failWrapper(function () { Number; });
     50 failWrapper(function () { String; });
     51 failWrapper(function () { Regexp; });
     52 failWrapper(function () { Reflect; });
     53 failWrapper(function () { Proxy; });
     54 failWrapper(function () { Error; });
     55 failWrapper(function () { Iterator; });
     56 failWrapper(function () { Generator; });
     57 failWrapper(function () { StopIteration; });
     58 failWrapper(function () { Float32Array; });
     59 failWrapper(function () { Float64Array; });
     60 failWrapper(function () { Int16Array; });
     61 failWrapper(function () { Int32Array; });
     62 failWrapper(function () { Int32Array; });
     63 failWrapper(function () { Uint16Array; });
     64 failWrapper(function () { Uint32Array; });
     65 failWrapper(function () { Uint8Array; });
     66 failWrapper(function () { Uint8ClampedArray; });
     67 failWrapper(function () { Weakmap; });
     68 
     69 
     70 print ("Enumerate over the global object");
     71 for (c in this) {}
     72 
     73 print ("That shouldn't have recreated the standard classes either");
     74 failWrapper(function () { Function; });
     75 failWrapper(function () { Object; });
     76 failWrapper(function () { Array; });
     77 failWrapper(function () { Boolean; });
     78 failWrapper(function () { JSON; });
     79 failWrapper(function () { Date; });
     80 failWrapper(function () { Math; });
     81 failWrapper(function () { Number; });
     82 failWrapper(function () { String; });
     83 failWrapper(function () { Regexp; });
     84 failWrapper(function () { Reflect; });
     85 failWrapper(function () { Proxy; });
     86 failWrapper(function () { Error; });
     87 failWrapper(function () { Iterator; });
     88 failWrapper(function () { Generator; });
     89 failWrapper(function () { StopIteration; });
     90 failWrapper(function () { Float32Array; });
     91 failWrapper(function () { Float64Array; });
     92 failWrapper(function () { Int16Array; });
     93 failWrapper(function () { Int32Array; });
     94 failWrapper(function () { Int32Array; });
     95 failWrapper(function () { Uint16Array; });
     96 failWrapper(function () { Uint32Array; });
     97 failWrapper(function () { Uint8Array; });
     98 failWrapper(function () { Uint8ClampedArray; });
     99 failWrapper(function () { Weakmap; });
    100 
    101 print ("success");