It's definitely a bug. It appears to be a timing issue with messing with
protocol handlers too early.
Getting someone to look at it might be tricky since it's not necessarily a
supported mechanism. But here's a workaround to just do it later in the
startup process that works for me:
Components.utils.import("resource://gre/modules/Services.jsm");
Services.obs.addObserver(function observer(subject, topic, data) {
// DO ANYTHING YOU NEED TO DO LATER IN STARTUP LIKE PROTOCOL HANDLERS
Services.obs.removeObserver(observer, topic);
}, "final-ui-startup");
I am going to see if I can figure out what caused it though.
Mike
On Mon, Oct 21, 2019 at 8:34 AM Mike Kaply <[email protected]> wrote:
> I'm definitely investigating it as a bug.
>
> Mike
>
> On Fri, Oct 18, 2019 at 4:16 PM James Pearson <[email protected]>
> wrote:
>
>> I actually meant: "I can sort-of work around this problem ..."
>>
>> But I would still like to know if this a bug or something that can be
>> fixed in the autoconfig file
>>
>> Thanks
>>
>> James Pearson
>> ________________________________________
>> From: Enterprise [[email protected]] on behalf of James
>> Pearson [[email protected]]
>> Sent: 16 October 2019 14:41
>> To: Mike Kaply
>> Cc: [email protected]
>> Subject: Re: [Mozilla Enterprise] Problem with custom protocol handler in
>> autoconfig file and ESR 68
>>
>> I can't sort-of work around this problem by checking for a custom pref
>> in the autoconfig file - and don't set up the custom protocol handler if
>> this pref doesn't exist, but set this custom pref. On subsequent runs of
>> Firefox, as the custom pref exists and is set, the custom protocol
>> handler is set up
>>
>> This does mean that the custom protocol handler doesn't work on the
>> first run, but all works as expected on subsequent runs ...
>>
>> Is this a bug I should report - or is it something that should be
>> 'fixed' (somehow?) in the autoconfig file ?
>>
>> Thanks
>>
>> James Pearson
>>
>> James Pearson wrote:
>> >
>> > pdfjs.disabled is set to false
>> >
>> > Thanks
>> >
>> > James Pearson
>> >
>> > Mike Kaply wrote:
>> >>
>> >> That's quite strange.
>> >>
>> >> Are you sure you're not somehow accidentally turning it off?
>> >>
>> >> What do you see for the value of pdfjs.disabled when you go to
>> >> about:config?
>> >>
>> >> Mike
>> >>
>> >> On Tue, Oct 15, 2019 at 10:25 AM James Pearson
>> >> <[email protected]<mailto:[email protected]>> wrote:
>> >> 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<
>> http://mozilla.org/uriloader/external-protocol-service;1
>> >"].getService(Ci.nsIExternalProtocolService);
>> >>
>> >> var handlerSvc =
>> >> Cc["@mozilla.org/uriloader/handler-service;1<
>> http://mozilla.org/uriloader/handler-service;1
>> >"].getService(Ci.nsIHandlerService);
>> >>
>> >>
>> >> var handlerInfo =
>> extProtocolSvc.getProtocolHandlerInfo("yourprotocol");
>> >>
>> >> var file =
>> >> Cc["@mozilla.org/file/local;1<http://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<
>> http://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
>> >>git push
>>
>> >> 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]<mailto:[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]<mailto:[email protected]>
>> >> with a subject of "unsubscribe"
>> >>
>> >
>> > _______________________________________________
>> > 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"
>>
>> _______________________________________________
>> 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"
>>
>
_______________________________________________
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"