Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
webext-schema
Advanced tools
WebExtentions schemas and MailExtensions schemas fetched from hg.mozilla.org. Stubbed browser API is also available.
npm i webext-schema
import { Schema } from 'webext-schema';
const schema = new Schema();
sinon.createSandbox()
, see Sinon.JS for details.Both arguments are optional.
const schema = new Schema("central", {
useFakeTimers: true,
useFakeServer: true,
});
"central", "beta", "release", "esr" for WebExtensions, and "mail" for MailExtensions are available. Channel defaults to "beta".
const schema = new Schema("central");
Also, you can set it afterwards.
const schema = new Schema();
schema.channel = "central";
Get the schema for the specific API. Argument can be either an API name or a file name.
const schema = new Schema().get("browserAction");
// [{namespace: "browserAction", events: [...], ...}]
const schema = new Schema().get("browser_action.json");
// [{namespace: "browserAction", events: [...], ...}]
Get all schemas as a single object. Note that the key of the object is the file name and the value is the schema.
const schema = new Schema().getAll();
// {"alarms.json": [{...}], "bookmarks.json": [{...}], ...}
Get the list of schema files.
const list = new Schema().list();
// ["alarms.json", "bookmarks.json", ...]
Creates stubbed browser API.
sinon.sandbox.stub()
.browser._sandbox
.
As an example of usage, call browser._sandbox.reset()
before and/or after each test to initialize all the stubbed functions.See Sinon.JS for details of sinon.sandbox.
const browser = new Schema().mock();
// example of mocking runtime.connect()
const mockConnect = browser.runtime.connect.callsFake(({ name }) => {
const port = Object.assign({}, browser.runtime.Port);
port.name = name;
return port;
});
const port1 = mockConnect({ name: "foo" });
const port2 = mockConnect({ name: "bar" });
assert.strictEqual(port1.name, "foo");
assert.isFunction(port1.onDisconnect.addListener);
assert.strictEqual(port2.name, "bar");
assert.isFunction(port2.onDisconnect.addListener);
// reset
browser._sandbox.reset();
FAQs
WebExtensions schemas fetched from hg.mozilla.org
The npm package webext-schema receives a total of 11 weekly downloads. As such, webext-schema popularity was classified as not popular.
We found that webext-schema demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.