Skip to content

Instantly share code, notes, and snippets.

@myrdd
Created September 13, 2015 18:06
Show Gist options
  • Save myrdd/0378963d425c220035e3 to your computer and use it in GitHub Desktop.
Save myrdd/0378963d425c220035e3 to your computer and use it in GitHub Desktop.
/**
* This function will be called before an add-on wraps
* a `gBrowser` function. A reference to the original
* function will be saved in `gBrowser.originalFunctions`.
*/
function beforeWrap(gBrowser, fnName) {
// Ensure that `gBrowser.originalFunctions` exists.
if (!gBrowser.hasOwnProperty("originalFunctions")) {
gBrowser.originalFunctions = {};
}
// Remember the original function, but do not overwrite an
// already existing reference.
if (!gBrowser.originalFunctions.hasOwnProperty(fnName)) {
gBrowser.originalFunctions[fnName] = gBrowser[fnName];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment