Thanks - we've actually moved away from using custom protocols, so in that 
respect, my original issue has now 'gone away'

I'll check out the Handlers policy anyway - just to see if it would have worked 
for us :-)

Thanks

James Pearson
________________________________________
From: Mike Kaply <[email protected]>
Sent: 14 October 2020 16:25
To: James Pearson
Cc: [email protected]
Subject: Re: [Mozilla Enterprise] Problem with custom protocol handler in 
autoconfig file and ESR 68

Hope things are well.

I had this in a folder to look at later, but I wanted to make sure you knew 
that I added Handlers support to policy, so you shouldn't need this anymore:

https://github.com/mozilla/policy-templates/blob/master/README.md

Mike

On Tue, Oct 22, 2019 at 7:28 AM James Pearson 
<[email protected]<mailto:[email protected]>> wrote:
Thanks - that workaround appears to work fine for me as well

James Pearson

Mike Kaply wrote:
>
> 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]<mailto:[email protected]><mailto:[email protected]<mailto:[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]<mailto:[email protected]><mailto:[email protected]<mailto:[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]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>]
>  on behalf of James Pearson 
> [[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>]
> Sent: 16 October 2019 14:41
> To: Mike Kaply
> Cc: 
> [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[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]><mailto:[email protected]<mailto:[email protected]>><mailto:[email protected]<mailto:[email protected]><mailto:[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<https://avanan.url-protection.com/v1/url?o=http%3A//mozilla.org/uriloader/external-protocol-service%3B1&g=Zjk4ODg3MjMyNDExMjcyNw==&h=NmU3M2RlZjZhNzMwYzhkMTI2OGI5MDA3YTk3OGE0MGUzOTZhZTAzYzRhYmViNzhiNjk0NjYwMjhmYjI3Zjg5Yg==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx><http://mozilla.org/uriloader/external-protocol-service;1<https://avanan.url-protection.com/v1/url?o=http%3A//mozilla.org/uriloader/external-protocol-service%3B1&g=OWZjMzdhZjE4ZmU0MTM3ZQ==&h=ZTQ5OTZiNjZiOGYyMjE5NzA3YzA3NTZmMTI4MjU1NjUwNjRiMzlmNDRhOWY4Mjk4ZWVlOTMwNjk3MmM1YTRhNw==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx>><http://mozilla.org/uriloader/external-protocol-service;1<https://avanan.url-protection.com/v1/url?o=http%3A//mozilla.org/uriloader/external-protocol-service%3B1&g=OTQ3ZGNmNDNhMjU4ODQyYQ==&h=YWFhY2Q0MTNmZTNmZjE3NTF
 
iNzk5NjkzZmM1NmE5YTE2Y2VhY2M1MzVhN2NlZmI5NTY5NGViOTY3NjQwNTZjMQ==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx>>"].getService(Ci.nsIExternalProtocolService);
>>>
>>> var handlerSvc =
>>> Cc["@mozilla.org/uriloader/handler-service;1<https://avanan.url-protection.com/v1/url?o=http%3A//mozilla.org/uriloader/handler-service%3B1&g=NmFkMDExOTU1YjUxMGVlNg==&h=MGMwYWI4ZTk0NDkwZDljNjFiZWRlNWIyNTYzZjE2Y2EwYzk5YWZmZjg4NTNjYjM2ZDZlOTA3MDg0NzIxZWNmMg==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx><http://mozilla.org/uriloader/handler-service;1<https://avanan.url-protection.com/v1/url?o=http%3A//mozilla.org/uriloader/handler-service%3B1&g=NzI5YzU5MWIzNzYzMThiYw==&h=N2U0YTNjZDk3MGJkNjcwMzllODc0NjI3ZmNjOGZhMDQyNWQ0NGViNTJmYzE3NTczNjU0OTIyYmFjYWUzZjI5Yg==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx>><http://mozilla.org/uriloader/handler-service;1<https://avanan.url-protection.com/v1/url?o=http%3A//mozilla.org/uriloader/handler-service%3B1&g=MzUzZjdiMGRiODE3YzMwYw==&h=ZGY1MDQ0NDEyYTMzYmY3MjM2MWE2NWEyMDA3OTE0Y2UyMDJmODE1NGQzMDJiOTlmNWI4YmNlOWNhNzhlYzc
 
5NQ==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx>>"].getService(Ci.nsIHandlerService);
>>>
>>>
>>> var handlerInfo = extProtocolSvc.getProtocolHandlerInfo("yourprotocol");
>>>
>>> var file =
>>> Cc["@mozilla.org/file/local;1<https://avanan.url-protection.com/v1/url?o=http%3A//mozilla.org/file/local%3B1&g=YTkzNjQ5MWRlM2UzOWYzMA==&h=ZjJlMTNkMTk1YjBiM2NlZDM2M2FjOWUwMzVmMTVmZjExNTJjODJmODk3M2QxZTViYjA1MDQ0Mzg2NjVhNDZkMQ==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx><http://mozilla.org/file/local;1<https://avanan.url-protection.com/v1/url?o=http%3A//mozilla.org/file/local%3B1&g=NTM3ZjRmMzRiNTI5MWZiYQ==&h=MTg3MzZhOWRmMzcyY2Y3ZmUxMmUxYzlkNjU1ZjM0Njk1ZTYwODY5N2ZiYjAyNWM3ZGFiYWYyZjBmYzA0ZDBlYg==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx>><http://mozilla.org/file/local;1<https://avanan.url-protection.com/v1/url?o=http%3A//mozilla.org/file/local%3B1&g=NmViM2NhM2ZiYTJlNDFhMQ==&h=MmJkOTJlOTJhNTQ4NWQ3MzFiYjU5MWE2NGQ0NWQ4NTJiODJkMjJjYWNiOTFjY2Q5YjljN2I2ZmZkNTk4MjYxNQ==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZD
 M2ZDQxODUxYmQ2Yzg5OTYzOnYx>>"].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<https://avanan.url-protection.com/v1/url?o=http%3A//mozilla.org/uriloader/local-handler-app%3B1&g=OThkN2EyZjkyOTM3ZTM5OA==&h=NTI0YWQzMGU4YjU1ZDlkNzVhZjA2ZWRhZDE5YmY1ODEyODViNTBiNGNlM2JkYWJlYzMyYTZlNWY3MTVkMzgwOQ==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx><http://mozilla.org/uriloader/local-handler-app;1<https://avanan.url-protection.com/v1/url?o=http%3A//mozilla.org/uriloader/local-handler-app%3B1&g=ZGFmZmM2NmY0Yzk3MzJjNA==&h=YmQ4NGE0ODg2YjYwZjJmM2Y5ZWNiMjlmM2Y4MTRmOTI4Y2I2YTBlYTMzM2U3Yzg4Yjk3ZGU3OTI5OGI5N2IyNg==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx>><http://mozilla.org/uriloader/local-handler-app;1<https://avanan.url-protection.com/v1/url?o=http%3A//mozilla.org/uriloader/local-handler-app%3B1&g=NTBjMzhlMWFmZTMwZTY5NA==&h=NjEwYmJkYTFjYmZkMzE0N2NhNDU5NjkwMTZiZDA4OTg2NTliMThlZTBlMDEyNDhmMWJlZmV
 
jN2QyYWJjMmEyMA==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx>>"].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]><mailto:[email protected]<mailto:[email protected]>><mailto:[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>
>>> https://mail.mozilla.org/listinfo/enterprise<https://avanan.url-protection.com/v1/url?o=https%3A//mail.mozilla.org/listinfo/enterprise&g=OTE0ZTQ0MWJkODQyM2QzOA==&h=ODRiMzgzZTViYjBlMjZhODBhYzBhZDZiM2U5MWM4MzRkOThiNWE1OGRmZjQyMDgzYjViYzcxYjI0MzUyNjMzZA==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx>
>>>
>>> To unsubscribe from this list, please visit
>>> https://mail.mozilla.org/listinfo/enterprise<https://avanan.url-protection.com/v1/url?o=https%3A//mail.mozilla.org/listinfo/enterprise&g=NTNiZTk2MGVkNjcwMTdmMA==&h=NTcyZWUzNDg4N2Q5ZDA4YWVlYTY3YjdiMTlmZTdiNjY2MDgzZTA0NjI4ZDA2ZjMxNDkwYTFkOTZjOTAwZWZkOA==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx>
>>>  or send an email to
>>> [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>><mailto:[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>
>>> with a subject of "unsubscribe"
>>>
>>
>> _______________________________________________
>> Enterprise mailing list
>> [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>
>> https://mail.mozilla.org/listinfo/enterprise<https://avanan.url-protection.com/v1/url?o=https%3A//mail.mozilla.org/listinfo/enterprise&g=MGJkNGE1MWQwMmQwZTMzZA==&h=MjAwNTg0N2YzMjRmYmUwYWUzMTJkZDYzYzI3YjEwMWVkYzExYmQxODhhY2RlZWI3ODg2OWViNjU3MWE1MzE4ZA==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx>
>>
>> To unsubscribe from this list, please visit
>> https://mail.mozilla.org/listinfo/enterprise<https://avanan.url-protection.com/v1/url?o=https%3A//mail.mozilla.org/listinfo/enterprise&g=NDhkNzQxOGIyYzljYmVjMg==&h=MTBmNTFmZjFjZmQ2OWQ2MWY3ZGVkZGY5NTU4NWE2ZWEzNDlmYzRlNDFlZmE4OWQyN2M0ZWQ3MmU2MWM3OTYwOQ==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx>
>>  or send an email to
>> [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>
>>  with a subject of "unsubscribe"
>
> _______________________________________________
> Enterprise mailing list
> [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>
> https://mail.mozilla.org/listinfo/enterprise<https://avanan.url-protection.com/v1/url?o=https%3A//mail.mozilla.org/listinfo/enterprise&g=NjI0MjFkZDM1M2Q3NGQzOQ==&h=MGI5NmJiN2ZmODdhZTYyNzBkOTljODEyZjY4YzRiYWI1YTc2OWMzYWVlM2ZlYzdlZTM2OGRiM2Y2NTYwNWVmZA==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx>
>
> To unsubscribe from this list, please visit 
> https://mail.mozilla.org/listinfo/enterprise<https://avanan.url-protection.com/v1/url?o=https%3A//mail.mozilla.org/listinfo/enterprise&g=MWJmODk2ZjFlMzVhMjExMw==&h=NWZkNmZlZGI2NjY2YWUzNzYyOTJiZjcxOGZkMjk0ZmMyMjNkMzc5YzY3ZDRlMGQxMWU5NDdlNThmOGJiMWYyOQ==&p=YXAzOnRlY2huaWNvbG9yOmF2YW5hbjpvZmZpY2UzNjVfZW1haWxzX2VtYWlsOjI0MTFjYTRjZjA5MTQyZDM2ZDQxODUxYmQ2Yzg5OTYzOnYx>
>  or send an email to 
> [email protected]<mailto:[email protected]><mailto:[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"

Reply via email to