mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
826b0f1e77
Some code to exercise this in the browser console: ``` { const printNames = async (appList) => { let buffer = "Start:\n"; for (let index = 0; index < appList4.length; index++) { let app = appList4.queryElementAt(index, Ci.nsILocalHandlerApp); buffer += app.executable.leafName; buffer += "\n"; } buffer += "\n"; for (let index = 0; index < appList4.length; index++) { let app = appList4.queryElementAt(index, Ci.nsILocalHandlerApp); let prettyName = await app.prettyNameAsync(); buffer += prettyName; buffer += "\n"; } buffer += "\n"; for (let index = 0; index < appList4.length; index++) { let app = appList4.queryElementAt(index, Ci.nsILocalHandlerApp); buffer += app.executable.displayName; buffer += "\n"; } buffer += "\n"; for (let index = 0; index < appList4.length; index++) { let app = appList4.queryElementAt(index, Ci.nsILocalHandlerApp); if (AppConstants.platform == "win") { let file = app.executable; if (file instanceof Ci.nsILocalFileWin) { try { buffer += file.getVersionInfoField("FileDescription"); } catch (e) { } } } buffer += "\n"; } buffer += "\nEnd\n"; console.log(buffer); }; const lazy4 = {}; XPCOMUtils.defineLazyServiceGetters(lazy4, { gMIMEService: ["@mozilla.org/mime;1", "nsIMIMEService"], }); let mimeInfo4 = lazy4.gMIMEService.getFromTypeAndExtension("text/html", "html"); if (mimeInfo4.hasDefaultHandler) { console.log(`HasDefaultHandler = true`); console.log(`Description = ${mimeInfo4.defaultDescription}`); } else { console.log(`HasDefaultHandler = false`); } let appList4 = mimeInfo4.possibleLocalHandlers || []; console.log("appList4 = "); console.log(JSON.stringify(appList4)); printNames(appList4); } ``` That produces output that can be seen in a pretty form here: https://docs.google.com/spreadsheets/d/1OvtrZgMlPMJO4Wgu6wwAYvm89orj9HdS_tsDxYn7yrA/edit#gid=0 This does not fix-up things so that all calls to getName() on the LocalHandlerApp are switched to prettyNameAsync. That work is tracked here: https://bugzilla.mozilla.org/show_bug.cgi?id=1884267 Differential Revision: https://phabricator.services.mozilla.com/D203876 |
||
---|---|---|
.. | ||
base | ||
docs | ||
exthandler | ||
prefetch | ||
preload | ||
moz.build |