Commit Graph

45 Commits

Author SHA1 Message Date
Luca Greco 61d92ea79b feat: Added devtools.inspectedWindow.eval and devtools.panels.create to wrapped APIs.
To be able to wrap the devtools API namespaces, this patch applies the
following changes:

- fix: Prevent Proxy violation exception on the read-only/non-configurable devtools property
  by using an empty object with the `chrome` API object as its prototype
  as the root Proxy target (the Proxy instances returned for the
  `chrome` API object) and add a related test case.

- fix: Added support for a new `singleCallbackArg` metadata property,
  which prevents devtools.panels.create to resolve an array of
  parameters (See the related Chromium issue at
  https://bugs.chromium.org/p/chromium/issues/detail?id=768159)
  and add the related test cases.

- test: Changes to the test case related to proxy getter/setter behavior
  on non wrapped properties:

  in the "deletes proxy getter/setter that are not wrapped" test case from
  the "test-proxied-properties.js" test file, we ensure that when a
  getter/setter is called for a "non-wrapped" property, the getter/setter
  is going to affect the original target object, unfortunately this in
  not true anymore for the root object (the `chrome` API object) because
  we are using an empty object (which has the `chrome` API object as its
  prototype and it is not exposed outside of the polyfill sources)
  as the target of the Proxy instance related to it,
  this change to the target of the Proxy has been needed to prevent the
  TypeError exception raised by the Proxy instance when we try to access
  the "devtools" property (which is non-configurable and read-only on the
  `chrome` API object).
2017-09-25 22:20:07 +02:00
Luca Greco 6b3c6da659 chore: bump version for release 0.1.2 2017-09-25 20:42:56 +02:00
Federico Brigante ab01b9605b docs: Added build status badge to the README.md (#45) 2017-08-20 13:35:53 +02:00
Federico Brigante 9468773ffe fix: Limit eslint to the project's own rules (#46) 2017-08-20 13:33:56 +02:00
Rob Wu ab0b667ff3 fix: Lock gruntify-eslint version to fix build errors (#42)
* Lock version of gruntify-eslint (and grunt-replace)

The current repository is compatible with gruntify-eslint 3.1.0.
`*` resolves to version 4.0.0., which bumps its eslint dependency
from 3.x to 4.x, which in turn causes linting errors.

To get the default check-out to pass, lock the dependencies to
known-compatible versions.

* Bump gruntify-eslint to 4.0.0 + fix lint error

Bump gruntify-eslint to 4.0.0, which depends on eslint ^4.0.0,
and fix the lint error that appeared.
2017-08-20 13:26:43 +02:00
Luca Greco a1fd64cab1 chore: bump version for release 0.1.1 2017-04-13 15:02:56 +02:00
Luca Greco c5fd6fdf41 chore: Publish tagged releases to npm from travis job 2017-04-13 14:48:04 +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
Luca Greco 46b8f7e583 fix: use babel and transform-es2015-modules-umd to fix the webpack bundling issue 2017-04-13 14:30:52 +02:00
Luca Greco 96cfb9c5c2 test: re-run the test suite on the minified file on travis 2017-04-11 14:24:23 +02:00
Luca Greco 9a38d923e9 fix: use babili to minify ES6 sources. 2017-04-11 14:19:56 +02:00
Luca Greco 31d778c2cd fix: Changes to the UMD built file and npm package publishing
This patch introduces on top of #17 some minor changes from the
review comments, in particular:

- do not replace require("../filename") to include the api-metadata.json
  (restored the original '{/* include("...") */}' placeholder)
- raise an appropriate error message when the source file is used
  by mistake (or the "dist/" file has not been built correctly).
- set the generated UMD wrapped module as the package.json main
  entrypoint
- do not include api-metadata.json and src dir from the files included
  in the published npm package
- run both build and test npm scripts on prepublish
2017-04-11 14:16:15 +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
Joseph Frazier 52791c8633 fix: normalized package.json properties
When running `npm install` to add new `devDependencies`, `npm` reformats
package.json with these changes, as can be seen [here]. Making these
changes separately allows developers to more easily keep them out of
unrelated commits.

[here]: https://github.com/mozilla/webextension-polyfill/pull/11/files#diff-b9cfc7f2cdf78a7f4b91a753d10865a2L22
2017-04-11 13:32:02 +02:00
Luca Greco 77af627d05 Merge pull request #6 from rpl/fix/reduce-ircbot-verbosity
fix: reduced travis irc message verbosity.
2016-11-14 22:41:48 +01:00
Luca Greco 27b71c2e2a fix: reduced travis irc message verbosity. 2016-11-14 22:34:17 +01:00
Luca Greco df71efea17 test: introduced a test suite for unit testing.
Merge pull request #2 from rpl/proposal/unit-testing
2016-11-14 19:20:38 +01:00
Luca Greco d1b0ff929a fix: rename polyfill source into src/browser-polyfill.js 2016-11-07 16:56:48 +01:00
Luca Greco e19cf82332 fix: indentation missed by eslint 2016-11-07 16:34:34 +01:00
Luca Greco 573c438c23 fix: change notified irc channel 2016-11-07 16:34:34 +01:00
Luca Greco 9a04fc3876 fix: pluralize argument in raised error message 2016-11-07 16:34:34 +01:00
Luca Greco 705e93bc2f test: added test case to check that different listeners are wrapped by different wrappers 2016-11-07 16:34:34 +01: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 de50f2047d test: update eslint to version 3.9.1 and add enforced indentation on call expression params 2016-11-07 16:34:34 +01:00
Luca Greco 0517edaa67 fix: refactor runtime.onMessage tests. 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 2853e98546 fix: the test jsdom window doesn't need to be in the shared global. 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 92ccea2e15 test: tweaks on test helpers (support for 'existent browser global' test). 2016-11-07 16:34:34 +01:00
Luca Greco a585b4b07a test: added test case for async function rejection, and arguments length validation. 2016-11-07 16:34:34 +01:00
Luca Greco 7a247f56f2 test: tweak the proxied properties tests. 2016-11-07 16:34:34 +01:00
Luca Greco a1469d6f17 fix: added inline comments to special runtime.onMessage wrapper tests. 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 b0a111cdc7 fix: init fake runtime.lastError to null. 2016-11-07 16:34:34 +01:00
Luca Greco 88e3728c46 fix: removed unused import in test file. 2016-11-07 16:34:34 +01:00
Luca Greco aaca860c2d fix: cleanup tests setup function. 2016-11-07 16:34:34 +01:00
Luca Greco f2c82fcbea fix: relax max-nested-callback eslint rules for tests. 2016-11-07 16:34:34 +01:00
Luca Greco 9cb05a1190 fix: fixed typo in Gruntfile.js. 2016-11-07 16:34:25 +01:00
Luca Greco c08b8af982 test: introduced a test suite for unit testing. 2016-11-07 16:33:42 +01:00
Kris Maglione c882612855 Update README and rename files to make it clearer that a build step is required. 2016-11-06 14:45:10 -08:00
Kris Maglione 2dd404db0f Add async function version of message listener example. 2016-10-10 14:03:27 -07:00
kmaglione 0007c27bb9 Merge pull request #1 from kmaglione/master
Initial checkin.
2016-10-10 20:24:13 +01:00
Kris Maglione c74d1af46d Initial checkin. 2016-10-10 11:36:21 -07:00
kmaglione 28d5a45905 Initial commit 2016-10-06 12:02:51 -07:00