Commit Graph

3117 Commits

Author SHA1 Message Date
Alex Crichton
9f77f8dd00 Update parallel raytrace example to use futures
Use the atomics support now implemented!
2019-07-18 10:13:34 -07:00
Alex Crichton
d122bbca13 Emit a compiler error with futures 0.3 and atomics
Not implemented yet, and the one there doesn't work with atomics! (we'll
get around to this soon-ish)
2019-07-18 10:13:05 -07:00
Alex Crichton
2529bb0b17
Merge pull request #1670 from fitzgen/check-for-use-after-move-in-methods
Check for use-after-move in JS glue when `--debug` is enabled again
2019-07-17 10:07:01 -05:00
ibaryshnikov
02be3690cf removed AtomicBool from Waker struct 2019-07-17 01:52:55 +03:00
ibaryshnikov
45d2c7ce93 updated to the latest master 2019-07-17 01:24:44 +03:00
ibaryshnikov
cbaa1d302a added documentation comment for a stable version of wasm-bindgen-futures 2019-07-17 00:58:05 +03:00
ibaryshnikov
6ab1a49a41 moved lib.rs to stable.rs in wasm-bindgen-futures, updated during review 2019-07-17 00:58:05 +03:00
ibaryshnikov
221dc732af updated default timeout and wait_async signature in wasm-bindgen-futures 2019-07-17 00:48:00 +03:00
ibaryshnikov
06c783d5e3 placed web-sys dependency behind a feature flag in wasm-bindgen-futures 2019-07-17 00:48:00 +03:00
ibaryshnikov
16c6bdc966 moved threadsafe futures implementation to a separate file, made updates after review 2019-07-17 00:48:00 +03:00
ibaryshnikov
e466e1a6f1 moved threadsafe futures behind a flag 2019-07-17 00:48:00 +03:00
ibaryshnikov
2fdfe79574 added polyfill implementation in rust 2019-07-17 00:48:00 +03:00
ibaryshnikov
c01575c1bc typo fixed in Atomics docs 2019-07-17 00:48:00 +03:00
ibaryshnikov
d1d3021271 added polyfill for Atomics.wait and used it to notify futures 2019-07-17 00:48:00 +03:00
Nick Fitzgerald
8fd5f4ed6a Check for use-after-move in JS glue when --debug is enabled again
Fixes #1669
2019-07-16 13:35:59 -07:00
Alex Crichton
1807de74a7
Merge pull request #1665 from ia0/getElementsByClassName
Add Element::get_elements_by_class_name
2019-07-15 12:57:18 -05:00
Julien Cretin
170ce683d8 Add missing Element::get_elements_by_* methods 2019-07-15 19:47:09 +02:00
Nick Fitzgerald
a48a0aeb93
Merge pull request #1654 from fitzgen/no-import-shims
Skip generating JS import shims when unnecessary
2019-07-15 10:13:11 -07:00
Nick Fitzgerald
31ca527523 Bump wasm-webidl-bindings dep to 0.1.2 2019-07-15 09:35:22 -07:00
Nick Fitzgerald
afb33e5cf4 Assert that a bunch more function signatures don't require JS glue 2019-07-12 12:34:29 -07:00
Nick Fitzgerald
bce892b625 Add #[wasm_bindgen(assert_no_shim)] on imported functions for testing
This should not be used outside of wasm-bindgen's test suite.
2019-07-12 12:34:29 -07:00
Alex Crichton
13b672aac0
Merge pull request #1661 from alexcrichton/fix-nightly
Fix parsing of `final` on Nightly Rust
2019-07-12 12:45:53 -05:00
Alex Crichton
4f86653e0d Fix parsing of final on Nightly Rust
This fixes an issue also reported to upstream (rust-lang/rust#62628) to
ensure that we parse the `final` attribute as either `r#final` or
`final`, since now the compiler is giving us `r#final` and we were
previously only accepting `final`.

The parsing here was a bit wonky, but this setup ended up working!
2019-07-12 10:05:11 -07:00
Nick Fitzgerald
2d0866da9a cli-support: rustfmt 2019-07-11 15:44:16 -07:00
Nick Fitzgerald
d5d3e46334 cli-support: Skip generating JS shims for imports when unnecessary
After this change, any import that only takes and returns ABI-safe numbers (signed
integers less than 64 bits and unrestricted floating point numbers) will be a
direct import, and will not have a little JS shim in the middle.

We don't have a great mechanism for testing the generated bindings' contents --
as opposed to its behavior -- but I manually verified that everything here does
the Right Thing and doesn't have a JS shim:

```rust
\#[wasm_bindgen]
extern "C" {
    fn trivial();

    fn incoming_i32() -> i32;
    fn incoming_f32() -> f32;
    fn incoming_f64() -> f64;

    fn outgoing_i32(x: i32);
    fn outgoing_f32(y: f32);
    fn outgoing_f64(z: f64);

    fn many(x: i32, y: f32, z: f64) -> i32;
}
```

Furthermore, I verified that when our support for emitting native `anyref` is
enabled, then we do not have a JS shim for the following import, but if it is
disabled, then we do have a JS shim:

```rust
\#[wasm_bindgen]
extern "C" {
    fn works_when_anyref_support_is_enabled(v: JsValue) -> JsValue;
}
```

Fixes #1636.
2019-07-11 15:44:16 -07:00
Nick Fitzgerald
f2a4694c69 cli-support: Fix copy-pasted error message
This error case is for an invalid free function, not an invalid constructor.
2019-07-11 15:44:16 -07:00
Nick Fitzgerald
21fe8dc706 cli-support: Fix typo in comment 2019-07-11 15:44:16 -07:00
Alex Crichton
a3ddd097eb
Merge pull request #1660 from alexcrichton/bump
Bump to 0.2.48
2019-07-11 17:16:57 -05:00
Alex Crichton
5c975592be
Merge pull request #1657 from fitzgen/fix-dyn-warnings
Fix warnings about missing `dyn` on trait objects
2019-07-11 17:11:07 -05:00
Alex Crichton
e596ef596c Bump to 0.2.48 2019-07-11 15:02:39 -07:00
Nick Fitzgerald
6252c7ab78 Fix warnings about missing dyn on trait objects 2019-07-11 13:27:20 -07:00
Alex Crichton
c21c85a7ff
Merge pull request #1655 from rustwasm/dependabot/cargo/weedle-0.10
Update weedle requirement from 0.9 to 0.10
2019-07-11 09:09:33 -05:00
dependabot-preview[bot]
ce40388a7f
Update weedle requirement from 0.9 to 0.10
Updates the requirements on [weedle](https://github.com/rustwasm/weedle) to permit the latest version.
- [Release notes](https://github.com/rustwasm/weedle/releases)
- [Commits](https://github.com/rustwasm/weedle/compare/0.9.0...0.10.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-07-11 10:07:41 +00:00
Nick Fitzgerald
d02e115fd4
Merge pull request #1650 from alexcrichton/less-csp
Use static accessors if possible to get global object
2019-07-10 09:37:56 -07:00
Alex Crichton
b64f5c0ad8
Merge pull request #1649 from alexcrichton/fix-futures
Update futures implementation to not destroy callbacks
2019-07-10 11:02:43 -05:00
Nick Fitzgerald
15cc4fbb0b
Merge pull request #1652 from fitzgen/fix-some-warnings
Fix some warnings
2019-07-09 13:43:28 -07:00
Nick Fitzgerald
6cb659d5ac Fix warning about dead code when testing on non-wasm32 targets
There are functions that are only used on wasm32 targets, but `cfg`ing them is
more work than just making the modules public, and this is just a testing crate.
2019-07-09 13:17:52 -07:00
Nick Fitzgerald
1ba298548f Fix warning about unnecessary parens in generated code 2019-07-09 13:17:34 -07:00
Alex Crichton
d32b6a916c Update futures implementation to not destroy callbacks
JS engines guarantee that at least one of our `then` callbacks are
invoked, so that means if we destroy them prematurely they're guaranteed
to log an exception to the console! Instead to prevent exceptions from
happening tweak how the completion callbacks for JS futures are managed
and ensure that the closures stay alive until they're invoked later.

Closes #1637
2019-07-09 11:14:26 -07:00
Alex Crichton
0b08bba0c7 Use static accessors if possible to get global object
Previously we always used `Function('return this')` but this triggers
CSP errors since it's basically `eval`. Instead this adds a few
preflight checks to look for objects like `globalThis`, `self`, etc.
Currently we don't have a `#[wasm_bindgen]` function annotation to
import a bare global field like `self`, but we test accesses with
`self.self` and `globalThis.globalThis`, catching errors to handle any
issues.

Closes #1641
2019-07-08 13:28:06 -07:00
Alex Crichton
604c036111
Merge pull request #1645 from derekdreery/fix_futures_0_3_hack
Add in (unsafe and incorrect) impls of Send/Sync that are now required.
2019-07-08 12:04:43 -05:00
Alex Crichton
16fc0596eb
Merge pull request #1646 from ibaryshnikov/explicit-extension
Added explicit extension for imported .wasm file for --target bundler
2019-07-08 10:51:25 -05:00
ibaryshnikov
8f52f10aea added explicit extension for imported .wasm file for --target bundler 2019-07-08 03:50:17 +03:00
Richard Dodd
2541507789 Add in (unsafe and incorrect) impls of Send/Sync that are now required. 2019-07-06 16:30:29 +01:00
Alex Crichton
7fe3dfd4f5
Merge pull request #1639 from dakom/master
whitelist slices for webgl2 uniformNuiv
2019-07-04 20:53:41 +02:00
dakom
f27de49989 whitelist slices for webgl2 uniformNuiv 2019-07-03 23:32:00 +03:00
Thomas
0ee7236698 Define is_truthy in terms of is_falsy 2019-07-02 19:06:44 +02:00
Thomas
e61f691e0b Add is_truthy, is_falsy 2019-07-02 18:44:06 +02:00
Alex Crichton
bf631eda1b
Merge pull request #1633 from Warfields/master
Attempted to tackle #1622
2019-06-29 11:29:01 +02:00
Samuel Warfield
367a56eb25 Test are fully implemented 2019-06-28 14:14:27 -06:00