tor-browser

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

001.js (1024B)


      1 var port;
      2 var timeout;
      3 onerror = function(a,b,c,d,e) {
      4  // will return undefined, thus the error is "not handled"
      5  // so error should be reported to the user, but this test doesn't check
      6  // that.
      7  // just make sure that this method is invoked with five arguments
      8  clearTimeout(timeout);
      9  var log = '';
     10  if (arguments.length != 5)
     11    log += 'got ' + arguments.length + ' arguments, expected 5. ';
     12  if (typeof a != 'string')
     13    log += 'first argument wasn\'t a string. ';
     14  if (b != location.href)
     15    log += 'second argument was ' + b + ', expected ' + location.href + '. ';
     16  if (typeof c != 'number')
     17    log += 'third argument wasn\'t a number. ';
     18  if (typeof d != 'number')
     19    log += 'fourth argument wasn\'t a number. ';
     20  if (e != 42)
     21    log += 'fifth argument wasn\'t the thrown exception. ';
     22  port.postMessage(log);
     23 }
     24 onconnect = function (e) {
     25  port = e.ports[0];
     26  timeout = setTimeout(function() { port.postMessage('self.onerror was not invoked'); }, 250);
     27  throw 42; // will "report the error"
     28 }