From 97f2fd40f1c00a80ebd129df9143c9c8ac96f7dc Mon Sep 17 00:00:00 2001 From: Isaac Schemm Date: Tue, 21 Feb 2017 13:47:01 -0600 Subject: [PATCH] Trying something to keep garbage collector at bay --- components/WebRTCToggle.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/components/WebRTCToggle.js b/components/WebRTCToggle.js index e802371..f85f7d1 100644 --- a/components/WebRTCToggle.js +++ b/components/WebRTCToggle.js @@ -47,8 +47,10 @@ WebRTCToggle.prototype = { // add to category manager _xpcom_categories: [{category: "profile-after-change"}], + + prefBranch: null, - observe: function(aSubject, aTopic, aData) + observe: function(aSubject, aTopic, aData) { switch (aTopic) { @@ -58,10 +60,10 @@ WebRTCToggle.prototype = { .getService(Components.interfaces.nsIObserverService) .addObserver(this, "quit-application", false); - Components.classes["@mozilla.org/preferences-service;1"] + this.prefBranch = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService) - .getBranch("media.navigator.permission.") - .addObserver("", this, false); + .getBranch("media.navigator.permission."); + this.prefBranch.addObserver("", this, false); break; case "quit-application": // Turn the override off when closing the application, @@ -86,6 +88,7 @@ WebRTCToggle.prototype = { } else { message = "Automatic WebRTC connection has been turned off."; } + console.log(message); var type = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService)