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 377951 542fb35b78c88923c9582c6be24db90fd59702fd
parent 377950 7261f391ff4fb2287a7a8530d9319eccb378e510
child 377952 7d40ae3963e7be7471091b70a83531321caefdc0
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [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);
   }