Commit Graph

9 Commits

Author SHA1 Message Date
Rob Wu ad207a84b9
fix: Throw error when loaded in non-extension contexts (#190)
Fixes #186
2019-07-18 15:21:49 +02:00
Luca Greco a34f9c71f8 test: run tests for the webpack and browserify bundled files on travis 2017-04-13 14:30:52 +02:00
Joseph Frazier f9248e62e7 feat: library wrapped as an UMD module
This addresses [issue 7] by making it possible for users to run:

```sh
npm install webextension-polyfill
```

and download a module that they can use with a bundler as follows:

```js
import browser from 'webextension-polyfill';
```

Also, add a [prepublish script] so that users who clone the repo don't
need to run `grunt` manually. In addition, specify [files] in
package.json so that this module can be published to npm without
including miscellanea. This can be verified by running:

```sh
npm pack && tar -tvf webextension-polyfill-0.1.0.tgz
```

[issue 7]: https://github.com/mozilla/webextension-polyfill/issues/7
[files]: https://docs.npmjs.com/files/package.json#files
[prepublish script]: https://docs.npmjs.com/misc/scripts
2017-04-11 13:32:31 +02:00
Luca Greco b28d3d9d74 fix: fixed typos and nits in tests. 2016-11-07 16:34:34 +01:00
Luca Greco 6486e551be fix: bulk fix call expression params indentation using eslint 2016-11-07 16:34:34 +01:00
Luca Greco 3842bd1693 style: destructure the assert methods to globals 2016-11-07 16:34:34 +01:00
Luca Greco 6cca044a5c test: add more test cases to reach a full code coverage.
- if the a browser global already exists, it should not be overridden
- use Object.defineProperty on the wrapped browser global
  (and test "has" for cached properties)
- delete a property defined with Object.defineProperty
- methods that are not wrapped are proxied correctly
- the special onMessage wrapper should not wrap a listener that is not
  a function
- test that a returned rejected Promise on the onMessage listener
  is turned in the parameter of the sendResponse callback
2016-11-07 16:34:34 +01:00
Luca Greco f28858961f fix: cleanup async function tests and other minor tweaks on tests. 2016-11-07 16:34:34 +01:00
Luca Greco c08b8af982 test: introduced a test suite for unit testing. 2016-11-07 16:33:42 +01:00