diff --git a/html/webappapis/scripting/reporterror.any.js b/html/webappapis/scripting/reporterror.any.js new file mode 100644 index 00000000000000..70c17c0de4246b --- /dev/null +++ b/html/webappapis/scripting/reporterror.any.js @@ -0,0 +1,22 @@ +setup({ allow_uncaught_exception:true }); + +test(t => { + let happened = false; + self.addEventListener("error", t.step_func(e => { + assert_equals(e.error, 1); + happened = true; + })); + self.reportError(1); + assert_true(happened); +}, "self.reportError(1)"); + +test(t => { + const throwable = new TypeError(); + let happened = false; + self.addEventListener("error", t.step_func(e => { + assert_equals(e.error, throwable); + happened = true; + })); + self.reportError(throwable); + assert_true(happened); +}, "self.reportError(obj)");