Commit Graph

264 Commits

Author SHA1 Message Date
Frazer McLean
751f226170 Merge branch 'master' of git://github.com/rustwasm/wasm-bindgen 2018-08-18 01:58:11 +02:00
Matt Kraai
6dccb7f777 Remove blank line
Part of #670
2018-08-17 14:50:15 -07:00
Matt Kraai
bec3178e3c Make all errors extend Object
Part of #670
2018-08-17 13:10:56 -07:00
Matt Kraai
687412ec50 Test for AsRef implementations
Part of #670
2018-08-17 13:09:30 -07:00
Alex Crichton
57693ee11a Bump to 0.2.17 2018-08-16 23:36:42 -07:00
Frazer McLean
ffccfdee7d WebAssembly::Table::new takes an object 2018-08-16 20:41:07 +02:00
Frazer McLean
b519c290f9 futures should be a dev dependency 2018-08-16 20:40:19 +02:00
Matt Kraai
c8d0c57990 Check that all errors are instances of Object
Part of #670
2018-08-16 07:14:12 -07:00
Frazer McLean
b698eb5d6a Add more WebAssembly bindings 2018-08-15 23:45:28 +02:00
Sendil Kumar N
190b45d59c
Merge pull request #708 from sendilkumarn/extends-arr
Adds Extends to TypedArrays
2018-08-15 23:45:04 +02:00
Sendil Kumar
af9ecac296 js-sys: Add extends attributes for js_sys::Float64Array
address review comments

add review comments
2018-08-15 22:50:27 +02:00
Sendil Kumar
d9fbc48daa js-sys: Add extends attributes for js_sys::Float32Array 2018-08-14 19:38:33 +02:00
Sendil Kumar
10bc69a8cd js-sys: Add extends attributes for js_sys::Int32Array 2018-08-14 19:34:59 +02:00
Sendil Kumar
2d737c5634 js-sys: Add extends attributes for js_sys::Int16Array 2018-08-14 19:34:43 +02:00
Sendil Kumar
17ef5f9702 js-sys: Add extends attributes for js_sys::Int8Array 2018-08-14 19:34:26 +02:00
Sendil Kumar
b80090d395 js-sys: Add extends attributes for js_sys::UInt32Array 2018-08-14 19:32:34 +02:00
Sendil Kumar
e58e231fdf js-sys: Add extends attributes for js_sys::UInt16Array 2018-08-14 19:32:14 +02:00
Sendil Kumar
2979618842 js-sys: Add extends attributes for js_sys::UInt8ClampedArray 2018-08-14 19:31:49 +02:00
Sendil Kumar
ea0ac134db js-sys: Add extends attributes for js_sys::Uint8Array 2018-08-14 19:29:13 +02:00
Thomas Eizinger
44f2ac0e9f Add bindings for Intl.NumberFormat and Intl.PluralRules 2018-08-14 13:46:06 +10:00
Thomas Eizinger
ade4a2c97a Fix typo in Intl.DateTimeFormat documentation 2018-08-14 13:45:49 +10:00
Alex Crichton
c0c27775f3
Merge pull request #681 from sepiropht/master
[670] add extends for some types
2018-08-13 18:39:53 -06:00
Alex Crichton
595162b35d
Merge pull request #691 from thomaseizinger/bindings/intl-datetimeformat
Add bindings for Intl.DateTimeFormat
2018-08-13 18:23:57 -06:00
sepiropht
96c24c47a2 add extends for JsString 2018-08-14 00:47:36 +02:00
Thomas Eizinger
ea74b8acba Add bindings for Intl.DateTimeFormat 2018-08-14 07:50:13 +10:00
Nick Fitzgerald
a434880229 Bump js-sys to 0.2.1 2018-08-13 14:32:52 -07:00
Nick Fitzgerald
8974a57fb9 Bump to version 0.2.16 2018-08-13 14:27:10 -07:00
Danielle Pham
30fc99b724 Use u32 params for String.from_char_code bindings 2018-08-13 17:03:58 -04:00
Danielle Pham
fd5958b51b Add bindings for String.from_char_code 2018-08-13 00:19:43 -04:00
Sendil Kumar N
539e987cdb
Merge pull request #685 from fitzgen/a-few-more-js-sys-things
A few more js sys things
2018-08-11 07:52:26 +02:00
Nick Fitzgerald
36e15149c7 js-sys: Add bindings for TypeError 2018-08-10 13:45:39 -07:00
Nick Fitzgerald
38ef5f9ffe js-sys: Add bindings for SyntaxError 2018-08-10 13:42:13 -07:00
Nick Fitzgerald
a58c2584b3 js-sys: Add bindings to URIError 2018-08-10 13:37:34 -07:00
Nick Fitzgerald
2a3d01c380
Merge pull request #683 from eminence/json
Add initial support and tests for JSON
2018-08-10 13:27:40 -07:00
Nick Fitzgerald
7af4e62d99 js-sys: Add bindings for Symbol.unscopables 2018-08-10 13:23:17 -07:00
Nick Fitzgerald
178a5e89df js-sys: add bindings for regexp.lastIndex 2018-08-10 13:14:54 -07:00
Nick Fitzgerald
dc028d38c8 js-sys: Add bindings to ReferenceError 2018-08-10 13:03:56 -07:00
Nick Fitzgerald
879fd43edb js-sys: Add bindings to RangeError 2018-08-10 13:03:44 -07:00
Nick Fitzgerald
adad606ee3 js-sys: Add bindings for Object.create 2018-08-10 11:49:22 -07:00
Nick Fitzgerald
4ea1603ddb js-sys: Add bindings to Object.assign 2018-08-10 11:41:58 -07:00
Andrew Chin
1092816652 Use Reflect::set instead of javascript helper 2018-08-10 14:33:21 -04:00
Nick Fitzgerald
f0444d1614 js-sys: Add bindings for Intl.Collator 2018-08-10 11:20:06 -07:00
Andrew Chin
f5203bba8a Handle exceptions from JSON::stringify 2018-08-10 14:13:57 -04:00
Nick Fitzgerald
7f5d0a2158 js-sys: Move Intl from a type to a module, since it is a namespace 2018-08-10 10:46:53 -07:00
Nick Fitzgerald
a66c4de892 js-sys: remove extra new line 2018-08-10 10:40:43 -07:00
Nick Fitzgerald
e667400a83 js-sys: Remove unused import in symbol tests 2018-08-10 10:29:35 -07:00
Nick Fitzgerald
95c55d0b4c js-sys: Add bindings to Array.of 2018-08-10 10:29:22 -07:00
Andrew Chin
23cb0ea656 Add initial support and tests for JSON 2018-08-09 20:54:13 -04:00
Alex Crichton
d390f2fe04
Merge pull request #680 from fitzgen/js-sys-promise-arguments-by-shared-ref
Js sys promise arguments by shared ref
2018-08-09 18:52:32 -06:00
Andrew Chin
70406fe18a Add support and tests for EvalError 2018-08-09 19:26:00 -04:00
Nick Fitzgerald
96ad97a9f9 js-sys: Document that new bindings should take JS things by shared ref 2018-08-09 13:08:51 -07:00
Nick Fitzgerald
e3011d629e js-sys: Promise methods should take JS things by shared reference 2018-08-09 13:08:30 -07:00
Andrew Chin
c371c4a509 Fixup from merge commit 2018-08-09 14:36:37 -04:00
Nick Fitzgerald
f8af399301
Merge branch 'master' into extends_object 2018-08-09 10:57:15 -07:00
Alex Crichton
f85fd0e2ad
Merge pull request #675 from sepiropht/master
[670] add extends for Array type
2018-08-09 09:52:13 -05:00
sepiropht
e9e7072687 [670] add extends for Array type 2018-08-09 14:35:44 +02:00
Andrew Chin
cc8095d065 Add extends attributes for several types
Part of #670
2018-08-08 23:16:57 -04:00
bokuweb
42e02f7769 js-sys: Add extends attributes for js_sys::Number 2018-08-09 10:10:20 +09:00
Nick Fitzgerald
235f9cc04e js-sys: Add extends attributes for js_sys::RegExp
Part of #670
2018-08-08 16:23:12 -07:00
Alex Crichton
b2977a4262 Delete wasm-bindgen-test-project-builder
No more tests use it!
2018-08-06 11:48:34 -07:00
Alex Crichton
d5b81595ec Remove support for the version attribute
First added in #161 this never ended up panning out, so let's remove the
experimental suport which isn't actually used by anything today and hold off on
any other changes until an RFC happens.
2018-08-06 13:30:28 -05:00
Camille TJHOA
aeca24c7ab Add ArrayBuffer.prototype.byteLength to js-sys 2018-08-06 11:44:24 -05:00
Michael Hoffmann
73e89fc59b Add bindings for RegExp.$1-$9 2018-08-06 10:41:06 -05:00
Alex Crichton
eee71de0ce
Support asynchronous tests (#600)
* Tweak the implementation of heap closures

This commit updates the implementation of the `Closure` type to internally store
an `Rc` and be suitable for dropping a `Closure` during the execution of the
closure. This is currently needed for promises but may be generally useful as
well!

* Support asynchronous tests

This commit adds support for executing tests asynchronously. This is modeled
by tests returning a `Future` instead of simply executing inline, and is
signified with `#[wasm_bindgen_test(async)]`.

Support for this is added through a new `wasm-bindgen-futures` crate which is a
binding between the `futures` crate and JS `Promise` objects.

Lots more details can be found in the details of the commit, but one of the end
results is that the `web-sys` tests are now entirely contained in the same test
suite and don't need `npm install` to be run to execute them!

* Review tweaks

* Add some bindings for `Function.call` to `js_sys`

Name them `call0`, `call1`, `call2`, ... for the number of arguments being
passed.

* Use oneshots channels with `JsFuture`

It did indeed clean up the implementation!
2018-08-01 15:52:24 -05:00
Alex Crichton
081f2fdc65 Add Function construtor to js-sys 2018-07-30 11:07:07 -07:00
Alex Crichton
7b4f0072c8 Add support for headless testing
This commit adds support to the `wasm-bindgen-test-runner` binary to
perform headless testing via browsers. The previous commit introduced a
local server to serve up files and run tests in a browser, and this
commit adds support for executing that in an automated fashion.

The general idea here is that each browser has a binary that implements
the WebDriver specification. These binaries (typically `foodriver` for
the browser "Foo") are interfaced with using HTTP and JSON messages. The
implementation was simple enough and the crates.io support was lacking
enough that a small implementation of the WebDriver protocol was added
directly to this crate.

Currently Firefox (`geckodriver`), Chrome (`chromedriver`), and Safari
(`safaridriver`) are supported for running tests. The test harness will
recognize env vars like `GECKODRIVER=foo` to specifically use one or
otherwise detects the first driver in `PATH`. Eventually we may wish to
automatically download a driver if one isn't found, but that isn't
implemented yet.

Headless testing is turned on with the `CI=1` env var currently to be
amenable with things like Travis and AppVeyor, but this may wish to grow
an explicit option to run headless tests in the future.
2018-07-30 11:07:07 -07:00
Michael Hoffmann
f5f541337c Create bindings for RegExp (#580)
* Create bindings for RegExp

* Address review comments

- Split the constructor into two: `new` and `new_regexp`. This way we
  can write RegExp::new("foo", "g") rather than
  RegExp::new(&JsValue::from("foo"), "g").

- The js_name for the setter for lastIndex should be `lastIndex` and
  not `set_lastIndex`. But fixing this causes a panic. Remove the
  method for now.
2018-07-29 16:13:42 -07:00
Joel Gallant
01194558bf Adds Array.prototype.splice() to js-sys (#571) 2018-07-27 10:07:21 -07:00
Jonas Trollvik
037915827b
Fix incorrect url 2018-07-27 10:10:11 +02:00
Nick Fitzgerald
8ec9713dd9 js-sys: Add some more Cargo.toml metadata like license 2018-07-26 15:06:24 -07:00
Nick Fitzgerald
6203fc8f98 js-sys: Add a js-sys specific CHANGELOG.md 2018-07-26 15:05:00 -07:00
Nick Fitzgerald
9a0470b1c4 Bump to 0.2.15 2018-07-26 14:53:59 -07:00
Nick Fitzgerald
a204c8d4b7
Merge pull request #565 from fitzgen/js-sys-iterator-protocol
js-sys: Unify all iterators under one generic iterator type
2018-07-26 14:22:34 -07:00
Nick Fitzgerald
62de3bad67 js-sys: Unify all iterators under one generic iterator type
The JS iterator protocol uses duck typing and we don't need separate
ArrayIterator and SetIterator etc types, we can have a single iterator type for
the whole protocol.
2018-07-26 13:48:52 -07:00
Alex Crichton
41200743af Tweak js-sys tests to pass in Firefox
Turns out date parsing is slightly different there!
2018-07-25 16:55:11 -07:00
Nick Fitzgerald
64591ef403 Js sys use &str arguments (#555)
* js-sys: imports should take &str parameters instead of &JsString

* js-sys: Imports should take Option<&str> instead of Option<String>
2018-07-25 18:50:30 -05:00
Nick Fitzgerald
61fc8d2567 Js sys once over (#550)
* js-sys: Return `f64` instead of `Number`

* js-sys: remove trailing whitespace

* js-sys: Ensure that all imported types derive Clone and Debug

* js-sys: Imported functions should always take JS object arguments by-ref
2018-07-25 16:33:44 -05:00
Nick Fitzgerald
3f5a0fb31c Bump to 0.2.14 2018-07-25 09:46:45 -07:00
Tyler Wilcock
cefe1681ab Implement Math.min() and Math.max() bindings (#542)
* Add Number.isNaN() binding

* Add binding for Math.hypot()

* Implement Math.min() and Math.max() bindings
2018-07-23 23:50:29 -05:00
Tyler Wilcock
5fddcf3868 Add Math.hypot binding (#538)
* Add Number.isNaN() binding

* Add binding for Math.hypot()
2018-07-23 09:11:03 -05:00
Marcin Baraniecki
de0ba29abc implements bindings for Object.is (#537)
* implements bindings for Object.is

* adds counterpart test cases for non-equal values
2018-07-22 12:42:10 -05:00
Alex Crichton
82c2dfa7b2
Bump to 0.2.13 (#536) 2018-07-21 23:10:47 -05:00
Alex Crichton
6679ddfefc Move final js-sys test to a headless suite
Hopefully this doesn't need to get too large over time!
2018-07-21 20:09:45 -07:00
Alex Crichton
59c04e26d4 Port Reflect tests to wasm 2018-07-21 20:07:55 -07:00
Alex Crichton
906cd7adcc Remove usage of wasm_import_module feature
This is now stabilized! Also tweak usage of it to the stable version.
2018-07-21 19:00:40 -07:00
Sendil Kumar
2ef4b74ca6 add unescape 2018-07-21 23:06:36 +02:00
Tyler Wilcock
b7acb0785d Add Number.isNaN() binding (#532) 2018-07-21 15:19:30 -05:00
Alex Crichton
2e5cc810c8 Migrate tests for global functions to wasm 2018-07-20 17:45:00 -07:00
Alex Crichton
5f87ed4cef Port WebAssembly tests to wasm 2018-07-20 17:09:50 -07:00
Alex Crichton
9f7eea1e75 Port WeakSet tests to wasm 2018-07-20 17:07:00 -07:00
Alex Crichton
1d1df09e60 Port WeakMap tests to wasm 2018-07-20 17:01:26 -07:00
Alex Crichton
b667cafb63 Port TypedArray tests to wasm 2018-07-20 16:31:29 -07:00
Alex Crichton
df3530a9c2 Port Symbol and SetIterator tests to wasm 2018-07-20 16:19:10 -07:00
Alex Crichton
54abca7344 Port Set tests to wasm 2018-07-20 15:44:15 -07:00
Alex Crichton
ad86c52b02 Port Proxy tests to wasm 2018-07-20 15:35:15 -07:00
Alex Crichton
01ff04d85c Port Object tests to wasm 2018-07-20 15:23:56 -07:00
Alex Crichton
fb6041cf3b Port Number tests to wasm 2018-07-20 14:35:44 -07:00
Alex Crichton
627ddcb192 Port Math tests to wasm 2018-07-20 14:21:29 -07:00
Alex Crichton
230f923fdb Port MapIterator tests to wasm 2018-07-20 13:57:18 -07:00
Alex Crichton
2c9a606c3d Port Map tests to wasm 2018-07-20 13:46:22 -07:00
Alex Crichton
f3e34d854d Port JsString tests to wasm 2018-07-20 13:35:46 -07:00
Alex Crichton
d76f619298 Port Intl tests to wasm 2018-07-20 13:00:44 -07:00
Alex Crichton
067de51e57 Port Generator tests to wasm 2018-07-20 12:56:32 -07:00
Alex Crichton
f3d4a20ec7 Change Function::apply to catch the result
We don't know whether it'll throw or not!
2018-07-20 12:44:21 -07:00
Alex Crichton
75215134a5 Migrate Function tests to wasm 2018-07-20 12:43:07 -07:00
Alex Crichton
347c1daad9 Tweak instructions in js-sys/src/lib.rs 2018-07-20 12:27:03 -07:00
Alex Crichton
20e9267775 Port Error tests to wasm 2018-07-20 12:21:41 -07:00
Alex Crichton
601b138296 Port Date tests to wasm 2018-07-20 12:07:41 -07:00
Alex Crichton
efd6b2abac Migrate Array tests to wasm-bindgen-test 2018-07-20 11:48:57 -07:00
Alex Crichton
f8d336d711
Add a test harness to directly execute wasm tests (#524)
* Add a test harness to directly execute wasm tests

This commits adds a few new crates and infrastructure to enable comands like:

    cargo test --target wasm32-unknown-unknown

The intention here is to make it as low-friction as possible to write wasm tests
and also have them execute in a reasonable amount of time. Eventually this is
also hopefully enough support to do things like headless testing!

For now though this is defintely MVP status rather than fully fleshed out.
There's some more information at `crates/test/README.md` about how it works and
how to use it, but for now this is mainly intended to play around with locally
in this repository for our own tests.

* Port a numbe of `js-sys` tests to the new test framework

This commit ports a number of existing tests for the `js-sys` crate over to the
new test framework created in the previous commit, showing off how they can be
executed as well as drastictlly simplifying the tests themselves! This is
intended to be a proof of concept for now which we can refine over time. This
should also show off that it's possible to incrementally move over to the new
test framework.
2018-07-20 13:47:49 -05:00
T. Nagasawa
bec1c95b5c bindings for to_locale_XXX_case (#523) 2018-07-20 09:03:29 -05:00
Alex Crichton
2d70a51370 Publication cleanup 2018-07-19 13:03:52 -07:00
Alex Crichton
aa348f963f
Bump to 0.2.12 (#515)
* Bump to 0.2.12

* Update all version numbers and deps
* Update all listed authors to `["The wasm-bindgen Developers"]`
* Update `repository` links to specific paths for each crate
* Update `homepage` links to the online book
* Update all links away from `alexcrichton/wasm-bindgen`
* Add `#[doc]` directives for HTML URLs

* Update more version requirements

* Fill out CHANGELOG
2018-07-19 14:57:04 -05:00
Alex Crichton
6eef5f7b52
Move the js module to a js_sys crate (#512)
* Move the `js` module to a `js_sys` crate

* Update js-sys tests to pass again

* Update binding_to_unimplemented_apis_doesnt_break_everything

Remove its dependency on the `js` module

* Update metadata for js-sys

* Fix the `closures` example
2018-07-19 14:30:58 -05:00