Bug 1396071 - check if SourceMapURLService has been destroyed after async call;r=tromey draft
authorJulian Descottes <jdescottes@mozilla.com>
Sat, 02 Sep 2017 00:59:46 +0200
changeset 659100 343f25d553fccb077952db835ddf8fbc25a3c91a
parent 658586 9cf256881e0a60b607312f7dc1bfb0de86d99a7c
child 729883 a3015788aed9d7cce96ee625e50839f5038be898
push id78013
push userjdescottes@mozilla.com
push dateTue, 05 Sep 2017 14:06:38 +0000
reviewerstromey
bugs1396071
milestone57.0a1
Bug 1396071 - check if SourceMapURLService has been destroyed after async call;r=tromey MozReview-Commit-ID: KsKtgvC9LXt
devtools/client/framework/source-map-url-service.js
--- a/devtools/client/framework/source-map-url-service.js
+++ b/devtools/client/framework/source-map-url-service.js
@@ -68,16 +68,21 @@ SourceMapURLService.prototype.destroy = 
   Services.prefs.removeObserver(SOURCE_MAP_PREF, this._onPrefChanged);
   this._target = this._urls = this._subscriptions = null;
 };
 
 /**
  * A helper function that is called when a new source is available.
  */
 SourceMapURLService.prototype._onSourceUpdated = function (_, sourceEvent) {
+  // Maybe we were shut down while waiting.
+  if (!this._urls) {
+    return;
+  }
+
   let { source } = sourceEvent;
   let { generatedUrl, url, actor: id, sourceMapURL } = source;
 
   // |generatedUrl| comes from the actor and is extracted from the
   // source code by SpiderMonkey.
   let seenUrl = generatedUrl || url;
   this._urls.set(seenUrl, { id, url: seenUrl, sourceMapURL });
 };