Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1858)

Unified Diff: Source/core/xml/XSLImportRule.cpp

Issue 507583002: XSLImportRule should not be ResourceClient. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use UTF8Encoding().decode() Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/xml/XSLImportRule.h ('k') | Source/core/xml/XSLStyleSheet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XSLImportRule.cpp
diff --git a/Source/core/xml/XSLImportRule.cpp b/Source/core/xml/XSLImportRule.cpp
index e8d38a07c9c94dd9d3d429e9c6b773d507bd0749..b391b30ee9fbd9621718d73299828ec4f9a36eae 100644
--- a/Source/core/xml/XSLImportRule.cpp
+++ b/Source/core/xml/XSLImportRule.cpp
@@ -27,13 +27,14 @@
#include "core/fetch/FetchRequest.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/fetch/XSLStyleSheetResource.h"
+#include "platform/SharedBuffer.h"
+#include "wtf/text/TextEncoding.h"
namespace blink {
XSLImportRule::XSLImportRule(XSLStyleSheet* parent, const String& href)
: m_parentStyleSheet(parent)
, m_strHref(href)
- , m_resource(0)
, m_loading(false)
{
}
@@ -44,9 +45,6 @@ XSLImportRule::~XSLImportRule()
if (m_styleSheet)
m_styleSheet->setParentStyleSheet(0);
#endif
-
- if (m_resource)
- m_resource->removeClient(this);
}
void XSLImportRule::setXSLStyleSheet(const String& href, const KURL& baseURL, const String& sheet)
@@ -99,19 +97,16 @@ void XSLImportRule::loadSheet()
return;
}
- FetchRequest request(ResourceRequest(fetcher->document()->completeURL(absHref)), FetchInitiatorTypeNames::xml);
- m_resource = fetcher->fetchXSLStyleSheet(request);
-
- if (m_resource) {
- m_resource->addClient(this);
+ ResourceLoaderOptions fetchOptions(ResourceFetcher::defaultResourceOptions());
+ FetchRequest request(ResourceRequest(fetcher->document()->completeURL(absHref)), FetchInitiatorTypeNames::xml, fetchOptions);
+ request.setOriginRestriction(FetchRequest::RestrictToSameOrigin);
+ ResourcePtr<Resource> resource = fetcher->fetchSynchronously(request);
+ if (!resource)
+ return;
- // If the imported sheet is in the cache, then setXSLStyleSheet gets
- // called, and the sheet even gets parsed (via parseString). In this
- // case we have loaded (even if our subresources haven't), so if we have
- // a stylesheet after checking the cache, then we've clearly loaded.
- if (!m_styleSheet)
- m_loading = true;
- }
+ ASSERT(!m_styleSheet);
+ if (SharedBuffer* data = resource->resourceBuffer())
+ setXSLStyleSheet(absHref, parentSheet->baseURL(), UTF8Encoding().decode(data->data(), data->size()));
}
void XSLImportRule::trace(Visitor* visitor)
« no previous file with comments | « Source/core/xml/XSLImportRule.h ('k') | Source/core/xml/XSLStyleSheet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698