Bug 1333001 - Ensure that ImportRule in fact always has a non-null mMedia. r=heycam a=gchang
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 24 Jan 2017 10:02:46 -0500
changeset 375667 542fb35b78c88923c9582c6be24db90fd59702fd
parent 375666 7261f391ff4fb2287a7a8530d9319eccb378e510
child 375668 7d40ae3963e7be7471091b70a83531321caefdc0
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam, gchang
bugs1333001
milestone53.0a2
Bug 1333001 - Ensure that ImportRule in fact always has a non-null mMedia. r=heycam a=gchang
layout/style/nsCSSRules.cpp
--- a/layout/style/nsCSSRules.cpp
+++ b/layout/style/nsCSSRules.cpp
@@ -266,16 +266,20 @@ ImportRule::ImportRule(const ImportRule&
   // Whether or not an @import rule has a null sheet is a permanent
   // property of that @import rule, since it is null only if the target
   // sheet failed security checks.
   if (aCopy.mChildSheet) {
     RefPtr<CSSStyleSheet> sheet =
       aCopy.mChildSheet->Clone(nullptr, this, nullptr, nullptr);
     SetSheet(sheet);
     // SetSheet sets mMedia appropriately
+  } else {
+    // We better just copy mMedia from aCopy, since we have nowhere else to get
+    // one.
+    mMedia = aCopy.mMedia;
   }
 }
 
 ImportRule::~ImportRule()
 {
   if (mChildSheet) {
     mChildSheet->SetOwnerRule(nullptr);
   }