- Revision
- 208279
- Author
- commit-qu...@webkit.org
- Date
- 2016-11-02 06:18:46 -0700 (Wed, 02 Nov 2016)
Log Message
REGRESSION(r207753-207755): ASSERTION FAILED: m_parsedStyleSheetCache->isInMemoryCache()
https://bugs.webkit.org/show_bug.cgi?id=163905
Patch by Youenn Fablet <you...@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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (208278 => 208279)
--- trunk/LayoutTests/ChangeLog 2016-11-02 13:02:18 UTC (rev 208278)
+++ trunk/LayoutTests/ChangeLog 2016-11-02 13:18:46 UTC (rev 208279)
@@ -1,3 +1,13 @@
+2016-11-02 Youenn Fablet <you...@apple.com>
+
+ REGRESSION(r207753-207755): ASSERTION FAILED: m_parsedStyleSheetCache->isInMemoryCache()
+ https://bugs.webkit.org/show_bug.cgi?id=163905
+
+ Reviewed by Antti Koivisto.
+
+ * http/tests/security/cached-cross-origin-shared-css-stylesheet-expected.txt: Added.
+ * http/tests/security/cached-cross-origin-shared-css-stylesheet.html: Added.
+
2016-11-02 Manuel Rego Casasnovas <r...@igalia.com>
[css-grid] mimax(auto, <flex>) should be serialized as <flex>
Added: trunk/LayoutTests/http/tests/security/cached-cross-origin-shared-css-stylesheet-expected.txt (0 => 208279)
--- trunk/LayoutTests/http/tests/security/cached-cross-origin-shared-css-stylesheet-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/security/cached-cross-origin-shared-css-stylesheet-expected.txt 2016-11-02 13:18:46 UTC (rev 208279)
@@ -0,0 +1,2 @@
+Test is passing if not crashing
+PASS
Added: trunk/LayoutTests/http/tests/security/cached-cross-origin-shared-css-stylesheet.html (0 => 208279)
--- trunk/LayoutTests/http/tests/security/cached-cross-origin-shared-css-stylesheet.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/cached-cross-origin-shared-css-stylesheet.html 2016-11-02 13:18:46 UTC (rev 208279)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<div>Test is passing if not crashing</div>
+<div id ="log"></div>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+function createLinkElement(isCORS, handler)
+{
+ link = document.createElement('link');
+ link.href = ""
+ link.rel = "stylesheet";
+ link.type = "text/css";
+ if (isCORS)
+ link.crossOrigin = "use-credentials";
+ link._onload_ = handler;
+ link._onerror_ = () => { console.log("Unexpected error loading link"); }
+ return link;
+}
+
+document.body.appendChild(createLinkElement(false, function() {
+ setTimeout(function() {
+ document.body.appendChild(createLinkElement(true, function() {
+ if (window.internals)
+ internals.beginSimulatedMemoryPressure();
+ if (window.internals)
+ internals.endSimulatedMemoryPressure();
+ document.getElementById('log').innerHTML = "PASS";
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }));
+ }, 1000);
+}));
+</script>
Modified: trunk/Source/WebCore/ChangeLog (208278 => 208279)
--- trunk/Source/WebCore/ChangeLog 2016-11-02 13:02:18 UTC (rev 208278)
+++ trunk/Source/WebCore/ChangeLog 2016-11-02 13:18:46 UTC (rev 208279)
@@ -1,3 +1,24 @@
+2016-11-02 Youenn Fablet <you...@apple.com>
+
+ REGRESSION(r207753-207755): ASSERTION FAILED: m_parsedStyleSheetCache->isInMemoryCache()
+ https://bugs.webkit.org/show_bug.cgi?id=163905
+
+ Reviewed by Antti Koivisto.
+
+ 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.
+
2016-11-02 Carlos Garcia Campos <cgar...@igalia.com>
[GTK] Remove FileSystem::filenameToString() and use FileSystem::stringFromFileSystemRepresentation() everywhere instead
Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (208278 => 208279)
--- trunk/Source/WebCore/css/StyleSheetContents.cpp 2016-11-02 13:02:18 UTC (rev 208278)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp 2016-11-02 13:18:46 UTC (rev 208279)
@@ -63,13 +63,7 @@
: m_ownerRule(ownerRule)
, m_originalURL(originalURL)
, m_defaultNamespace(starAtom)
- , m_loadCompleted(false)
, m_isUserStyleSheet(ownerRule && ownerRule->parentStyleSheet() && ownerRule->parentStyleSheet()->isUserStyleSheet())
- , m_hasSyntacticallyValidCSSHeader(true)
- , m_didLoadErrorOccur(false)
- , m_usesStyleBasedEditability(false)
- , m_isMutable(false)
- , m_isInMemoryCache(false)
, m_parserContext(context)
{
}
@@ -84,13 +78,10 @@
, m_childRules(o.m_childRules.size())
, m_namespaces(o.m_namespaces)
, m_defaultNamespace(o.m_defaultNamespace)
+ , m_isUserStyleSheet(o.m_isUserStyleSheet)
, m_loadCompleted(true)
- , m_isUserStyleSheet(o.m_isUserStyleSheet)
, m_hasSyntacticallyValidCSSHeader(o.m_hasSyntacticallyValidCSSHeader)
- , m_didLoadErrorOccur(false)
, m_usesStyleBasedEditability(o.m_usesStyleBasedEditability)
- , m_isMutable(false)
- , m_isInMemoryCache(false)
, m_parserContext(o.m_parserContext)
{
ASSERT(o.isCacheable());
@@ -532,16 +523,15 @@
void StyleSheetContents::addedToMemoryCache()
{
- ASSERT(!m_isInMemoryCache);
ASSERT(isCacheable());
- m_isInMemoryCache = true;
+ ++m_inMemoryCacheCount;
}
void StyleSheetContents::removedFromMemoryCache()
{
- ASSERT(m_isInMemoryCache);
+ ASSERT(m_inMemoryCacheCount);
ASSERT(isCacheable());
- m_isInMemoryCache = false;
+ --m_inMemoryCacheCount;
}
void StyleSheetContents::shrinkToFit()
Modified: trunk/Source/WebCore/css/StyleSheetContents.h (208278 => 208279)
--- trunk/Source/WebCore/css/StyleSheetContents.h 2016-11-02 13:02:18 UTC (rev 208278)
+++ trunk/Source/WebCore/css/StyleSheetContents.h 2016-11-02 13:18:46 UTC (rev 208279)
@@ -138,7 +138,7 @@
bool isMutable() const { return m_isMutable; }
void setMutable() { m_isMutable = true; }
- bool isInMemoryCache() const { return m_isInMemoryCache; }
+ bool isInMemoryCache() const { return m_inMemoryCacheCount; }
void addedToMemoryCache();
void removedFromMemoryCache();
@@ -162,14 +162,14 @@
PrefixNamespaceURIMap m_namespaces;
AtomicString m_defaultNamespace;
- bool m_loadCompleted : 1;
- bool m_isUserStyleSheet : 1;
- bool m_hasSyntacticallyValidCSSHeader : 1;
- bool m_didLoadErrorOccur : 1;
- bool m_usesStyleBasedEditability : 1;
- bool m_isMutable : 1;
- bool m_isInMemoryCache : 1;
-
+ bool m_isUserStyleSheet;
+ bool m_loadCompleted { false };
+ bool m_hasSyntacticallyValidCSSHeader { true };
+ bool m_didLoadErrorOccur { false };
+ bool m_usesStyleBasedEditability { false };
+ bool m_isMutable { false };
+ unsigned m_inMemoryCacheCount { 0 };
+
CSSParserContext m_parserContext;
Vector<CSSStyleSheet*> m_clients;
Modified: trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp (208278 => 208279)
--- trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp 2016-11-02 13:02:18 UTC (rev 208278)
+++ trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp 2016-11-02 13:18:46 UTC (rev 208279)
@@ -96,7 +96,8 @@
m_decoder = sheet.m_decoder;
m_decodedSheetText = sheet.m_decodedSheetText;
- m_parsedStyleSheetCache = sheet.m_parsedStyleSheetCache;
+ if (sheet.m_parsedStyleSheetCache)
+ saveParsedStyleSheet(*sheet.m_parsedStyleSheetCache);
}
void CachedCSSStyleSheet::finishLoading(SharedBuffer* data)