-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add some initial tests for JSON modules. #16734
Conversation
Note to self: some CORS tests could be useful too. CC @littledan |
Chrome added some logic for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as a start. For posterity, additional ideas for tests (potentially best done by the first implementer):
- Non-JSON content types get rejected, including tricky cases like @annevk pointed out.
- Test that there are no non-default imports. (Maybe easiest to test with
import()
.) - Test non-Window contexts. (Easy: using
.any.js
+import()
. Harder: using module workers which nobody ships yet, but Chrome has behind a flag.) - Test JSON files containing non-objects (null, true, false, array)
@@ -0,0 +1,21 @@ | |||
<!DOCTYPE html> | |||
<meta charset=utf-8> | |||
<title>JSON modules: Content-Type</title> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong title
Also there are a lot of tests in the JS modules directory that might benefit from porting. For example testing that if you have module A with side effects, that imports JSON module B containing invalid JSON, asserting that the side effects of A do not happen. /cc @nyaxt and @hiroshige-g as folks who helped with a lot of the test coverage for JS modules. |
As explained at WICG/webcomponents#839 the current setup is insecure. Tests are now marked as "tentative": web-platform-tests/wpt#16734. This reverts db03474.
As explained at WICG/webcomponents#839 the current setup is insecure. Tests are now marked as "tentative": web-platform-tests/wpt#16734. This reverts db03474.
See whatwg/html#4407.