diff options
author | Josh Matthews <josh@joshmatthews.net> | 2015-11-09 11:48:54 -0500 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2015-11-12 16:21:24 -0500 |
commit | c4c0809934a8f8d924ddeff6d485ef620621c560 (patch) | |
tree | 8947364b49cf58127ce9bd0be8d41fec344dcb08 | |
parent | 2340583e56a7a67dc3d15dcd2673670255694b59 (diff) | |
download | servo-c4c0809934a8f8d924ddeff6d485ef620621c560.tar.gz servo-c4c0809934a8f8d924ddeff6d485ef620621c560.zip |
Add test for OnErrorEventHandler special case.
3 files changed, 73 insertions, 0 deletions
diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 329cdeeacbf..2237fa1a18b 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -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" + } ] } }, diff --git a/tests/wpt/web-platform-tests/html/webappapis/scripting/events/onerroreventhandler-frame.html b/tests/wpt/web-platform-tests/html/webappapis/scripting/events/onerroreventhandler-frame.html new file mode 100644 index 00000000000..79e4af30206 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/webappapis/scripting/events/onerroreventhandler-frame.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> diff --git a/tests/wpt/web-platform-tests/html/webappapis/scripting/events/onerroreventhandler.html b/tests/wpt/web-platform-tests/html/webappapis/scripting/events/onerroreventhandler.html new file mode 100644 index 00000000000..60fc674d570 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/webappapis/scripting/events/onerroreventhandler.html @@ -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> |