This is really aimed at Mike Kaply ...
Many years ago on this list, Mike provided the 'magic' to add a custom
protocol handler in an autoconfig cfg file - the archives of this list
don't go back to 2014, so I can't link to the original thread - but what
is needed is something like this:
const Cc = Components.classes;
const Ci = Components.interfaces;
var extProtocolSvc =
Cc["@mozilla.org/uriloader/external-protocol-service;1"].getService(Ci.nsIExternalProtocolService);
var handlerSvc =
Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService);
var handlerInfo = extProtocolSvc.getProtocolHandlerInfo("yourprotocol");
var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
// This should be the path to the .app file on Mac or the EXE on Windows
file.initWithPath("/Applications/Preview.app");
var localHandlerApp =
Cc["@mozilla.org/uriloader/local-handler-app;1"].createInstance(Ci.nsILocalHandlerApp);
localHandlerApp.executable = file;
// The name that will be shown in preferences.
// Not used on Mac
localHandlerApp.name = "Preview";
handlerInfo.possibleApplicationHandlers.appendElement(localHandlerApp,
false);
handlerInfo.preferredAction = Ci.nsIHandlerInfo.useHelperApp;
handlerInfo.preferredApplicationHandler = localHandlerApp;
handlerInfo.alwaysAskBeforeHandling = false;
handlerSvc.store(handlerInfo);
This has worked fine ever since for us - and works with ESR 68 -
however, it appears to 'break' the built-in PDF viewer
If I create a new profile with a custom protocol handler defined in the
autoconfig (as above), then the built-in PDF viewer isn't used - you're
given the option to open the PDF file in an external viewer instead
Looking at the Preference Setting for PDF, it is set to 'Always ask' -
changing this to 'Preview in Firefox' just brings up a Save dialog when
clicking on a link to a PDF file
(The custom protocol handler works fine)
However, if I create a new profile with an autoconfig that doesn't have
a custom handler defined, start Firefox with that new profile, then quit
Firefox. Then restart Firefox (using the same profile), but this time
using an autoconfig that has the custom handler defined, then the
built-in PDF viewer works as expected ... as does the custom protocol
handler
i.e. defining a custom protocol handler on the first run of Firefox
appears to interfere with/break the built-it PDF viewer
This is with Firefox ESR 68.1 on Linux
Any idea what I can do to prevent this happening ?
Thanks
James Pearson
_______________________________________________
Enterprise mailing list
[email protected]
https://mail.mozilla.org/listinfo/enterprise
To unsubscribe from this list, please visit https://mail.mozilla.org/listinfo/enterprise
or send an email to [email protected] with a subject of
"unsubscribe"