Skip to content

Instantly share code, notes, and snippets.

@myrdd
Created April 7, 2018 05:20
Show Gist options
  • Save myrdd/3013c38cb93338e09675cd3fa306a9c6 to your computer and use it in GitHub Desktop.
Save myrdd/3013c38cb93338e09675cd3fa306a9c6 to your computer and use it in GitHub Desktop.
extend sinon-chrome
// source: https://github.com/RequestPolicyContinued/requestpolicy/blob/1c9810d005a0bc12a7719484bf63f58616ff6cbf/tests/mocha/lib/sinon-chrome.js
const stableApiFx = require("sinon-chrome/config/stable-api-ff.json");
const Api = require("sinon-chrome/api");
for (let ns of stableApiFx) {
if (ns.namespace === "management") {
if (!("events" in ns)) ns.events = [];
ns.events.push({
"name": "onEnabled",
"type": "function",
"parameters": [
{
"name": "info",
"$ref": "management.ExtensionInfo",
"description": "info about the add-on that was enabled.",
},
],
});
ns.events.push({
"name": "onDisabled",
"type": "function",
"parameters": [
{
"name": "info",
"$ref": "management.ExtensionInfo",
"description": "info about the add-on that was disabled.",
},
],
});
}
}
module.exports = {
createBrowserApi() {
return new Api(stableApiFx).create();
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment