Bug 1480054: Restrict XUL tree pseudos on nightly and early-beta. r=xidorn

Differential Revision: https://phabricator.services.mozilla.com/D2598

MozReview-Commit-ID: I1dUPuGKkyX
This commit is contained in:
Emilio Cobos Álvarez 2018-08-01 14:57:01 +02:00
parent 88a1a3951c
commit 96fbee69e0
8 changed files with 33 additions and 7 deletions

View File

@ -143,7 +143,7 @@ random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 712600-2-dyn.html 712600
== 817406-3.html 817406-1-ref.html
== 817406-4.html 817406-4-ref.html
== 847242-1.html 847242-1-ref.html
fuzzy-if(xulRuntime.widgetToolkit=="gtk3",1,11) == 869833-1.xul 869833-1-ref.xul
pref(layout.css.xul-tree-pseudos.content.enabled,true) fuzzy-if(xulRuntime.widgetToolkit=="gtk3",1,11) == 869833-1.xul 869833-1-ref.xul
== 922530-1.html 922530-1-ref.html
== 922550-1.html 922550-1-ref.html
== 989994-1.html 989994-1-ref.html

View File

@ -1289,7 +1289,7 @@ fuzzy-if(skiaContent,1,5) == 474472-1.html 474472-1-ref.html
== 476598-1b.html 476598-1-ref2.html
!= 476598-1-ref.html about:blank
== 476856-1.html 476856-1-ref.html
random-if(d2d) == 478377-1.xul 478377-1-ref.xul
pref(layout.css.xul-tree-pseudos.content.enabled,true) random-if(d2d) == 478377-1.xul 478377-1-ref.xul
== 478614-1.html 478614-1-ref.html
== 478614-2.html 478614-1-ref.html
== 478614-3.html 478614-3-ref.html
@ -1689,7 +1689,7 @@ fuzzy-if(d2d,1,256) skip-if(Android) fuzzy-if(skiaContent,1,68000) fuzzy-if(webr
== 665597-1.html 665597-1-ref.html
== 665597-2.html 665597-2-ref.html
== 667079-1.html 667079-1-ref.html
== 668319-1.xul about:blank
pref(layout.css.xul-tree-pseudos.content.enabled,true) == 668319-1.xul about:blank
!= 669015-1.xul 669015-1-notref.xul
skip-if(azureSkiaGL) == 670442-1.html 670442-1-ref.html
== 670467-1.html 670467-1-ref.html

View File

@ -9,7 +9,7 @@ random-if(Android) == menulist-shrinkwrap-2.xul menulist-shrinkwrap-2-ref.xul
skip-if(cocoaWidget) == accesskey.xul accesskey-ref.xul
fails-if(cocoaWidget) fuzzy-if(xulRuntime.widgetToolkit=="gtk3",1,11) == tree-row-outline-1.xul tree-row-outline-1-ref.xul # win8: bug 1254832
skip-if(!cocoaWidget) fails-if(webrender&&cocoaWidget) == mac-tab-toolbar.xul mac-tab-toolbar-ref.xul
!= tree-row-outline-1.xul tree-row-outline-1-notref.xul
pref(layout.css.xul-tree-pseudos.content.enabled,true) != tree-row-outline-1.xul tree-row-outline-1-notref.xul
== text-crop.xul text-crop-ref.xul
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == text-small-caps-1.xul text-small-caps-1-ref.xul
fuzzy-if(skiaContent,1,60) fuzzy-if(cocoaWidget&&browserIsRemote&&!skiaContent,1,31) fuzzy-if(winWidget&&browserIsRemote&&layersGPUAccelerated,1,50) == inactive-fixed-bg-bug1205630.xul inactive-fixed-bg-bug1205630-ref.html

View File

@ -32,6 +32,10 @@ const NON_CONTENT_ACCESIBLE_PSEUDOS = [
":-moz-autofill-preview",
];
if (!SpecialPowers.getBoolPref("layout.css.xul-tree-pseudos.content.enabled")) {
NON_CONTENT_ACCESIBLE_PSEUDOS.push("::-moz-tree-row", "::-moz-tree-row(foo)");
}
test(function() {
sheet.textContent = `div { color: initial }`;
assert_equals(sheet.sheet.cssRules.length, 1);

View File

@ -16,7 +16,9 @@ SimpleTest.requestLongerTimeout(2);
var cloneiframe;
function run() {
SpecialPowers.pushPrefEnv({ set: [["layout.css.xul-tree-pseudos.content.enabled", true]] }, runTests);
}
function runTests() {
var iframe = document.getElementById("iframe");
var ifwin = iframe.contentWindow;
var ifdoc = iframe.contentDocument;

View File

@ -379,6 +379,20 @@ VARCACHE_PREF(
)
#undef PREF_VALUE
// Pref to control whether ::xul-tree-* pseudo-elements are parsed in content
// pages.
#ifdef EARLY_BETA_OR_EARLIER
#define PREF_VALUE false
#else
#define PREF_VALUE true
#endif
VARCACHE_PREF(
"layout.css.xul-tree-pseudos.content.enabled",
layout_css_xul_tree_pseudos_content_enabled,
bool, PREF_VALUE
)
#undef PREF_VALUE
// Is support for CSS "grid-template-{columns,rows}: subgrid X" enabled?
VARCACHE_PREF(
"layout.css.grid-template-subgrid-value.enabled",

View File

@ -112,7 +112,11 @@ impl PseudoElement {
% for pseudo in PSEUDOS:
${pseudo_element_variant(pseudo)} =>
% if pseudo.is_tree_pseudo_element():
0,
if unsafe { structs::StaticPrefs_sVarCache_layout_css_xul_tree_pseudos_content_enabled } {
0
} else {
structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME
},
% elif pseudo.is_anon_box():
structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS,
% else:

View File

@ -488,9 +488,11 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
}
let args = args.into_boxed_slice();
if let Some(pseudo) = PseudoElement::tree_pseudo_element(&name, args) {
if self.is_pseudo_element_enabled(&pseudo) {
return Ok(pseudo);
}
}
}
Err(
parser.new_custom_error(SelectorParseErrorKind::UnsupportedPseudoClassOrElement(
name,