Commit Graph

2470 Commits

Author SHA1 Message Date
Alex Crichton
6803c619bb Bump to 0.2.40 2019-03-21 17:08:48 -07:00
Alex Crichton
a8c5fa4a2a
Merge pull request #1385 from alexcrichton/fix-uaf
Fix use-after-free with closures in JS bindings
2019-03-21 19:05:24 -05:00
Nick Fitzgerald
6c62d54ad9
Update crates/cli-support/src/js/closures.rs
Co-Authored-By: alexcrichton <alex@alexcrichton.com>
2019-03-21 19:05:15 -05:00
Nick Fitzgerald
407bc5dfbb
Update crates/cli-support/src/js/closures.rs
Co-Authored-By: alexcrichton <alex@alexcrichton.com>
2019-03-21 19:05:10 -05:00
Alex Crichton
1a7b3d56bd
Merge pull request #1384 from rustwasm/cloudflare-workers
feat(js): add check to no_modules gen js for cloudflare workers
2019-03-21 19:04:53 -05:00
Ashley Williams
3e814a6824 feat(js): add check to no_modules gen js for cloudflare workers 2019-03-21 18:10:20 -05:00
Alex Crichton
2ff2e2505a Fix use-after-free with closures in JS bindings
This commit fixes an erroneous use-after-free which can happen in
erroneous situations in JS. It's intended that if you invoke a closure
after its environment has been destroyed that you'll immediately get an
error from Rust saying so. The JS binding generation for mutable
closures, however, accidentally did not protect against this.

Each closure has an internal reference count which is incremented while
being invoked and decremented when the invocation finishes and also when
the `Closure` in Rust is dropped. That means there's two branches where
the reference count reaches zero and the internal pointer stored in JS
needs to be set to zero. Only one, however, actually set the pointer to
zero!

This means that if a closure was destroyed while it was being invoked it
would not correctly set its internal pointer to zero. A further
invocation of the closure would then pass as seemingly valid pointer
into Rust, causing a use-after-free.

A test isn't included here specifically for this because our CI has
started failing left-and-right over this test, so this commit will
hopefully just make our CI green!
2019-03-21 15:57:08 -07:00
Alex Crichton
b8e9a20d8f
Merge pull request #1377 from alexcrichton/fix-dupe
Move `links` annotation to `wasm-bindgen-shared`
2019-03-21 16:58:53 -05:00
Alex Crichton
c9a972ac55
Merge pull request #1376 from alexcrichton/more-debugging
Add some logging useful in debugging #1373
2019-03-21 16:55:04 -05:00
Alex Crichton
a4736682d5
Merge pull request #1383 from alexcrichton/deterministic
Fix a nondeterministic bug in the JS wrapper emitted
2019-03-21 16:54:53 -05:00
Alex Crichton
80899abf84
Merge pull request #1378 from alexcrichton/doc-tweaks
Clarify some introductory docs
2019-03-21 16:54:45 -05:00
Alex Crichton
a5a600192a Fix a nondeterministic bug in the JS wrapper emitted
We've always wanted this to be the deterministic, but usage of `HashMap`
for example can accidentally lead to non-determinism. Looks like one was
forgotten and the bindings were nondeterministic by accident as a
result!
2019-03-21 14:37:44 -07:00
Alex Crichton
629a19b8de Bring back accidentally deleted raytrace build script 2019-03-21 14:32:27 -07:00
Alex Crichton
0e864a4855
Merge pull request #1369 from alexcrichton/targets
Replace target flags with `--target`
2019-03-21 16:06:42 -05:00
Alex Crichton
995be7c027 Replace target flags with --target
This commit deprecates the `--web`, `--no-modules`, and `--nodejs` flags
in favor of one `--target` flag. The motivation for this commit is to be
consistent between `wasm-bindgen` and `wasm-pack` so documentation for
one is applicable for the other (so we don't have to document everywhere
what the translation is between flags). Additionally this should make it
a bit easier to add new targets (if necessary) in the future as it won't
add to the proliferation of flags.

For now the old flags (like `--web`) continue to be accepted, but
they'll be removed during the next set of breaking changes for
`wasm-bindgen`.
2019-03-21 14:00:33 -07:00
Alex Crichton
93cab3d755
Merge pull request #1382 from fitzgen/wasm-pack-web-target
Use `wasm-pack build --target web` for without-a-bundler example
2019-03-21 15:57:12 -05:00
Nick Fitzgerald
1e98f6b0dd Use wasm-pack build --target web for without-a-bundler example 2019-03-21 13:55:25 -07:00
Alex Crichton
e39b5c1121 Clarify some introductory docs
* Note that after the game of life tutorial there's also wasm-pack tutorials
* Ensure that the hello world example is clear that webpack isn't
  required inline in addition to the text on other pages.
2019-03-21 08:44:53 -07:00
Alex Crichton
7b6731fd3b Move links annotation to wasm-bindgen-shared
This commit moves our `links` annotation in the `wasm-bindgen` crate to
the `wasm-bindgen-shared` crate. The `links` annotation is used to
ensure that there's only one version of `wasm-bindgen` in a crate graph
because if there are multiple versions then a CLI surely cannot actually
process the wasm binary (as the multiple versions likely have different
formats in their custom sections).

Discovered in #1373 it looks like the usage in `wasm-bindgen` isn't
quite sufficient to cause this deduplication. It turns out that
`wasm-bindgen-shared`, a very core dependency, is actually the most
critical to be deduplicated since its the one that defines the format of
the custom section. In #1373 a case came up where `wasm-bindgen` was
deduplciated but there were two versions of `wasm-bindgen-shared` in the
crate graph, meaning that a `[patch]` for only `wasm-bindgen` wasn't
sufficient, but rather `web-sys` and/or `js-sys` also needed a `[patch]`
annotation to ensure everyone used the right dependencies.

This commit won't actually fix #1373 to the point where it "just works",
but what it does do is present a better error message than an internal
panic of `wasm-bindgen`. The hope is that by moving the `links`
annotation we can catch more errors of this crate graph duplication,
leading to more `[patch]` annotations locally.

Closes #1373
2019-03-21 08:35:27 -07:00
Alex Crichton
12355ce81c Add some logging useful in debugging #1373
Ended up helping diagnose the problem in the end!
2019-03-21 08:30:30 -07:00
Alex Crichton
d49d8c9e1b
Merge pull request #1372 from RReverser/fix-dataview-docs
Fix docs for DataView::get*int32*
2019-03-20 13:47:10 -05:00
Alex Crichton
3f86c9429f
Merge pull request #1371 from RReverser/merge-typed-arrays
Merge TypedArray definitions into a macro
2019-03-20 13:46:12 -05:00
Ingvar Stepanyan
4e806bab70 Fix docs for DataView::get*int32* 2019-03-20 18:32:34 +00:00
Ingvar Stepanyan
c5260f29aa Merge TypedArray definitions into a macro 2019-03-20 17:25:35 +00:00
konstin
42c1cdd8bf
Merge branch 'master' into reexporting_in_2018 2019-03-18 21:38:18 +01:00
Alex Crichton
2177dee9e4
Merge pull request #1353 from alexcrichton/raw-module
Add a `raw_module` attribute to `#[wasm_bindgen]`
2019-03-18 12:48:14 -05:00
Alex Crichton
ae47665b4d
Merge pull request #1356 from c410-f3r/ts-tests
Improve TS tests
2019-03-18 10:10:21 -05:00
Alex Crichton
b89fefde29
Merge pull request #1346 from rustwasm/dependabot/npm_and_yarn/@wasm-tool/wasm-pack-plugin-0.2.7
Update @wasm-tool/wasm-pack-plugin requirement from 0.2.5 to 0.2.7
2019-03-18 10:09:12 -05:00
Alex Crichton
8cc9374904
Merge pull request #1350 from alexlapa/enable-rtc-rtp-transceiver
Enable OptionIntoWasmAbi and OptionFromWasmAbi for ast::ImportEnum, RTCRtpTransceiver.webidl
2019-03-18 10:08:59 -05:00
konstin
69bbf597af Allow reexporting proc macro output in the 2018 edition
Trying to use a proc macro from a 2018 edition crate in a 2018 edition crate that reexports wasm bindgen's output failed before this commit with "could not find `wasm_bindgen` in `{{root}}`".

This commit was made with 

rg " ::wasm_bindgen::" --files-with-matches | xargs sed -i 's/::wasm_bindgen::/wasm_bindgen::/g'
2019-03-18 10:43:48 +01:00
Stephen Sherratt
47f3247a0e Installing and running the linkcheck mdbook backend 2019-03-16 17:42:15 +00:00
Caio
dc50a5ab58 Improve TS tests 2019-03-15 22:15:04 -03:00
alexlapa
4e32b5e430 add read_optional_enum_attribute to webidl-tests/enums 2019-03-15 14:27:18 -06:00
Alex Crichton
0d592fffb0 Add a raw_module attribute to #[wasm_bindgen]
This allows subverting the checks and resolution performed by the
`module` attribute added as part of [RFC 6] and has been discussed in #1343.

Closes #1343

[RFC 6]: https://github.com/rustwasm/rfcs/pull/6
2019-03-15 08:08:09 -07:00
Alex Crichton
9e74085f4b
Merge pull request #1351 from konradsz/number_slices_guide
Import correct functions
2019-03-15 09:34:57 -05:00
Konrad Szymoniak
185c2b66fa Import correct functions 2019-03-14 23:28:18 +01:00
alexlapa
1014bdb5df Merge remote-tracking branch 'upstream/master' into enable-rtc-rtp-transceiver 2019-03-14 13:24:24 -06:00
alexlapa
e6c42d4155 fix 2019-03-14 12:50:50 -06:00
Alex Crichton
d5a9208b49
Merge pull request #1344 from c410-f3r/arg-names
Preserve argument names
2019-03-14 13:45:52 -05:00
alexlapa
bf273a2035 fix 2019-03-14 12:30:08 -06:00
alexlapa
9178231b60 impl OptionFromWasmAbi and OptionIntoWasmAbi for ImportEnum, enable RTCRtpTransceiver.webidl, add add rtc_rtp_transceiver_direction test 2019-03-14 12:15:02 -06:00
Caio
91ea972c03 Take &str instead of String in argument fn 2019-03-14 12:21:41 -03:00
Caio
59c1b2a565 Merge branch 'master' into arg-names 2019-03-14 09:30:14 -03:00
Caio
70f5373348 Preserve argument names 2019-03-14 08:46:42 -03:00
dependabot[bot]
5403510594
Update @wasm-tool/wasm-pack-plugin requirement from 0.2.5 to 0.2.7
Updates the requirements on [@wasm-tool/wasm-pack-plugin](https://github.com/wasm-tool/wasm-pack-plugin) to permit the latest version.
- [Release notes](https://github.com/wasm-tool/wasm-pack-plugin/releases)
- [Commits](https://github.com/wasm-tool/wasm-pack-plugin/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-03-14 08:17:24 +00:00
Alex Crichton
e075d0492d
Merge pull request #1342 from alexcrichton/bump
Bump to 0.2.39
2019-03-13 14:47:57 -05:00
Alex Crichton
228f58dca3 Bump to 0.2.39 2019-03-13 11:02:27 -07:00
Alex Crichton
4cda18f777
Merge pull request #1338 from alexcrichton/fix-nom
Workaround an upstream `nom` bug
2019-03-13 09:48:35 -05:00
Alex Crichton
5192b95bf3 Workaround an upstream nom bug
This commit works around Geal/nom#843 where the API of the `nom` crate
changes based on feature selection, meaning we need to be compatible
even if another crate in the crate graph enables a feature.

Ideally this'd be fixed in upstream `nom`, and it looks like it will in
the next major version! For now a local catch-all directive should help
out.
2019-03-12 12:22:24 -07:00
Alex Crichton
90c3196b7b
Merge pull request #1333 from nstoddard/master
Make the slice argument of texImage2D and related functions immutable
2019-03-11 14:14:50 -05:00