Fixes#249.
This updates `browser.devtools.network.onRequestFinished` to emit an
object with a promisified `getContent()` property. This brings the
polyfill implementation in line with Firefox's implementation, although
MDN documentation is still inaccurate at the moment.
Also updates some out of date documentation with `makeCallback()` and
`wrapAsyncFunction()`.
Currently the build/test fails with the following output:
```
Test webextension-polyfill bundled with webpack
===============================================
[webpack-cli] Unknown argument: --output
[webpack-cli] Unknown argument: /tmp/webpack-bundle.js
? Which flags do you want to use? …
✔ --entry: The entry point(s) of your application e.g. ./src/main.js
✔ --config: Provide path to a webpack configuration file e.g. ./webpack.config.js
✔ --color: Enable/Disable colors on console
✔ --merge: Merge two or more configurations using webpack-merge e.g. -c ./webpack.config.js -c ./webpack.test.config.js --merge
✔ --progress: Print compilation progress during build
✔ --help: Outputs list of supported flags
✔ --output-path: Output location of the file generated by webpack e.g. ./dist/
```
Regressed by:
https://github.com/webpack/webpack-cli/pull/18552f36b9d858
`--output` has been renamed to `--output-path` (`-o` in both cases), but
stopped supporting file names. To output to a specific absolute path,
`--output-path` and `--output-filename` must both be specified, with the
directory in the former and the filename in the latter.
CI is currently failing because package.json refers chromedriver
^80.0.1, which also matches 80.0.2.
In 80.0.2, chromedriver updated the `extract-zip` dependency:
16151de4c7
extract-zip 2.0.0 has dropped support for Node <10, e.g. by using APIs
that were introduced in Node 10:
https://github.com/maxogden/extract-zip/blob/v2.0.0/index.js#L11
which triggers the following error when run on earlier versions of Node:
```
> chromedriver@80.0.2 install /home/travis/build/mozilla/webextension-polyfill/node_modules/chromedriver
> node install.js
internal/util.js:214
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'original', 'function');
^
TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type function
at promisify (internal/util.js:214:11)
at Object.<anonymous> (/home/travis/build/mozilla/webextension-polyfill/node_modules/extract-zip/index.js:11:18)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/travis/build/mozilla/webextension-polyfill/node_modules/chromedriver/install.js:14:20)
```
This commit fixes the issue by running tests with Node 10.
Node 8 had become end-of-life on 2019-12-31 anyway.
* fix: Update babel deps to babel 7
* chore: Replaced @babel/transfor-umd-modules with a small custom babel transformer script
* test: Added minimal integration test as smoke test for importing polyfill as es6 module
* fix: browser.devtools.inspectedWindow.eval promise should always resolve to an array
* test(integration): Add test for browser.devtools.inspectedWindow.eval API