Commit Graph

875 Commits

Author SHA1 Message Date
Nick Fitzgerald
f2f2d7231a
Create the web-sys crate mechanically from WebIDL (#409)
* Create a new `web-sys` crate

This will eventually contain all the WebIDL-generated bindings to Web APIs.

* ci: Test the new `web-sys` crate in CI

* web-sys: Add a small README

* web-sys: Vendor all the WebIDL files from mozilla-central

* backend: Add a pass to remove AST items that use undefined imports

This is necessary for the WebIDL frontend, which can't translate many WebIDL
constructs into equivalent wasm-bindgen AST things yet. It lets us make
incremental progress: we can generate bindings to methods we can support right
now even though there might be methods on the same interface that we can't
support yet.

* webidl: Add a bunch of missing semicolons

* webidl: Make parsing private

It was only `pub` so that we could test it, but we ended up moving towards
integration tests rather than unit tests that assert particular ASTs are parsed
from WebIDL files.

* webidl: Remove uses of undefined import types

* test-project-builder: Build projects in "very verbose" mode

This helps for debugging failing WebIDL-related tests.

* test-project-builder: Add more profiling timers

* test-project-builder: Detect when webpack-dev-server fails

Instead of going into an infinite loop, detect when webpack-dev-server fails to
start up and early exit the test.

* webidl: Specify version for dev-dependency on wasm-bindgen-backend

Instead of only a relative path.

* guide: Add section about contributing to `web-sys`

* WIP enable Event.webidl

Still need to fix and finish the test.

* Update expected webidl output

* Start out a test's status as incomplete

That way if we don't fill it in the error message doesn't look quite so bizarre

* Fix onerror function in headless mode

Otherwise we don't see any output!

* Fix package.json/node_modules handling in project generation

Make sure these are looked up in the git project root rather than the crate root

* Avoid logging body text

This was meant for debugging and is otherwise pretty noisy

* Fix a relative path

* More expected test fixes

* Fix a typo

* test-project-builder: Allow asynchronous tests

* webidl: Convert [Unforgeable] attributes into `#[wasm_bindgen(structural)]`

Fixes #432

* test-project-builder: Print generated WebIDL bindings for debugging purposes

Helps debug bad WebIDL bindings generation inside tests.

* When we can't find a descriptor, say which one can't be found

This helps when debugging things that need to become structural.

* web-sys: Test bindings for Event

* ci: Use `--manifest-path dir` instead of `cd dir && ...`

* web-sys: Just move .webidl files isntead of symlinking to enable them

* tests: Polyfill Array.prototype.values for older browsers in CI

* test-project-builder: Don't panic on poisoned headless test mutex

We only use it to serialize headless tests so that we don't try to bind the port
concurrently. Its OK to run another headless test if an earlier one panicked.

* JsValue: Add {is,as}_{object,function} methods

Allows dynamically casting values to `js::Object` and `js::Function`.

* tidy: Fix whitespace and missing semicolons

* Allow for dynamic feature detection of methods

If we create bindings to a method that doesn't exist in this implementation,
then it shouldn't fail until if/when we actually try and invoke that missing
method.

* tests: Do feature detection in Array.prototype.values test

* Add JsValue::{is_string, as_js_string} methods

And document all the cast/convert/check methods for js value.

* eslint: allow backtick string literals

* Only generate a fallback import function for non-structural imports
2018-07-09 16:35:25 -07:00
Alex Crichton
ade4561eba Don't unwrap mutex lock in headless testing
We don't worry about poisoning and it causes too many test failures if it's
turned on!
2018-07-09 14:55:55 -07:00
Nick Fitzgerald
2b5dd430a8
Merge pull request #428 from alexcrichton/missing-docs
Fix some cases with `#[deny(missing_docs)]`
2018-07-09 11:01:05 -07:00
Nick Fitzgerald
3e0711ab0b
Merge pull request #427 from alexcrichton/no-recurse
Simplify the `reset_indentation` function
2018-07-09 11:00:02 -07:00
Michael Hoffmann
bae324c951 Add Array.prototype.values binding (#395) 2018-07-09 12:42:30 -05:00
Nick Fitzgerald
21cb50ef05
Merge pull request #412 from matiasinsaurralde/intl
Add bindings for `Intl`
2018-07-09 10:31:22 -07:00
Alex Crichton
5a95cb3c1f
Test in release mode on Travis (#431)
Contrary to #393 it looks like it's a big win now with the number of tests
we have. Tested in #429 it was confirmed that multiple threads are indeed
benefitting us here. A [debug build][1] took 22m while a [release build][2] took
15m.

[1]: https://travis-ci.org/rustwasm/wasm-bindgen/jobs/401819002
[2]: https://travis-ci.org/rustwasm/wasm-bindgen/jobs/401819004
2018-07-09 11:34:24 -05:00
Alex Crichton
331a86a07a Simplify the reset_indentation function
This should fix a stack overflow reported on IRC by ensuring that the function
isn't recursive
2018-07-09 09:10:26 -07:00
Alex Crichton
b4c7a5c1e1 Fix some cases with #[deny(missing_docs)]
Generated functions by wasm-bindgen should either be `#[doc(hidden)]` or include
the docs on the original item!

Closes #425
2018-07-09 08:49:16 -07:00
Alex Crichton
3c38ba258c Fix tests 2018-07-09 08:49:00 -07:00
Alex Crichton
5e747c721b Remove a stray extern forgotten in #410 2018-07-09 08:13:03 -07:00
Liigo Zhuang
bfec9e6401 bindings for parseInt/parseFloat (#384)
* parseInt, parseFloat, JsValue::is_nan

* Number.parseInt, Number.parseFloat

* remove `JsValue::is_nan`

* parse_int/float returns f64
2018-07-09 08:59:54 -05:00
Marcin Baraniecki
d6a0b34480
Merge pull request #426 from toVersus/js_date
bindings for Date.getTimezoneOffset and Date.getUTCXXX
2018-07-09 15:12:19 +02:00
toversus
5bfde7778d binding for Date.prototype.getUTCSeconds() 2018-07-09 18:20:04 +09:00
toversus
15d9f743ec binding for Date.prototype.getUTCMonth() 2018-07-09 18:08:38 +09:00
toversus
2e85bbd9e0 binding for Date.prototype.getUTCMinutes() 2018-07-09 18:04:20 +09:00
toversus
c260ac7c3e binding for Date.prototype.getUTCMilliseconds() 2018-07-09 17:59:15 +09:00
toversus
6aa3661e11 binding for Date.prototype.getUTCHours() 2018-07-09 17:54:19 +09:00
toversus
975818a1f6 binding for Date.prototype.getUTCFullYear() 2018-07-09 17:50:13 +09:00
toversus
ea19848691 binding for Date.prototype.getUTCDay() 2018-07-09 17:46:21 +09:00
toversus
792baefc22 binding for Date.prototype.getUTCDate() 2018-07-09 17:42:30 +09:00
toversus
d3a17d4014 binding for Date.prototype.getTimezoneOffset() 2018-07-09 17:38:38 +09:00
dependabot[bot]
37645c5d2b
Merge pull request #424 from rustwasm/dependabot/npm_and_yarn/eslint-5.1.0 2018-07-09 07:23:55 +00:00
dependabot[bot]
113577329c
Bump eslint from 5.0.1 to 5.1.0
Bumps [eslint](https://github.com/eslint/eslint) from 5.0.1 to 5.1.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v5.0.1...v5.1.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-09 05:50:55 +00:00
Marcin Baraniecki
a5b8c45d28 adds julia set example (#419)
* adds julia set example

* fixes indentation in *.js files

* fixes *.js formatting

* fixes a typo in function arguments signature
2018-07-08 10:57:19 -05:00
Alex Crichton
b66095bcff Avoid logging body text
This was meant for debugging and is otherwise pretty noisy
2018-07-08 08:20:21 -07:00
Alex Crichton
bc01d6cd61 Fix onerror function in headless mode
Otherwise we don't see any output!
2018-07-08 08:20:14 -07:00
Alex Crichton
3236bac3f6 Start out a test's status as incomplete
That way if we don't fill it in the error message doesn't look quite so bizarre
2018-07-08 08:20:06 -07:00
Alexander Kryvomaz
6758525980 bindings for isFinite(), Number.isFinite() and Number.isSafeInteger() (#420)
* bindings for isFinite()

* bindings for Number.isFiniter(), refactoring of Number.isInteger()

* bindings for Number.isSafeInteger()
2018-07-08 10:03:10 -05:00
Frank Hassanabad
6561fba947 Applied eslint from main .eslintrc to examples (#418)
* Changed eslintrc to be JSON file (Most projects use JSON version)
  * Added .eslintignore to ingore node_modules from subdirectories such as examples
  * Ran eslint --fix examples to fix all examples
  * Added npm script for running eslint against examples
  * Added npm script for running eslint against generated *out* code
  * Hooked npm scripts into travis ci to prevent examples from becoming inconsistent with future PR's
2018-07-08 01:02:10 -05:00
Sendil Kumar N
9482a1fa9a
Merge pull request #416 from FrankHassanabad/fix-https-to-http
Change https to http and make a link to it for ease of read
2018-07-08 00:10:04 +02:00
frankhassanbad
0b3a17685f Changed https to http and make a link to it for ease of read 2018-07-07 14:38:29 -06:00
Marcin Baraniecki
d179503a63 uses (JS) const for stack and slab declarations (#415) 2018-07-07 13:36:05 -05:00
Alex Crichton
791e69a5c0
Generate normal Rust functions for imported bindings (#410)
* Generate normal Rust functions for imported bindings

No need to use the C ABI, it just mixes up the documentation!

* Update expected webidl output
2018-07-07 12:20:42 -05:00
R. Andrew Ohana
2d50d5209b Backend refactor (#411)
* remove BindgenAttrs from other backend::ast structs

This is primarily a tool for use with the macro crate. Most of
these attributes were ignored in the actual codegen, but a few
were still being used. This is confusing when trying to add
other sources for codegen (such as webidl and typescript).

* move parsing logic to macro crate

This makes the backend crate solely concerned with having an ast
for which we can generate code.
2018-07-07 12:20:31 -05:00
T. Nagasawa
056b45aeed bindings for Date.parse and Date.getXXX (#414)
* binding for Date.prototype.getHours()

* binding for Date.prototype.getMilliseconds()

* binding for Date.prototype.getMinutes()

* binding for Date.prototype.getMonth()

* binding for Date.prototype.getSeconds()

* binding for Date.prototype.getTime()

* binding for Date.parse()
2018-07-07 12:09:46 -05:00
limira
b790856c6e Add [hello-online] (#413) 2018-07-07 11:23:01 -05:00
Matias Insaurralde
8352b4610f
Add bindings for Intl.getCanonicalLocales 2018-07-07 08:00:22 -04:00
Alex Crichton
0e2e826182 Hide the __wbindgen_if_not_std macro from docs 2018-07-06 20:04:49 -07:00
Alex Crichton
ef807a8068 Tweak some docs and fixup some symbol tests 2018-07-06 20:00:53 -07:00
dependabot[bot]
fce0bbba7f
Merge pull request #406 from rustwasm/dependabot/npm_and_yarn/webpack-cli-3.0.8 2018-07-07 01:02:06 +00:00
dependabot[bot]
fcb3085485
Bump webpack-cli from 2.1.5 to 3.0.8
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 2.1.5 to 3.0.8.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/v2.1.5...v3.0.8)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-06 23:45:53 +00:00
dependabot[bot]
e0ed0a36a1
Merge pull request #408 from rustwasm/dependabot/npm_and_yarn/webpack-4.15.1 2018-07-06 23:44:22 +00:00
dependabot[bot]
11b58f0c03
Bump webpack from 4.12.0 to 4.15.1
Bumps [webpack](https://github.com/webpack/webpack) from 4.12.0 to 4.15.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.12.0...v4.15.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-06 22:23:31 +00:00
dependabot[bot]
d1f22d3101
Merge pull request #407 from rustwasm/dependabot/npm_and_yarn/ts-loader-4.4.2 2018-07-06 22:22:15 +00:00
dependabot[bot]
8bf53aae5d
Merge pull request #405 from rustwasm/dependabot/npm_and_yarn/@types/node-10.5.2 2018-07-06 21:44:39 +00:00
dependabot[bot]
31252a23c8
Bump ts-loader from 4.4.1 to 4.4.2
Bumps [ts-loader](https://github.com/TypeStrong/ts-loader) from 4.4.1 to 4.4.2.
- [Release notes](https://github.com/TypeStrong/ts-loader/releases)
- [Changelog](https://github.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/ts-loader/compare/v4.4.1...v4.4.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-06 20:33:01 +00:00
dependabot[bot]
5da5bddadf
Bump @types/node from 9.6.22 to 10.5.2
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped) from 9.6.22 to 10.5.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-06 20:32:16 +00:00
Alex Crichton
45d25ebdf0 Only check the master branch 2018-07-06 13:30:28 -07:00
dependabot[bot]
37bb15baf6
Merge pull request #404 from rustwasm/dependabot/cargo/docopt-1.0 2018-07-06 19:43:25 +00:00