tor-browser

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

bug858586.js (1001B)


      1 // This test case was created before %TypedArrayPrototype%.toString was
      2 // implemented. Now that we've got %TypedArrayPrototype%.toString the test will
      3 // attempt to create a 300300001 character long string and either timeout or
      4 // throw an oom error. Restore the original behavior by replacing toString with
      5 // Object.prototype.toString.
      6 Uint8ClampedArray.prototype.toString = Object.prototype.toString;
      7 
      8 function A(a) { this.a = a; }
      9 A.prototype.foo = function (x) {};
     10 function B(b) { this.b = b; }
     11 B.prototype.foo = function (x) {};
     12 function C(c) {}
     13 function makeArray(n) {
     14    var classes = [A, B, C];
     15    var arr = [];
     16    for (var i = 0; i < n; i++) {
     17        arr.push(new classes[i % 3](i % 3));
     18    }
     19    return arr;
     20 }
     21 function runner(arr, resultArray, len) {
     22    for (var i = 0; i < len; i++) {
     23        var obj = arr[i];
     24        resultArray[0] += new obj.foo(i);
     25    }
     26 }
     27 var resultArray = [0];
     28 var arr = makeArray(30000);
     29 C.prototype.foo = Uint8ClampedArray;
     30 runner(arr, resultArray, 30000);