Commit Graph

911 Commits

Author SHA1 Message Date
Nick Fitzgerald
7a579be629
Merge pull request #459 from Slowki/github-linguist
Fix Language Statistics
2018-07-11 16:39:23 -07:00
Stephan Wolski
d6a97adb5a
add .gitattributes to mark WebIDL as vendored
Add .gitattributes file to tell Linguist that the WebIDL is vendored.
2018-07-11 18:48:51 -04:00
Nick Fitzgerald
9c7b15ea40
Merge pull request #433 from Slowki/feat/basic-enum-support
WebIDL Enum Support
2018-07-11 14:31:16 -07:00
Stephan Wolski
5520da1ef6
webidl: update enum test to unwrap constructor results
Update the enum test to match the new constructor return values
2018-07-11 16:17:56 -04:00
Stephan Wolski
fac73a2ea4
webidl: make from_js_value visible for enums
Make from_js_value match the visibility of the enum it's associated with
2018-07-11 15:36:41 -04:00
Stephan Wolski
4c7b130872
Merge branch 'master' into feat/basic-enum-support 2018-07-11 15:34:00 -04:00
Nick Fitzgerald
3578a83fe2
Merge pull request #454 from alexcrichton/api
Build documentation for master branch on gh-pages
2018-07-11 11:48:00 -07:00
Nick Fitzgerald
f8949acbe0
Merge pull request #457 from fitzgen/turn-throws-extended-attribute-into-catch
webidl: Turn the `[Throws]` extended attributes into `Result<T, JsValue>`
2018-07-11 11:37:57 -07:00
Nick Fitzgerald
3cdb6ef03a webidl: Turn the [Throws] extended attributes into Result<T, JsValue>
This sets the `catch` flag on the emitted AST when an operation/attribute has
the `[Throws]` extended attribute on it.

Additionally, constructors aren't annotated with `[Throws]` but can still throw
exceptions, so we must conservatively assume *every* constructor can throw an
error.
2018-07-11 11:07:03 -07:00
T. Nagasawa
5ce424e57b bindings for Date.prototype.setUTCXXX() (#456) 2018-07-11 09:27:59 -05:00
Michael Hoffmann
77b86f481e Add helper function to preconfigure project for web-sys (#455) 2018-07-11 09:27:27 -05:00
Alex Crichton
128dad300c Build documentation for master branch on gh-pages
Don't link it from the book as the book likely wants to use published crates.io
versions, but it should be available to browse if need be
2018-07-11 07:10:01 -07:00
Stephan Wolski
6608828d72
webidl: use JSValue::from in IntoWasmAbi for enums 2018-07-10 20:28:34 -04:00
Stephan Wolski
c56b1b0189
webidl: replace From trait with from_js_value method for enums
* Remove From<JSValue> for ENUM
* Add `from_js_value` method which returns an Option<ENUM>
2018-07-10 20:28:34 -04:00
Stephan Wolski
a981dfd507
webidl: initial enum support
Add enum support to the WebIDL interface generator.
2018-07-10 20:28:34 -04:00
Nick Fitzgerald
94d939f4da
Merge pull request #453 from dorayakikun/master
Binding for Array.prototype.map()
2018-07-10 16:39:11 -07:00
Nick Fitzgerald
eabbe0e56e
Merge pull request #452 from brisad/add-fetch-api-response
Add Response interface part of fetch API
2018-07-10 15:22:12 -07:00
Tomohide Takao
d7857da262 binding for Array.prototype.map() 2018-07-11 07:20:52 +09:00
Michael Hoffmann
717e260a99 Add Response interface part of fetch API 2018-07-10 23:49:14 +02:00
Nick Fitzgerald
92dd8e859f Move webidl tests to the webidl crate's test suite (#451)
* webidl: Remove exact-output tests

These have not been as effective, nor as easy to write and maintain, as the
project()-based integration tests.

* tests: Move webidl tests into the webidl crate's test suite
2018-07-10 16:17:33 -05:00
Nick Fitzgerald
42938792c7
Merge pull request #430 from FreeMasen/js_docs
Js docs
2018-07-10 10:08:41 -07:00
Nick Fitzgerald
7200d36fb6
Merge pull request #438 from toVersus/js_date
bindings for Date.setXXX
2018-07-10 10:04:36 -07:00
Satoshi Amemiya
8be0a98386 Add support for methods of Symbol (#437) 2018-07-10 09:46:05 -05:00
toversus
d2feddcf90 fix to have no impact on timezones difference 2018-07-10 23:31:25 +09:00
Robert Masen
1d826e96de fix reformatting for new syntax 2018-07-10 08:42:35 -05:00
Robert Masen
c7d98b9ee1 add js doc @param and @returns annotations 2018-07-10 08:42:34 -05:00
Marcin Baraniecki
8abe0f903e
Merge pull request #435 from liigo/buffer_is_view
[doc] fix `ArrayBuffer::is_view()`'s document.
2018-07-10 15:27:55 +02:00
toversus
91d6ae5f04 binding for Date.prototype.setTime() 2018-07-10 21:46:44 +09:00
toversus
c185897eff binding for Date.prototype.setSeconds() 2018-07-10 21:45:33 +09:00
toversus
609d457301 binding for Date.prototype.setMonth() 2018-07-10 21:27:12 +09:00
toversus
a81827caf9 binding for Date.prototype.setMinutes() 2018-07-10 21:20:18 +09:00
toversus
11a58a1bd0 binding for Date.prototype.setMilliseconds() 2018-07-10 20:55:45 +09:00
toversus
524628e1e1 binding for Date.prototype.setHours() 2018-07-10 20:51:39 +09:00
toversus
d555b7f068 binding for Date.prototype.setFullYear() 2018-07-10 20:45:25 +09:00
toversus
1a8da45340 binding for Date.prototype.setDate() 2018-07-10 20:38:54 +09:00
Liigo Zhuang
ae9c5a8d71 [doc] fix ArrayBuffer::is_view()'s document. 2018-07-10 14:07:38 +08:00
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