import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

View file

@ -0,0 +1,14 @@
[
{
"id": "definitions-1",
"original_id": "definitions-1"
},
{
"id": "processing-model-3",
"original_id": "processing-model-3"
},
{
"id": "generic-task-sources",
"original_id": "generic-task-sources"
}
]

View file

@ -0,0 +1,57 @@
<!DOCTYPE html>
<head>
<link rel=author title="Aleks Totic" href="mailto:atotic@chromium.org">
<link rel=help href="https://html.spec.whatwg.org/#clean-up-after-running-script">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/common.js"></script>
</head>
<body style="height:2000px;">
<script>
/*
promise 1, promise 2 execute immediately after rAF
promise 1 child executes immediately after promise 2.
Relevant specs:
https://html.spec.whatwg.org/#clean-up-after-running-script
If the JavaScript execution context stack is now empty, perform a microtask checkpoint.
https://html.spec.whatwg.org/#perform-a-microtask-checkpoint
"perform a microtask checkpoint" runs in a loop until all microtasks have been delivered.
*/
var test = async_test("Microtask execute immediately after script");
window.requestAnimationFrame( function() {
var events = [];
Promise.resolve()
.then(function() {
events.push("promise 1");
return Promise.resolve();
})
.then(function() {
test.step(function() {
events.push("promise 1 child");
assert_array_equals(events, ["promise 1", "promise 2", "promise 1 child"]);
test.done();
});
});
Promise.resolve()
.then(function() {
events.push("promise 2");
});
// Set up events that must be executed after Promise.
window.setTimeout(function() {
events.push('timeout');
}, 0);
window.addEventListener('scroll', function() {
events.push('scroll');
});
window.scrollBy(0,10);
});
</script>
</body>

View file

@ -0,0 +1,55 @@
<!DOCTYPE html>
<head>
<link rel=author title="Aleks Totic" href="mailto:atotic@chromium.org">
<link rel=help href="https://html.spec.whatwg.org/#clean-up-after-running-script">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/common.js"></script>
</head>
<body style="height:2000px;">
<script>
/*
promise 1, promise 2 execute immediately after script tag
promise 1 child executes immediately after promise 2.
Relevant specs:
https://html.spec.whatwg.org/#clean-up-after-running-script
If the JavaScript execution context stack is now empty, perform a microtask checkpoint.
https://html.spec.whatwg.org/#perform-a-microtask-checkpoint
"perform a microtask checkpoint" runs in a loop until all microtasks have been delivered.
*/
var test = async_test("Microtask immediately after script");
var events = [];
Promise.resolve()
.then(function() {
events.push("promise 1");
return Promise.resolve();
})
.then(function() {
test.step(function() {
events.push("promise 1 child");
assert_array_equals(events, ["promise 1", "promise 2", "promise 1 child"]);
test.done();
});
});
Promise.resolve()
.then(function() {
events.push("promise 2");
});
// Set up events that must be executed after Promise.
window.setTimeout(function() {
events.push('timeout');
}, 0);
window.addEventListener('scroll', function() {
events.push('scroll');
});
window.scrollBy(0,10);
</script>
</body>

View file

@ -0,0 +1,20 @@
// Helper for tests that just want to verify the ordering of a series of events.
// Usage:
// log_test(function(t, log) {
// log('first');
// log('second');
// }, ['first', 'second'], 'Ordinal numbers are ordinal');
function log_test(func, expected, description) {
async_test(function(t) {
var actual = [];
function log(entry) {
actual.push(entry);
if (expected.length <= actual.length) {
assert_array_equals(actual, expected);
t.done();
}
}
func(t, t.step_func(log));
}, description);
}

View file

@ -0,0 +1,64 @@
<!DOCTYPE html>
<title>Task and Microtask Ordering </title>
<link rel=author title="Joshua Bell" href="mailto:jsbell@google.com">
<link rel=help href="https://html.spec.whatwg.org/multipage/#event-loops">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/common.js"></script>
<style>
.inner { padding: 46px; width: 0; margin: 0 auto; background: #d4d4d4; }
.outer { padding: 25px; width: 92px; background: #f1f1f1; }
</style>
<p>Click on the inner box:</p>
<div class="outer">
<div class="inner"></div>
</div>
<script>
// Based on: https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/
log_test(function(t, log) {
// Let's get hold of those elements
var outer = document.querySelector('.outer');
var inner = document.querySelector('.inner');
// Let's listen for attribute changes on the
// outer element
new MutationObserver(function() {
log('mutate');
}).observe(outer, {
attributes: true
});
// Here's a click listener...
function onClick() {
log('click');
setTimeout(function() {
log('timeout');
}, 0);
Promise.resolve().then(function() {
log('promise');
});
outer.setAttribute('data-random', Math.random());
}
// ...which we'll attach to both elements
inner.addEventListener('click', onClick);
outer.addEventListener('click', onClick);
}, [
'click',
'promise',
'mutate',
'click',
'promise',
'mutate',
'timeout',
'timeout'
], 'Level 1 bossfight (manual click)');
</script>

View file

@ -0,0 +1,85 @@
<!DOCTYPE html>
<title>Task and Microtask Ordering </title>
<link rel=author title="Joshua Bell" href="mailto:jsbell@google.com">
<link rel=help href="https://html.spec.whatwg.org/multipage/#event-loops">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/common.js"></script>
<div class="outer">
<div class="inner"></div>
</div>
<script>
// Based on: https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/
log_test(function(t, log) {
log('script start');
setTimeout(function() {
log('setTimeout');
}, 0);
Promise.resolve().then(function() {
log('promise1');
}).then(function() {
log('promise2');
});
log('script end');
}, [
'script start',
'script end',
'promise1',
'promise2',
'setTimeout'
], 'Basic task and microtask ordering');
log_test(function(t, log) {
// Let's get hold of those elements
var outer = document.querySelector('.outer');
var inner = document.querySelector('.inner');
// Let's listen for attribute changes on the
// outer element
new MutationObserver(function() {
log('mutate');
}).observe(outer, {
attributes: true
});
// Here's a click listener...
function onClick() {
log('click');
setTimeout(function() {
log('timeout');
}, 0);
Promise.resolve().then(function() {
log('promise');
});
outer.setAttribute('data-random', Math.random());
}
// ...which we'll attach to both elements
inner.addEventListener('click', onClick);
outer.addEventListener('click', onClick);
// Note that this will behave differently than a real click,
// since the dispatch is synchronous and microtasks will not
// run between event bubbling steps.
inner.click();
}, [
'click',
'click',
'promise',
'mutate',
'promise',
'timeout',
'timeout'
], 'Level 1 bossfight (synthetic click)');
</script>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<title>HTMLBodyElement.onload</title>
<link rel="author" title="Boris Zbarsky" href="mailto:bzbarsky@mit.edu">
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#handler-window-onload">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test("body.onload should set the window.onload handler")
window.onload = t.step_func(function() {
assert_unreached("This handler should be overwritten.")
})
var b = document.createElement("body")
b.onload = t.step_func(function(e) {
assert_equals(e.currentTarget, window,
"The event should be fired at the window.")
t.done()
})
</script>

View file

@ -0,0 +1,18 @@
[
{
"id": "event-handler-attributes",
"original_id": "event-handler-attributes"
},
{
"id": "event-handlers-on-elements-document-objects-and-window-objects",
"original_id": "event-handlers-on-elements,-document-objects,-and-window-objects"
},
{
"id": "event-firing",
"original_id": "event-firing"
},
{
"id": "events-and-the-window-object",
"original_id": "events-and-the-window-object"
}
]

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<title>HTMLBodyElement event handlers</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<body>
<script>
function f() {
return 0;
}
var handlers = ['blur','error','focus','load','resize','scroll',
'afterprint','beforeprint','beforeunload','hashchange',
'languagechange','message','offline','online','pagehide',
'pageshow','popstate','storage','unload'];
handlers.forEach(function(handler) {
test(function() {
document.body['on' + handler] = f;
assert_equals(window['on' + handler], f);
}, handler);
});
handlers.forEach(function(handler) {
document.body['on' + handler] = null;
});
handlers.forEach(function(handler) {
test(function() {
assert_equals(document.body['on' + handler], null);
assert_equals(window['on' + handler], null);
}, handler + " removal");
});
</script>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<title>Event handler with labels</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body onload="javascript:
for (var i = 0; i < 2; ++i) {
for (var j = 0; j < 2; ++j) {
t.step(function() {
assert_equals(i, 0);
assert_equals(j, 0);
});
break javascript;
}
}
t.done();
">
<div id="log"></div>
<script>
var t = async_test("Event handlers starting with 'javascript:' should treat that as a label.");
</script>

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<title>HTMLBodyElement.onresize</title>
<link rel="author" title="His-Name-Is-Joof" href="mailto:jeffrharrison@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#handler-window-onresize">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test("body.onresize should set the window.onload handler")
window.onresize = t.step_func(function() {
assert_unreached("This handler should be overwritten.")
})
var body = document.createElement("body")
body.onresize = t.step_func(function(e) {
assert_equals(e.currentTarget, window,
"The event should be fired at the window.")
t.done()
})
window.dispatchEvent(new Event('resize'));
t = async_test("document.onresize should set the document.onresize handler");
document.onresize = t.step_func(function(e) {
assert_equals(e.currentTarget, document,
"The event should be fired at the document")
t.done()
})
document.dispatchEvent(new Event('resize'));
t = async_test("meta.onresize should set the meta.onresize handler");
var meta = document.createElement("meta")
meta.onresize = t.step_func(function(e) {
assert_equals(e.currentTarget, meta,
"The event should be fired at the <meta> object")
t.done()
})
meta.dispatchEvent(new Event('resize'));
</script>

View file

@ -0,0 +1,63 @@
<!DOCTYPE html>
<title>Event handlers processing algorithm</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<div id="foo" style="width: 100px; height: 100px; background-color: black"></div>
<script>
async_test(function(t) {
var ev = new Event('mouseover', {cancelable: true});
document.getElementById("foo").onmouseover = t.step_func(function() { return true });
document.getElementById("foo").dispatchEvent(ev);
assert_equals(ev.defaultPrevented, true)
t.done();
}, "mouseover listener returning true cancels event");
async_test(function(t) {
var ev = new Event('mouseover', {cancelable: true});
document.getElementById("foo").onmouseover = t.step_func(function() { return false; });
document.getElementById("foo").dispatchEvent(ev);
assert_equals(ev.defaultPrevented, false);
t.done();
}, "mouseover listener returning false doesn't cancel event");
async_test(function(t) {
var ev = new Event('beforeunload', {cancelable: true});
window.onbeforeunload = t.step_func(function() {return null});
window.dispatchEvent(ev);
assert_equals(ev.defaultPrevented, true);
t.done();
}, "beforeunload listener returning null cancels event");
async_test(function(t) {
var ev = new Event('beforeunload', {cancelable: true});
window.onbeforeunload = t.step_func(function() {return true});
window.dispatchEvent(ev);
assert_equals(ev.defaultPrevented, false);
t.done();
}, "beforeunload listener returning non-null doesn't cancel event");
async_test(function(t) {
var ev = new Event("click", {cancelable: true});
document.getElementById("foo").onclick = t.step_func(function() { return false; });
document.getElementById("foo").dispatchEvent(ev);
assert_equals(ev.defaultPrevented, true);
t.done();
}, "click listener returning false cancels event");
async_test(function(t) {
var ev = new Event("blur", {cancelable: true});
document.getElementById("foo").onblur = t.step_func(function() { return false; });
document.getElementById("foo").dispatchEvent(ev);
assert_equals(ev.defaultPrevented, true);
t.done();
}, "blur listener returning false cancels event");
async_test(function(t) {
var ev = new Event("dblclick", {cancelable: true});
document.getElementById("foo").ondblclick = t.step_func(function() { return false; });
document.getElementById("foo").dispatchEvent(ev);
assert_equals(ev.defaultPrevented, true);
t.done();
}, "dblclick listener returning false cancels event");
</script>

View file

@ -0,0 +1,65 @@
<!DOCTYPE html>
<title>Event handler invocation order</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var objects = [{}, function() {}, new Number(42), new String()];
var primitives = [42, null, undefined, ""];
objects.forEach(function(object) {
var t = async_test("Event handler listeners should be registered when they " +
"are first set to an object value (" +
format_value(object) + ").");
t.step(function() {
var i = 0;
var uncalled = "t.step(function() { assert_unreached('First event handler.') })"
var button = document.createElement('button');
button.onclick = object; // event handler listener is registered here
button.addEventListener('click', t.step_func(function () { assert_equals(++i, 2) }), false);
button.setAttribute('onclick', uncalled);
button.addEventListener('click', t.step_func(function () { assert_equals(++i, 3) }), false);
button.onclick = t.step_func(function () { assert_equals(++i, 1); });
button.addEventListener('click', t.step_func(function () { assert_equals(++i, 4) }), false);
button.click()
assert_equals(button.getAttribute("onclick"), uncalled)
assert_equals(i, 4);
t.done()
});
});
primitives.forEach(function(primitive) {
var t = async_test("Event handler listeners should be registered when they " +
"are first set to an object value (" +
format_value(primitive) + ").");
t.step(function() {
var i = 0;
var uncalled = "t.step(function() { assert_unreached('First event handler.') })"
var button = document.createElement('button');
button.onclick = primitive;
button.addEventListener('click', t.step_func(function () { assert_equals(++i, 1) }), false);
button.setAttribute('onclick', uncalled); // event handler listener is registered here
button.addEventListener('click', t.step_func(function () { assert_equals(++i, 3) }), false);
button.onclick = t.step_func(function () { assert_equals(++i, 2); });
button.addEventListener('click', t.step_func(function () { assert_equals(++i, 4) }), false);
button.click()
assert_equals(button.getAttribute("onclick"), uncalled)
assert_equals(i, 4);
t.done()
});
});
var t = async_test("Event handler listeners should be registered when they " +
"are first set to an object value.");
t.step(function() {
var i = 0;
var uncalled = "t.step(function() { assert_unreached('First event handler.') })"
var button = document.createElement('button');
button.addEventListener('click', t.step_func(function () { assert_equals(++i, 1) }), false);
button.setAttribute('onclick', uncalled); // event handler listener is registered here
button.addEventListener('click', t.step_func(function () { assert_equals(++i, 3) }), false);
button.onclick = t.step_func(function () { assert_equals(++i, 2); });
button.addEventListener('click', t.step_func(function () { assert_equals(++i, 4) }), false);
button.click()
assert_equals(button.getAttribute("onclick"), uncalled)
assert_equals(i, 4);
t.done()
});
</script>

View file

@ -0,0 +1,52 @@
<!doctype html>
<meta charset="utf-8">
<title>Inline event handlers retain their ordering even when invalid</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
var events = [];
test(function() {
events = [];
var e = document.createElement("div");
document.body.appendChild(e);
e.addEventListener("click", function() { events.push("ONE") });
e.setAttribute("onclick", "window.open(");
e.addEventListener("click", function() { events.push("THREE") });
// Try to compile the event handler.
e.onclick;
e.setAttribute("onclick", "events.push('TWO')");
e.dispatchEvent(new Event("click"));
var expected_events = ["ONE", "TWO", "THREE"];
assert_array_equals(events, expected_events);
}, "Inline event handlers retain their ordering when invalid and force-compiled");
test(function() {
events = [];
var e = document.createElement("div");
document.body.appendChild(e);
e.addEventListener("click", function() { events.push("ONE") });
e.setAttribute("onclick", "window.open(");
e.addEventListener("click", function() { events.push("THREE") });
e.dispatchEvent(new Event("click"));
e.setAttribute("onclick", "events.push('TWO')");
e.dispatchEvent(new Event("click"));
var expected_events = ["ONE", "THREE", "ONE", "TWO", "THREE"];
assert_array_equals(events, expected_events);
}, "Inline event handlers retain their ordering when invalid and force-compiled via dispatch");
test(function() {
events = [];
var e = document.createElement("div");
document.body.appendChild(e);
e.addEventListener("click", function() { events.push("ONE") });
e.setAttribute("onclick", "window.open(");
e.addEventListener("click", function() { events.push("THREE") });
e.setAttribute("onclick", "events.push('TWO')");
e.dispatchEvent(new Event("click"));
var expected_events = ["ONE", "TWO", "THREE"];
assert_array_equals(events, expected_events);
}, "Inline event handlers retain their ordering when invalid and lazy-compiled");
</script>
</body>

View file

@ -0,0 +1,25 @@
<!doctype html>
<meta charset="utf-8">
<title>Invalid uncompiled raw handlers should only be compiled when about to call them.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
setup({ allow_uncaught_exception: true });
test(function() {
var events = [];
window.onerror = function() {
events.push("Error");
};
var div = document.createElement("div");
div.addEventListener("click", function (e) { events.push("click 1") });
div.setAttribute("onclick", "}");
div.addEventListener("click", function (e) { events.push("click 2") });
div.dispatchEvent(new Event("click"));
assert_equals(div.onclick, null);
assert_array_equals(events, ["click 1", "error", "click 2"]);
});
</script>
</body>

View file

@ -0,0 +1,23 @@
<!doctype html>
<meta charset="utf-8">
<title>Invalid uncompiled raw handlers should only be compiled once.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
setup({ allow_uncaught_exception: true });
var errors = 0;
window.onerror = function() {
errors++;
};
test(function() {
var e = document.body;
e.setAttribute("onclick", "window.open(");
assert_equals(e.onclick, null);
assert_equals(e.onclick, null);
assert_equals(errors, 1);
});
</script>
</body>

View file

@ -0,0 +1,56 @@
<body></body>
<script>
function check1(args, callee) {
parent.t.step(function() {
parent.assert_equals(callee.length, 5);
parent.assert_equals(args.length, 5);
parent.assert_equals(args[0], reference_error.message);
parent.assert_equals(args[1], reference_error.filename);
parent.assert_equals(args[2], reference_error.lineno);
parent.assert_equals(args[3], reference_error.colno);
parent.assert_equals(args[4], reference_error.error);
parent.t.done();
});
}
var reference_error = new ErrorEvent("error", {
filename: "error_file.js",
lineno: 333,
colno: 999,
message: "there was an error",
error: {nondefault: 'some unusual object'},
});
parent.t.step(function() {
document.body.outerHTML = "<body onerror='check1(arguments, arguments.callee)'></body>"
window.dispatchEvent(reference_error);
});
function check2(args, callee) {
parent.t2.step(function() {
parent.assert_equals(callee.length, 5);
parent.assert_equals(args.length, 1);
parent.assert_false(args[0] instanceof ErrorEvent);
parent.t2.done()
});
}
parent.t2.step(function() {
document.body.outerHTML = "<body onerror='check2(arguments, arguments.callee)'></body>"
window.dispatchEvent(new Event("error"));
});
function check3(args, callee) {
parent.t3.step(function() {
parent.assert_equals(args.length, 1);
parent.assert_equals(callee.length, 1);
});
}
parent.t3.step(function() {
document.body.outerHTML = "<body><span onerror='check3(arguments, arguments.callee)'></span></body>"
document.body.firstChild.dispatchEvent(reference_error);
document.body.firstChild.dispatchEvent(new Event("error"));
parent.t3.done();
});
</script>

View file

@ -0,0 +1,11 @@
<!doctype html>
<meta charset=utf-8>
<title>OnErrorEventHandler + ErrorEvent is treated differently</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
var t = async_test("onerror + ErrorEvent + Window");
var t2 = async_test("onerror + !ErrorEvent + Window");
var t3 = async_test("onerror + Document");
</script>
<iframe src="onerroreventhandler-frame.html"></iframe>

View file

@ -0,0 +1,32 @@
<!doctype html>
<html>
<head>
<title>window.onerror - addEventListener</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var ran = false;
window.addEventListener('error', t.step_func(function(e){
ran = true;
assert_true(e.isTrusted, 'isTrusted');
}), false);
</script>
<script>
undefined_variable;
</script>
<script>
for (;) {}
</script>
<script>
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,37 @@
<!doctype html>
<html>
<head>
<title>&lt;body onerror> - compile error in &lt;script src=data:...></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
</script>
<body onerror="
t.step(function(){
ran = true;
assert_equals(typeof event, 'string', 'first arg');
assert_equals(source, 'data:text/javascript,for(;){}', 'second arg');
assert_equals(typeof lineno, 'number', 'third arg');
});
t_col.step(function() {
assert_equals(typeof colno, 'number', 'fourth arg');
});
">
<div id=log></div>
<script src="data:text/javascript,for(;){}"></script>
<script>
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
t_col.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,39 @@
<!doctype html>
<html>
<head>
<title>&lt;body onerror> - compile error in &lt;script></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
</script>
<body onerror="
t.step(function(){
ran = true;
assert_equals(typeof event, 'string', 'first arg');
assert_equals(source, location.href, 'second arg');
assert_equals(typeof lineno, 'number', 'third arg');
});
t_col.step(function() {
assert_equals(typeof colno, 'number', 'fourth arg');
});
">
<div id=log></div>
<script>
for(;) {}
</script>
<script>
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
t_col.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,39 @@
<!doctype html>
<html>
<head>
<title>&lt;body onerror> - runtime error in &lt;script></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
</script>
<body onerror="
t.step(function(){
ran = true;
assert_equals(typeof event, 'string', 'first arg');
assert_equals(source, location.href, 'second arg');
assert_equals(typeof lineno, 'number', 'third arg');
});
t_col.step(function(){
assert_equals(typeof colno, 'number', 'fourth arg');
});
">
<div id=log></div>
<script>
undefined_variable;
</script>
<script>
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
t_col.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!doctype html>
<html>
<head>
<title>window.onerror - compile error in cross-origin setInterval</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
var interval;
window.onerror = t.step_func(function(a, b, c, d){
clearInterval(interval);
ran = true;
col_value = d;
assert_equals(a, 'Script error.', 'first arg');
assert_equals(b, '', 'second arg');
assert_equals(c, 0, 'third arg');
});
function col_check() {
assert_equals(col_value, 0, 'fourth arg');
t_col.done();
}
var script = document.createElement('script');
script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/syntax-error-in-setInterval.js');
document.body.appendChild(script);
</script>
</body>
</html>

View file

@ -0,0 +1,32 @@
<!doctype html>
<html>
<head>
<title>window.onerror - compile error in cross-origin setTimeout</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
window.onerror = t.step_func(function(a, b, c, d){
ran = true;
col_value = d;
assert_equals(a, 'Script error.', 'first arg');
assert_equals(b, '', 'second arg');
assert_equals(c, 0, 'third arg');
});
function col_check() {
assert_equals(col_value, 0, 'fourth arg');
t_col.done();
}
var script = document.createElement('script');
script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/syntax-error-in-setTimeout.js');
document.body.appendChild(script);
</script>
</body>
</html>

View file

@ -0,0 +1,38 @@
<!doctype html>
<html>
<head>
<title>window.onerror - compile error in &lt;script src=//www1...></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
window.onerror = t.step_func(function(a, b, c, d){
ran = true;
col_value = d;
assert_equals(a, 'Script error.', 'first arg');
assert_equals(b, '', 'second arg');
assert_equals(c, 0, 'third arg');
});
var script = document.createElement('script');
script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/syntax-error.js');
document.body.appendChild(script);
onload = function(){
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
assert_equals(col_value, 0, 'fourth arg');
t_col.done();
});
};
</script>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<title>window.onerror - compile error in &lt;script src=data:...></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
window.onerror = t.step_func(function(a, b, c, d){
ran = true;
col_value = d;
assert_equals(typeof a, 'string', 'first arg');
assert_equals(b, 'data:text/javascript,for(;){}', 'second arg');
assert_equals(typeof c, 'number', 'third arg');
});
</script>
<script src="data:text/javascript,for(;){}"></script>
<script>
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
assert_equals(typeof col_value, 'number', 'fourth arg');
t_col.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,39 @@
<!doctype html>
<html>
<head>
<title>window.onerror - compile error in attribute</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
window.onerror = t.step_func(function(a, b, c, d){
ran = true;
col_value = d;
assert_equals(typeof a, 'string', 'first arg');
assert_equals(b, location.href, 'second arg');
assert_equals(typeof c, 'number', 'third arg');
});
</script>
<p onclick="{"></p>
<script>
t.step(function(){
var ev = document.createEvent('Event');
ev.initEvent('click', false, false);
document.querySelector('p').dispatchEvent(ev);
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
assert_equals(typeof col_value, 'number', 'fourth arg');
t_col.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,28 @@
<!doctype html>
<html>
<head>
<title>window.onerror - compile error in &lt;body onerror></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var ran = false;
window.onerror = t.step_func(function(){
ran = true;
});
</script>
</head>
<body onerror="{"><!-- sets the event handler to null before compiling -->
<div id=log></div>
<script>
for(;) {}
</script>
<script>
t.step(function(){
assert_false(ran, 'ran');
t.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,39 @@
<!doctype html>
<html>
<head>
<title>window.onerror - compile error in setInterval</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
var interval;
window.onerror = t.step_func(function(a, b, c, d){
clearInterval(interval);
ran = true;
col_value = d;
assert_equals(typeof a, 'string', 'first arg');
assert_equals(b, location.href, 'second arg');
assert_equals(typeof c, 'number', 'third arg');
});
interval = setInterval("{", 10);
setTimeout(function(){
t.step(function(){
clearInterval(interval);
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
assert_equals(typeof col_value, 'number', 'fourth arg');
t_col.done();
});
}, 20);
</script>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<title>window.onerror - compile error in setTimeout</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
window.onerror = t.step_func(function(a, b, c, d){
ran = true;
col_value = d;
assert_equals(typeof a, 'string', 'first arg');
assert_equals(b, location.href, 'second arg');
assert_equals(typeof c, 'number', 'third arg');
});
setTimeout("{", 10);
setTimeout(function(){
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
assert_equals(typeof col_value, 'number', 'fourth arg');
t_col.done();
});
}, 20);
</script>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<title>window.onerror - compile error in &lt;script src=...></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
window.onerror = t.step_func(function(a, b, c, d){
ran = true;
col_value = d;
assert_equals(typeof a, 'string', 'first arg');
assert_equals(b, document.querySelector('script[src="support/syntax-error.js"]').src, 'second arg');
assert_equals(typeof c, 'number', 'third arg');
});
</script>
<script src="support/syntax-error.js"></script>
<script>
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
assert_equals(typeof col_value, 'number', 'fourth arg');
t_col.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,38 @@
<!doctype html>
<html>
<head>
<title>window.onerror - compile error in &lt;script></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
window.onerror = t.step_func(function(a, b, c, d){
ran = true;
col_value = d;
assert_equals(typeof a, 'string', 'first arg');
assert_equals(b, location.href, 'second arg');
assert_equals(typeof c, 'number', 'third arg');
});
</script>
<script>
for(;) {}
</script>
<script>
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
assert_equals(typeof col_value, 'number', 'fourth arg');
t_col.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,28 @@
[
{
"id": "definitions-0",
"original_id": "definitions-0"
},
{
"id": "calling-scripts",
"original_id": "calling-scripts"
},
{
"id": "creating-scripts",
"original_id": "creating-scripts"
},
{
"id": "killing-scripts",
"original_id": "killing-scripts"
},
{
"id": "runtime-script-errors",
"original_id": "runtime-script-errors",
"children": [
{
"id": "runtime-script-errors-in-documents",
"original_id": "runtime-script-errors-in-documents"
}
]
}
]

View file

@ -0,0 +1,34 @@
<!doctype html>
<html>
<head>
<title>window.onerror - runtime error in cross-origin setInterval</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
var interval;
window.onerror = t.step_func(function(a, b, c, d){
clearInterval(interval);
ran = true;
col_value = d;
assert_equals(a, 'Script error.', 'first arg');
assert_equals(b, '', 'second arg');
assert_equals(c, 0, 'third arg');
});
function col_check() {
assert_equals(col_value, 0, 'fourth arg');
t_col.done();
}
var script = document.createElement('script');
script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/undefined-variable-in-setInterval.js');
document.body.appendChild(script);
</script>
</body>
</html>

View file

@ -0,0 +1,32 @@
<!doctype html>
<html>
<head>
<title>window.onerror - runtime error in cross-origin setTimeout</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
window.onerror = t.step_func(function(a, b, c, d){
ran = true;
col_value = d;
assert_equals(a, 'Script error.', 'first arg');
assert_equals(b, '', 'second arg');
assert_equals(c, 0, 'third arg');
});
function col_check() {
assert_equals(col_value, 0, 'fourth arg');
t_col.done();
}
var script = document.createElement('script');
script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/undefined-variable-in-setTimeout.js');
document.body.appendChild(script);
</script>
</body>
</html>

View file

@ -0,0 +1,38 @@
<!doctype html>
<html>
<head>
<title>window.onerror - runtime error in &lt;script src=//www1...></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
window.onerror = t.step_func(function(a, b, c, d){
ran = true;
col_value = d;
assert_equals(a, 'Script error.', 'first arg');
assert_equals(b, '', 'second arg');
assert_equals(c, 0, 'third arg');
});
var script = document.createElement('script');
script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/undefined-variable.js');
document.body.appendChild(script);
onload = function(){
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
assert_equals(col_value, 0, 'fourth arg');
t_col.done();
});
};
</script>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<title>window.onerror - runtime error in &lt;script src=data:...></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
window.onerror = t.step_func(function(a, b, c, d){
ran = true;
col_value = d;
assert_equals(typeof a, 'string', 'first arg');
assert_equals(b, 'data:text/javascript,undefined_variable;', 'second arg');
assert_equals(typeof c, 'number', 'third arg');
});
</script>
<script src="data:text/javascript,undefined_variable;"></script>
<script>
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
assert_equals(typeof col_value, 'number', 'fourth arg');
t_col.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,39 @@
<!doctype html>
<html>
<head>
<title>window.onerror - runtime error in attribute</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
window.onerror = t.step_func(function(a, b, c, d){
ran = true;
col_value = d;
assert_equals(typeof a, 'string', 'first arg');
assert_equals(b, location.href, 'second arg');
assert_equals(typeof c, 'number', 'third arg');
});
</script>
<p onclick="undefined_variable;"></p>
<script>
t.step(function(){
var ev = document.createEvent('Event');
ev.initEvent('click', false, false);
document.querySelector('p').dispatchEvent(ev);
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
assert_equals(typeof col_value, 'number', 'fourth arg');
t_col.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,25 @@
<!doctype html>
<html>
<head>
<title>runtime error in &lt;body onerror></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var ran = 0;
</script>
</head>
<body onerror="ran++; undefined_variable_in_onerror;">
<div id=log></div>
<script>
undefined_variable;
</script>
<script>
t.step(function(){
assert_equals(ran, 1, 'ran');
t.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,39 @@
<!doctype html>
<html>
<head>
<title>window.onerror - runtime error in setInterval</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
var interval;
window.onerror = t.step_func(function(a, b, c, d){
clearInterval(interval);
ran = true;
col_value = d;
assert_equals(typeof a, 'string', 'first arg');
assert_equals(b, location.href, 'second arg');
assert_equals(typeof c, 'number', 'third arg');
});
interval = setInterval("undefined_variable;", 10);
setTimeout(function(){
clearInterval(interval);
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
assert_equals(typeof col_value, 'number', 'fourth arg');
t_col.done();
});
}, 20);
</script>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<title>window.onerror - runtime error in setTimeout</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
window.onerror = t.step_func(function(a, b, c, d){
ran = true;
col_value = d;
assert_equals(typeof a, 'string', 'first arg');
assert_equals(b, location.href, 'second arg');
assert_equals(typeof c, 'number', 'third arg');
});
setTimeout("undefined_variable;", 10);
setTimeout(function(){
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
assert_equals(typeof col_value, 'number', 'fourth arg');
t_col.done();
});
}, 20);
</script>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!doctype html>
<html>
<head>
<title>runtime error in window.onerror</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var ran = 0;
window.onerror = function(){
ran++;
undefined_variable_in_onerror;
};
</script>
<script>
undefined_variable;
</script>
<script>
t.step(function(){
assert_equals(ran, 1, 'ran');
t.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<title>window.onerror - runtime error in &lt;script src=...></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
window.onerror = t.step_func(function(a, b, c, d){
ran = true;
col_value = d;
assert_equals(typeof a, 'string', 'first arg');
assert_equals(b, document.querySelector('script[src="support/undefined-variable.js"]').src, 'second arg');
assert_equals(typeof c, 'number', 'third arg');
});
</script>
<script src="support/undefined-variable.js"></script>
<script>
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
assert_equals(typeof col_value, 'number', 'fourth arg');
t_col.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,38 @@
<!doctype html>
<html>
<head>
<title>window.onerror - runtime error in &lt;script></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
setup({allow_uncaught_exception:true});
var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false;
var col_value;
window.onerror = t.step_func(function(a, b, c, d){
ran = true;
col_value = d;
assert_equals(typeof a, 'string', 'first arg');
assert_equals(b, location.href, 'second arg');
assert_equals(typeof c, 'number', 'third arg');
});
</script>
<script>
undefined_variable;
</script>
<script>
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(function(){
assert_equals(typeof col_value, 'number', 'fourth arg');
t_col.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,9 @@
interval = setInterval('{', 10);
setTimeout(function(){
clearInterval(interval);
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(col_check);
}, 20);

View file

@ -0,0 +1,8 @@
setTimeout('{', 10);
setTimeout(function(){
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(col_check);
}, 20);

View file

@ -0,0 +1,9 @@
interval = setInterval('undefined_variable;', 10);
setTimeout(function(){
clearInterval(interval);
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(col_check);
}, 20);

View file

@ -0,0 +1,8 @@
setTimeout('undefined_variable;', 10);
setTimeout(function(){
t.step(function(){
assert_true(ran, 'ran');
t.done();
});
t_col.step(col_check);
}, 20);

View file

@ -0,0 +1,40 @@
<!doctype html>
<html>
<head>
<title>window.onerror: parse errors</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
In https://html.spec.whatwg.org/multipage/#creating-scripts ,
step 3 describes parsing the script, and step 5 says:
# Otherwise, report the error using the onerror event handler of
# the script's global object. If the error is still not handled
# after this, then the error may be reported to the user.
which links to
https://html.spec.whatwg.org/multipage/#report-the-error ,
which describes what to do when onerror is a Function.
-->
</head>
<body>
<div id="log"></div>
<script>
setup({allow_uncaught_exception:true});
var error_count = 0;
window.onerror = function(msg, url, lineno) {
++error_count;
test(function() {assert_equals(url, window.location.href)},
"correct url passed to window.onerror");
test(function() {assert_equals(lineno, 34)},
"correct line number passed to window.onerror");
};
</script>
<script>This script does not parse correctly.</script>
<script>
test(function() {assert_equals(error_count, 1)},
"correct number of calls to window.onerror");
</script>
</body>
</html>

View file

@ -0,0 +1,39 @@
<!doctype html>
<html>
<head>
<title>window.onerror: runtime scripterrors</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
https://html.spec.whatwg.org/multipage/#runtime-script-errors
says what to do for uncaught runtime script errors, and just below
describes what to do when onerror is a Function.
-->
</head>
<body>
<div id="log"></div>
<script>
setup({allow_uncaught_exception:true});
var error_count = 0;
window.onerror = function(msg, url, lineno) {
++error_count;
};
</script>
<script>
try {
// This error is caught, so it should NOT trigger onerror.
throw "foo";
} catch (ex) {
}
// This error is NOT caught, so it should trigger onerror.
throw "bar";
</script>
<script>
test(function() {assert_equals(error_count, 1)},
"correct number of calls to window.onerror");
</script>
</body>
</html>

View file

@ -0,0 +1,43 @@
<!doctype html>
<html>
<head>
<title>window.onerror: runtime scripterrors</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
https://html.spec.whatwg.org/multipage/#runtime-script-errors
says what to do for uncaught runtime script errors, and just below
describes what to do when onerror is a Function.
-->
</head>
<body>
<div id="log"></div>
<script>
setup({allow_uncaught_exception:true});
var error_count = 0;
window.onerror = function(msg, url, lineno) {
++error_count;
test(function() {assert_equals(url, window.location.href)},
"correct url passed to window.onerror");
test(function() {assert_equals(lineno, 36)},
"correct line number passed to window.onerror");
};
</script>
<script>
try {
// This error is caught, so it should NOT trigger onerror.
window.nonexistentproperty.oops();
} catch (ex) {
}
// This error is NOT caught, so it should trigger onerror.
window.nonexistentproperty.oops();
</script>
<script>
test(function() {assert_equals(error_count, 1)},
"correct number of calls to window.onerror");
</script>
</body>
</html>

View file

@ -0,0 +1,33 @@
<!doctype html>
<meta charset=utf-8>
<title>
When a listener from window A is added to an event target in window B via the
addEventListener function from window B, errors in that listener should be
reported to window A.
</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<iframe></iframe>
<iframe></iframe>
<script>
test(function() {
var f = new frames[0].Function("thereIsNoSuchCallable()");
frames[1].document.addEventListener("myevent", f);
var frame0ErrorFired = false;
var frame1ErrorFired = false;
var ourErrorFired = false;
frames[0].addEventListener("error", function() {
frame0ErrorFired = true;
});
frames[1].addEventListener("error", function() {
frame1ErrorFired = true;
});
addEventListener("error", function() {
ourErrorFired = true;
});
frames[1].document.dispatchEvent(new Event("myevent"));
assert_true(frame0ErrorFired);
assert_false(frame1ErrorFired);
assert_false(ourErrorFired);
}, "The error event from an event listener should fire on that listener's global");
</script>

View file

@ -0,0 +1,33 @@
<!doctype html>
<meta charset=utf-8>
<title>
When a listener from window A is added to an event target in window B via the
addEventListener function from window A, errors in that listener should be
reported to window A.
</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<iframe></iframe>
<iframe></iframe>
<script>
test(function() {
var f = new frames[0].Function("thereIsNoSuchCallable()");
frames[0].document.addEventListener.call(frames[1].document, "myevent", f);
var frame0ErrorFired = false;
var frame1ErrorFired = false;
var ourErrorFired = false;
frames[0].addEventListener("error", function() {
frame0ErrorFired = true;
});
frames[1].addEventListener("error", function() {
frame1ErrorFired = true;
});
addEventListener("error", function() {
ourErrorFired = true;
});
frames[1].document.dispatchEvent(new Event("myevent"));
assert_true(frame0ErrorFired);
assert_false(frame1ErrorFired);
assert_false(ourErrorFired);
}, "The error event from an event listener should fire on that listener's global");
</script>

View file

@ -0,0 +1,33 @@
<!doctype html>
<meta charset=utf-8>
<title>
When a listener from window A is added to an event target in window A via the
addEventListener function from window A, errors in that listener should be
reported to window A.
</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<iframe></iframe>
<iframe></iframe>
<script>
test(function() {
var f = new frames[1].Function("thereIsNoSuchCallable()");
frames[1].document.addEventListener("myevent", f);
var frame0ErrorFired = false;
var frame1ErrorFired = false;
var ourErrorFired = false;
frames[0].addEventListener("error", function() {
frame0ErrorFired = true;
});
frames[1].addEventListener("error", function() {
frame1ErrorFired = true;
});
addEventListener("error", function() {
ourErrorFired = true;
});
frames[1].document.dispatchEvent(new Event("myevent"));
assert_false(frame0ErrorFired);
assert_true(frame1ErrorFired);
assert_false(ourErrorFired);
}, "The error event from an event listener should fire on that listener's global");
</script>

View file

@ -0,0 +1,33 @@
<!doctype html>
<meta charset=utf-8>
<title>
When a listener from window A is added to an event target in window A via the
addEventListener function from window B, errors in that listener should be
reported to window A.
</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<iframe></iframe>
<iframe></iframe>
<script>
test(function() {
var f = new frames[1].Function("thereIsNoSuchCallable()");
frames[0].document.addEventListener.call(frames[1].document, "myevent", f);
var frame0ErrorFired = false;
var frame1ErrorFired = false;
var ourErrorFired = false;
frames[0].addEventListener("error", function() {
frame0ErrorFired = true;
});
frames[1].addEventListener("error", function() {
frame1ErrorFired = true;
});
addEventListener("error", function() {
ourErrorFired = true;
});
frames[1].document.dispatchEvent(new Event("myevent"));
assert_false(frame0ErrorFired);
assert_true(frame1ErrorFired);
assert_false(ourErrorFired);
}, "The error event from an event listener should fire on that listener's global");
</script>