Index: third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp |
diff --git a/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp b/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp |
index 26a3cb189f0ec67210f4ab9d4805a1f6aeb214de..6a92ff5372c586675130660aaf5a38b60b259e2b 100644 |
--- a/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp |
+++ b/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp |
@@ -51,6 +51,7 @@ CSSStyleSheetResource* CSSStyleSheetResource::createForTest(const ResourceReques |
CSSStyleSheetResource::CSSStyleSheetResource(const ResourceRequest& resourceRequest, const ResourceLoaderOptions& options, const String& charset) |
: StyleSheetResource(resourceRequest, CSSStyleSheet, options, "text/css", charset) |
+ , m_didNotifyFirstData(false) |
{ |
} |
@@ -80,6 +81,8 @@ void CSSStyleSheetResource::didAddClient(ResourceClient* c) |
// because setCSSStyleSheet() may cause scripts to be executed, which could destroy 'c' if it is an instance of HTMLLinkElement. |
// see the comment of HTMLLinkElement::setCSSStyleSheet. |
Resource::didAddClient(c); |
+ if (m_didNotifyFirstData) |
+ static_cast<StyleSheetResourceClient*>(c)->didAppendFirstData(this); |
hiroshige
2016/07/26 09:57:10
|*c| must not be destructed during didAppendFirstD
haraken
2016/07/26 10:01:06
You won't need Persistent<StyleSheetResourceClient
|
if (!isLoading()) |
hiroshige
2016/07/26 09:57:10
|c| might be removed as client in didAppendFirstDa
Charlie Harrison
2016/07/26 16:31:52
Done.
|
static_cast<StyleSheetResourceClient*>(c)->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), encoding(), this); |
@@ -99,6 +102,17 @@ const String CSSStyleSheetResource::sheetText(MIMETypeCheck mimeTypeCheck) const |
return decodedText(); |
} |
+void CSSStyleSheetResource::appendData(const char* data, size_t length) |
+{ |
+ Resource::appendData(data, length); |
+ if (m_didNotifyFirstData) |
+ return; |
+ ResourceClientWalker<StyleSheetResourceClient> w(clients()); |
+ while (StyleSheetResourceClient* c = w.next()) |
+ c->didAppendFirstData(this); |
+ m_didNotifyFirstData = true; |
+} |
+ |
void CSSStyleSheetResource::checkNotify() |
{ |
// Decode the data to find out the encoding and keep the sheet text around during checkNotify() |