Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Issue 5857: Firebug command does not go away when disabled

  • Loading branch information...
commit 9ea45e4980d7e6d93169c7f8410218383c86c94c 1 parent 43511bf
Jan Odvarko authored
4  extension/bootstrap.js
@@ -73,6 +73,7 @@ function startup(params, reason)
73 73
 
74 74
     // GCLI commands
75 75
     Cu.import("resource://firebug/gcli.js");
  76
+    FirebugGCLICommands.startup();
76 77
 }
77 78
 
78 79
 function shutdown(params, reason)
@@ -94,6 +95,9 @@ function shutdown(params, reason)
94 95
         Cu.reportError(e);
95 96
     }
96 97
 
  98
+    // Unregister all GCLI commands
  99
+    FirebugGCLICommands.shutdown();
  100
+
97 101
     // xxxHonza: I think this shouldn't be here (perhaps in firebug-service.js)
98 102
     // Shutdown Firebug's JSD debugger service.
99 103
     var fbs = Cu.import("resource://firebug/firebug-service.js", {}).fbs;
106  extension/modules/gcli.js
@@ -7,7 +7,7 @@ var Cc = Components.classes;
7 7
 var Ci = Components.interfaces;
8 8
 var Cu = Components.utils;
9 9
 
10  
-var EXPORTED_SYMBOLS = [];
  10
+var EXPORTED_SYMBOLS = ["FirebugGCLICommands"];
11 11
 
12 12
 // ********************************************************************************************* //
13 13
 // GCLI
@@ -24,12 +24,25 @@ catch (err)
24 24
         FBTrace.sysout("GCLI not available");
25 25
 }
26 26
 
  27
+var Locale = Cu.import("resource://firebug/locale.js").Locale;
  28
+
27 29
 if (scope.gcli) {
28 30
 
29 31
 // ********************************************************************************************* //
30  
-// Services
  32
+// FirebugGCLICommands
31 33
 
32  
-var Locale = Cu.import("resource://firebug/locale.js").Locale;
  34
+var FirebugGCLICommands =
  35
+{
  36
+    startup: function()
  37
+    {
  38
+        registerCommands();
  39
+    },
  40
+
  41
+    shutdown: function()
  42
+    {
  43
+        unregisterCommands();
  44
+    }
  45
+}
33 46
 
34 47
 // ********************************************************************************************* //
35 48
 // Command Implementation
@@ -99,40 +112,59 @@ var FirebugController =
99 112
 // ********************************************************************************************* //
100 113
 // Registration
101 114
 
102  
-scope.gcli.addCommand({
103  
-    name: "firebug",
104  
-    description: "Web Development Evolved"
105  
-});
106  
-
107  
-scope.gcli.addCommand({
108  
-    name: "firebug open",
109  
-    description: Locale.$STR("firebug.menu.tip.Open_Firebug"),
110  
-    exec: FirebugController.openFirebug.bind(FirebugController)
111  
-});
112  
-
113  
-scope.gcli.addCommand({
114  
-    name: "firebug hide",
115  
-    description: Locale.$STR("firebug.menu.tip.Minimize_Firebug"),
116  
-    exec: FirebugController.hideFirebug.bind(FirebugController)
117  
-});
118  
-
119  
-scope.gcli.addCommand({
120  
-    name: "firebug close",
121  
-    description: Locale.$STR("firebug.shortcut.tip.closeFirebug"),
122  
-    exec: FirebugController.closeFirebug.bind(FirebugController)
123  
-});
124  
-
125  
-scope.gcli.addCommand({
126  
-    name: "firebug detach",
127  
-    description: Locale.$STR("firebug.DetachFirebug"),
128  
-    exec: FirebugController.detachFirebug.bind(FirebugController)
129  
-});
130  
-
131  
-scope.gcli.addCommand({
132  
-    name: "firebug attach",
133  
-    description: Locale.$STR("firebug.AttachFirebug"),
134  
-    exec: FirebugController.attachFirebug.bind(FirebugController)
135  
-});
  115
+var commands = [];
  116
+
  117
+function addCommand(command)
  118
+{
  119
+    scope.gcli.addCommand(command);
  120
+    commands.push(command);
  121
+}
  122
+
  123
+function registerCommands()
  124
+{
  125
+    addCommand({
  126
+        name: "firebug",
  127
+        description: "Web Development Evolved"
  128
+    });
  129
+
  130
+    addCommand({
  131
+        name: "firebug open",
  132
+        description: Locale.$STR("firebug.menu.tip.Open_Firebug"),
  133
+        exec: FirebugController.openFirebug.bind(FirebugController)
  134
+    });
  135
+
  136
+    addCommand({
  137
+        name: "firebug hide",
  138
+        description: Locale.$STR("firebug.menu.tip.Minimize_Firebug"),
  139
+        exec: FirebugController.hideFirebug.bind(FirebugController)
  140
+    });
  141
+
  142
+    addCommand({
  143
+        name: "firebug close",
  144
+        description: Locale.$STR("firebug.shortcut.tip.closeFirebug"),
  145
+        exec: FirebugController.closeFirebug.bind(FirebugController)
  146
+    });
  147
+
  148
+    addCommand({
  149
+        name: "firebug detach",
  150
+        description: Locale.$STR("firebug.DetachFirebug"),
  151
+        exec: FirebugController.detachFirebug.bind(FirebugController)
  152
+    });
  153
+
  154
+    addCommand({
  155
+        name: "firebug attach",
  156
+        description: Locale.$STR("firebug.AttachFirebug"),
  157
+        exec: FirebugController.attachFirebug.bind(FirebugController)
  158
+    });
  159
+}
  160
+
  161
+function unregisterCommands()
  162
+{
  163
+    for (var i=0; i<commands.length; i++)
  164
+        scope.gcli.removeCommand(commands[i]);
  165
+
  166
+    commands = [];
  167
+}
136 168
 
137 169
 // ********************************************************************************************* //
138 170
 }

0 notes on commit 9ea45e4

Please sign in to comment.
Something went wrong with that request. Please try again.