Commit Graph

3117 Commits

Author SHA1 Message Date
Alex Crichton
a16253174a
Merge pull request #1736 from Pauan/improving-string-passing
Making passStringToWasm smaller
2019-08-26 09:09:36 -05:00
Pauan
d9ae387536 Fixing minor typo 2019-08-24 19:49:26 +02:00
Pauan
92c2e0ebe7 More improvements to the passStringToWasm function 2019-08-24 19:41:04 +02:00
Pauan
fb0bbc00cb Adding ignoreBOM and fatal to TextDecoder (#1730)
* Adding ignoreBOM and fatal to TextDecoder

* Minor tweak to expose_text_processor

* Adding in unit tests for BOM

* Adding in comment for expose_text_decoder

* Attempting to fix build failure

* Temporarily disabling unit tests
2019-08-22 20:00:49 -07:00
Pauan
5581cdf656 Improving the passStringToWasm function 2019-08-23 01:06:21 +02:00
nasso
e39e8501db Update browser support for BigInt (#1728)
* Update browser support for `BigInt`

`BigInt` is supported in Firefox as of Firefox 68!
Also replaced Firefox with Safari as a second example of an unsupported browser.

* Add link to "BigInt" on "Can I use..."
2019-08-20 19:16:46 -05:00
Alex Crichton
5c56c02385
Merge pull request #1726 from alexcrichton/bump
Bump to 0.2.50
2019-08-19 06:22:09 -05:00
Alex Crichton
c2daa4f63c Bump to 0.2.50 2019-08-19 04:21:27 -07:00
Alex Crichton
487289cf9b
Merge pull request #1725 from alexcrichton/real-webidl-section
Add support for emitting a Wasm Interface Types section
2019-08-19 06:19:23 -05:00
Alex Crichton
c5dd572d9e Add support for emitting a Wasm Interface Types section
This commit adds support to `wasm-bindgen` to emit a WebAssembly module
that contains a WebAssembly Interface Types section. As of today there are no
native consumers of these WebAssembly modules, and the actual binary format
here is basically arbitrary (chosen by the `wasm-webidl-bindings` crate). The
intention is that we'll be following the [WebAssembly Interface
Types proposal][proposal] very closely and update here as necessary.

The main feature added in this PR is that a new experimental environment
variable, `WASM_INTERFACE_TYPES=1`, is recognized by the `wasm-bindgen`
CLI tool. When present the CLI tool will act differently than it does
today:

* The `anyref` feature will be implicitly enabled
* A WebAssembly interface types section will be emitted in the
  WebAssembly module
* For now, the WebAssembly module is strictly validated to require zero
  JS glue. This means that `wasm-bindgen` is producing a fully
  standalone WebAssembly module.

The last point here is one that will change before this functionality is
stabilized in `wasm-bindgen`. For now it reflects the major use case of
this feature which is to produce a standalone WebAssembly module with no
support JS glue, and to do that we need to verify properties like it's
not using JS global names, nonstandard binding expressions, etc. The
error messages here aren't the best but they at least fail compilation
at some point instead of silently producing weird wasm modules.

Eventually it's envisioned that a WebAssembly module will contain an
interface types section but *also* have JS glue so binding expressions
can be used when available but otherwise we'd still generate JS glue for
things like nonstandard expressions and accessing JS global values.

It should be noted that a major feature not implemented in
`wasm-bindgen` yet is the multi-value proposal for WebAssembly. This is
coming soon (as soon as we can) in `walrus` and later for a pass here,
but for now this means that returning multiple values (like a string
which has a pointer/length) is a bit of a hack. To enable this use case
a `wasm-bindgen`-specific-convention which will never be stabilized is
invented here by using binding expression to indicate "this return value
is actually returned through an out-ptr as the first argument list".
This is a gross hack and is guaranteed to be removed. Eventually we will
support multi-value and the wasm module emitted will simply use
multi-value and contain internal polyfills for Rust's ABI which returns
values through out-ptrs.

Overall this should make `wasm-bindgen` usable for playing around with
the WebIDL bindings proposal and helping us get a taste of what it looks
like to have entirely standalone WebAssembly modules running in multiple
environments, no extra fluff necessary!

[proposal]: https://github.com/webassembly/webidl-bindings
2019-08-16 12:02:01 -07:00
Alex Crichton
bd7c90788a
Merge pull request #1723 from alexcrichton/instntiate-streaming
Improve instantiateStreaming fallback
2019-08-15 11:55:51 -05:00
Alex Crichton
20be0a3c72 Improve instantiateStreaming fallback
This commit improves our `instantiateStreaming` fallback to only
actually trigger the fallback if the headers look wrong. If the headers
look right then we let through the original error which should help
avoid accidentally papering over bugs with different bugs in
misconfigured situations.

Closes #1696
2019-08-15 09:37:52 -07:00
Alex Crichton
906ac1500f
Merge pull request #1722 from alexcrichton/bump
Bump to 0.2.49
2019-08-14 13:46:46 -05:00
Alex Crichton
e08ea46fed Fix UI test for beta 2019-08-14 11:46:30 -07:00
Alex Crichton
c1d4fddeac Bump to 0.2.49 2019-08-14 08:32:02 -07:00
Alex Crichton
603d5742ee
Merge pull request #1717 from alexcrichton/walrus-update
Update with list IR from `walrus`
2019-08-13 14:09:31 -05:00
Alex Crichton
aace8cedee Move table export to the anyref pass
Turns out #1704 was buggy and ended up never injecting initialization
because the anyref table was never present! This fixes that issue and
this should now be tested on CI to ensure this doesn't regress and
future changes preserve correctness
2019-08-13 12:08:56 -07:00
Alex Crichton
ad34fa29d8 Update with list IR from walrus
This commit updates `wasm-bindgen` to the latest version of `walrus`
which transforms all internal IR representations to a list-based IR
instead of a tree-based IR. This isn't a major change other than
cosmetic for `wasm-bindgen` itself, but involves a lot of changes to the
threads/anyref passes.

This commit also updates our CI configuration to actually run all the
anyref tests on CI. This is done by downloading a nightly build of
node.js which is theorized to continue to be there for awhile until the
full support makes its way into releases.
2019-08-13 11:17:55 -07:00
Alex Crichton
8775f9b1b3
Merge pull request #1720 from alexcrichton/update-syn
Upgrade to syn/quote 1.0
2019-08-13 12:55:44 -05:00
Alex Crichton
45b43905b4 Upgrade to syn/quote 1.0
Fresh off the presses let's start the update!
2019-08-13 10:37:08 -07:00
Alex Crichton
1d0c333a2b Run cargo fmt over all code 2019-08-12 11:28:37 -07:00
Alex Crichton
3697fb7205
Merge pull request #1716 from najamelan/fix/futures-preview-0.3.0-alpha.18
Update to work with futures-preview 0.3.0-alpha.18
2019-08-12 09:12:07 -05:00
Naja Melan
9f7afa8a5e Update to work with futures-preview 0.3.0-alpha.18 2019-08-10 21:33:36 +02:00
Alex Crichton
bb6c0136f3 Update sccache again 2019-08-09 07:03:36 -07:00
Alex Crichton
67e858e32a
Merge pull request #1638 from ThomasdenH/master
Add is_truthy, is_falsy
2019-08-08 12:35:01 -05:00
Thomas den Hollander
8b99fdc745 Add truthy_falsy tests to main.rs 2019-08-08 09:17:38 +02:00
Alex Crichton
49acddf88e
Merge pull request #1710 from UnHumbleBen/patch-1
Removed unnecessary dereference in Store::find
2019-08-07 09:33:01 -05:00
Benjamin Lee
50683f0c3c
Removed unnecessary dereference in Store::find
Prefer no dereference when it is not needed.
`todo` has type `&&Item`. Argument needs to be `&Item`, but this is converted via deref coercion.
2019-08-06 20:34:39 -07:00
Alex Crichton
0ab6956747
Merge pull request #1709 from UnHumbleBen/patch-1
Fixup styling in sync_local_storage
2019-08-06 11:43:38 -05:00
Benjamin Lee
af922fb670
Fixup styling in sync_local_storage
- `storage_string` is already a `JsString`, calling `to_string` is redundant

- `as_str` is not required, so it is more idiomatic to just use a borrow.
2019-08-06 09:27:09 -07:00
Alex Crichton
640c807736
Merge pull request #1707 from UnHumbleBen/patch-1
Removed unnecessary and confusing clone of String
2019-08-06 09:17:35 -05:00
Benjamin Lee
fffcc5ef35
Makes code clearing by providing code symmetry.
```            
child.push(&JsValue::from(&item.title));
child.push(&JsValue::from(item.completed));
child.push(&JsValue::from(&item.id));
```
Parallel syntax makes it easier to see that each iteration intends to push each of `item`'s fields to `child`.
2019-08-05 23:16:53 -07:00
Benjamin Lee
09b37b4a43
Removed unnecessary and confusing clone of String 2019-08-05 22:59:53 -07:00
Alex Crichton
cbab8a191d
Merge pull request #1704 from alexcrichton/skip-anyref
Fix anyref table export in empty modules
2019-08-05 15:16:28 -05:00
Alex Crichton
ba0c6a98e6 Fix anyref table export in empty modules
This commit fixes an issue previously introduced around handling the
anyref table, gracefully handling the case where the source module
doesn't actually use the anyref table at all, meaning that the logic
around initializing it can be entirely skipped.
2019-08-05 13:01:39 -07:00
Alex Crichton
9314873cd1 Upgrade sccache 2019-08-05 08:16:33 -07:00
Alex Crichton
0dbf4294c2
Merge pull request #1702 from UnHumbleBen/patch-2
Fixes description of Closure lifetime in comments.
2019-08-05 10:15:23 -05:00
Alex Crichton
c7180ddc8d
Merge pull request #1699 from UnHumbleBen/patch-1
Use idiomatic syntax of Rc::clone()
2019-08-05 10:07:12 -05:00
Alex Crichton
f76ec9e066
Merge pull request #1703 from Kirguir/parse_client_args
Add parse a env args to invocation the browser
2019-08-05 10:05:41 -05:00
Kirguir
b60ed2ee27 Add parse a env args to invocation the browser 2019-08-05 15:20:26 +03:00
Benjamin Lee
89067c1ddf
Updated description for single closure 2019-08-04 20:22:41 -07:00
Benjamin Lee
af4622ff3d
Fixes description of Closure lifetime in comments. 2019-08-04 11:01:13 -07:00
Benjamin Lee
b978531536
Use idiomatic syntax of Rc::clone() 2019-08-03 19:52:14 -07:00
Alex Crichton
732b691bb8
Merge pull request #1690 from alexcrichton/webidl-polyfill
Add support as a vanilla polyfill of WebIDL bindings
2019-08-02 09:47:57 -05:00
Alex Crichton
117fce1c82
Merge pull request #1692 from alexcrichton/fix-anyref-bugs
Fix a number of `anyref` related bugs in our passes
2019-08-02 09:47:14 -05:00
Alex Crichton
adde6c2da7 Correct base calculation in anyref allocator
This `base` value is the raw value coming out of the first call to
`table.grow`. Throwing in the addition of `JSIDX_RESERVED` just wasn't
right!
2019-08-01 12:00:33 -07:00
Alex Crichton
6cc7e3dadf Ensure the 0th slot of anyref table is undefined
This is currently required by our ABI for wasm-bindgen where `None` js
values going out have an index of 0 and are intended to be `undefined`.
This also refactors initialization a bit to be slightly more generic
over the constants we already have defined in this module.
2019-08-01 11:59:05 -07:00
Alex Crichton
5aee2f9c6a Fix an off-by-one in anyref stack manipulation
With more than two anyref stack arguments we were accidentally storing
the anyref values one higher in the stack than intended, so fix this
off-by-one by switching up some addition logic.
2019-08-01 11:58:33 -07:00
Alex Crichton
6e3e9d2dae Correctly hook up the anyref table initialization
This functionality got lost in recent refactorings for WebIDL bindings
unfortunately, so this commit touches things up to ensure that the
anyref table initialization in anyref-mode is hooked up correctly, even
when tests are enabled. This invovled moving injection of the start
function to the webidl processing pass and ensuring its intrinsic is
registered in the internal maps of wasm-bindgen.
2019-08-01 11:56:57 -07:00
Alex Crichton
36db788829
Merge pull request #1689 from alexcrichton/direct-imports
Support emitting direct imports in wasm files
2019-08-01 10:24:08 -05:00