Bug 1497299 - Avoid destroying nsHashPropertyBag when recording/replaying, r=mccr8.
authorBrian Hackett <bhackett1024@gmail.com>
Thu, 07 Mar 2019 21:46:49 +0000
changeset 520937 b7141d2c750d98e83c36907de6443b51acc8131e
parent 520936 346002ff619eef0712be55594102460b40f44db1
child 520938 3dc5de51e6313dca5675b3c6b501c3f9f9da91b8
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1497299
milestone67.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 1497299 - Avoid destroying nsHashPropertyBag when recording/replaying, r=mccr8. Differential Revision: https://phabricator.services.mozilla.com/D22561
xpcom/ds/nsHashPropertyBag.h
--- a/xpcom/ds/nsHashPropertyBag.h
+++ b/xpcom/ds/nsHashPropertyBag.h
@@ -27,17 +27,22 @@ class nsHashPropertyBagBase : public nsI
 
  protected:
   // a hash table of string -> nsIVariant
   nsInterfaceHashtable<nsStringHashKey, nsIVariant> mPropertyHash;
 };
 
 class nsHashPropertyBag : public nsHashPropertyBagBase {
  public:
-  nsHashPropertyBag() {}
+  nsHashPropertyBag() {
+    // Avoid destroying this object when recording/replaying. See bug 1497299.
+    if (mozilla::recordreplay::IsRecordingOrReplaying()) {
+      AddRef();
+    }
+  }
   NS_DECL_THREADSAFE_ISUPPORTS
 
  protected:
   virtual ~nsHashPropertyBag();
 };
 
 /* A cycle collected nsHashPropertyBag for main-thread-only use. */
 class nsHashPropertyBagCC final : public nsHashPropertyBagBase {