blob: adba81f6353e6ff1db650eb2e8d81e08d073fc2c [file] [log] [blame]
<!--
var port;
var timeout;
onerror = function(a,b,c,d,e) {
// will return undefined, thus the error is "not handled"
// so error should be reported to the user, but this test doesn't check
// that.
// just make sure that this method is invoked with five arguments
clearTimeout(timeout);
var log = '';
if (arguments.length != 5)
log += 'got ' + arguments.length + ' arguments, expected 5. ';
if (typeof a != 'string')
log += 'first argument wasn\'t a string. ';
if (b != location.href)
log += 'second argument was ' + b + ', expected ' + location.href + '. ';
if (typeof c != 'number')
log += 'third argument wasn\'t a number. ';
if (typeof d != 'number')
log += 'fourth argument wasn\'t a number. ';
if (e != 42)
log += 'fifth argument wasn\'t the thrown exception. ';
port.postMessage(log);
}
onconnect = function (e) {
port = e.ports[0];
timeout = setTimeout(function() { port.postMessage('self.onerror was not invoked'); }, 250);
throw 42; // will "report the error"
}
/*
-->
<!doctype html>
<title>shared worker, not handled</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
async_test(function() {
window.onerror = this.step_func(function(a) {
assert_unreached('window.onerror invoked: ' + a);
});
var worker = new SharedWorker('#', '');
worker.port.onmessage = this.step_func_done(function(e) {
assert_equals(e.data, '');
});
});
</script>
<!--
*/
//-->