Bug 1535612 - CSSKeyframeList::RemoveRule should clear parent references when removed. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 20 Mar 2019 09:50:51 +0000
changeset 465813 208cf2d82f55bf31d951e818ca0e3b29ef2f5ebe
parent 465812 eae1fd2ff0c6f840da830773f851e2adb4e7dc35
child 465814 acaebd9d440a4bc85e9c85d6bcc4abfedf1f0617
push id112523
push usershindli@mozilla.com
push dateSat, 23 Mar 2019 09:54:29 +0000
treeherdermozilla-inbound@59e55930dc0f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1535612
milestone68.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 1535612 - CSSKeyframeList::RemoveRule should clear parent references when removed. r=heycam Differential Revision: https://phabricator.services.mozilla.com/D23729
layout/style/CSSKeyframesRule.cpp
--- a/layout/style/CSSKeyframesRule.cpp
+++ b/layout/style/CSSKeyframesRule.cpp
@@ -64,17 +64,25 @@ class CSSKeyframeList : public dom::CSSR
       return nullptr;
     }
     aFound = true;
     return GetRule(aIndex);
   }
 
   void AppendRule() { mRules.AppendObject(nullptr); }
 
-  void RemoveRule(uint32_t aIndex) { mRules.RemoveObjectAt(aIndex); }
+  void RemoveRule(uint32_t aIndex) {
+    if (aIndex >= mRules.Length()) {
+      return;
+    }
+    if (css::Rule* child = mRules[aIndex]) {
+      child->DropReferences();
+    }
+    mRules.RemoveObjectAt(aIndex);
+  }
 
   uint32_t Length() final { return mRules.Length(); }
 
   void DropReferences() {
     if (!mStyleSheet && !mParentRule) {
       return;
     }
     mStyleSheet = nullptr;