Bug 1167782 - Null-check pseudo element in nsHTMLCSSStyleSheet::RulesMatching(). r=dbaron, a=jocheng
authorDaniel Holbert <dholbert@cs.stanford.edu>
Tue, 26 May 2015 16:44:52 -0700
changeset 238523 de798dcaa90fb3129a49a5767a83079942c979a5
parent 238522 6ae516ab1f40adc3da87c953b5a40e3239ea6eec
child 238524 f46e8f80c3613d4cda5c6ed8eed987d6459213f6
push id659
push userryanvm@gmail.com
push dateFri, 29 May 2015 15:21:23 +0000
treeherdermozilla-b2g37_v2_2@de798dcaa90f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron, jocheng
bugs1167782
milestone37.0
Bug 1167782 - Null-check pseudo element in nsHTMLCSSStyleSheet::RulesMatching(). r=dbaron, a=jocheng
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
@@ -107,10 +107,11 @@ pref(layers.offmainthreadcomposition.asy
 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
 load 1136010-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
@@ -89,21 +89,18 @@ nsHTMLCSSStyleSheet::ElementRulesMatchin
       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) {
     // just get the one and only style rule from the content's STYLE attribute
     css::StyleRule* rule = aData->mPseudoElement->GetInlineStyleRule();
     if (rule) {
       rule->RuleMatched();
       aData->mRuleWalker->Forward(rule);
     }
   }
 }