Open Bug 1552459 Opened 6 years ago Updated 3 years ago

not possible to add custom command handler (like thunderbird.exe -test)

Categories

(Thunderbird :: General, defect)

defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: cardbook.thunderbird, Unassigned)

Details

(Whiteboard: [dupme?])

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0

Steps to reproduce:

create a chrome.manifest :

component {823f4516-885f-492d-b8d3-d5e8c8316be1} test.js
contract @mozilla.org/commandlinehandler/general-startup;1?type=test {823f4516-885f-492d-b8d3-d5e8c8316be2}
category command-line-handler m-test @mozilla.org/commandlinehandler/general-startup;1?type=test

create a file test.js :

var { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");

function CardBookCmdLineHandler() {}
CardBookCmdLineHandler.prototype = {
classID: Components.ID("{823f4516-885f-492d-b8d3-d5e8c8316be2}"),
QueryInterface: ChromeUtils.generateQI([Components.interfaces.nsICommandLineHandler]),
helpInfo: " -test Do tests.\n",
handle: function (aCmdLine) {
if (aCmdLine.handleFlag("test", false)) {
// some stuff here
aCmdLine.preventDefault = true;
}
}
};

function NSGetFactory(cid) {
return (XPCOMUtils.generateNSGetFactory([CardBookCmdLineHandler]))(cid);
}

Actual results:

"thunderbird.exe -test" is correctly executed only when Thunderbird is already started.

Expected results:

Like with previous versions, "thunderbird.exe -test" should have executed even if Thunderbird is not already started

oops correct chrome.manifest :
component {823f4516-885f-492d-b8d3-d5e8c8316be2} test.js
contract @mozilla.org/commandlinehandler/general-startup;1?type=test {823f4516-885f-492d-b8d3-d5e8c8316be2}
category command-line-handler m-test @mozilla.org/commandlinehandler/general-startup;1?type=test

and according to Geoff : "component registration happens way to late"

Component: Untriaged → General
Whiteboard: [dupme?]

I second this request. It is really sad that now "thunderbird -adressbook " is possible, but "thunderbird -cardbook" not anymore.

Either allow addition of NEW cli options, or allow overwriting the existing -adressbook one or replace the broken and outdated addressbook with cardbook anyways.

Please, please, please.

Tormen

The use case is primarily testing?
If that's not available, are the alternate solutions not working?

it's not for testing et there are no alternatives... :(

(In reply to Wayne Mery (:wsmwk) from comment #3)

The use case is primarily testing?

Use case: To be able to start CardBook as an address book on its own, too. I have an icon for "thunderbird -cardbook" on my desktop, which led me directly to CardBook. Most of the time I am not going to use thunderbird's other features if I look something up in CardBook.

Well, this would be a solution:
https://gitlab.com/CardBook/CardBook/issues/761
...

Version: 68 → Trunk
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.