/* See license.txt for terms of usage */

"use strict";

const { Cu, Ci } = require("chrome");
const { Firebug } = require("./firebug.js");
const { Trace } = require("./trace.js");
const { gDevTools } = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});

// Entry points of the extension. Both 'main' and 'onUnload' methods are
// exported from this module and executed automatically by Add-ons SDK.
function main(options, callbacks) {
  Trace.sysout("main; ", options);

  // Instantiate the main application object (a singleton). There is one
  // Firebug instance shared across all browser windows.
  var firebug = new Firebug(options);

  // Hook developer tools events to maintain Firebug object life time.
  gDevTools.on("toolbox-ready", firebug.onToolboxReady.bind(firebug));
  gDevTools.on("toolbox-destroyed", firebug.onToolboxDestroyed.bind(firebug));
}

function onUnload(reason) {
  firebug.shutdown(reason)
}

// Exports from this module
exports.main = main;
exports.onUnload = onUnload;

@@ -258,16 +258,61 @@
 , %7B%7D);%0A%0A
+// The application (singleton)%0Avar firebug;%0A%0A
 // Entry
@@ -376,16 +376,16 @@
 ods are%0A
-
 // expor
@@ -652,20 +652,16 @@
 dows.%0A  
-var 
 firebug 
@@ -827,16 +827,16 @@
 ebug));%0A
-
   gDevTo
@@ -906,16 +906,84 @@
 ebug));%0A
+  gDevTools.on(%22pref-changed%22, firebug.updateOption.bind(firebug));%0A
 %7D%0A%0Afunct

Fix undefined variable in onUnload