Bug 157370 - CORS check is sometimes incorrectly failing for media loads
Summary: CORS check is sometimes incorrectly failing for media loads
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P1 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-05-04 21:45 PDT by Chris Dumez
Modified: 2016-06-19 17:47 PDT (History)
5 users (show)

See Also:


Attachments
WIP Patch (2.89 KB, patch)
2016-05-04 21:48 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (9.47 KB, patch)
2016-05-05 15:07 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-05-04 21:45:41 PDT
CORS check is sometimes incorrectly failing for media loads. This happens when our media library issues a conditional request and when the sever responds with a "304 Not Modified" response which does not have the "Access-Control-Allow-Origin: *" header. Apache for example does not provide such header for 304 responses.
Comment 1 Chris Dumez 2016-05-04 21:46:18 PDT
<rdar://problem/26071607>
Comment 2 Chris Dumez 2016-05-04 21:48:21 PDT
Created attachment 278156 [details]
WIP Patch
Comment 3 Alex Christensen 2016-05-05 10:30:11 PDT
Comment on attachment 278156 [details]
WIP Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=278156&action=review

> Source/WebCore/loader/MediaResourceLoader.cpp:73
> +    if (updatedRequest.isConditional() && corsPolicy == PotentiallyCrossOriginEnabled) {

We shouldn't need to check if a request is conditional.  Just make it unconditional, which won't do anything if it is not conditional.  This will reduce iterating.
We also don't need to make a new ResourceRequest for non-cors requests.
Comment 4 Chris Dumez 2016-05-05 10:32:22 PDT
Comment on attachment 278156 [details]
WIP Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=278156&action=review

>> Source/WebCore/loader/MediaResourceLoader.cpp:73
>> +    if (updatedRequest.isConditional() && corsPolicy == PotentiallyCrossOriginEnabled) {
> 
> We shouldn't need to check if a request is conditional.  Just make it unconditional, which won't do anything if it is not conditional.  This will reduce iterating.
> We also don't need to make a new ResourceRequest for non-cors requests.

Yes, I thought about calling makeUnconditional() directly as well. I have it done locally already.

It is true we do not have to copy the request in the non-CORS case, it is just easier to write this way.
Comment 5 Chris Dumez 2016-05-05 15:07:06 PDT
Created attachment 278193 [details]
Patch
Comment 6 WebKit Commit Bot 2016-05-05 16:26:28 PDT
Comment on attachment 278193 [details]
Patch

Clearing flags on attachment: 278193

Committed r200493: <http://trac.webkit.org/changeset/200493>
Comment 7 WebKit Commit Bot 2016-05-05 16:26:36 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Michael Catanzaro 2016-06-19 17:47:41 PDT
This test is timing out for GTK, see bug #158921.