Created
April 7, 2018 05:20
-
-
Save myrdd/3013c38cb93338e09675cd3fa306a9c6 to your computer and use it in GitHub Desktop.
extend sinon-chrome
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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