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

Why do we throw different exceptions for non-text/css imports and other load failures #53

Closed
bzbarsky opened this issue Oct 23, 2018 · 2 comments

Comments

@bzbarsky
Copy link

bzbarsky commented Oct 23, 2018

It's not clear to me why wrong MIME type on an @import leads to TypeError but other failures (CSP, say) lead to a DOMException.

If we think the text/css thing really needs to be distinguishable from other load failures, doing it by the type of the exception is a bit odd.

@rakina
Copy link
Member

rakina commented Oct 23, 2018

Oh, yeah, probably we should throw a DOMException with error name "NotAllowedError" for wrong MIME type (or a different name?).

And maybe we should update the one on adoptedStyleSheets to throw DOMException with name "NotAllowedError" instead of TypeError when assigned invalid stylesheets as well?

@bzbarsky
Copy link
Author

Oh, yeah, probably we should throw a DOMException with error name "NotAllowedError"

Oh, speaking of which, the spec doesn't say what the name should be for the "load failed" case.

In my ideal world, the "load failed" case and the "not text/css" case would not be distinguishable via this API. Especially because with CORB the "not text/css" case becomes the "load failed" case and the assumption is that this difference is not observable.

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

No branches or pull requests

2 participants