From 716d720e13476bbe4a34bff94603a3b61030c20e Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Fri, 15 Mar 2019 12:54:17 +0000 Subject: [PATCH] Bug 1534399 - Don't allow disabling non-author sheets. r=emilio Differential Revision: https://phabricator.services.mozilla.com/D23624 --HG-- extra : moz-landing-system : lando --- layout/inspector/tests/chrome/chrome.ini | 1 + .../tests/chrome/test_ua_sheet_disable.html | 20 +++++++++++++++++++ layout/style/StyleSheet.cpp | 5 +++++ 3 files changed, 26 insertions(+) create mode 100644 layout/inspector/tests/chrome/test_ua_sheet_disable.html diff --git a/layout/inspector/tests/chrome/chrome.ini b/layout/inspector/tests/chrome/chrome.ini index e15a0bd39838..d0954e9675e0 100644 --- a/layout/inspector/tests/chrome/chrome.ini +++ b/layout/inspector/tests/chrome/chrome.ini @@ -29,3 +29,4 @@ skip-if = ((os == 'win' && bits!=64) || (os=='linux' && bits==32) || os == 'mac' support-files = test_fontVariationsAPI.css [test_fontFaceGeneric.xul] +[test_ua_sheet_disable.html] diff --git a/layout/inspector/tests/chrome/test_ua_sheet_disable.html b/layout/inspector/tests/chrome/test_ua_sheet_disable.html new file mode 100644 index 000000000000..7d12da68db21 --- /dev/null +++ b/layout/inspector/tests/chrome/test_ua_sheet_disable.html @@ -0,0 +1,20 @@ + +Test for bug 1534399 + + + diff --git a/layout/style/StyleSheet.cpp b/layout/style/StyleSheet.cpp index 2f28854d6f41..98c440456839 100644 --- a/layout/style/StyleSheet.cpp +++ b/layout/style/StyleSheet.cpp @@ -241,6 +241,11 @@ void StyleSheet::ApplicableStateChanged(bool aApplicable) { } void StyleSheet::SetDisabled(bool aDisabled) { + // Only allow disabling author sheets. + if (mParsingMode != css::eAuthorSheetFeatures) { + return; + } + if (aDisabled == Disabled()) { return; }