diff options
Diffstat (limited to 'Source/WebCore/xml/XSLImportRule.cpp')
-rw-r--r-- | Source/WebCore/xml/XSLImportRule.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/Source/WebCore/xml/XSLImportRule.cpp b/Source/WebCore/xml/XSLImportRule.cpp index bfec5c85c..61de1115d 100644 --- a/Source/WebCore/xml/XSLImportRule.cpp +++ b/Source/WebCore/xml/XSLImportRule.cpp @@ -34,7 +34,7 @@ namespace WebCore { XSLImportRule::XSLImportRule(XSLStyleSheet* parent, const String& href) : m_parentStyleSheet(parent) , m_strHref(href) - , m_cachedSheet(0) + , m_cachedSheet(nullptr) , m_loading(false) { } @@ -42,16 +42,16 @@ XSLImportRule::XSLImportRule(XSLStyleSheet* parent, const String& href) XSLImportRule::~XSLImportRule() { if (m_styleSheet) - m_styleSheet->setParentStyleSheet(0); - + m_styleSheet->setParentStyleSheet(nullptr); + if (m_cachedSheet) - m_cachedSheet->removeClient(this); + m_cachedSheet->removeClient(*this); } void XSLImportRule::setXSLStyleSheet(const String& href, const URL& baseURL, const String& sheet) { if (m_styleSheet) - m_styleSheet->setParentStyleSheet(0); + m_styleSheet->setParentStyleSheet(nullptr); m_styleSheet = XSLStyleSheet::create(this, href, baseURL); @@ -61,7 +61,7 @@ void XSLImportRule::setXSLStyleSheet(const String& href, const URL& baseURL, con m_styleSheet->parseString(sheet); m_loading = false; - + if (parent) parent->checkLoaded(); } @@ -73,7 +73,7 @@ bool XSLImportRule::isLoading() void XSLImportRule::loadSheet() { - CachedResourceLoader* cachedResourceLoader = 0; + CachedResourceLoader* cachedResourceLoader = nullptr; XSLStyleSheet* rootSheet = parentStyleSheet(); @@ -84,28 +84,30 @@ void XSLImportRule::loadSheet() if (rootSheet) cachedResourceLoader = rootSheet->cachedResourceLoader(); - + String absHref = m_strHref; XSLStyleSheet* parentSheet = parentStyleSheet(); if (!parentSheet->baseURL().isNull()) // use parent styleheet's URL as the base URL absHref = URL(parentSheet->baseURL(), m_strHref).string(); - + // Check for a cycle in our import chain. If we encounter a stylesheet // in our parent chain with the same URL, then just bail. for (XSLStyleSheet* parentSheet = parentStyleSheet(); parentSheet; parentSheet = parentSheet->parentStyleSheet()) { if (absHref == parentSheet->baseURL().string()) return; } - - CachedResourceRequest request(ResourceRequest(cachedResourceLoader->document()->completeURL(absHref))); + if (m_cachedSheet) - m_cachedSheet->removeClient(this); - m_cachedSheet = cachedResourceLoader->requestXSLStyleSheet(request); - + m_cachedSheet->removeClient(*this); + + auto options = CachedResourceLoader::defaultCachedResourceOptions(); + options.mode = FetchOptions::Mode::SameOrigin; + m_cachedSheet = cachedResourceLoader->requestXSLStyleSheet({ResourceRequest(cachedResourceLoader->document()->completeURL(absHref)), options}); + if (m_cachedSheet) { - m_cachedSheet->addClient(this); - + m_cachedSheet->addClient(*this); + // 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 |