Changeset 208279 in webkit


Ignore:
Timestamp:
Nov 2, 2016 6:18:46 AM (7 years ago)
Author:
commit-queue@webkit.org
Message:

REGRESSION(r207753-207755): ASSERTION FAILED: m_parsedStyleSheetCache->isInMemoryCache()
https://bugs.webkit.org/show_bug.cgi?id=163905

Patch by Youenn Fablet <youenn@apple.com> on 2016-11-02
Reviewed by Antti Koivisto.

Source/WebCore:

Covered by existing tests and http/tests/security/cached-cross-origin-shared-css-stylesheet.html

Small refactoring to do more member fields initialization in StyleSheetContents header.
Refactored StyleSheetContents::m_isInMemoryCache to be a counter instead of a boolean.
This allows StyleSheetContents to be linked to several CachedCSSStyleSheets.

  • css/StyleSheetContents.cpp:

(WebCore::StyleSheetContents::StyleSheetContents):
(WebCore::StyleSheetContents::addedToMemoryCache):
(WebCore::StyleSheetContents::removedFromMemoryCache):

  • css/StyleSheetContents.h:
  • loader/cache/CachedCSSStyleSheet.cpp:

(WebCore::CachedCSSStyleSheet::setBodyDataFrom): Making reuse of saveParsedStyleSheet to handle update of StyleSheetContents cache count.

LayoutTests:

  • http/tests/security/cached-cross-origin-shared-css-stylesheet-expected.txt: Added.
  • http/tests/security/cached-cross-origin-shared-css-stylesheet.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r208277 r208279  
     12016-11-02  Youenn Fablet  <youenn@apple.com>
     2
     3        REGRESSION(r207753-207755): ASSERTION FAILED: m_parsedStyleSheetCache->isInMemoryCache()
     4        https://bugs.webkit.org/show_bug.cgi?id=163905
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * http/tests/security/cached-cross-origin-shared-css-stylesheet-expected.txt: Added.
     9        * http/tests/security/cached-cross-origin-shared-css-stylesheet.html: Added.
     10
    1112016-11-02  Manuel Rego Casasnovas  <rego@igalia.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r208278 r208279  
     12016-11-02  Youenn Fablet  <youenn@apple.com>
     2
     3        REGRESSION(r207753-207755): ASSERTION FAILED: m_parsedStyleSheetCache->isInMemoryCache()
     4        https://bugs.webkit.org/show_bug.cgi?id=163905
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Covered by existing tests and http/tests/security/cached-cross-origin-shared-css-stylesheet.html
     9
     10        Small refactoring to do more member fields initialization in StyleSheetContents header.
     11        Refactored StyleSheetContents::m_isInMemoryCache to be a counter instead of a boolean.
     12        This allows StyleSheetContents to be linked to several CachedCSSStyleSheets.
     13
     14        * css/StyleSheetContents.cpp:
     15        (WebCore::StyleSheetContents::StyleSheetContents):
     16        (WebCore::StyleSheetContents::addedToMemoryCache):
     17        (WebCore::StyleSheetContents::removedFromMemoryCache):
     18        * css/StyleSheetContents.h:
     19        * loader/cache/CachedCSSStyleSheet.cpp:
     20        (WebCore::CachedCSSStyleSheet::setBodyDataFrom): Making reuse of saveParsedStyleSheet to handle update of StyleSheetContents cache count.
     21
    1222016-11-02  Carlos Garcia Campos  <cgarcia@igalia.com>
    223
  • trunk/Source/WebCore/css/StyleSheetContents.cpp

    r208200 r208279  
    6464    , m_originalURL(originalURL)
    6565    , m_defaultNamespace(starAtom)
    66     , m_loadCompleted(false)
    6766    , m_isUserStyleSheet(ownerRule && ownerRule->parentStyleSheet() && ownerRule->parentStyleSheet()->isUserStyleSheet())
    68     , m_hasSyntacticallyValidCSSHeader(true)
    69     , m_didLoadErrorOccur(false)
    70     , m_usesStyleBasedEditability(false)
    71     , m_isMutable(false)
    72     , m_isInMemoryCache(false)
    7367    , m_parserContext(context)
    7468{
     
    8579    , m_namespaces(o.m_namespaces)
    8680    , m_defaultNamespace(o.m_defaultNamespace)
     81    , m_isUserStyleSheet(o.m_isUserStyleSheet)
    8782    , m_loadCompleted(true)
    88     , m_isUserStyleSheet(o.m_isUserStyleSheet)
    8983    , m_hasSyntacticallyValidCSSHeader(o.m_hasSyntacticallyValidCSSHeader)
    90     , m_didLoadErrorOccur(false)
    9184    , m_usesStyleBasedEditability(o.m_usesStyleBasedEditability)
    92     , m_isMutable(false)
    93     , m_isInMemoryCache(false)
    9485    , m_parserContext(o.m_parserContext)
    9586{
     
    533524void StyleSheetContents::addedToMemoryCache()
    534525{
    535     ASSERT(!m_isInMemoryCache);
    536526    ASSERT(isCacheable());
    537     m_isInMemoryCache = true;
     527    ++m_inMemoryCacheCount;
    538528}
    539529
    540530void StyleSheetContents::removedFromMemoryCache()
    541531{
    542     ASSERT(m_isInMemoryCache);
     532    ASSERT(m_inMemoryCacheCount);
    543533    ASSERT(isCacheable());
    544     m_isInMemoryCache = false;
     534    --m_inMemoryCacheCount;
    545535}
    546536
  • trunk/Source/WebCore/css/StyleSheetContents.h

    r208200 r208279  
    139139    void setMutable() { m_isMutable = true; }
    140140
    141     bool isInMemoryCache() const { return m_isInMemoryCache; }
     141    bool isInMemoryCache() const { return m_inMemoryCacheCount; }
    142142    void addedToMemoryCache();
    143143    void removedFromMemoryCache();
     
    163163    AtomicString m_defaultNamespace;
    164164
    165     bool m_loadCompleted : 1;
    166     bool m_isUserStyleSheet : 1;
    167     bool m_hasSyntacticallyValidCSSHeader : 1;
    168     bool m_didLoadErrorOccur : 1;
    169     bool m_usesStyleBasedEditability : 1;
    170     bool m_isMutable : 1;
    171     bool m_isInMemoryCache : 1;
    172    
     165    bool m_isUserStyleSheet;
     166    bool m_loadCompleted { false };
     167    bool m_hasSyntacticallyValidCSSHeader { true };
     168    bool m_didLoadErrorOccur { false };
     169    bool m_usesStyleBasedEditability { false };
     170    bool m_isMutable { false };
     171    unsigned m_inMemoryCacheCount { 0 };
     172
    173173    CSSParserContext m_parserContext;
    174174
  • trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp

    r208200 r208279  
    9797    m_decoder = sheet.m_decoder;
    9898    m_decodedSheetText = sheet.m_decodedSheetText;
    99     m_parsedStyleSheetCache = sheet.m_parsedStyleSheetCache;
     99    if (sheet.m_parsedStyleSheetCache)
     100        saveParsedStyleSheet(*sheet.m_parsedStyleSheetCache);
    100101}
    101102
Note: See TracChangeset for help on using the changeset viewer.