Bug 1046140 - bail if getSubpropertiesForCSSProperty param is a CSS variable. r=bz

This commit is contained in:
Paul Rouget 2014-07-31 22:33:17 +10:00
parent fd4645e895
commit aca1e4c415
3 changed files with 37 additions and 1 deletions

View File

@ -609,7 +609,8 @@ inDOMUtils::GetSubpropertiesForCSSProperty(const nsAString& aProperty,
nsCSSProperty propertyID =
nsCSSProps::LookupProperty(aProperty, nsCSSProps::eEnabledForAllContent);
if (propertyID == eCSSProperty_UNKNOWN) {
if (propertyID == eCSSProperty_UNKNOWN ||
propertyID == eCSSPropertyExtra_variable) {
return NS_ERROR_FAILURE;
}

View File

@ -12,6 +12,7 @@ support-files = bug856317.css
[test_bug856317.html]
[test_bug877690.html]
[test_bug1006595.html]
[test_bug1046140.html]
[test_color_to_rgba.html]
[test_css_property_is_valid.html]
[test_get_all_style_sheets.html]

View File

@ -0,0 +1,34 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1046140
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1046140</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
var utils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"]
.getService(SpecialPowers.Ci.inIDOMUtils);
try {
utils.getSubpropertiesForCSSProperty("--foo");
ok(false, "expected an exception");
} catch(e) {
ok(true, "getSubpropertiesForCSSProperty throws when passed a CSS variable");
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1046140">Mozilla Bug 1046140</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>