Bug 1396071 - check if SourceMapURLService has been destroyed after async call;r=tromey
MozReview-Commit-ID: KsKtgvC9LXt
--- 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 });
};