diff options
author | B. Stack <bgstack15@gmail.com> | 2022-04-16 16:51:25 +0000 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-04-16 16:51:25 +0000 |
commit | 4aa31a2f1a060439447f8de3b1674b6e0524c7e2 (patch) | |
tree | c6028dac4de4e3be8bfb49223ac931303e6c57d2 /librewolf/debian/extra-stuff | |
parent | Merge branch 'veracrypt-bump' into 'master' (diff) | |
parent | lw 98.0 stackrpms rc1 (diff) | |
download | stackrpms-4aa31a2f1a060439447f8de3b1674b6e0524c7e2.tar.gz stackrpms-4aa31a2f1a060439447f8de3b1674b6e0524c7e2.tar.bz2 stackrpms-4aa31a2f1a060439447f8de3b1674b6e0524c7e2.zip |
Merge branch 'librewolf-bump' into 'master'
librewolf 98
See merge request bgstack15/stackrpms!293
Diffstat (limited to 'librewolf/debian/extra-stuff')
-rw-r--r-- | librewolf/debian/extra-stuff/Makefile.in | 0 | ||||
-rw-r--r-- | librewolf/debian/extra-stuff/addonsInfo.conf | 11 | ||||
-rw-r--r-- | librewolf/debian/extra-stuff/addonsInfo.jsm | 94 | ||||
-rw-r--r-- | librewolf/debian/extra-stuff/moz.build | 7 |
4 files changed, 112 insertions, 0 deletions
diff --git a/librewolf/debian/extra-stuff/Makefile.in b/librewolf/debian/extra-stuff/Makefile.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/librewolf/debian/extra-stuff/Makefile.in diff --git a/librewolf/debian/extra-stuff/addonsInfo.conf b/librewolf/debian/extra-stuff/addonsInfo.conf new file mode 100644 index 0000000..b55f9f4 --- /dev/null +++ b/librewolf/debian/extra-stuff/addonsInfo.conf @@ -0,0 +1,11 @@ +Classes = [ + { + 'cid': '17a1f091-70f7-411c-a9d7-191689552d01', + 'contract_ids': [ + '@mozilla.org/toolkit/addonsInfo-clh;1', + ], + 'jsm': 'resource://gre/modules/addonsInfo.jsm', + 'constructor': 'addonsInfoHandler', + 'categories': {'command-line-handler': 'a-addons-info'}, + }, +] diff --git a/librewolf/debian/extra-stuff/addonsInfo.jsm b/librewolf/debian/extra-stuff/addonsInfo.jsm new file mode 100644 index 0000000..b26a5ba --- /dev/null +++ b/librewolf/debian/extra-stuff/addonsInfo.jsm @@ -0,0 +1,94 @@ +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); +const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); +const {AddonManager} = ChromeUtils.import("resource://gre/modules/AddonManager.jsm"); + +function compare(a, b) { + return a.name.localeCompare(b.name); +} + +function dump_addons(path) { + AddonManager.getAllAddons().then(function(addons) { + var resProtoHandler; + var file = Cc["@mozilla.org/file/local;1"] + .createInstance(Ci.nsIFile); + file.initWithPath(path); + var outstream = Cc["@mozilla.org/network/file-output-stream;1"] + .createInstance(Ci.nsIFileOutputStream); + outstream.init(file, 0x2A /* TRUNCATE | WRONLY | CREATE */, 0o666, 0); + var out = Cc["@mozilla.org/intl/converter-output-stream;1"] + .createInstance(Ci.nsIConverterOutputStream); + out.init(outstream, "UTF-8", 0, 0); + + addons.sort(compare); + out.writeString("-- Extensions information\n"); + addons.forEach(function(extension) { + if (extension.type == "plugin") + return; + out.writeString("Name: " + extension.name); + if (extension.type != "extension") + out.writeString(" " + extension.type); + out.writeString("\n"); + if (extension.getResourceURI) { + var location = extension.getResourceURI(""); + if (location.scheme == "resource") { + if (!resProtoHandler) { + resProtoHandler = Services.io.getProtocolHandler("resource") + .QueryInterface(Ci.nsIResProtocolHandler); + } + location = Services.io.newURI(resProtoHandler.resolveURI(location)); + } + if (location instanceof Ci.nsIJARURI) { + location = location.JARFile; + } + location = location.QueryInterface(Ci.nsIFileURL).file; + if (!extension.isBuiltin && extension.scope == AddonManager.SCOPE_PROFILE) + out.writeString("Location: ${PROFILE_EXTENSIONS}/" + + location.leafName + "\n"); + else + out.writeString("Location: " + location.path + "\n"); + } + out.writeString("Status: " + (extension.appDisabled ? "app-disabled" : + (extension.softDisabled ? "soft-disabled" : + (extension.userDisabled ? "user-disabled" : + "enabled"))) + "\n"); + out.writeString("\n"); + }); + + var phs = Cc["@mozilla.org/plugin/host;1"] + .getService(Ci.nsIPluginHost); + var plugins = phs.getPluginTags({ }); + plugins.sort(compare); + out.writeString("-- Plugins information\n"); + plugins.forEach(function(plugin) { + out.writeString("Name: " + plugin.name + + (plugin.version ? " (" + plugin.version + ")" : "") + "\n"); + out.writeString("Location: " + + (plugin.fullpath ? plugin.fullpath : plugin.filename) + "\n"); + out.writeString("Status: " + (plugin.disabled ? "disabled" : "enabled") + + (plugin.blocklisted ? " blocklisted" : "") + "\n"); + out.writeString("\n"); + }); + out.close(); + // Avoid running -dumps-addons-info without a running Firefox counting as + // a crash. + Services.startup.trackStartupCrashEnd(); + }); +} + +function addonsInfoHandler() {} +addonsInfoHandler.prototype = { + handle: function clh_handle(cmdLine) { + var path = cmdLine.handleFlagWithParam("dump-addons-info", false); + if (!path) + return; + + cmdLine.preventDefault = true; + + dump_addons(path); + }, + + classDescription: "addonsInfoHandler", + QueryInterface: ChromeUtils.generateQI([Ci.nsICommandLineHandler]), +}; + +var EXPORTED_SYMBOLS = ["addonsInfoHandler"]; diff --git a/librewolf/debian/extra-stuff/moz.build b/librewolf/debian/extra-stuff/moz.build new file mode 100644 index 0000000..4a1c325 --- /dev/null +++ b/librewolf/debian/extra-stuff/moz.build @@ -0,0 +1,7 @@ +XPCOM_MANIFESTS += [ + 'addonsInfo.conf', +] + +EXTRA_JS_MODULES += [ + 'addonsInfo.jsm', +] |