Changeset 206902 in webkit


Ignore:
Timestamp:
Oct 6, 2016 11:18:37 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

CachedXSLStylesheet does not need to be updated according Origin/Fetch mode
https://bugs.webkit.org/show_bug.cgi?id=162389

Patch by Youenn Fablet <youenn@apple.com> on 2016-10-06
Reviewed by Darin Adler.

No change of behavior.

Making clear that there is no reason to update cached XSLT resources according the origin, given that CORS is never checked and loading is always same-origin.

Renaming CachedResource::isClean to CachedResource::isCORSSameOrigin to better match spec terminology.
Updating HTMLLinkElement accordingly.

  • html/HTMLLinkElement.cpp:

(WebCore::HTMLLinkElement::initializeStyleSheet):

  • loader/cache/CachedResource.cpp:

(WebCore::CachedResource::isCORSSameOrigin): Ensuring that this method is not called for resource types for which CORS is not to be used.
(WebCore::CachedResource::isClean): Deleted.

  • loader/cache/CachedResource.h:
  • loader/cache/CachedResourceLoader.cpp:

(WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r206901 r206902  
     12016-10-06  Youenn Fablet  <youenn@apple.com>
     2
     3        CachedXSLStylesheet does not need to be updated according Origin/Fetch mode
     4        https://bugs.webkit.org/show_bug.cgi?id=162389
     5
     6        Reviewed by Darin Adler.
     7
     8        No change of behavior.
     9
     10        Making clear that there is no reason to update cached XSLT resources according the origin, given that CORS is never checked and loading is always same-origin.
     11
     12        Renaming CachedResource::isClean to CachedResource::isCORSSameOrigin to better match spec terminology.
     13        Updating HTMLLinkElement accordingly.
     14
     15        * html/HTMLLinkElement.cpp:
     16        (WebCore::HTMLLinkElement::initializeStyleSheet):
     17        * loader/cache/CachedResource.cpp:
     18        (WebCore::CachedResource::isCORSSameOrigin): Ensuring that this method is not called for resource types for which CORS is not to be used.
     19        (WebCore::CachedResource::isClean): Deleted.
     20        * loader/cache/CachedResource.h:
     21        * loader/cache/CachedResourceLoader.cpp:
     22        (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
     23
    1242016-10-06  Youenn Fablet  <youenn@apple.com>
    225
  • trunk/Source/WebCore/html/HTMLLinkElement.cpp

    r206880 r206902  
    342342    Optional<bool> originClean;
    343343    if (cachedStyleSheet.options().mode == FetchOptions::Mode::Cors)
    344         originClean = cachedStyleSheet.isClean();
     344        originClean = cachedStyleSheet.isCORSSameOrigin();
    345345
    346346    m_sheet = CSSStyleSheet::create(WTFMove(styleSheet), *this, originClean);
  • trunk/Source/WebCore/loader/cache/CachedResource.cpp

    r206900 r206902  
    443443}
    444444
    445 bool CachedResource::isClean() const
    446 {
     445bool CachedResource::isCORSSameOrigin() const
     446{
     447    // Following resource types do not use CORS
     448    ASSERT(type() != CachedResource::Type::FontResource);
     449    ASSERT(type() != CachedResource::Type::SVGFontResource);
     450    ASSERT(type() != CachedResource::XSLStyleSheet);
     451
    447452    // https://html.spec.whatwg.org/multipage/infrastructure.html#cors-same-origin
    448453    return !loadFailedOrCanceled() && m_responseTainting != ResourceResponse::Tainting::Opaque;
  • trunk/Source/WebCore/loader/cache/CachedResource.h

    r206867 r206902  
    209209    void setCrossOrigin();
    210210    bool isCrossOrigin() const;
    211     bool isClean() const;
     211    bool isCORSSameOrigin() const;
    212212    ResourceResponse::Tainting responseTainting() const { return m_responseTainting; }
    213213
  • trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp

    r206900 r206902  
    550550    }
    551551
     552#if ENABLE(XSLT)
     553    // Load is same-origin, we do not check for CORS.
     554    if (resource.type() == CachedResource::XSLStyleSheet)
     555        return false;
     556#endif
     557
    552558    // FIXME: We should enable resource reuse for these resource types
    553559    switch (resource.type()) {
     
    560566    case CachedResource::MainResource:
    561567        return false;
    562 #if ENABLE(XSLT)
    563     case CachedResource::XSLStyleSheet:
    564         return false;
    565 #endif
    566568#if ENABLE(LINK_PREFETCH)
    567569    case CachedResource::LinkPrefetch:
Note: See TracChangeset for help on using the changeset viewer.