Bug 1333001. Ensure that ImportRule in fact always has a non-null mMedia. r=heycam
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 24 Jan 2017 10:02:46 -0500
changeset 330877 65a5cc2a2ef6be3d38d89dba7013d4a889843071
parent 330876 c1fa41bd31be3f43f83746961a1618f449e08e33
child 330878 63dce15dd3d4a030c951c96703cb9cd700614df2
push id31254
push userphilringnalda@gmail.com
push dateWed, 25 Jan 2017 02:53:42 +0000
treeherdermozilla-central@6dccae211ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1333001
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1333001. Ensure that ImportRule in fact always has a non-null mMedia. r=heycam
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);
   }