Commit Graph

1559 Commits

Author SHA1 Message Date
1ea3c37b5f Merge pull request #727 from quelledanielle/js_string_locale_compare
Add binding for String.prototype.localeCompare
2018-08-18 22:08:02 -07:00
78369637f8 Merge pull request #721 from eminence/console_log
Show how to use web-sys::console::log from the console_log example
2018-08-18 22:07:31 -07:00
27d48ad267 Add bindings for String.from_code_point 2018-08-18 21:35:38 -04:00
00a0152adf Rename local param to locale 2018-08-18 21:05:12 -04:00
0d3f706195 Add binding for String.prototype.localeCompare 2018-08-18 21:05:02 -04:00
d9fd2147a0 [wip] support variadic javascript function parameters 2018-08-18 22:15:29 +01:00
302f7ba21d Fix missing WindowOrWorkerGlobalScope partial interface mixins.
Without the "mixin" keyword, wasm_bindgen_webidl would report:

     Partial interface WindowOrWorkerGlobalScope missing non-partial interface

Also, including the "mixin" keyword here is consistent with the official
webidl spec (for example see https://fetch.spec.whatwg.org/#fetch-method)
2018-08-18 11:23:29 -04:00
c543b5d149 Add extends attributes for js_sys:Generator 2018-08-18 09:11:07 -05:00
4a994da904 Show how to use web-sys::console::log from the console_log example 2018-08-17 22:54:59 -04:00
751f226170 Merge branch 'master' of git://github.com/rustwasm/wasm-bindgen 2018-08-18 01:58:11 +02:00
6dccb7f777 Remove blank line
Part of #670
2018-08-17 14:50:15 -07:00
bec3178e3c Make all errors extend Object
Part of #670
2018-08-17 13:10:56 -07:00
687412ec50 Test for AsRef implementations
Part of #670
2018-08-17 13:09:30 -07:00
7a08da9205 Merge pull request #716 from eminence/webaudio
Initial example of using the WebAudio APIs from web-sys
2018-08-17 08:24:55 -07:00
4f18e21659 Initial example of using the WebAudio APIs from web-sys
Part of #443
2018-08-17 07:02:48 -04:00
57693ee11a Bump to 0.2.17 0.2.17 2018-08-16 23:36:42 -07:00
a4e8fb6686 Fix compile on latest nightly 2018-08-16 23:30:40 -07:00
37068cb47f Fix tests on nightly 2018-08-16 23:25:57 -07:00
25b6f5d982 Merge pull request #702 from alexcrichton/dictionaries
Implement support for WebIDL dictionaries
2018-08-16 13:06:06 -07:00
ffccfdee7d WebAssembly::Table::new takes an object 2018-08-16 20:41:07 +02:00
b519c290f9 futures should be a dev dependency 2018-08-16 20:40:19 +02:00
0a47a1f9e2 Merge pull request #715 from kraai/patch-1
Check that all errors are instances of Object
2018-08-16 09:28:58 -07:00
c8d0c57990 Check that all errors are instances of Object
Part of #670
2018-08-16 07:14:12 -07:00
f8354b3a88 Merge pull request #711 from fitzgen/get-canvas-example-working
Get canvas example working
2018-08-15 18:29:19 -07:00
34363aff12 example: Add an example of drawing a smiley face with canvas
Adapted from https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_shapes
2018-08-15 17:40:39 -07:00
d6e48195b3 Implement support for WebIDL dictionaries
This commit adds support for generating bindings for dictionaries defined in
WebIDL. Dictionaries are associative arrays which are simply objects in JS with
named keys and some values. In Rust given a dictionary like:

    dictionary Foo {
        long field;
    };

we'll generate a struct like:

    pub struct Foo {
        obj: js_sys::Object,
    }

    impl Foo {
        pub fn new() -> Foo { /* make a blank object */ }

        pub fn field(&mut self, val: i32) -> &mut Self {
            // set the field using `js_sys::Reflect`
        }
    }

    // plus a bunch of AsRef, From, and wasm abi impls

At the same time this adds support for partial dictionaries and dictionary
inheritance. All dictionary fields are optional by default and hence only have
builder-style setters, but dictionaries can also have required fields. Required
fields are exposed as arguments to the `new` constructor.

Closes #241
2018-08-15 17:08:27 -07:00
b8afa0abde web-sys: Use mixins instead of [NoInterfaceObject] interfaces and implements
I think these might all be from before WebIDL mixins existed. Either way,
multiple inheritance of interfaces that don't have exposed interface objects is
equivalent to mixins.
2018-08-15 16:57:23 -07:00
69cc7725d6 webidl: Add some more logging for debugging code generation 2018-08-15 16:57:23 -07:00
9616ef3633 web-sys: Remove a bunch of mozilla extensions from our webidl 2018-08-15 16:57:23 -07:00
703e2a3fbe web-sys: Fix typedef of nsISupports
The JS Object type is named "object" in webidl, not "Object".
2018-08-15 16:57:23 -07:00
88582ec47c webidl: Fix warning about partial interfaces without non-partial definition 2018-08-15 16:57:23 -07:00
13fe2b4aca Merge pull request #709 from fitzgen/webidl-and-logging
Webidl and logging
2018-08-15 15:09:53 -07:00
b698eb5d6a Add more WebAssembly bindings 2018-08-15 23:45:28 +02:00
190b45d59c Merge pull request #708 from sendilkumarn/extends-arr
Adds Extends to TypedArrays
2018-08-15 23:45:04 +02:00
ea137a951b web-sys: Remove a few more interfaces from gecko's test suite 2018-08-15 14:34:59 -07:00
21063fd42f webidl: Make logging a little more consistently formatted
This commit makes these changes:

* Unsupported constructs always log "unsupported" for easy `grep`ing
* There is always a "<generic message> : <details>" format now, so we can easily
  use `cut` to grab the generic message and count which kinds of things are our
  biggest missing features.
* Make sure that we have different `warn!` logs for each kind of unsupported
  thing, instead of grouping them together.

Put all that together and this is the current state of `wasm-bindgen-webidl` and
`web-sys`:

```
$ grep WARN stderr.txt | grep wasm_bindgen_webidl | grep -i unsupported | cut -d ' ' -f5- | cut -d ':' -f 1 | sort | uniq -c | sort -rn
    387 Unsupported WebIDL Dictionary definition
    139 Unsupported argument type
     70 Unsupported return type
     47 Unsupported WebIDL Callback definition
     22 Unsupported WebIDL extended attribute
     18 Unsupported unnamed operation
      9 Unsupported WebIDL CallbackInterface definition
      7 Unsupported WebIDL Stringifier interface member
      7 Unsupported WebIDL Maplike interface member
      2 Unsupported webidl stringifier
      2 Unsupported WebIDL Setlike interface member
      2 Unsupported stringifier on type
```
2018-08-15 14:24:09 -07:00
af9ecac296 js-sys: Add extends attributes for js_sys::Float64Array
address review comments

add review comments
2018-08-15 22:50:27 +02:00
c1f7b42662 web-sys: Provide more info in logs when type conversion fails 2018-08-15 11:45:45 -07:00
a40f83ea1b web-sys: Remove a bunch of non-standard, Mozilla-specific Web IDL 2018-08-15 11:12:22 -07:00
6b5beda8d1 web-sys: Add a type alias to Object from nsISupports 2018-08-15 10:54:50 -07:00
a45676045e Merge pull request #705 from alexcrichton/promise
Translate WebIDL `promise` type to `js_sys::Promise`
2018-08-14 21:41:25 -07:00
8c4d8d0b05 Merge pull request #706 from fitzgen/guide-types-section-stuff
Guide types section stuff
2018-08-14 19:02:43 -07:00
b15ebf27a8 Merge pull request #687 from eminence/misc_fixes
Misc fixes and enable tests on appveyor
2018-08-14 18:59:44 -07:00
a5a8fd747d guide: Split supported types section up into many sub sections 2018-08-14 18:01:17 -07:00
b1e3101fd4 guide: Add examples for number slices 2018-08-14 17:42:47 -07:00
fea41b4a87 guide: also allow Option<bool> 2018-08-14 17:34:16 -07:00
9c9e53485a guide: Add examples of boxed number slices 2018-08-14 17:15:01 -07:00
5af2837b96 Enable js-sys, web-sys, and webidl-tests tests in appveyor 2018-08-14 19:12:29 -04:00
156eb24359 Use raw string in paths in webidl-tests generated code
This fixes things on Windows, which uses backslashes in their paths
2018-08-14 19:11:58 -04:00
ca5e7b8542 Fix for some unused import warnings 2018-08-14 19:11:38 -04:00