From 9ce047439890d507b9e2e69e425a960a0b9983c0 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Thu, 28 Sep 2017 16:19:45 +1000 Subject: [PATCH] Bug 1402094 - Blacklist about:reader from using stylo. r=bholley MozReview-Commit-ID: 6cG1x1tcOwn --HG-- extra : rebase_source : dce6a0b1828f8388952e5ff1993424dff782d3d5 --- dom/base/nsDocument.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index afa7fac21670..471b38680181 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -13608,6 +13608,27 @@ nsIDocument::ReportHasScrollLinkedEffect() "ScrollLinkedEffectFound2"); } +// URL-based blacklist for stylo. +static bool +ShouldUseGeckoBackend(nsIURI* aDocumentURI) +{ + if (!aDocumentURI) { + return false; + } + bool isScheme = false; + if (NS_SUCCEEDED(aDocumentURI->SchemeIs("about", &isScheme))) { + nsAutoCString path; + aDocumentURI->GetFilePath(path); + // about:reader requires support of :scope pseudo-class so we have + // to use Gecko backend for now. See bug 1402094. + // This should be fixed by bug 1204818. + if (path.EqualsLiteral("reader")) { + return true; + } + } + return false; +} + void nsIDocument::UpdateStyleBackendType() { @@ -13626,7 +13647,7 @@ nsIDocument::UpdateStyleBackendType() // Note that, since tests can have XUL support, we still need to // explicitly exclude XUL documents here. if (!nsContentUtils::IsSystemPrincipal(NodePrincipal()) && - !IsXULDocument()) { + !IsXULDocument() && !ShouldUseGeckoBackend(mDocumentURI)) { mStyleBackendType = StyleBackendType::Servo; } }