Commit Graph

1254 Commits

Author SHA1 Message Date
Alex Crichton
9f6c2a6125
Merge pull request #1314 from alexcrichton/typescript-tests
Start testing TypeScript output on CI
2019-03-05 17:20:00 -06:00
Alex Crichton
d6e3770350 Scope snippets within a crate
Use the same crate identifier for manually included snippets as well as
inline snippets to help with debugging.
2019-03-05 14:53:14 -08:00
Alex Crichton
c463cc96df Clean up the super long finalize function 2019-03-05 14:40:05 -08:00
Alex Crichton
f3f3ebee3a Remove unsafe usage in backend/src/encode.rs
Using `unsafe` was just a little too eager there so let's use an
off-the-shelf solution for solving the actual problem we have, which is
to allocate strings with a lifetime of `Interner` rather than
deduplicating strings.
2019-03-05 12:28:14 -08:00
Alex Crichton
93a1301c9f Don't explicitly hide _INCLUDED_FILES
It's already hidden from docs!
2019-03-05 12:17:42 -08:00
Alex Crichton
bdcfcb49b1 Log webdriver command we execute 2019-03-05 09:33:22 -08:00
Alex Crichton
235bc7c889 Start testing TypeScript output on CI
This commit starts to add some simple tests for our TypeScript output of
the wasm-bindgen CLI, currently just running `tsc` to make sure syntax
looks good and types are emitted as expected. This'll hopefully be able
to get expanded over time with bug reports as they come in as well as
ensure that we don't regress anything in egregious manners!

Closes #922
2019-03-05 08:57:52 -08:00
Alex Crichton
20f1e503d3 Fix the webidl-tests crate 2019-03-05 08:00:47 -08:00
Alex Crichton
5de3189411 Fix js-sys and web-sys tests 2019-03-05 08:00:47 -08:00
Alex Crichton
7e62aff1ce Fix a case where snippet is specified twice
When importing a file across multiple locations in a module make sure it
doesn't trip an assert and it works as expected.
2019-03-05 08:00:47 -08:00
Alex Crichton
6283169a30 Paths are relative to CARGO_MANIFEST_DIR
The cwd is different for workspaces, so use the manifest env var
instead.
2019-03-05 08:00:47 -08:00
Alex Crichton
b762948456 Implement the local JS snippets RFC
This commit is an implementation of [RFC 6] which enables crates to
inline local JS snippets into the final output artifact of
`wasm-bindgen`. This is accompanied with a few minor breaking changes
which are intended to be relatively minor in practice:

* The `module` attribute disallows paths starting with `./` and `../`.
  It requires paths starting with `/` to actually exist on the filesystem.
* The `--browser` flag no longer emits bundler-compatible code, but
  rather emits an ES module that can be natively loaded into a browser.

Otherwise be sure to check out [the RFC][RFC 6] for more details, and
otherwise this should implement at least the MVP version of the RFC!
Notably at this time JS snippets with `--nodejs` or `--no-modules` are
not supported and will unconditionally generate an error.

[RFC 6]: https://github.com/rustwasm/rfcs/pull/6

Closes #1311
2019-03-05 08:00:47 -08:00
Alex Crichton
a659f27c07 Bump to 0.2.38 2019-03-04 09:11:23 -08:00
Dan Robertson
7ad5426714
Update tests after nightly fix 2019-03-04 02:14:57 +00:00
Alex Crichton
1299a2086f
Merge pull request #1307 from alexcrichton/fix-name
Fix name of "current thread ID" intrinsic
2019-03-01 12:48:53 -06:00
Alex Crichton
dad0de4f8b Work around a nightly regression 2019-03-01 10:48:03 -08:00
Alex Crichton
1031d9dea6 Work around rust-lang/rust#58853 2019-03-01 10:47:27 -08:00
Alex Crichton
9ac8a974a9 Fix name of "current thread ID" intrinsic
This was accidentally renamed in the transition to `walrus`, but
upstream rust-lang/rust still uses the old name so let's switch back to
that.
2019-03-01 09:22:30 -08:00
Alex Crichton
233525d7d6 Fix passStringToWasm with shared memory
Looks like `TextEncoder#encodeInto` isn't compatible when the buffer
passed in is backed by a `SharedArrayBuffer`, so if the module has a
shared thread skip the `encodeInto` optimization entirely.
2019-02-28 14:58:10 -08:00
Alex Crichton
c62f6529d8
Merge pull request #1304 from alexcrichton/fix-init
Fix a `__wbindgen_placeholder__` module leaking through
2019-02-28 13:39:56 -06:00
Alex Crichton
da168dc7f5
Merge pull request #1302 from tyleranton/export-comments-ts
Add doc comments export for typescript
2019-02-28 09:34:11 -06:00
Alex Crichton
c4c0fea05e Fix a __wbindgen_placeholder__ module leaking through
With #1267 now fixed looks like we had an accidental regression sneak
through in the meantime!
2019-02-28 07:32:30 -08:00
Tyler Anton
59825c6d01 Add doc comments export for typescript 2019-02-27 20:09:28 +00:00
Alex Crichton
cb432be5df
Merge pull request #1296 from rustwasm/dependabot/cargo/scoped-tls-1.0
Update scoped-tls requirement from 0.1 to 1.0
2019-02-27 10:45:01 -06:00
Alex Crichton
46955735d9
Merge pull request #1298 from LegNeato/fix_high_sierra
Fix headless test runner on macOS High Sierra
2019-02-27 09:32:42 -06:00
Christian Legnitto
e80b0ccdc2 Fix headless test runner on macOS High Sierra 2019-02-26 21:06:45 -07:00
Alex Crichton
860612485d
Merge pull request #1279 from alexcrichton/encode-into
Add support for `TextEncoder#encodeInto`
2019-02-26 12:29:56 -06:00
Alex Crichton
745b16e3d2 Add support for TextEncoder#encodeInto
This commit adds support for the recently implemented standard of
[`TextEncoder#encodeInto`][standard]. This new function is a "bring your
own buffer" style function where we can avoid an intermediate allocation
and copy by encoding strings directly into wasm's memory.

Currently we feature-detect whether `encodeInto` exists as it is only
implemented in recent browsers and not in all browsers. Additionally
this commit emits the binding using `encodeInto` by default, but this
requires `realloc` functionality to be exposed by the wasm module.
Measured locally an empty binary which takes `&str` previously took
7.6k, but after this commit takes 8.7k due to the extra code needed for
`realloc`.

[standard]: https://encoding.spec.whatwg.org/#dom-textencoder-encodeinto

Closes #1172
2019-02-26 10:29:39 -08:00
dependabot[bot]
7eb11a7faa
Update scoped-tls requirement from 0.1 to 1.0
Updates the requirements on [scoped-tls](https://github.com/alexcrichton/scoped-tls) to permit the latest version.
- [Release notes](https://github.com/alexcrichton/scoped-tls/releases)
- [Commits](https://github.com/alexcrichton/scoped-tls/compare/0.1.0...1.0.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-26 08:15:14 +00:00
Alex Crichton
7fbe0210dc Rename test Context in JS
This will hopefully help avoid symbol collisions with other projects
that have a struct named `Context`
2019-02-20 09:23:00 -08:00
Alex Crichton
4181fb311a Add experimental support for the anyref type
This commit adds experimental support to `wasm-bindgen` to emit and
leverage the `anyref` native wasm type. This native type is still in a
proposal status (the reference-types proposal). The intention of
`anyref` is to be able to directly hold JS values in wasm and pass the
to imported functions, namely to empower eventual host bindings (now
renamed WebIDL bindings) integration where we can skip JS shims
altogether for many imports.

This commit doesn't actually affect wasm-bindgen's behavior at all
as-is, but rather this support requires an opt-in env var to be
configured. Once the support is stable in browsers it's intended that
this will add a CLI switch for turning on this support, eventually
defaulting it to `true` in the far future.

The basic strategy here is to take the `stack` and `slab` globals in the
generated JS glue and move them into wasm using a table. This new table
in wasm is managed at the fringes via injected shims. At
`wasm-bindgen`-time the CLI will rewrite exports and imports with shims
that actually use `anyref` if needed, performing loads/stores inside the
wasm module instead of externally in the wasm module.

This should provide a boost over what we have today, but it's not a
fantastic strategy long term. We have a more grand vision for `anyref`
being a first-class type in the language, but that's on a much longer
horizon and this is currently thought to be the best we can do in terms
of integration in the near future.

The stack/heap JS tables are combined into one wasm table. The stack
starts at the end of the table and grows down with a stack pointer (also
injected). The heap starts at the end and grows up (state managed in
linear memory). The anyref transformation here will hook up various
intrinsics in wasm-bindgen to the runtime functionality if the anyref
supoprt is enabled.

The main tricky treatment here was applied to closures, where we need JS
to use a different function pointer than the one Rust gives it to use a
JS function pointer empowered with anyref. This works by switching up a
bit how descriptors work, embedding the shims to call inside descriptors
rather than communicated at runtime. This means that we're accessing
constant values in the generated JS and we can just update the constant
value accessed.
2019-02-20 07:28:54 -08:00
Alex Crichton
8fb705a1ef Upgrade to walrus 0.4
Also be sure to have an explicit GC pass!
2019-02-19 14:14:01 -08:00
Nick Fitzgerald
5b0cfd7cea
Merge pull request #1274 from alexcrichton/delete-once
Fix an assert while deleting table elements
2019-02-19 10:21:25 -08:00
Alex Crichton
f831711f5d Support Option<RustStruct> in arguments/returns
Add all the necessary support in a few locations and we should be good
to go!

Closes #1252
2019-02-19 09:08:37 -08:00
Alex Crichton
9bab9d4af1 Fix an assert while deleting table elements
LLVM's mergefunc pass may mean that the same descriptor function is used
for different closure invocation sites even when the closure itself is
different. This typically only happens with LTO but in theory could
happen at any time!

The assert was tripping when we tried to delete the same function table
entry twice, so instead of a `Vec<usize>` of entries to delete this
commit switches to a `HashSet<usize>` which should do the deduplication
for us and enusre that we delete each descriptor only once.

Closes #1264
2019-02-19 08:17:14 -08:00
Alex Crichton
a3c03b5265 Revert "Temporarily unconditionally remove producers section"
This reverts commit f0cd51a566.
2019-02-15 11:22:46 -08:00
Alex Crichton
e9f423d57e Bump to 0.2.37 2019-02-15 08:16:24 -08:00
Alex Crichton
f0cd51a566 Temporarily unconditionally remove producers section
We've had a lot of bug reports with upstream webpack currently and while
webpack has a fix it may take a moment to deploy. Let's try and fix
wasm-bindgen in the meantime!

Once webpack is updated we can go back to emitting a producers section
by default and publish a new version of wasm-bindgen.
2019-02-15 07:39:42 -08:00
Alex Crichton
632a2b2979
Merge pull request #1259 from ctjhoa/master
Fix warning on ATOMIC_USIZE_INIT & ATOMIC_BOOL_INIT
2019-02-15 08:59:24 -06:00
Camille TJHOA
768b654b58 Fix warning on ATOMIC_USIZE_INIT & ATOMIC_BOOL_INIT 2019-02-15 11:58:48 +00:00
Alex Crichton
5e3cedfaf2 Add a flag to remove producers section
This should help handle instances like the recent Webpack bug and is
also a useful flag in its own right. For now it's set to `false`, but if
the Webpack bug persists through to tomorrow we likely want to publish a
version of `wasm-bindgen` with it default set to `true`.
2019-02-14 10:08:24 -08:00
Nick Fitzgerald
17dc79e4c5 Configure walrus to generate DWARF/names at the right times
Fixes ##1254
2019-02-14 07:20:43 -08:00
Alex Crichton
c49b87b2d8
Merge pull request #1225 from Pauan/get_index
Adding in Reflect::get_f64, Reflect::get_u32, Reflect::set_f64, and Reflect::set_u32
2019-02-13 13:10:40 -06:00
Alex Crichton
8ead8a1b62
Merge pull request #1248 from selaux/add-srcObject-to-HTMLMediaElement
[HTMLMediaElement] Reintroduce srcObject
2019-02-13 13:00:57 -06:00
Nick Fitzgerald
802cfedcbd Bump to 0.2.36 2019-02-12 13:19:02 -08:00
Nick Fitzgerald
f20afebdd1 Don't need the old wasm-bindgen-gc crate's Cargo.toml either 2019-02-12 13:16:17 -08:00
Nick Fitzgerald
6f00d9563f interpreter: handle closure descriptors with less than two parameters
This might happen because of LTO.

Fixes #1244
2019-02-12 12:57:22 -08:00
Nick Fitzgerald
d9cf9b3735 Bump to version 0.2.35 2019-02-12 11:36:19 -08:00
Alex Crichton
db4c3bf77b
Merge pull request #1243 from fitzgen/instantiateStreaming-fallback-round-2
Apply the `instantiateStreaming` incorrect MIME type recovery for no-modules
2019-02-12 12:45:46 -06:00
Nick Fitzgerald
b858875d49 Apply the instantiateStreaming incorrect MIME type recovery for no-modules
It was incorrectly only enabled for the multithreading glue previously.
2019-02-12 10:41:53 -08:00
Alex Crichton
894b479213 Migrate wasm-bindgen to using walrus
This commit moves `wasm-bindgen` the CLI tool from internally using
`parity-wasm` for wasm parsing/serialization to instead use `walrus`.
The `walrus` crate is something we've been working on recently with an
aim to replace the usage of `parity-wasm` in `wasm-bindgen` to make the
current CLI tool more maintainable as well as more future-proof.

The `walrus` crate provides a much nicer AST to work with as well as a
structured `Module`, whereas `parity-wasm` provides a very raw interface
to the wasm module which isn't really appropriate for our use case. The
many transformations and tweaks that wasm-bindgen does have a huge
amount of ad-hoc index management to carefully craft a final wasm
binary, but this is all entirely taken care for us with the `walrus`
crate.

Additionally, `wasm-bindgen` will ingest and rewrite the wasm file,
often changing the binary offsets of functions. Eventually with DWARF
debug information we'll need to be sure to preserve the debug
information throughout the transformations that `wasm-bindgen` does
today. This is practically impossible to do with the `parity-wasm`
architecture, but `walrus` was designed from the get-go to solve this
problem transparently in the `walrus` crate itself. (it doesn't today,
but this is planned work)

It is the intention that this does not end up regressing any
`wasm-bindgen` use cases, neither in functionality or in speed. As a
large change and refactoring, however, it's likely that at least
something will arise! We'll want to continue to remain vigilant to any
issues that come up with this commit.

Note that the `gc` crate has been deleted as part of this change, as the
`gc` crate is no longer necessary since `walrus` does it automatically.
Additionally the `gc` crate was one of the main problems with preserving
debug information as it often deletes wasm items!

Finally, this also starts moving crates to the 2018 edition where
necessary since `walrus` requires the 2018 edition, and in general it's
more pleasant to work within the 2018 edition!
2019-02-12 07:25:53 -08:00
Nick Fitzgerald
078257943d Bump to 0.2.34 2019-02-11 18:58:54 -08:00
Nick Fitzgerald
4975ca2954 Don't give up when servers don't set the application/wasm MIME type
It is quite annoying when using `python -m SimpleHTTPServer` or equivalent.
2019-02-10 13:59:39 -05:00
Nick Fitzgerald
c8ad85dd0b Use unwrap_throw instead of normal unwrap for JsString -> String conversion
Should have less code size.
2019-02-10 13:59:39 -05:00
T5uku5hi
5c0da8878d add #[allow(clippy::all)] in top-level items. 2019-02-09 20:20:10 +09:00
T5uku5hi
916789336c add #[allow(clippy::drop_ref)] 2019-02-09 03:47:25 +09:00
T5uku5hi
1b764103f6 Merge remote-tracking branch 'upstream/master' into add-allow-clippy 2019-02-09 03:13:16 +09:00
Nick Fitzgerald
11eeeb8fc8 Use textContent instead of innerHTML for extracting logs from headless browser tests
Easier to maintain fidelity and less likely to be sabotaged by XSS and
`<script>` tags.

Fixes #1232
2019-02-08 10:35:19 +01:00
Alex Crichton
9d27bc2e8b
Merge pull request #1199 from chinedufn/ref-slice
Whitelist for slice args that do not need to be mutable
2019-02-07 13:40:36 +01:00
Chinedu Francis Nwafili
acd69e97ee
Remove RefCell 2019-02-07 07:14:33 -05:00
Chinedu Francis Nwafili
ed28ce9db2
Clean up 2019-02-05 13:47:46 -05:00
Alex Crichton
74cd3c08f6
Merge pull request #1228 from rustwasm/dependabot/cargo/parity-wasm-0.36
Update parity-wasm requirement from 0.35 to 0.36
2019-02-05 08:28:53 +01:00
Alex Crichton
3de5253554 Remove passive segment tests for now 2019-02-04 22:24:08 -08:00
Alex Crichton
ef37986541 Update more parity-wasm 2019-02-04 22:06:10 -08:00
Nick Fitzgerald
e20c4067dc futures: Add a test for creating multiple futures from the same promise 2019-02-04 16:38:21 +01:00
dependabot[bot]
4a50d7b71c
Update parity-wasm requirement from 0.35 to 0.36
Updates the requirements on [parity-wasm](https://github.com/paritytech/parity-wasm) to permit the latest version.
- [Release notes](https://github.com/paritytech/parity-wasm/releases)
- [Commits](https://github.com/paritytech/parity-wasm/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-04 08:30:40 +00:00
Pauan
e4294babeb Simplifying the error handling code 2019-02-04 02:08:08 +01:00
Pauan
8b6e951e34 Adding in Reflect::get_f64, Reflect::get_u32, Reflect::set_f64, and Reflect::set_u32 2019-02-04 01:32:43 +01:00
T5uku5hi
fb8e158c9b remove unnecessary changes 2019-02-03 22:44:27 +09:00
T5uku5hi
51f7756e83 add #[allow(clippy::*)] to 901 line 2019-02-03 22:40:24 +09:00
T5uku5hi
d3a523439e comment out the all #[allow(clippy::*)] lines 2019-02-03 13:55:57 +09:00
T5uku5hi
223054811d fixed conflict 2019-02-03 13:49:42 +09:00
Alex Crichton
2e80313aa3
Merge pull request #1221 from rhysd/format-dts-file
Format .d.ts file
2019-02-01 09:24:49 -06:00
rhysd
6e2f10440e give 2 space indentations to each enum variant 2019-02-01 16:25:25 +09:00
rhysd
a1995cafd4 remove unnecessary blank lines in .d.ts file 2019-02-01 16:07:31 +09:00
rhysd
23ccd3b5c1 remove unnecessary space before function name in .d.ts file 2019-02-01 16:07:12 +09:00
rhysd
019a0863c4 give class members 2 spaces indentation in .d.ts files 2019-02-01 15:45:01 +09:00
Chinedu Francis Nwafili
965bd8c9fa
Clean up 2019-01-31 07:32:12 -05:00
Alex Crichton
9224455077 Support Option with custom enums in JS
Find a hole automatically to use a sentinel value for `None`, and then
just wire everything up!

Closes #1198
2019-01-28 14:27:57 -08:00
Alex Crichton
c35d6f4b0a Fix conditional #[wasm_bindgen] in impls
Reported in #1191 the fix requires us to get a bit creative I think. The
general gist is that a block like this:

    #[wasm_bindgen]
    impl Foo {
        pub fn foo() {}
    }

was previously expanded all in one go. Now, however, it's expanded into:

    impl Foo {
        #[__wasm_bindgen_class_marker(Foo = "Foo")]
        pub fn foo() {}
    }

    // goop generated by orginal #[wasm_bindgen]

This method of expansion takes advantage of rustc's recursive expansion
feature. It also allows us to expand `impl` blocks and allow inner items
to not be fully expanded yet, such as still having `#[cfg]` attributes
(like in the original bug report).

We use theinternal `__wasm_bindgen_class_marker` to indicate that we're
parsing an `ImplItemMethod` unconditionally, and then generation
proceeds as usual. The only final catch is that when we're expanding in
an `impl` block we have to generate tokens for the `Program`
(wasm-bindgen injected goop like the custom section) inside the body
of the function itself instead of next to it. Otherwise we'd get syntax
errors inside of impl blocks!

Closes #1191
2019-01-28 12:29:01 -08:00
Chinedu Francis Nwafili
fa1d51fe44
Comment out WebGl tests 2019-01-26 12:19:28 -05:00
Chinedu Francis Nwafili
2e6880c43c
Whitelist WebGlRenderingContext float slices 2019-01-26 12:10:08 -05:00
T5uku5hi
e19306c6a9 add #[allow(clippy::*)] in the top-level items 2019-01-25 14:44:10 +09:00
Henry
2a6d2004e1
minor typo in js-sys lib.rs 2019-01-24 15:35:21 -08:00
rhysd
3300301b3f add '| undefined' to optional types in generated .d.ts 2019-01-23 20:49:52 +09:00
Chinedu Francis Nwafili
048a22bc77 Fix idl_type swap 2019-01-22 21:35:22 -05:00
Chinedu Francis Nwafili
48b64f4cfe
Remove test file 2019-01-21 19:24:37 -05:00
Chinedu Francis Nwafili
1738f0772c
Add immutable field to IdlType::Float32Array 2019-01-21 19:18:35 -05:00
Chinedu Francis Nwafili
216b4e36ff
Rename immutable slices test 2019-01-21 16:59:02 -05:00
Chinedu Francis Nwafili
e6971cee34
Add failing immutable slice test 2019-01-21 16:59:02 -05:00
Chinedu Francis Nwafili
459639137c
Add maybe adjust function 2019-01-21 16:59:01 -05:00
Alex Crichton
78c4075e40 Bump to 0.2.33 2019-01-18 15:32:17 -08:00
Alex Crichton
ba732a8a72
Merge pull request #1161 from derekdreery/debug_output
Better output from `impl Debug for JsValue`.
2019-01-17 16:52:13 -08:00
Richard Dodd (dodj)
867b13b65e
remove array check 2019-01-17 21:07:23 +00:00
Nick Fitzgerald
d79ca22234
Merge pull request #1190 from sagan-software/issue-1186
js-sys: JSON::stringify_with_replacer[_and_space]
2019-01-16 16:38:59 -08:00
Liam Curry
6226e6959f js-sys: JSON::stringify_with_replacer[_and_space]
This commit adds two new externs for `JSON.stringify`:
`JSON::stringify_with_replacer` and
`JSON::stringify_with_replacer_and_space`.

Fixes #1186
2019-01-16 18:03:03 -05:00
Nick Fitzgerald
31fdede9fc Bump to 0.2.32 2019-01-16 13:11:13 -08:00
Richard Dodd
b0906fddba Better recognition of error type. 2019-01-16 15:36:13 +00:00
Richard Dodd
5f2ba3f98e Add better support for errors. 2019-01-16 10:46:26 +00:00
Richard Dodd
5bffc28631 Add a proper test.
And fix loads of bugs.
2019-01-16 10:16:29 +00:00
Richard Dodd
b60d82a531 Implement suggestings from @fitzgen. 2019-01-16 10:16:29 +00:00
Richard Dodd
72765757ef Fix tests again. 2019-01-16 10:16:29 +00:00
Richard Dodd
126efd5a95 Redo as js function + fix tests 2019-01-16 10:16:29 +00:00
Richard Dodd
5b51d279b4 Use toString where JSON.stringify didn't work 2019-01-16 10:16:29 +00:00
Richard Dodd
34bab511e5 Use JSON serialization to get better debug printouts. 2019-01-16 10:16:29 +00:00
Nick Fitzgerald
41eefa7425 wasm-bindgen-test: Capture more console logging methods' output
Fixes #1183
2019-01-15 14:05:22 -08:00
rhysd
8d6839878e fix missing semicolons to struct fields in .d.ts
TypeScript class property requires semicolon at the end:
    https://www.typescriptlang.org/docs/handbook/classes.html
2019-01-15 17:45:11 +09:00
Alex Crichton
715b4f4ced
Merge pull request #1179 from alexcrichton/catch-all-errors
In debug mode log all imported uncaught exceptions
2019-01-14 17:28:15 -08:00
Alex Crichton
f2f11a01a2 In debug mode log all imported uncaught exceptions
This commit updates the `--debug` output of `wasm-bindgen` from the CLI
to catch all JS exceptions from imported functions, log such, and then
rethrow. It's hoped that this can be used when necessary to learn more
information about thrown exceptions and where an uncaught exception
could be causing issues with Rust code.

Closes #1176
2019-01-14 15:59:31 -08:00
Alex Crichton
5c04427382
Merge pull request #1175 from alexcrichton/internal-consistency
Fix an issue where closure rewriting required class internals
2019-01-14 15:53:40 -08:00
Alex Crichton
20e871f676 Fix an issue where closure rewriting required class internals
Surfaced through previous sanity-checking commits, this reorders some
internal operations to...

Closes #1174
2019-01-14 15:53:29 -08:00
Alex Crichton
b21489368c Ensure internal exported_classes map is consistent
Throw it in an `Option` and then `take()` it when we consume it to
ensure that future calls to insert data into it panic instead of
producing inconsistent JS.
2019-01-14 15:53:29 -08:00
Nick Fitzgerald
f2cbbb83f3 wasm-bindgen-test: ignore example code that is not intended to compile
This was making `cargo test --all` fail.
2019-01-14 14:53:46 -08:00
Nick Fitzgerald
56c4385f42 wasm-bindgen-test: Rename console_*_redirect to on_console_*
Since we are no longer redirecting all console logs, and are instead just
observing them.
2019-01-14 14:51:28 -08:00
Nick Fitzgerald
a94f3f4403 wasm-bindgen-test: Have the test runner JS call the original console.log
This makes control flow a little easier to follow and avoids wasm->js->wasm
re-entrancy.
2019-01-14 14:51:28 -08:00
Nick Fitzgerald
51ef19b85f wasm-bindgen-test: Use spread array arguments instead of arguments objects
Our testing runtime tries to call `Array.prototype.forEach` on this object, so
it had damn well better be a proper array!

Fixes #1167
2019-01-14 14:51:28 -08:00
Alex Crichton
c0ddabcca1 Sanity check exposed_globals map
Make sure that we don't actually try to expose something when they've
already been written, causing an internal tool panic rather than wrong
JS.
2019-01-14 13:09:05 -08:00
lcnr/Bastian Kauschke
6e08f579a6 add temporary test 2019-01-14 21:04:29 +01:00
lcnr/Bastian Kauschke
4e611c318e fix spawn_local 2019-01-12 17:42:05 +01:00
Alex Crichton
12893183b6
Merge pull request #1164 from alexcrichton/fix-tests
Fix and execute wasm-bindgen-wasm-interpreter tests
2019-01-11 18:45:47 -08:00
Alex Crichton
61a6fcfced Fix and execute wasm-bindgen-wasm-interpreter tests 2019-01-11 13:20:08 -08:00
Richard Dodd
cb8bf9390d Implement webidl sequences. 2019-01-11 19:14:07 +00:00
Ryan Levick
c056235530 Simply remove the web-sys bindings 'tested' list 2019-01-10 19:06:11 +01:00
Alex Crichton
b04f60cf2b Bump to 0.2.31 2019-01-09 09:17:50 -08:00
Alex Crichton
f404182c47 Fix a typo 2019-01-07 11:00:15 -08:00
Alex Crichton
9dced1d99b
Merge pull request #1147 from alexcrichton/more-slicing
Add conversions between typed arrays and Rust
2019-01-07 12:59:38 -06:00
Alex Crichton
8b0416a0e5
Merge pull request #1155 from derekdreery/fix_dictionaries
Make dictionaries use their original text in js
2019-01-07 12:45:15 -06:00
Richard Dodd
8bc9fad103 Fix error 2019-01-07 17:40:42 +00:00
Richard Dodd
3d2efb0dff Add test to check case of field. 2019-01-07 17:09:10 +00:00
Alex Crichton
194a169c24
Merge pull request #1148 from derekdreery/spawn_local
Spawn local
2019-01-07 10:27:44 -06:00
Alex Crichton
fbf000a508 Bump to 0.2.30 2019-01-07 07:47:07 -08:00
Richard Dodd
687fc278a7 Revert previous change. 2019-01-07 14:23:10 +00:00
Richard Dodd
46d4330637 Make dictionaries use their original text in js 2019-01-07 14:15:00 +00:00
Stefan Lau
0427ede5e9 [HTMLMediaElement] Reintroduce srcObject
This was removed when mozilla specific extensions were removed. It is not
mozilla specific though and currently the only way to show webcam data in
a video element that I am aware of.
2019-01-06 17:07:43 +01:00
Richard Dodd
73913c99f2 Relax bound on Future 2019-01-05 18:10:14 +00:00
Richard Dodd
25ac4549a0 Docs 2019-01-05 14:37:39 +00:00
Richard Dodd
c849ef3cf4 Add naive spawn_local implementation + tests
This is just a naive implementation. It seems it can be improved using a
custom task queue, but that can be in a separate PR.
2019-01-05 14:34:50 +00:00
Alex Crichton
2d7f601696 Add conversions between typed arrays and Rust
For all typed arrays, this commit adds:

* `TypedArray::view(src: &[Type])`
* `TypedArray::copy_to(&self, dst: &mut [Type])`

The `view` function is unsafe because it doesn't provide any guarantees
about lifetimes or mutability. The `copy_to` function is, however, safe.

Closes #811
2019-01-04 10:42:14 -08:00
Alex Crichton
b4f172899c Fix order of export/gc
We might gc a table away so if we need to export it be sure to do so
before we gc! Additionally remove an extraneous gc that snuck in at some
point, no need to do more than one.

Closes #1130
2019-01-03 11:38:28 -08:00
Alex Crichton
47c4347955 Update UI tests 2019-01-02 08:35:05 -08:00
Daniel Barney
3858fe773f
fixing a small spelling error
I realize that this is just fixing spelling on some comments and a fairly minor correction at that.
2018-12-29 22:26:51 -07:00
Alex Crichton
9db0addb63 Update wat syntax with upstream changes 2018-12-19 15:49:05 -08:00
Alex Crichton
9237d4cf2c Flag all web-sys methods as structural
This was an intended change from #1019, but we forgot to apply it!

Closes #1095
2018-12-17 10:43:48 -08:00
Alex Crichton
ae49dd8697 Uncomment a webidl method we now support
First commented out in #568 when we didn't support this we now do!

Closes #1111
2018-12-14 13:25:35 -08:00
Alex Crichton
c6b74ffb43
Merge pull request #1106 from mvlabat/default-support
Add support for importing default exports
2018-12-11 15:48:10 -06:00
mvlabat
371e864509 Add support for importing default exports 2018-12-11 21:00:00 +02:00
dependabot[bot]
1610d199e3
Update rouille requirement from 2.1.0 to 3.0.0
Updates the requirements on [rouille](https://github.com/tomaka/rouille) to permit the latest version.
- [Release notes](https://github.com/tomaka/rouille/releases)
- [Changelog](https://github.com/tomaka/rouille/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tomaka/rouille/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-10 08:16:06 +00:00
DavidOConnor
a4bc5049c6 Added an --out-name param to the CLI, to allow custom output file names 2018-12-04 21:35:05 -05:00
Alex Crichton
63e3ba722d Bump to 0.2.29 2018-12-04 06:04:47 -08:00
Alex Crichton
a83c3af4bf Ensure our JS heap is a dense array
Turns out `heap.fill(undefined)` is required to ensure it's a dense
array, otherwise we'll accidentally be a sparse array and much slower
than necessary!
2018-11-30 13:23:41 -08:00