Skip to content

Instantly share code, notes, and snippets.

@leibovic
Created June 11, 2015 23:06
Show Gist options
  • Save leibovic/4f30e00461304886d41b to your computer and use it in GitHub Desktop.
Save leibovic/4f30e00461304886d41b to your computer and use it in GitHub Desktop.
Replaces the signed ABP extension file in the profile directory with a slightly modified version
let fileName = "{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}.xpi";
// Copy new add-on file from sdcard to profile extensions directory
let newFile = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile);
newFile.initWithPath("/sdcard/" + fileName);
let extDir = FileUtils.getFile("ProfD", ["extensions"]);
newFile.copyTo(extDir, fileName);
console.log("moved file from sdcard to extensions directory");
let observer = (subject, topic, data) => {
Services.obs.removeObserver(observer, "xpi-signature-changed");
console.log("signatures changed");
}
Services.obs.addObserver(observer, "xpi-signature-changed", false);
console.log("verifying signatures");
let XPIscope = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm");
XPIscope.XPIProvider.verifySignatures();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment