Bug 161859

Summary: Link loader should use FetchOptions::mode according its crossOrigin attribute
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebCore Misc.Assignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, commit-queue, dbates, japhet, koivisto, sam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch for landing none

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