mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Add test for OnErrorEventHandler special case.
This commit is contained in:
parent
2340583e56
commit
c4c0809934
3 changed files with 73 additions and 0 deletions
|
@ -29826,6 +29826,12 @@
|
|||
"path": "html/browsers/browsing-the-web/navigating-across-documents/javascript-url-query-fragment-components.html",
|
||||
"url": "/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-query-fragment-components.html"
|
||||
}
|
||||
],
|
||||
"html/webappapis/scripting/events/onerroreventhandler.html": [
|
||||
{
|
||||
"path": "html/webappapis/scripting/events/onerroreventhandler.html",
|
||||
"url": "/html/webappapis/scripting/events/onerroreventhandler.html"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue