Bug 1530019 - Check if actor.cleanup() exists before trying to call it. r=mconley
authorFelipe Gomes <felipc@gmail.com>
Fri, 22 Feb 2019 19:28:00 -0300
changeset 460721 75f417cfd0d21205c36493cfd1086faacd4a5182
parent 460720 aea45260a0bcb1da32fe474c957c5b1751b636da
child 460722 0e0b4b2f297307d8c3178acca10dc3b4a2c55359
push id35597
push userrmaries@mozilla.com
push dateSat, 23 Feb 2019 04:15:57 +0000
treeherdermozilla-central@6924dd16f7b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1530019
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 1530019 - Check if actor.cleanup() exists before trying to call it. r=mconley
toolkit/modules/ActorManagerChild.jsm
--- a/toolkit/modules/ActorManagerChild.jsm
+++ b/toolkit/modules/ActorManagerChild.jsm
@@ -213,20 +213,22 @@ class SingletonDispatcher extends Dispat
     for (let msg of this.messages.keys()) {
       this.mm.removeMessageListener(msg, this);
     }
     for (let [event, listener, options] of this.listeners) {
       this.mm.removeEventListener(event, listener, options);
     }
 
     for (let actor of this.instances.values()) {
-      try {
-        actor.cleanup();
-      } catch (e) {
-        Cu.reportError(e);
+      if (typeof actor.cleanup == "function") {
+        try {
+          actor.cleanup();
+        } catch (e) {
+          Cu.reportError(e);
+        }
       }
     }
 
     this.listeners = [];
   }
 
   get window() {
     return this._window.get();