Bug 1167782 - Null-check pseudo element in nsHTMLCSSStyleSheet::RulesMatching(). r=dbaron, a=sledru
authorDaniel Holbert <dholbert@cs.stanford.edu>
Tue, 26 May 2015 16:44:52 -0700
changeset 266128 cc237f8e9fa5
parent 266127 11000e0b0c71
child 266129 4f5b9c0de6ce
push id4762
push userryanvm@gmail.com
push date2015-05-28 18:54 +0000
treeherdermozilla-beta@dc9c305024f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron, sledru
bugs1167782
milestone39.0
Bug 1167782 - Null-check pseudo element in nsHTMLCSSStyleSheet::RulesMatching(). r=dbaron, a=sledru
layout/style/crashtests/1167782-1.html
layout/style/crashtests/crashtests.list
layout/style/nsHTMLCSSStyleSheet.cpp
new file mode 100644
--- /dev/null
+++ b/layout/style/crashtests/1167782-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<html>
+<body>
+<script>
+  var d = window.getComputedStyle(document.body, "::-moz-color-swatch").display;
+</script>
+</body>
+</html>
--- a/layout/style/crashtests/crashtests.list
+++ b/layout/style/crashtests/crashtests.list
@@ -108,10 +108,11 @@ load 989965-1.html
 load 992333-1.html
 pref(dom.webcomponents.enabled,true) load 1017798-1.html
 load 1028514-1.html
 load 1066089-1.html
 load 1074651-1.html
 pref(dom.webcomponents.enabled,true) load 1089463-1.html
 pref(layout.css.expensive-style-struct-assertions.enabled,true) load 1136010-1.html
 load 1153693-1.html
+load 1167782-1.html
 load large_border_image_width.html
 load border-image-visited-link.html
--- a/layout/style/nsHTMLCSSStyleSheet.cpp
+++ b/layout/style/nsHTMLCSSStyleSheet.cpp
@@ -99,21 +99,18 @@ nsHTMLCSSStyleSheet::PseudoElementRulesM
     rule->RuleMatched();
     aRuleWalker->Forward(rule);
   }
 }
 
 /* virtual */ void
 nsHTMLCSSStyleSheet::RulesMatching(PseudoElementRuleProcessorData* aData)
 {
-  if (nsCSSPseudoElements::PseudoElementSupportsStyleAttribute(aData->mPseudoType)) {
-    MOZ_ASSERT(aData->mPseudoElement,
-        "If pseudo element is supposed to support style attribute, it must "
-        "have a pseudo element set");
-
+  if (nsCSSPseudoElements::PseudoElementSupportsStyleAttribute(aData->mPseudoType) &&
+      aData->mPseudoElement) {
     PseudoElementRulesMatching(aData->mPseudoElement, aData->mPseudoType,
                                aData->mRuleWalker);
   }
 }
 
 /* virtual */ void
 nsHTMLCSSStyleSheet::RulesMatching(AnonBoxRuleProcessorData* aData)
 {