Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please consider supporting Firefox's WebExtensions #40

Closed
Standard8 opened this issue Sep 16, 2016 · 6 comments
Closed

Please consider supporting Firefox's WebExtensions #40

Standard8 opened this issue Sep 16, 2016 · 6 comments

Comments

@Standard8
Copy link
Contributor

Firefox is currently implementing web extensions - these are pretty much the same as the chrome.*, although there are a few differences.

Firefox has created the browser.* namespace which is virtually the same as the chrome.* space. There are two differences:

  • browser.* will gain Firefox specific extensions.
  • browser.* uses promises rather the callbacks.

More information:

@vitalets
Copy link
Collaborator

@Standard8 great point!

@kumar303
Copy link

One way that would allow this library to keep up with new APIs and API changes (which are probably a bit rare) is to parse schema files. Had you considered that?

Here is an example of the bookmarks API:

All of Firefox's extension schemas:

Parsing schema files would also make the behavior of the mocks very exact.

@acvetkov
Copy link
Owner

@Standard8 hi.

Why you can not use sinon-chrome for FF web-extensions testing?

global.browser = require('sinon-chrome');

before(function() {
  browser.tabs.query.yields([]);
  // or
  browser.tabs.query.returns(Promise.resolve([]));
});

@Standard8
Copy link
Contributor Author

@acvetkov Whilst that is possible, the browser namespace has different APIs to the chrome namespace, so simply duplicating the chrome one isn't likely to be correct - and could lead to code that runs tests fine still being wrong as the API isn't there.

@acvetkov
Copy link
Owner

acvetkov commented Oct 3, 2016

@Standard8 Ok. I'll implement schema files for chrome and FF webextensions

@acvetkov
Copy link
Owner

sinon-chrome has supported webextensions api since 2.1.0 version.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants