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

Should errors be considered same-origin or cross-origin? #848

Closed
mfalken opened this issue Dec 11, 2018 · 3 comments
Closed

Should errors be considered same-origin or cross-origin? #848

mfalken opened this issue Dec 11, 2018 · 3 comments

Comments

@mfalken
Copy link

mfalken commented Dec 11, 2018

This came up in a Blink Intent to Ship.

HTML defines CORS-same-origin in a way that excludes 'error' responses. As a result, stylesheets that fail to load are considered cross-origin, so stylesheet.cssRules will throw a SecurityError.

Is this the recommended way specs interpret the Fetch response type 'error', and if so why?

I could imagine an alternative design we have 'error' and 'opaqueerror', where 'error' is network error from a same-origin URL and opaqueerror is a network error from a cross-origin URL. Was that type of design considered and rejected?

@annevk
Copy link
Member

annevk commented Dec 11, 2018

It's somewhat part of the way we "designed" errors that you cannot tell much about them. E.g., if the TLS handshake fails when establishing a second same-origin connection, is that a same-origin error?

I suspect that for new APIs we wouldn't use DOMException "SecurityError" though, we'd use TypeError or perhaps DOMException "NetworkError".

Hope that helps.

@mfalken
Copy link
Author

mfalken commented Dec 18, 2018

Thanks. Following up on this, I changed Chrome to throw a SecurityError for a <link rel=stylesheet> that fails to load due to network error. There's a risk of breaking some sites that access cssRules expecting it to never throw. Indeed one Chrome test broke with this change because it was loading a file:// URL that didn't exist, and no one noticed until now. I'll see if reports come in. You can probably close this issue.

@annevk
Copy link
Member

annevk commented Dec 21, 2018

Thanks for the follow-up!

@annevk annevk closed this as completed Dec 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants