Commit Graph

2938 Commits

Author SHA1 Message Date
79cf4f6198 Add first-class support for binary crates (#1843)
* autodiscover an exported `main` if possible

this allows for first-class support of binary crates

* wrap `main` to zero out arguments and suppress return value

* add test for bin crate support

* process only the export of the generated main wrapper

* skip most of `export` since only one line of that is needed
2019-11-04 13:34:42 -06:00
b29c110d01 Remove dependencies on git versions of crates 2019-11-04 10:37:50 -08:00
935f71afec Switch from failure to anyhow (#1851)
This commit switches all of `wasm-bindgen` from the `failure` crate to
`anyhow`. The `anyhow` crate should serve all the purposes that we
previously used `failure` for but has a few advantages:

* It's based on the standard `Error` trait rather than a custom `Fail`
  trait, improving ecosystem compatibility.
* We don't need a `#[derive(Fail)]`, which means that's less code to
  compile for `wasm-bindgen`. This notably helps the compile time of
  `web-sys` itself.
* Using `Result<()>` in `fn main` with `anyhow::Error` produces
  human-readable output, so we can use that natively.
2019-11-04 11:35:28 -06:00
913fdbc3da Update HTMLImageElement IDL to latest version from gecko (#1842)
* Update HTMLImageElement IDL to latest version from gecko

* Remove Mozilla-specific extensions to HTMLImageElement IDL
2019-10-29 18:11:19 -05:00
1f51831c3d Adding in to_vec method for typed arrays (#1844)
* Adding in to_vec method for typed arrays

* Fixing type error
2019-10-29 18:10:18 -05:00
6159d50eb6 Fix expired Discord link in README.md (#1845) 2019-10-29 17:56:07 -05:00
c7c169ae72 Bump to 0.2.53 (#1840) 0.2.53 2019-10-29 09:37:37 -05:00
9b8711a5b7 Update webidl_ty field in multi-value transform (#1839)
* Reduce indentation in interface types processing

Just a small stylistic change

* Update `webidl_ty` field in multi-value transform

When we're emitting a bindings section we need to be sure to update the
listed type of the binding in addition to the actual binding
expressions. This should help remove the stray return pointer being
listed there by accident!
2019-10-29 08:55:01 -05:00
0397e529e0 Add debugging names for multivalue shims 2019-10-28 20:15:46 -07:00
513285f73d Run rustfmt 2019-10-28 20:15:05 -07:00
a20dd26dde Bump to 0.2.52 (#1833) 0.2.52 2019-10-24 16:08:45 -05:00
e880baf11d Working around bug in Safari (#1829) 2019-10-22 17:26:28 -05:00
c1b4f67444 Adding in unintern function (#1828)
* Adding in unintern function

* Adding in some basic unit tests for interning and uninterning
2019-10-22 17:23:30 -05:00
777a12dc70 Fix TypeScript capitalization in internals guide (#1826) 2019-10-21 09:27:48 -05:00
fe4dd0b301 Merge pull request #1805 from fitzgen/wasm-interface-types-and-multi-value
Wasm interface types and multi-value
2019-10-18 10:03:37 -07:00
46cbd19e60 Improve worker.js reliability (#1820)
While it doesn't happen right now in this particular example, `lastPtr` can be potentially overridden several times before the module is fully initialised.

Rather than having a boolean and a storage for one last argument, `await` a promise returned from `wasm_bindgen` itself in the new `onmessage` handler before executing actual command.

This way all the potential tasks will queue up naturally, wait for the initialisation, and then execute in a correct order.
2019-10-17 17:29:37 -05:00
a31b81307c Update Worklet IDL to latest version from gecko (#1817) 2019-10-16 09:41:25 -05:00
c7514b7ee8 Enable selectionStart and selectionEnd for HTMLInputElement (#1811) 2019-10-08 09:58:59 -07:00
ebef7a7aa7 Update toolchain for raytrace example (#1806)
Pulls in an LLVM tweak which emits far fewer `memory.copy`, drastrically
improving performance on Firefox!
2019-10-04 10:54:15 -05:00
0e3b696fb7 Fix return type of WebIDL indexing getters (#1789)
* Wrap the return type of indexing getters as Option<T> if necessary.

* Update tests for indexing getters

* Fix typo

* Add comments describing what the code segment is doing

* Update indexing getter usage

* Revert "Add comments describing what the code segment is doing"

This reverts commit 624a14c0fffb78e8eaed21658ddddbad70b2462d.

* Revert "Fix typo"

This reverts commit 487fc307bc08c2a7778b2117fb03f0f5eb5a3c18.

* Revert "Wrap the return type of indexing getters as Option<T> if necessary."

This reverts commit 547f3dd36c1182928ff728a8452591a492b65e21.

* Update the return signatures of WebIDL indexing getters
2019-10-03 19:48:37 -05:00
25dd84c503 Get rid of the wasm interface types return pointer hacks
Now that using standard Wasm interface types implies multi-value support, we
don't need these return pointer hacks anymore.
2019-10-03 13:24:50 -07:00
311ae1941f Wasm interface types should imply multi-value 2019-10-03 12:57:26 -07:00
085924567f Fix guide for tests in the remote browser (#1804) 2019-10-03 09:27:07 -05:00
ffa6eabffe fixed broken link (#1803) 2019-10-03 09:26:54 -05:00
74812bd236 Merge pull request #1802 from alexcrichton/switch-cores
Don't offset the number of rayon workers by 1
2019-10-02 11:25:05 -07:00
53c0dcf17a Don't offset the number of rayon workers by 1
If we pass rayon 0 workers it still spawns 1, so both 1 and 2 threads
were actually spawning one thread each. Let's remove the off-by-one so
1 and 2 cores should show a significant difference.
2019-10-01 18:10:18 -07:00
6d1dc813c4 Bump to 0.2.51 (#1797)
This notably brings in async/await support for current beta/nightly
users. Yay!
0.2.51
2019-09-26 14:07:28 -05:00
599ec8b9f4 Use official node releases for anyref test suite (#1798)
Looks like 12.11.0 has all the support we need!
2019-09-26 14:07:21 -05:00
bdcf27c7cb Major improvements to wasm-bindgen-futures (#1760)
This PR contains a few major improvements:

* Code duplication has been removed.

* Everything has been refactored so that the implementation is much easier to understand.

* `future_to_promise` is now implemented with `spawn_local` rather than the other way around (this means `spawn_local` is faster since it doesn't need to create an unneeded `Promise`).

* Both the single threaded and multi threaded executors have been rewritten from scratch:

   * They only create 1-2 allocations in Rust per Task, and all of the allocations happen when the Task is created.

   * The singlethreaded executor creates 1 Promise per tick, rather than 1 Promise per tick per Task.

   * Both executors do *not* create `Closure`s during polling, instead all needed `Closure`s are created ahead of time.

   * Both executors now have correct behavior with regard to spurious wakeups and waking up during the call to `poll`.

   * Both executors cache the `Waker` so it doesn't need to be recreated all the time.

I believe both executors are now optimal in terms of both Rust and JS performance.
2019-09-26 13:33:12 -05:00
0b1a764f8a Guarantee static_method_of uses the right this (#1795)
This came up during #1760 where `Promise.resolve` must be invoked with
`this` as the `Promise` object, but we were erroneously importing it in
such a way that it didn't have a shim and `this` was `undefined`.
2019-09-26 12:33:04 -05:00
025b1d8bca Switch to Cargo's -Zbuild-std for building libstd (#1796)
This commit switches away from `xargo` to using `-Zbuild-std` to
building the standard library for the raytrace-parallel example (which
needs to rebuild std with new target features).
2019-09-26 12:32:50 -05:00
6b31777794 Fix local webdriver discovery via PATH (#1794) 2019-09-26 09:49:43 -05:00
0607a75b78 Switch CI to testing beta toolchains (#1792)
Don't accidentally leak in nightly features and bring a modicum of
stability to the UI tests
2019-09-25 12:45:49 -05:00
6f52f2a37c Fix logic for is_enabled in the threads transform (#1791)
The threads transform is implicitly enabled nowadays when the memory
looks like it's shared, so ensure that's taken into account in the
`is_enabled` check.
2019-09-25 11:58:55 -05:00
f4a7fe3ddb More CHANGELOG updates 2019-09-25 09:31:46 -07:00
72f346871c Handle JSON.stringify(undefined)
Turns out that `JSON.stringify(undefined)` doesn't actually return a
string, it returns `undefined`! If we're requested to serialize
`undefined` into JSON instead just interpret it as `null` which should
have the expected semantics of serving as a placeholder for `None`.

Closes #1778
2019-09-25 11:24:48 -05:00
55dbf9478f Don't log routine errors as out-of-the-ordinary
To benefit users in debug mode we log any unexpected exceptions to help
diagnose any issues that might arise. It turns out, though, we log this
for *every* exception happening for *every* import, including imports
like `__wbindgen_throw` which are explicitly intended to throw an
exception. This can cause distracting debug logs to get emitted to the
console, so let's squelch the debug logging for known imports that we
shouldn't log for, such as intrinsics.

Closes #1785
2019-09-25 11:24:27 -05:00
8b4fd2a946 Update CHANGELOG for upcoming release
No release yet, but wanted to write these things down
2019-09-25 11:24:00 -05:00
0afb6aafd3 Fix importing static values of non-JS types
This hasn't ever actually worked in `wasm-bindgen` but there's been
enough refactorings since the initial implementation that it's actually
quite trivial to implement now!

Closes #1777
2019-09-25 11:23:39 -05:00
e809a45c61 Update ui test expectations 2019-09-24 08:23:11 -07:00
a88003c2ec Update env_logger requirement from 0.6 to 0.7 (#1786)
Updates the requirements on [env_logger](https://github.com/sebasmagri/env_logger) to permit the latest version.
- [Release notes](https://github.com/sebasmagri/env_logger/releases)
- [Changelog](https://github.com/sebasmagri/env_logger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sebasmagri/env_logger/compare/v0.6.0...v0.7.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-24 09:00:22 -05:00
9c330529f2 Fix codegen for descriptors of async fn returns (#1782)
They erroneously reported returning the original return type, not the
promise! Let's also add a bunch of positive tests while we're at it.

Closes #1781
2019-09-20 16:06:27 -05:00
8ba0142dd2 Update UI expectations 2019-09-20 11:50:39 -07:00
d1f104567b Fix file permissions (#1779) 2019-09-20 13:50:00 -05:00
93f5bbaf95 Update async-errors test for nightly 2019-09-19 07:03:03 -07:00
eeebec0765 Add ability to run tests on remote webdriver. (#1744)
* Add ability run tests on remote webdriver

* Add parsing `webdriver.json` for configure browser capabilities

* Add docs for configuring of browser capabilities

* Remove webdriver dependency
2019-09-19 09:00:51 -05:00
04c9b32e34 Merge pull request #1764 from fitzgen/multi-value-xform
Use multi-value with interface types
2019-09-16 13:36:33 -07:00
b2d1165724 CI: Temporarily disable sccache usage
It is failing to install / setup on CI.
2019-09-16 13:15:20 -07:00
a0582cd6f2 rustfmt the publish script 2019-09-16 12:54:05 -07:00
d9c4164c11 Also publish the wasm-bindgen-wasm-conventions crate 2019-09-16 12:54:05 -07:00