summaryrefslogtreecommitdiffstats
path: root/devtools/client/webide/components/webideCli.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/client/webide/components/webideCli.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/webide/components/webideCli.js')
-rw-r--r--devtools/client/webide/components/webideCli.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/devtools/client/webide/components/webideCli.js b/devtools/client/webide/components/webideCli.js
new file mode 100644
index 000000000..0f75da2c4
--- /dev/null
+++ b/devtools/client/webide/components/webideCli.js
@@ -0,0 +1,58 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+
+const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
+
+XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
+
+/**
+ * Handles --webide command line option.
+ */
+
+function webideCli() { }
+
+webideCli.prototype = {
+ handle: function (cmdLine) {
+ if (!cmdLine.handleFlag("webide", false)) {
+ return;
+ }
+
+ // If --webide is used remotely, we don't want to open
+ // a new tab.
+ //
+ // If --webide is used for a new Firefox instance, we
+ // want to open webide only.
+ cmdLine.preventDefault = true;
+
+ let win = Services.wm.getMostRecentWindow("devtools:webide");
+ if (win) {
+ win.focus();
+ } else {
+ win = Services.ww.openWindow(null,
+ "chrome://webide/content/",
+ "webide",
+ "chrome,centerscreen,resizable,dialog=no",
+ null);
+ }
+
+ if (cmdLine.state == Ci.nsICommandLine.STATE_INITIAL_LAUNCH) {
+ // If this is a new Firefox instance, and because we will only start
+ // webide, we need to notify "sessionstore-windows-restored" to trigger
+ // addons registration (for simulators and adb helper).
+ Services.obs.notifyObservers(null, "sessionstore-windows-restored", "");
+ }
+ },
+
+ helpInfo: "",
+
+ classID: Components.ID("{79b7b44e-de5e-4e4c-b7a2-044003c615d9}"),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
+};
+
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([webideCli]);