Bug 1469774 - Error this.pageListener is undefined in AboutPrivateBrowsingHandler.jsm r=johannh
authorSyeda Asra Arshia Qadri <asra.qadri@gmail.com>
Thu, 14 Mar 2019 10:05:02 +0000
changeset 521869 5da37483c3e2
parent 521868 e9e31edcc25a
child 521870 f101c9664b87
push id10870
push usernbeleuzu@mozilla.com
push dateFri, 15 Mar 2019 20:00:07 +0000
treeherdermozilla-beta@c594aee5b7a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1469774
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 1469774 - Error this.pageListener is undefined in AboutPrivateBrowsingHandler.jsm r=johannh Differential Revision: https://phabricator.services.mozilla.com/D23295
browser/components/about/AboutPrivateBrowsingHandler.jsm
--- a/browser/components/about/AboutPrivateBrowsingHandler.jsm
+++ b/browser/components/about/AboutPrivateBrowsingHandler.jsm
@@ -5,30 +5,35 @@
 "use strict";
 
 var EXPORTED_SYMBOLS = ["AboutPrivateBrowsingHandler"];
 
 const {RemotePages} = ChromeUtils.import("resource://gre/modules/remotepagemanager/RemotePageManagerParent.jsm");
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var AboutPrivateBrowsingHandler = {
+  _inited: false,
   _topics: [
     "DontShowIntroPanelAgain",
     "OpenPrivateWindow",
     "SearchHandoff",
   ],
 
   init() {
     this.pageListener = new RemotePages("about:privatebrowsing");
     for (let topic of this._topics) {
       this.pageListener.addMessageListener(topic, this.receiveMessage.bind(this));
     }
+    this._inited = true;
   },
 
   uninit() {
+    if (!this._inited) {
+      return;
+    }
     for (let topic of this._topics) {
       this.pageListener.removeMessageListener(topic);
     }
     this.pageListener.destroy();
   },
 
   receiveMessage(aMessage) {
     switch (aMessage.name) {