Skip to content

Commit

Permalink
Enable reportError tests in ShadowRealm
Browse files Browse the repository at this point in the history
reportError seems to be minimally tested. ShadowRealm doesn't have the
location exposed, so just assume it will be blank. This may need to be
changed depending on what browsers do. It is not specified what the value
should be in https://html.spec.whatwg.org/#extract-error:

  "Set _attributes_[message], _attributes_[filename],
  _attributes_[lineno], and _attributes_[colno] to implementation-defined
  values derived from _exception_.

  NOTE: Browsers implement behavior not specified here or in the
  JavaScript specification to gather values which are helpful, including
  in unusual cases (e.g., `eval`). In the future, this might be specified
  in greater detail.

This seems like exactly such an unusual case.
  • Loading branch information
ptomato committed Nov 27, 2024
1 parent feb313b commit 50fd176
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion html/webappapis/scripting/reporterror.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

setup({ allow_uncaught_exception:true });

[
Expand All @@ -9,7 +11,7 @@ setup({ allow_uncaught_exception:true });
let happened = false;
self.addEventListener("error", t.step_func(e => {
assert_true(e.message !== "");
assert_equals(e.filename, new URL("reporterror.any.js", location.href).href);
assert_equals(e.filename, location ? new URL("reporterror.any.js", location.href).href : "");
assert_greater_than(e.lineno, 0);
assert_greater_than(e.colno, 0);
assert_equals(e.error, throwable);
Expand Down

0 comments on commit 50fd176

Please sign in to comment.