<div dir="ltr"><div>It's definitely a bug. It appears to be a timing issue with messing with protocol handlers too early.</div><div><br></div><div>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:<br></div><div><br></div><div>Components.utils.import("resource://gre/modules/Services.jsm");<br><br>Services.obs.addObserver(function observer(subject, topic, data) {</div><div> // DO ANYTHING YOU NEED TO DO LATER IN STARTUP LIKE PROTOCOL HANDLERS<br></div><div> Services.obs.removeObserver(observer, topic);<br>}, "final-ui-startup");<br></div><div><br></div><div>I am going to see if I can figure out what caused it though.</div><div><br></div><div>Mike<br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Oct 21, 2019 at 8:34 AM Mike Kaply <<a href="mailto:mkaply@mozilla.com">mkaply@mozilla.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I'm definitely investigating it as a bug.</div><div><br></div><div>Mike<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 18, 2019 at 4:16 PM James Pearson <<a href="mailto:james-p@moving-picture.com" target="_blank">james-p@moving-picture.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I actually meant: "I can sort-of work around this problem ..."<br>
<br>
But I would still like to know if this a bug or something that can be fixed in the autoconfig file<br>
<br>
Thanks<br>
<br>
James Pearson<br>
________________________________________<br>
From: Enterprise [<a href="mailto:enterprise-bounces@mozilla.org" target="_blank">enterprise-bounces@mozilla.org</a>] on behalf of James Pearson [<a href="mailto:james-p@moving-picture.com" target="_blank">james-p@moving-picture.com</a>]<br>
Sent: 16 October 2019 14:41<br>
To: Mike Kaply<br>
Cc: <a href="mailto:enterprise@mozilla.org" target="_blank">enterprise@mozilla.org</a><br>
Subject: Re: [Mozilla Enterprise] Problem with custom protocol handler in autoconfig file and ESR 68<br>
<br>
I can't sort-of work around this problem by checking for a custom pref<br>
in the autoconfig file - and don't set up the custom protocol handler if<br>
this pref doesn't exist, but set this custom pref. On subsequent runs of<br>
Firefox, as the custom pref exists and is set, the custom protocol<br>
handler is set up<br>
<br>
This does mean that the custom protocol handler doesn't work on the<br>
first run, but all works as expected on subsequent runs ...<br>
<br>
Is this a bug I should report - or is it something that should be<br>
'fixed' (somehow?) in the autoconfig file ?<br>
<br>
Thanks<br>
<br>
James Pearson<br>
<br>
James Pearson wrote:<br>
><br>
> pdfjs.disabled is set to false<br>
><br>
> Thanks<br>
><br>
> James Pearson<br>
><br>
> Mike Kaply wrote:<br>
>><br>
>> That's quite strange.<br>
>><br>
>> Are you sure you're not somehow accidentally turning it off?<br>
>><br>
>> What do you see for the value of pdfjs.disabled when you go to<br>
>> about:config?<br>
>><br>
>> Mike<br>
>><br>
>> On Tue, Oct 15, 2019 at 10:25 AM James Pearson<br>
>> <<a href="mailto:james-p@moving-picture.com" target="_blank">james-p@moving-picture.com</a><mailto:<a href="mailto:james-p@moving-picture.com" target="_blank">james-p@moving-picture.com</a>>> wrote:<br>
>> This is really aimed at Mike Kaply ...<br>
>><br>
>> Many years ago on this list, Mike provided the 'magic' to add a custom<br>
>> protocol handler in an autoconfig cfg file - the archives of this list<br>
>> don't go back to 2014, so I can't link to the original thread - but what<br>
>> is needed is something like this:<br>
>><br>
>> const Cc = Components.classes;<br>
>> const Ci = Components.interfaces;<br>
>> var extProtocolSvc =<br>
>> Cc["@<a href="http://mozilla.org/uriloader/external-protocol-service;1" rel="noreferrer" target="_blank">mozilla.org/uriloader/external-protocol-service;1</a><<a href="http://mozilla.org/uriloader/external-protocol-service;1" rel="noreferrer" target="_blank">http://mozilla.org/uriloader/external-protocol-service;1</a>>"].getService(Ci.nsIExternalProtocolService);<br>
>><br>
>> var handlerSvc =<br>
>> Cc["@<a href="http://mozilla.org/uriloader/handler-service;1" rel="noreferrer" target="_blank">mozilla.org/uriloader/handler-service;1</a><<a href="http://mozilla.org/uriloader/handler-service;1" rel="noreferrer" target="_blank">http://mozilla.org/uriloader/handler-service;1</a>>"].getService(Ci.nsIHandlerService);<br>
>><br>
>><br>
>> var handlerInfo = extProtocolSvc.getProtocolHandlerInfo("yourprotocol");<br>
>><br>
>> var file =<br>
>> Cc["@<a href="http://mozilla.org/file/local;1" rel="noreferrer" target="_blank">mozilla.org/file/local;1</a><<a href="http://mozilla.org/file/local;1" rel="noreferrer" target="_blank">http://mozilla.org/file/local;1</a>>"].createInstance(Ci.nsIFile);<br>
>><br>
>> // This should be the path to the .app file on Mac or the EXE on Windows<br>
>> file.initWithPath("/Applications/Preview.app");<br>
>> var localHandlerApp =<br>
>> Cc["@<a href="http://mozilla.org/uriloader/local-handler-app;1" rel="noreferrer" target="_blank">mozilla.org/uriloader/local-handler-app;1</a><<a href="http://mozilla.org/uriloader/local-handler-app;1" rel="noreferrer" target="_blank">http://mozilla.org/uriloader/local-handler-app;1</a>>"].createInstance(Ci.nsILocalHandlerApp);<br>
>><br>
>> localHandlerApp.executable = file;<br>
>> // The name that will be shown in preferences.<br>
>> // Not used on Mac<br>
>> localHandlerApp.name = "Preview";<br>
>> handlerInfo.possibleApplicationHandlers.appendElement(localHandlerApp,<br>
>> false);<br>
>> handlerInfo.preferredAction = Ci.nsIHandlerInfo.useHelperApp;<br>
>> handlerInfo.preferredApplicationHandler = localHandlerApp;<br>
>> handlerInfo.alwaysAskBeforeHandling = false;<br>
>> handlerSvc.store(handlerInfo);<br>
>><br>
>> This has worked fine ever since for us - and works with ESR 68 -<br>
>> however, it appears to 'break' the built-in PDF viewer<br>
>><br>
>> If I create a new profile with a custom protocol handler defined in the<br>
>> autoconfig (as above), then the built-in PDF viewer isn't used - you're<br>
>> given the option to open the PDF file in an external viewer instead<br>
>><br>
>> Looking at the Preference Setting for PDF, it is set to 'Always ask' -<br>
>> changing this to 'Preview in Firefox' just brings up a Save dialog when<br>
>> clicking on a link to a PDF file<br>
>><br>
>> (The custom protocol handler works fine)<br>
>><br>
>> However, if I create a new profile with an autoconfig that doesn't have<br>
>> a custom handler defined, start Firefox with that new profile, then quit<br>
>> Firefox. Then restart Firefox (using the same profile), but this time<br>
>> using an autoconfig that has the custom handler defined, then the<br>
>> built-in PDF viewer works as expected ... as does the custom protocol<br>
>> handler<br>
>>git push<br>
<br>
>> i.e. defining a custom protocol handler on the first run of Firefox<br>
>> appears to interfere with/break the built-it PDF viewer<br>
>><br>
>> This is with Firefox ESR 68.1 on Linux<br>
>><br>
>> Any idea what I can do to prevent this happening ?<br>
>><br>
>> Thanks<br>
>><br>
>> James Pearson<br>
>> _______________________________________________<br>
>> Enterprise mailing list<br>
>> <a href="mailto:Enterprise@mozilla.org" target="_blank">Enterprise@mozilla.org</a><mailto:<a href="mailto:Enterprise@mozilla.org" target="_blank">Enterprise@mozilla.org</a>><br>
>> <a href="https://mail.mozilla.org/listinfo/enterprise" rel="noreferrer" target="_blank">https://mail.mozilla.org/listinfo/enterprise</a><br>
>><br>
>> To unsubscribe from this list, please visit<br>
>> <a href="https://mail.mozilla.org/listinfo/enterprise" rel="noreferrer" target="_blank">https://mail.mozilla.org/listinfo/enterprise</a> or send an email to<br>
>> <a href="mailto:enterprise-request@mozilla.org" target="_blank">enterprise-request@mozilla.org</a><mailto:<a href="mailto:enterprise-request@mozilla.org" target="_blank">enterprise-request@mozilla.org</a>><br>
>> with a subject of "unsubscribe"<br>
>><br>
><br>
> _______________________________________________<br>
> Enterprise mailing list<br>
> <a href="mailto:Enterprise@mozilla.org" target="_blank">Enterprise@mozilla.org</a><br>
> <a href="https://mail.mozilla.org/listinfo/enterprise" rel="noreferrer" target="_blank">https://mail.mozilla.org/listinfo/enterprise</a><br>
><br>
> To unsubscribe from this list, please visit<br>
> <a href="https://mail.mozilla.org/listinfo/enterprise" rel="noreferrer" target="_blank">https://mail.mozilla.org/listinfo/enterprise</a> or send an email to<br>
> <a href="mailto:enterprise-request@mozilla.org" target="_blank">enterprise-request@mozilla.org</a> with a subject of "unsubscribe"<br>
<br>
_______________________________________________<br>
Enterprise mailing list<br>
<a href="mailto:Enterprise@mozilla.org" target="_blank">Enterprise@mozilla.org</a><br>
<a href="https://mail.mozilla.org/listinfo/enterprise" rel="noreferrer" target="_blank">https://mail.mozilla.org/listinfo/enterprise</a><br>
<br>
To unsubscribe from this list, please visit <a href="https://mail.mozilla.org/listinfo/enterprise" rel="noreferrer" target="_blank">https://mail.mozilla.org/listinfo/enterprise</a> or send an email to <a href="mailto:enterprise-request@mozilla.org" target="_blank">enterprise-request@mozilla.org</a> with a subject of "unsubscribe"<br>
</blockquote></div>
</blockquote></div>