Skip to content

Instantly share code, notes, and snippets.

@codefisher
Created January 4, 2015 13:46
Show Gist options
  • Save codefisher/085232320f85c47a560e to your computer and use it in GitHub Desktop.
Save codefisher/085232320f85c47a560e to your computer and use it in GitHub Desktop.
function createResource(resourceName, uriPath) {
let resource = Services.io.getProtocolHandler("resource").QueryInterface(Ci.nsIResProtocolHandler);
var fileuri = Services.io.newURI(uriPath, null, null);
resource.setSubstitution(resourceName, fileuri);
}
// in startup()
createResource('toolbar-buttons', 'chrome://toolbar-buttons/content/resources/');
// in shutdown()
let resource = Services.io.getProtocolHandler("resource").QueryInterface(Ci.nsIResProtocolHandler);
resource.setSubstitution("toolbar-buttons", null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment