Bug 1402094 - Blacklist about:reader from using stylo. r?bholley
MozReview-Commit-ID: 6cG1x1tcOwn
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -13484,16 +13484,39 @@ nsIDocument::ReportHasScrollLinkedEffect
}
mHasScrollLinkedEffect = true;
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
NS_LITERAL_CSTRING("Async Pan/Zoom"),
this, nsContentUtils::eLAYOUT_PROPERTIES,
"ScrollLinkedEffectFound2");
}
+#ifdef MOZ_STYLO
+// 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;
+}
+#endif // MOZ_STYLO
+
void
nsIDocument::UpdateStyleBackendType()
{
MOZ_ASSERT(mStyleBackendType == StyleBackendType::None,
"no need to call UpdateStyleBackendType now");
// Assume Gecko by default.
mStyleBackendType = StyleBackendType::Gecko;
@@ -13502,17 +13525,17 @@ nsIDocument::UpdateStyleBackendType()
if (nsLayoutUtils::StyloEnabled()) {
// Disable stylo only for system principal. Other principals aren't
// able to use XUL by default, and the back door to enable XUL is
// mostly just for testing, which means they don't matter, and we
// shouldn't respect them at the same time.
// 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;
}
}
#endif
}
/**
* Retrieves the classification of the Flash plugins in the document based on