Commit Graph

1980 Commits

Author SHA1 Message Date
Alex Crichton
3001d1e973
Merge pull request #909 from alexcrichton/fix-webidl
Fix our WebIDL for Safari
2018-10-01 14:40:56 -07:00
Alex Crichton
bb7271aa43 Fix our WebIDL for Safari
This commit employs the strategy described in #908 to apply a
non-breaking change to fix WebIDL to be compatible with all browsers,
including Safari.

The problem here is that `BaseAudioContext` and `AudioScheduledSourceNode`
are not types in Safari, but they are types in Firefox/Chrome. The fix
here was to move the contents of these two interfaces into mixins, and
then include the mixins in all classes which inherit from these two
classes. That should have the same effect as defining the methods
inherently on the original interface.

Additionally a special `[RustDeprecated]` attribute to WebIDL was added
to signify interfaces this has happened to. Currently it's directly
tailored towards this case of "this intermediate class doesn't exist in
all browsers", but we may want to refine and extend the deprecation
message over time.

Although it's possible we could do this as a breaking change to
`web-sys` I'm hoping that we can do this as a non-breaking change for
now and then eventually on the next breaking release batch all these
changes together, deleting the intermediate classes. This is also
hopefully a good trial run for how stable web-sys can be when it's
actually stable!

cc #897
cc #908
2018-10-01 12:24:37 -07:00
Alex Crichton
473258f731
Merge pull request #913 from fitzgen/allow-unused-js-sys-object-import
web-sys: allow unused import warning
2018-10-01 10:06:41 -07:00
Nick Fitzgerald
0a48d2bc29 web-sys: allow unused import warning
This import is only used if some features get used and it is way easier to just
quiet the warning when those features aren't used than to try and `cfg` this
import.
2018-10-01 09:53:03 -07:00
Alex Crichton
717cfa303d Fix polyfill of TextEncoder and TextDecoder
This commit does a few things, including:

* Fixing the generated JS of `wasm-bindgen` to allow polyfills to work.
  (a minor tweak of the generated JS)

* All examples are updated to include a Webpack-specific polyfill for
  these two types to get examples working in Edge.

* A new page has been added to the guide about supported browsers. This
  mentions known caveats like IE 11 requiring `wasm2js` as well as
  documenting some `TextEncoder` and `TextDecoder` workarounds for Edge.

Closes #895
2018-09-30 10:16:20 -07:00
Sendil Kumar N
62c5699f48
Merge pull request #911 from alexcrichton/fixed-indexed-db
Fix WebIDL mixin attributes on `Window`
2018-09-29 22:40:27 +02:00
Alex Crichton
8ba41cce6e Improve codegen for Closure<T>
This commit improves the codegen for `Closure<T>`, primarily for ZST
where the closure doesn't actually capture anything. Previously
`wasm-bindgen` would unconditionally allocate an `Rc` for a fat pointer,
meaning that it would always hit the allocator even when the `Box<T>`
didn't actually contain an allocation. Now the reference count for the
closure is stored on the JS object rather than in Rust.

Some more advanced tests were added along the way to ensure that
functionality didn't regress, and otherwise the calling convention for
`Closure` changed a good deal but should still be the same user-facing.
The primary change was that the reference count reaching zero may cause
JS to need to run the destructor. It simply returns this information in
`Drop for Closure` and otherwise when calling it now also retains a
function pointer that runs the destructor.

Closes #874
2018-09-29 07:00:53 -07:00
Alex Crichton
230b8f61fd Fix WebIDL mixin attributes on Window
Previously the "container attribute" were set to the attributes of the
mixin itself, but we want the container attributes to be that of the
type which includes the mixin (like `Window`) as those attributes
contain information about whether or not bindings are `structural`.

The end result with this is that the `structural` tag is now used for
properties on `Window`, correctly generating setters/getters.

Closes #904
2018-09-28 21:41:48 -07:00
Alex Crichton
0ac84c231a
Merge pull request #906 from alexcrichton/polyfill
Implement a `polyfill` attribute for imports
2018-09-28 21:31:44 -07:00
Alex Crichton
10fce93c4e
Merge pull request #907 from alexcrichton/catch-errors
Add `catch(console.error)` to all examples
2018-09-28 21:31:14 -07:00
Alex Crichton
bc36b6f84b Add catch(console.error) to all examples
Some examples have been failing to load in some browsers, and this
ensures that whenever the promise to load Rust code fails we log any
errors happening instead of accidentally failing silently.

This helped debug a bit in #897
2018-09-28 13:55:07 -07:00
Alex Crichton
3c14f7a6eb Implement a polyfill attribute for imports
Allow using imported APIs under alternative names, such as prefixed
names, for web APIs when the exact API differs across browsers.
2018-09-28 13:43:00 -07:00
Alex Crichton
11bcaf42d5
Merge pull request #902 from alexcrichton/target-docs
Add documentation about supported targets
2018-09-27 13:51:17 -07:00
Alex Crichton
7447c30ba4
Merge pull request #903 from alexcrichton/doc-constructors
Add more documentation to `web-sys` constructors
2018-09-27 13:51:07 -07:00
Alex Crichton
69ec889dc5
Merge pull request #900 from alexcrichton/fix-test
Escape HTML text in browser failure messages
2018-09-27 13:50:53 -07:00
Alex Crichton
a0c397d2be
Merge pull request #901 from alexcrichton/inline-unit
Add `#[inline]` for `IntoWasmAbi for ()`
2018-09-27 13:50:38 -07:00
Alex Crichton
114176f8b8 Add documentation about supported targets
* Main target is wasm32-unknown-unknown
* All other targets work ok, but imports panic
* Emscripten explicitly not supported at this time

Closes #892
2018-09-27 13:39:23 -07:00
Alex Crichton
f3dd28e294 Add more documentation to web-sys constructors
Closes #899
2018-09-27 12:35:46 -07:00
Alex Crichton
5a0ac2d37c Add #[inline] for IntoWasmAbi for ()
No need for it to not be inlined, it literally compiles to nothing!
2018-09-27 12:22:05 -07:00
Alex Crichton
fd1a00db76 Escape HTML text in browser failure messages
When browser tests fail we're appending to `innerHTML`, which means that
we need to escape some characters for all to show up!

Closes #898
2018-09-27 12:21:41 -07:00
Alex Crichton
65fc8228f1 Remove a stray script 2018-09-27 12:21:41 -07:00
Alex Crichton
35a7233101
Merge pull request #891 from alexcrichton/rustfmt
cargo +nightly fmt --all
2018-09-26 14:20:33 -05:00
Nick Fitzgerald
826619870f examples(webaudio): allow turning the noise off again 2018-09-26 10:37:12 -07:00
Alex Crichton
7ecf4aae87 cargo +nightly fmt --all
Rustfmt all the things!
2018-09-26 08:26:00 -07:00
Alex Crichton
a3e160744e Update Window example in web-sys 2018-09-26 08:14:14 -07:00
Alex Crichton
7a2f55d2d1 Update another git url 2018-09-26 08:11:55 -07:00
Alex Crichton
3b2448cce1 Update web-sys docs now that it's published 2018-09-26 08:10:18 -07:00
Alex Crichton
18e089fa85 Add some Cargo metadata for web-sys 2018-09-26 08:07:33 -07:00
Nick Fitzgerald
dbbb904562
Merge pull request #890 from fitzgen/bump-to-0.2.23
Bump to version 0.2.23 (and js-sys and wasm-bindgen-futures to 0.3.0)
2018-09-26 07:47:55 -07:00
Nick Fitzgerald
e0f47935db changelog: Note that this is the first web-sys release 2018-09-26 07:44:58 -07:00
Nick Fitzgerald
4c766c5c7a Start web-sys at 0.3.0 2018-09-26 07:37:51 -07:00
Nick Fitzgerald
f834a427d7 Bump to version 0.2.23 (and js-sys and wasm-bindgen-futures to 0.3.0) 2018-09-26 07:31:54 -07:00
Alex Crichton
0ab03bb4c3
Merge pull request #888 from ctaggart/webpack-cli
update to "webpack-cli": "^3.1.1"
2018-09-25 21:52:13 -07:00
Cameron Taggart
052b41b84c update to "webpack-cli": "^3.1.1" 2018-09-25 18:50:27 -07:00
Nick Fitzgerald
ee0e4bc089
Merge pull request #887 from fitzgen/iterating-over-js-values
Iterating over js values
2018-09-25 16:04:50 -07:00
Nick Fitzgerald
a920656e09 guide: Update untyped JS values section to handle fallibility of Reflect::* APIs 2018-09-25 14:30:26 -07:00
Nick Fitzgerald
dfd0f534f9 guide: Add section about iterating over JS values 2018-09-25 14:30:26 -07:00
Nick Fitzgerald
7db28b4548 js-sys: run rustfmt 2018-09-25 14:30:26 -07:00
Nick Fitzgerald
f9cd329b14 js-sys: Add js_sys::try_iter for iterating over any JsValue
Fixes #776
2018-09-25 14:30:26 -07:00
Nick Fitzgerald
e3d2ea2628 js-sys: Catch exceptions thrown in Reflect APIs
Proxies passed to Reflect APIs can throw for any of these operations and it is a
bit of a mess.
2018-09-25 14:30:26 -07:00
Alex Crichton
d50e2f8605
Merge pull request #881 from alexcrichton/test-beta
Start running CI tests on Rust beta
2018-09-25 12:27:41 -07:00
Alex Crichton
9b99ebfc87
Merge pull request #886 from alexcrichton/tweak-features
Update and improve crate features in `web-sys`
2018-09-25 12:26:45 -07:00
Alex Crichton
97cceebe7e Update and improve crate features in web-sys
* Regenerate the list of features for the crate given recent
  improvements, enabling some more types to be bound.
* Add feature gates for the `css` and `console` namespaces (modules),
  gating the APIs by default. Now `web_sys` has zero APIs unless they're
  requested.
* Improved the "required feature" documentation for `struct` types to
  not list parent classes and mention just the `struct` type instead.
2018-09-25 11:27:22 -07:00
Nick Fitzgerald
6edb871c36 js-sy: Add a doc comment for js_sys::IntoIter 2018-09-25 11:21:56 -07:00
Nick Fitzgerald
dc22965e71 js-sys: Add doc comment for js_sys::Iter 2018-09-25 11:21:56 -07:00
Alex Crichton
5af3d72f42 Start running CI tests on Rust beta
We'll graduate these to stable once 1.30.0 is released, but for now
let's start testing beta! Some matrix entries remain on nightly, but the
bulk of tests are switching to beta.
2018-09-25 10:36:28 -07:00
Nick Fitzgerald
8a2b2cb6e1
Merge pull request #876 from alexcrichton/contrib-js-sys
Update contributing docs for js-sys
2018-09-24 17:35:28 -07:00
Nick Fitzgerald
f9f8d2c214
Merge pull request #877 from alexcrichton/opt-tests
Add some blurbs about optimizing for size
2018-09-24 17:30:41 -07:00
Nick Fitzgerald
2c62795a8d
Merge pull request #880 from alexcrichton/better-link-mem-intrinsics
Improve `link_mem_intrinsics` hack
2018-09-24 17:20:54 -07:00
Nick Fitzgerald
e786d991ce
Merge pull request #883 from alexcrichton/no-chrome
Temporarily disable Chrome on CI
2018-09-24 17:11:24 -07:00