Mac Os X Chrome Reset Protocol Handlers For Profiles
I've been reading a lot online about custom URL handlers / custom protocol handlers such as: Launching External Applications using Custom Protocols under OSX OS X URL handler to open links to local. How do I configure custom URL handlers on OS X? Listing current LaunchServices URL handler settings on Apple OS X 10.10 (Yosemite). Find the desired product help. Select product ITarian Comodo Accounts Manager Comodo Anti-Theft For Android Comodo Antispam Gateway Comodo Antivirus For Linux Comodo Antivirus For.
12 years ago Code needs to be written to add our default web-based protocol handlers to the mimeTypes.rdf in existing profiles for protocols that we care about. This should be fairly straightforward, I think: I suspect something similar to the strategy used in the mochitests for nsIHandlerService should work pretty nicely. We also need to have reasonable defaults for new profiles, which we could easily do by just putting them in the default mimeTypes.rdf. Alternately, we could just use the dynamic insertion code described above unconditionally. 12 years ago Comment on patch, v1 >Index: browser/app/profile/firefox.js >+pref('gecko.handlerService.version', 'chrome://browser-region/locale/region.properties'); >+pref('gecko.handlerService.schemes.webcal.0.name', 'chrome://browser-region/locale/region.properties'); >+pref('gecko.handlerService.schemes.webcal.0.uriTemplate', 'chrome://browser-region/locale/region.properties'); Wow, funky.
>Index: browser/locales/en-US/chrome/browser-region/region.properties >+# the default set of web-based protocol handlers shown in the application >+# selection dialog >+gecko.handlerService.schemes.webcal.0.name=WebCal Test Handler >+gecko.handlerService.schemes.webcal.0.uriTemplate= I guess the other thing you could do is make these JSON objects, which would simplify the extraction code but might make the prefs a bit harder to read. Hmm, I guess I'd err on the side of making the extraction code harder to read and the properties easier, so this seems good as is. >+# at startup, if the handler service notices that the version number here >+# is newer than the version number in the handler service datastore, it will >+# add any handlers it finds in the prefs (as seeded by this file) to its >+# datastore >+gecko.handlerService.version=0 Note: we'll want to version the datastore schema when we switch to SQLite, and components like the handler service have version numbers in their contract IDs, so I think it would make sense to call this something more specific, like defaultHandlersVersion.
>Index: uriloader/exthandler/nsHandlerService.js > _init: function HS__init() { > // Observe profile-before-change so we can switch to the datasource > // in the new profile when the user changes profiles. > this._observerSvc.addObserver(this, 'profile-before-change', false); > > // Observe xpcom-shutdown so we can remove these observers > // when the application shuts down. > this._observerSvc.addObserver(this, 'xpcom-shutdown', false); >+ >+ this._upgradeDS(); For transparency, I think it'd make sense to do something like this here (but with shorter names, if we can think of some): if (this._datastoreDefaultHandlersVersion + _upgradeDS: function HS__upgradeDS() { >+ >+ // XXX should datastore include locale token? Good question! If I switch to a different locale, it'd make sense to get its new handlers, and comparing versions wouldn't make sense. Perhaps we could record locale and reset the version string when starting up with a new one? >+ // get handler service pref branch >+ var prefSvc = Cc['@mozilla.org/preferences-service;1'] >+.getService(Ci.nsIPrefService); >+ var handlerSvcBranch = prefSvc.getBranch('gecko.handlerService'); >+ >+ // get the version of the preferences for this locale >+ var handlerSvcPrefsVersion = >+ Number(handlerSvcBranch.getComplexValue('.version', >+ Ci.nsIPrefLocalizedString).data); Wow, you sure do have to jump through a lot of hoops to use the preference service!
Are version strings really complex values? They look like simple numbers to me.
Or maybe that's the result of the funky redirection to region.properties? >+ // YYY datastore version >+ var datastoreVersion = -1; Right, so, we could store the version as an assertion like 'urn:root' NC:defaultHandlersVersion -1. It doesn't really matter what URI we use as the 'source' of the assertion as long as we agree on the semantics of that URN. We could also use something like 'urn:datastore'. Vmware virtual workstation for mac. >+ // if the datastore version is older than the preferences version, >+ // we should inject any new handlers and bump the datastore version >+ if (datastoreVersion + let handlerApp = Cc['@mozilla.org/uriloader/web-handler-app;1'].