Bug 161859 - Link loader should use FetchOptions::mode according its crossOrigin attribute
Summary: Link loader should use FetchOptions::mode according its crossOrigin attribute
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-12 04:25 PDT by youenn fablet
Modified: 2016-10-25 07:35 PDT (History)
7 users (show)

See Also:


Attachments
Patch (22.20 KB, patch)
2016-09-12 04:41 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (20.82 KB, patch)
2016-09-16 00:11 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2016-09-12 04:25:26 PDT
This will allow actual reuse of resources now that the cache is handling resource origin and CORS mode.
Comment 1 youenn fablet 2016-09-12 04:41:47 PDT
Created attachment 288566 [details]
Patch
Comment 2 youenn fablet 2016-09-16 00:11:34 PDT
Created attachment 289039 [details]
Patch for landing
Comment 3 WebKit Commit Bot 2016-09-16 00:43:59 PDT
Comment on attachment 289039 [details]
Patch for landing

Clearing flags on attachment: 289039

Committed r206010: <http://trac.webkit.org/changeset/206010>
Comment 4 WebKit Commit Bot 2016-09-16 00:44:04 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Antti Koivisto 2016-10-25 06:02:30 PDT
Comment on attachment 289039 [details]
Patch for landing

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

> Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp:99
> +    m_parsedStyleSheetCache = sheet.m_parsedStyleSheetCache;

This is not correct. It is not safe to have multiple cache clients for the same StyleSheetContents instance. This should make a copy() and call addedToMemoryCache() for it.

This is a probable cause for https://bugs.webkit.org/show_bug.cgi?id=163905
Comment 6 youenn fablet 2016-10-25 06:39:48 PDT
Comment on attachment 289039 [details]
Patch for landing

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

>> Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp:99
>> +    m_parsedStyleSheetCache = sheet.m_parsedStyleSheetCache;
> 
> This is not correct. It is not safe to have multiple cache clients for the same StyleSheetContents instance. This should make a copy() and call addedToMemoryCache() for it.
> 
> This is a probable cause for https://bugs.webkit.org/show_bug.cgi?id=163905

I can prepare something along the lines you mention but I would be interested in further understanding the situation.
For instance, what is the reason of this multiple cache clients limitation? Can we remove it?
Comment 7 Antti Koivisto 2016-10-25 07:35:01 PDT
> I can prepare something along the lines you mention but I would be
> interested in further understanding the situation.
> For instance, what is the reason of this multiple cache clients limitation?
> Can we remove it?

It might actually be just matter of replacing m_isInMemoryCache bit with m_isInMemoryCacheCount that gets incremented and decremented as needed.

The bit is used to figuring out if we need to make a copy of the stylesheet contents when it is mutated via API. See CSSStyleSheet::willMutateRules().
Comment 8 Antti Koivisto 2016-10-25 07:35:33 PDT
m_inMemoryCacheCount