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

Eliminate last uses of assert_throws. #21762

Merged
merged 1 commit into from Feb 13, 2020

Conversation

bzbarsky
Copy link
Contributor

The one remaining use inside promise_rejects will go away soon when
promise_rejects goes away.

@bzbarsky
Copy link
Contributor Author

Looking at the Firefox stability failures:

so that should not block this landing.

Looking at the experimental wpt.fyi results:

  • Safari: this is a known bug in Safari's fetch() impl: it rejects with exceptions from the wrong global.
  • Firefox: this is covered by the stability failures above.
  • Chrome: This is a problem with this PR. import-maps/builtin-support.tentative/imported/parsing-schema.tentative.html parses an invalid thing in a subframe and then rethrows the resulting SyntaxError, so the exception comes from a different global.

I'll see about fixing the import-map test.

assert_throws(new SyntaxError(), () => { i.states.add(''); });
assert_throws('InvalidCharacterError', () => { i.states.add('a\tb'); });
assert_throws_js(TypeError, () => { i.states.supports('foo'); });
assert_throws_dom('SyntaxError', () => { i.states.add(''); });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth pointing out that this also fixes correctness of test as new SyntaxError() seems wrong. (Same for some other files.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pointing out in the commit message? But yes, in general that was the whole point of the assert_throws changes...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the main point was asserting the correct global, not also changing some incorrect JS SyntaxError to "SyntaxError" DOMException.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fwiw, the main point for me when I started this was catching places where people threw bogus DOMException TypeErrors instead of JS TypeErrors. The JS-vs-DOM SyntaxError is basically the same thing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't realize the state of affairs was that bad. Wow, well I'm even more glad you fixed this then, thanks so much!

The one remaining use inside promise_rejects will go away soon when
promise_rejects goes away.
@Ms2ger
Copy link
Contributor

Ms2ger commented Feb 13, 2020

Have we checked if webkit is ready for the removal? @rniwa ?

@jgraham
Copy link
Contributor

jgraham commented Feb 13, 2020

So I should go ahead and admin merge this?

@foolip
Copy link
Member

foolip commented Feb 13, 2020

@stephenmcgruer are we ready for this change in Chromium?

@stephenmcgruer
Copy link
Contributor

stephenmcgruer commented Feb 13, 2020

Not exactly, but we can merge it without breaking us. We keep a separate copy of testharness.js for internal tests, and roll that manually, so we just can't roll till we migrate internal tests.

Currently we have ~1200 assert_throws( and ~150 promise_rejects( in obvious internal WPTs. (There may be more, some unittests embed HTML content and depend on us, which is always fun.)

https://crbug.com/1051932 tracks Chromium

@clopez
Copy link
Contributor

clopez commented Feb 13, 2020

Currently in WebKit we are not running automated imports of the imported WPT tests.
This will be only an issue if someone updates the resources/ directory without also updating every other directory or at least checking that no more users of assert_throws or promise_rejects remain.
Hopefully the one updating that directory will notice this function its now gone.
Also, I will try to remember this the next time we do WPT imports and i'll be around.
So I don't think this should be an issue, feel free to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants