Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding a way to pass a global to assert_throws_dom #21809

Closed
bzbarsky opened this issue Feb 14, 2020 · 4 comments
Closed

Consider adding a way to pass a global to assert_throws_dom #21809

bzbarsky opened this issue Feb 14, 2020 · 4 comments

Comments

@bzbarsky
Copy link
Contributor

@bzbarsky bzbarsky commented Feb 14, 2020

Now that we have the JS and DOM cases clearly separated, it's worth thinking about ways to test that exceptions come from the right global in the DOM case. Possible options:

  1. Allow (or require?) passing a new DOMException("", name) instead of just the name string. The code could then compare the .constructor on the two things. The drawback is that silly message arg, and the general length.
  2. Allow passing a trailing argument for the global, either a required one or defaulting to self. The compare .constructor to global.DOMException.
  3. Allow passing a (clearly required) leading argument for the global.

Other options? Preferences?

@bzbarsky
Copy link
Contributor Author

@bzbarsky bzbarsky commented Feb 15, 2020

One issue with adding the trailing argument is that callers who are not passing a description right now would have to start passing one (e.g. undefined to keep the current behavior).

That said, I suspect most users of assert_throws_dom do not need to pass a non-default global, so this may still be the right tradeoff.

@bzbarsky
Copy link
Contributor Author

@bzbarsky bzbarsky commented Feb 15, 2020

OK, looks like options 2 and 3 do not work, because at least some tests test that an exception is thrown in a navigated-away-from window. And in that case passing in a global is no good, because the WindowProxy will now point to the new Window. So it seems like we really do need to pass in the relevant DOMException constructor somehow.

@guest271314

This comment was marked as off-topic.

@bzbarsky

This comment was marked as off-topic.

bzbarsky added a commit to bzbarsky/web-platform-tests that referenced this issue Feb 19, 2020
Then we can verify that the DOMExceptions come from the right global.

Fixes web-platform-tests#21809
bzbarsky added a commit to bzbarsky/web-platform-tests that referenced this issue Feb 19, 2020
Then we can verify that the DOMExceptions come from the right global.

Fixes web-platform-tests#21809
bzbarsky added a commit to bzbarsky/web-platform-tests that referenced this issue Feb 19, 2020
Then we can verify that the DOMExceptions come from the right global.

Fixes web-platform-tests#21809
bzbarsky added a commit to bzbarsky/web-platform-tests that referenced this issue Feb 19, 2020
Then we can verify that the DOMExceptions come from the right global.

Fixes web-platform-tests#21809
bzbarsky added a commit to bzbarsky/web-platform-tests that referenced this issue Feb 21, 2020
Then we can verify that the DOMExceptions come from the right global.

Fixes web-platform-tests#21809
jgraham added a commit that referenced this issue Feb 21, 2020
Then we can verify that the DOMExceptions come from the right global.

Fixes #21809
xeonchen pushed a commit to xeonchen/gecko that referenced this issue Feb 24, 2020
…and promise_rejects_dom., a=testonly

Automatic update from web-platform-tests
Pass a constructor to assert_throws_dom and promise_rejects_dom.

Then we can verify that the DOMExceptions come from the right global.

Fixes web-platform-tests/wpt#21809

--

wpt-commits: 4ba5bc3847bc88a7a2598841933b89ae4b611bcf
wpt-pr: 21876
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Feb 25, 2020
…and promise_rejects_dom., a=testonly

Automatic update from web-platform-tests
Pass a constructor to assert_throws_dom and promise_rejects_dom.

Then we can verify that the DOMExceptions come from the right global.

Fixes web-platform-tests/wpt#21809

--

wpt-commits: 4ba5bc3847bc88a7a2598841933b89ae4b611bcf
wpt-pr: 21876

UltraBlame original commit: b592d6685296f964170caec2f0758e23439df005
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Feb 25, 2020
…and promise_rejects_dom., a=testonly

Automatic update from web-platform-tests
Pass a constructor to assert_throws_dom and promise_rejects_dom.

Then we can verify that the DOMExceptions come from the right global.

Fixes web-platform-tests/wpt#21809

--

wpt-commits: 4ba5bc3847bc88a7a2598841933b89ae4b611bcf
wpt-pr: 21876
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.