summaryrefslogtreecommitdiffstats
path: root/b2g/components/BootstrapCommandLine.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 /b2g/components/BootstrapCommandLine.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 'b2g/components/BootstrapCommandLine.js')
-rw-r--r--b2g/components/BootstrapCommandLine.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/b2g/components/BootstrapCommandLine.js b/b2g/components/BootstrapCommandLine.js
new file mode 100644
index 000000000..24d9f5461
--- /dev/null
+++ b/b2g/components/BootstrapCommandLine.js
@@ -0,0 +1,52 @@
+/* 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/. */
+
+const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/AppsUtils.jsm");
+
+function BootstrapCommandlineHandler() {
+ this.wrappedJSObject = this;
+ this.startManifestURL = null;
+}
+
+BootstrapCommandlineHandler.prototype = {
+ bailout: function(aMsg) {
+ dump("************************************************************\n");
+ dump("* /!\\ " + aMsg + "\n");
+ dump("************************************************************\n");
+ let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
+ .getService(Ci.nsIAppStartup);
+ appStartup.quit(appStartup.eForceQuit);
+ },
+
+ handle: function(aCmdLine) {
+ this.startManifestURL = null;
+
+ try {
+ // Returns null if the argument was not specified. Throws
+ // NS_ERROR_INVALID_ARG if there is no parameter specified (because
+ // it was the last argument or the next argument starts with '-').
+ // However, someone could still explicitly pass an empty argument!
+ this.startManifestURL = aCmdLine.handleFlagWithParam("start-manifest", false);
+ } catch(e) {
+ return;
+ }
+
+ if (!this.startManifestURL) {
+ return;
+ }
+
+ if (!isAbsoluteURI(this.startManifestURL)) {
+ this.bailout("The start manifest url must be absolute.");
+ return;
+ }
+ },
+
+ helpInfo: "--start-manifest=manifest_url",
+ classID: Components.ID("{fd663ec8-cf3f-4c2b-aacb-17a6915ccb44}"),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler])
+};
+
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([BootstrapCommandlineHandler]);