Bug 107389
Summary: | <script crossorigin> not handled correctly when server doesn't send the right headers | ||
---|---|---|---|
Product: | WebKit | Reporter: | Boris Zbarsky <bzbarsky> |
Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | abarth, ap, pf, rakeshpai, syoichi |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Boris Zbarsky
Accordiing to https://bugzilla.mozilla.org/show_bug.cgi?id=832587#c0 a <script crossorigin> with a cross-origin URL to a server that's not sending the right access-control-allow-origin headers executes in Chrome. That's not what the spec says to do. In particular, see http://www.whatwg.org/specs/web-apps/current-work/multipage/fetching-resources.html#potentially-cors-enabled-fetch the part about 'If mode is "Anonymous" or "Use Credentials"' under 'If the CORS cross-origin request status is not success'.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Pablo Flouret
Do you have a testcase that i can look at?
Otherwise, if i understand you correctly, this test does what you mean, no? http://trac.webkit.org/browser/trunk/LayoutTests/http/tests/security/script-with-failed-cors-check-fails-to-load.html
Pablo Flouret
Ah, i see the testcase in the bugzilla bug, looking at it now.
Pablo Flouret
I wasn't aware that when the parser triggers the script request it follows a different code path that doesn't end up in ScriptElement::notifyFinished() so the check is never done.
I'm not super familiar with how the parser does things, is HTMLScriptRunner::executePendingScriptAndDispatchEvent() the right place to do the CORS check (or HTMLScriptRunner::runScript(), or both)?