mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 02:28:00 +01:00
Update components to load more reliably on FF<4.0. Fix command line option parsing.
This commit is contained in:
@@ -6,28 +6,27 @@
|
|||||||
|
|
||||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
|
||||||
const Name = Components.classes["@dactyl.googlecode.com/base/dactyl"]
|
|
||||||
.getService().wrappedJSObject.name;
|
|
||||||
const name = Name.toLowerCase();
|
|
||||||
function CommandLineHandler() {
|
function CommandLineHandler() {
|
||||||
this.wrappedJSObject = this;
|
this.wrappedJSObject = this;
|
||||||
}
|
}
|
||||||
CommandLineHandler.prototype = {
|
CommandLineHandler.prototype = {
|
||||||
|
|
||||||
classDescription: Name + " Command-line Handler",
|
classDescription: "Dactyl Command-line Handler",
|
||||||
|
|
||||||
classID: Components.ID("{16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}"),
|
classID: Components.ID("{16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}"),
|
||||||
|
|
||||||
contractID: "@mozilla.org/commandlinehandler/general-startup;1?type=" + name,
|
contractID: "@mozilla.org/commandlinehandler/general-startup;1?type=dactyl",
|
||||||
|
|
||||||
_xpcom_categories: [{
|
_xpcom_categories: [{
|
||||||
category: "command-line-handler",
|
category: "command-line-handler",
|
||||||
entry: "m-" + name
|
entry: "m-dactyl"
|
||||||
}],
|
}],
|
||||||
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsICommandLineHandler]),
|
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsICommandLineHandler]),
|
||||||
|
|
||||||
handle: function (commandLine) {
|
handle: function (commandLine) {
|
||||||
|
let name = Components.classes["@dactyl.googlecode.com/base/dactyl"]
|
||||||
|
.getService().wrappedJSObject.name;
|
||||||
// TODO: handle remote launches differently?
|
// TODO: handle remote launches differently?
|
||||||
try {
|
try {
|
||||||
this.optionValue = commandLine.handleFlagWithParam(name, false);
|
this.optionValue = commandLine.handleFlagWithParam(name, false);
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ ChromeData.prototype = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function Dactyl() {
|
function Dactyl() {
|
||||||
|
Dactyl.prototype.__proto__ = Cc["@dactyl.googlecode.com/base/dactyl"].getService().wrappedJSObject;
|
||||||
this.wrappedJSObject = this;
|
this.wrappedJSObject = this;
|
||||||
|
|
||||||
this.HELP_TAGS = {};
|
this.HELP_TAGS = {};
|
||||||
@@ -131,8 +132,6 @@ Dactyl.prototype = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
__proto__: Cc["@dactyl.googlecode.com/base/dactyl"].getService().wrappedJSObject,
|
|
||||||
|
|
||||||
init: function (obj) {
|
init: function (obj) {
|
||||||
for each (let prop in ["HELP_TAGS", "FILE_MAP", "OVERLAY_MAP"]) {
|
for each (let prop in ["HELP_TAGS", "FILE_MAP", "OVERLAY_MAP"]) {
|
||||||
this[prop] = this[prop].constructor();
|
this[prop] = this[prop].constructor();
|
||||||
|
|||||||
@@ -1098,12 +1098,18 @@ const Dactyl = Module("dactyl", {
|
|||||||
*/
|
*/
|
||||||
parseCommandLine: function (cmdline) {
|
parseCommandLine: function (cmdline) {
|
||||||
const options = [
|
const options = [
|
||||||
[["+u"], commands.OPTIONS_STRING],
|
[["+u"], CommandOption.STRING],
|
||||||
[["++noplugin"], commands.OPTIONS_NOARG],
|
[["++noplugin"], CommandOption.NOARG],
|
||||||
[["++cmd"], commands.OPTIONS_STRING, null, null, true],
|
[["++cmd"], CommandOption.STRING, null, null, true],
|
||||||
[["+c"], commands.OPTIONS_STRING, null, null, true]
|
[["+c"], CommandOption.STRING, null, null, true]
|
||||||
];
|
].map(CommandOption.fromArray, CommandOption);
|
||||||
return commands.parseArgs(cmdline, options, "*");
|
try {
|
||||||
|
return commands.parseArgs(cmdline, options, "*");
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
dactyl.reportError(e, true);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
variableReference: function (string) {
|
variableReference: function (string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user