Commit Graph

1488 Commits

Author SHA1 Message Date
Alex Crichton
5ed7b806d1 Fix getStringFromWasm for shared memory
We currently pass a raw view into wasm's memory for `getStringFromWasm`, but if
the memory is actually shared then `TextDecoder` rejects `SharedArrayBuffer` and
won't actually decode anything. Work around this for now with an extra copy into
a local buffer, and then pass that buffer to `getStringFromWasm` whenever memory
is shared.
2018-08-28 10:58:26 -07:00
Alex Crichton
4b15570b3f
Merge pull request #758 from alexcrichton/bump-parity-wasm
Bump dependency on parity-wasm to 0.32.0
2018-08-28 10:54:42 -07:00
Alex Crichton
f7e6fa2a04 Bump dependency on parity-wasm to 0.32.0
Brings support for atomic instructions!
2018-08-28 10:12:56 -07:00
Alex Crichton
a48a35fe41 Fix npm ci on AppVeyor 2018-08-27 19:02:26 -07:00
Alex Crichton
0e38388e7b Remove package-lock.json
It shouldn't be critical now that we're no longer testing with it and the
examples build should be testing against the latest anyway!
2018-08-27 17:40:46 -07:00
Alex Crichton
7154372af9 Remove yarn tests on CI
We're not actually using them any more!
2018-08-27 17:39:40 -07:00
Alex Crichton
6c0a00ca39 Build tags on AppVeyor 2018-08-27 17:34:35 -07:00
Alex Crichton
b41ce52d98
Merge pull request #756 from fitzgen/mdn-links
js-sys: Make MDN URLs into links
2018-08-27 17:21:27 -07:00
Nick Fitzgerald
26c351ecf4 js-sys: Make MDN URLs into links 2018-08-27 15:18:48 -07:00
Alex Crichton
69a831423b Update publishing instructions
We've got a publish script now!
2018-08-27 13:51:47 -07:00
Alex Crichton
4863ccd100 Update CHANGELOG for 0.2.19 2018-08-27 13:49:34 -07:00
Alex Crichton
d9bc0a3176 Bump to 0.2.19 2018-08-27 13:39:23 -07:00
Alex Crichton
c89182b1fd Merge remote-tracking branch 'origin/master' into bump 2018-08-27 13:38:53 -07:00
Alex Crichton
98008b9e77 Bump to 0.2.18
At the same time, also add a `publish.rs` script to ease our publishing woes.
2018-08-27 13:37:55 -07:00
Alex Crichton
502311f3a9
Merge pull request #755 from alexcrichton/memory-accessor
Add an accessor for wasm's own memory as a JS object
2018-08-27 13:04:03 -07:00
Alex Crichton
e1474110d4 Add an accessor for wasm's own memory as a JS object
In addition to closing #495 this'll be useful eventually when instantiating
multiple wasm modules from Rust as you'd now be able to acquire a reference to
the current module in Rust itself.
2018-08-27 11:05:55 -07:00
Alex Crichton
85fd49f90a Fix importing same types in two modules/crates
This'll hopefully fix fallout from 4f4da747ad
2018-08-27 09:59:47 -07:00
Alex Crichton
0f787e42f8
Merge pull request #754 from rustwasm/dependabot/npm_and_yarn/webpack-dev-server-3.1.6
Bump webpack-dev-server from 3.1.5 to 3.1.6
2018-08-27 09:18:28 -07:00
dependabot[bot]
9225642eaa
Bump webpack-dev-server from 3.1.5 to 3.1.6
Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 3.1.5 to 3.1.6.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases)
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-dev-server/compare/v3.1.5...v3.1.6)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-27 08:13:19 +00:00
Alex Crichton
9fc43f8a19
Merge pull request #752 from alexcrichton/remove-hack
Remove a hack around an LLVM bug
2018-08-26 15:43:07 -07:00
Alex Crichton
856892d11d
Merge pull request #750 from alexcrichton/import-memory
Add support for modules importing memory
2018-08-26 15:42:24 -07:00
Alex Crichton
335c0b1ab6 Add support for modules importing memory
The default of Rust wasm binaries is to export the memory that they contain, but
LLD also supports an `--import-memory` option where memory is imported into a
module instead. It's looking like importing memory is along the lines of how
shared memory wasm modules will work (they'll all import the same memory).

This commit adds support to wasm-bindgen to support modules which import memory.
Memory accessors are tweaked to no longer always assume that the wasm module
exports its memory. Additionally JS bindings will create a `memory` option
automatically because LLD always imports memory from an `env` module which won't
actually exist.
2018-08-26 15:41:36 -07:00
Alex Crichton
0cd04ca85e
Merge pull request #749 from alexcrichton/wasm-memory
Add WebAssembly.Memory to js-sys
2018-08-26 15:40:58 -07:00
Alex Crichton
bb7ca348c2 Add WebAssembly.Memory to js-sys
This adds definitions for the `WebAssembly.Memory` type to `js-sys`.
2018-08-26 15:40:37 -07:00
Alex Crichton
4f4da747ad Remove a hack around an LLVM bug
This has since been fixed in rust-lang/rust#52506
2018-08-25 10:45:51 -07:00
Nick Fitzgerald
2f8d437684
Merge pull request #748 from alexcrichton/no-mut
Remove casting to `&mut T` for JS casts
2018-08-25 10:03:17 -07:00
Alex Crichton
9729efe50e Remove casting to &mut T for JS casts
I discussed this with @fitzgen awhile back and this sort of casting seems
especially problematic when you have code along the lines of:

    let mut x: HtmlElement = ...;
    {
        let y: &mut JsValue = x.as_ref();
        *y = 3.into();
    }
    x.some_html_element_method();

as that will immediately throw! We didn't have a use case for mutable casting
other than consistency, so this commit removes it for now. We can possibly add
it back in later if motivated, but for now it seems reasonable to try to avoid
these sorts of pitfalls!
2018-08-24 20:45:11 -07:00
Alex Crichton
8ce7465bba
Merge pull request #747 from robertohuertasm/feat/extends-promise
feat(extends): extend promise
2018-08-23 17:52:50 -07:00
Roberto Huertas
042cfad5ce feat(extends): extend promise 2018-08-24 02:15:02 +02:00
Alex Crichton
045138f397
Merge pull request #744 from rustwasm/dependabot/npm_and_yarn/webpack-4.17.1
Bump webpack from 4.17.0 to 4.17.1
2018-08-23 09:25:13 -07:00
dependabot[bot]
c99b27a367
Bump webpack from 4.17.0 to 4.17.1
Bumps [webpack](https://github.com/webpack/webpack) from 4.17.0 to 4.17.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.17.0...v4.17.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-23 08:12:54 +00:00
Alex Crichton
9442db46f1
Merge pull request #743 from rustwasm/dependabot/npm_and_yarn/webpack-4.17.0
Bump webpack from 4.16.5 to 4.17.0
2018-08-22 09:05:56 -07:00
dependabot[bot]
304af77015
Bump webpack from 4.16.5 to 4.17.0
Bumps [webpack](https://github.com/webpack/webpack) from 4.16.5 to 4.17.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.16.5...v4.17.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-22 08:12:59 +00:00
Alex Crichton
bf791efe2c Fix wasm-interpreter with mixed types of imports
We counted all imports until the index of the descriptor function, now we only
count imported functions
2018-08-20 16:18:09 -07:00
Alex Crichton
493cd24ace
Merge pull request #736 from alexcrichton/remove-wasmi
Remove dependency on `wasmi`
2018-08-20 15:18:03 -07:00
Alex Crichton
6343f2659a Remove dependency on wasmi
This is a pretty heavyweight dependency which accounts for a surprising amount
of runtime for larger modules in `wasm-bindgen`. We don't need 90% of the crate
and so this commit bundles a small interpreter for instructions we know are only
going to appear in describe-related functions.
2018-08-20 15:14:56 -07:00
Alex Crichton
7486fa5104
Merge pull request #710 from RazerM/master
Add more WebAssembly bindings
2018-08-20 14:17:24 -07:00
Alex Crichton
3c3e6c4498 Provide no input for yarn
Hopefully it won't hang waiting for input as a result
2018-08-20 14:15:42 -07:00
Alex Crichton
2972599ee3 Fix some mistakes from WeakRef support
* Be sure to free the pointer, not `this.ptr` which is always 0
* Unconditionally attempt to free data and let Rust throw an exception if it's
  null
2018-08-20 14:14:55 -07:00
Frazer McLean
1ea1410f98 Catch errors in Table and Module constructors 2018-08-20 22:12:29 +02:00
Frazer McLean
7432f5ff5c Merge branch 'master' of git://github.com/rustwasm/wasm-bindgen 2018-08-20 21:55:42 +02:00
Alex Crichton
86d1ab513b
Merge pull request #741 from alexcrichton/duplicate-statics
Support importing same-name statics from two modules
2018-08-20 11:37:21 -07:00
Alex Crichton
ccae331b2a
Merge pull request #740 from alexcrichton/catch-constructors
Fix the `constructor` and `catch` attributes combined
2018-08-20 11:37:02 -07:00
Alex Crichton
66d96aac11 Fix merge conflicts with fetch example 2018-08-20 11:23:02 -07:00
Alex Crichton
285a7bf7da
Merge pull request #713 from alexcrichton/weakref
Add experimental support for `WeakRef`
2018-08-20 11:18:40 -07:00
Alex Crichton
61491eafbf Add experimental support for WeakRef
This commit adds experimental support for `WeakRef` to be used to automatically
free wasm objects instead of having to always call the `free` function manually.
Note that when enabled the `free` function for all exported objects is still
generated, it's just optionally invoked by the application.

Support isn't exposed through a CLI flag right now due to the early stages of
the `WeakRef` proposal, but the env var `WASM_BINDGEN_WEAKREF` can be used to
enable this generation. Upon doing so the output can then be edited slightly as
well to work in the SpiderMonkey shell and it looks like this is working!

Closes #704
2018-08-20 11:18:02 -07:00
Alex Crichton
f8cf4ab732 Support importing same-name statics from two modules
Closes #714
2018-08-20 10:56:58 -07:00
Alex Crichton
4195af68e7 Fix the constructor and catch attributes combined
This commit fixes annotations that include both the `constructor` and `catch`
attributes on imported types, ensuring that we infer the right type being
returned after extracting the first type parameter of the `Result`.

Closes #735
2018-08-20 10:40:54 -07:00
Alex Crichton
adcc0dd23e
Merge pull request #729 from eminence/fetch
Initial example for the Fetch API
2018-08-20 10:35:57 -07:00
Alex Crichton
3b02b8e319
Merge pull request #731 from alexcrichton/rename-usv-str
Tweak some WebIDL type names in methods
2018-08-20 10:32:15 -07:00