Commit Graph

1674 Commits

Author SHA1 Message Date
Alex Crichton
a83d561bb3 Add js_sys::global 2018-09-18 15:40:49 -07:00
Alex Crichton
604ecd9529 Squelch warnings in webidl tests 2018-09-18 14:30:01 -07:00
Alex Crichton
bbc46f92c6 Fix web-sys Location test 2018-09-18 14:16:01 -07:00
Alex Crichton
e66d01f7fb Fix botched merge 2018-09-17 17:38:16 -07:00
Alex Crichton
4ea5d701bb Tweak package.json for fetch example 2018-09-17 17:38:07 -07:00
Alex Crichton
fe31615ca1 Fix webidl-tests fallout 2018-09-17 17:36:53 -07:00
Alex Crichton
f24828a16b Add a top-level web_sys::window function
Returns `Option<Window>` and can be used as a convenience to get a handle to the
global `window` object.
2018-09-17 17:36:53 -07:00
Alex Crichton
99e1b352e5 Translate the WindowProxy type to Window.
This is roughly defined by
https://html.spec.whatwg.org/multipage/window-object.html#windowproxy and
otherwise fits the bill how otherwise only `interface WindowProxy;` exists in
the WebIDL.
2018-09-17 17:36:53 -07:00
Alex Crichton
8cf9da4981 Translate the Global attribute to "structural"
All APIs on `Windows` are tagged where `Window` has `[Global]`, and they all
need to be structurally accessed rather than through a prototype.
2018-09-17 17:36:53 -07:00
Alex Crichton
c67582a315 Remove support for scoped static methods
This is intended to address #834 where we don't actually want methods scoped
like this! Instead we'll provide one unique accessor for the `window` object
itself.
2018-09-17 17:36:53 -07:00
Alex Crichton
a7cda70253
Merge pull request #848 from alexcrichton/closure-docs-again
Tweak more `Closure` docs
2018-09-17 17:36:30 -07:00
Alex Crichton
bb82db9a12 Tweak more Closure docs
Show off usage of the stable `Closure::wrap` instead of `Closure::new` and
additionally add an explicit example of using it with `web_sys`.

Closes #843
2018-09-17 17:36:17 -07:00
Nick Fitzgerald
a37fa45100
Merge pull request #845 from alexcrichton/more-webidl
Uncommented some WebIDL TODO
2018-09-17 15:29:49 -07:00
Nick Fitzgerald
b38b9da499
Merge pull request #846 from alexcrichton/no-modules
Remove `Module` node from the backend AST
2018-09-17 15:19:57 -07:00
Nick Fitzgerald
6ce5e6e1dd
Merge pull request #831 from alexcrichton/more-webidl-types
Add bindings for a few more "long long" types
2018-09-17 15:17:17 -07:00
Nick Fitzgerald
4db375ba97
Merge pull request #844 from alexcrichton/dox
Clarify nightly-ness of `Closure::new`
2018-09-17 15:16:45 -07:00
Alex Crichton
9daa11592a Remove Module node from the backend AST
This is a roundabout way to say that this addresses the last comment on #23,
namely if you only use the `console` submodule from `web_sys` it doesn't
actually link correctly!

The problem here has to do with codegen units and the compiler. The compiler
will create a codegen unit for each `mod` in the source code. If a codegen unit
isn't actually used, then the codegen unit is removed from the final link step.
This causes problems for web-sys where the JSON description of our program was
part of the main CGU but not in each submodule, so when submodules were only
used the descriptor program in the main CGU was not included.

The fix in this commit is to instead generate a descriptor program in the
submodule itself instead of leaving it in the main CGU. By removing the `Module`
node in the AST this naturally happens as the descriptor is only generated in
the same module as all other associated items.
2018-09-17 13:50:26 -07:00
Alex Crichton
a02c4c1410 Uncommented some WebIDL TODO
This partially reverts commit 4b4bed5ce2 by
restoring a number of items to our WebIDL

Closes #839
2018-09-17 13:25:10 -07:00
Alex Crichton
f230e66242 Clarify nightly-ness of Closure::new
`Closure` itself does not require nightly, only the `new` function.
2018-09-17 13:15:13 -07:00
Nick Fitzgerald
1ee579093b
Merge pull request #832 from myelin-ai/device-pixel-ratio
Add devicePixelRatio to Window
2018-09-17 10:12:43 -07:00
Sendil Kumar N
a897715f50
Merge pull request #838 from brisad/object-get-descriptors
Object get descriptors
2018-09-17 10:47:46 +02:00
Alex Crichton
47acbab1e2
Merge pull request #837 from afdw/master
Update weedle: use special instead of specials
2018-09-16 17:37:52 -07:00
Michael Hoffmann
2d91fa11b5 Add binding for Object.getOwnPropertyDescriptors() 2018-09-16 23:02:46 +02:00
Michael Hoffmann
b005e96fd9 Add binding for Object.getOwnPropertyDescriptor() 2018-09-16 22:55:15 +02:00
Alex Crichton
866d9e2823
Merge pull request #836 from chinedufn/api-docs
Link to API docs from README
2018-09-16 13:50:30 -07:00
Anton Danilkin
61eb7df0c8 Update weedle 2018-09-16 23:39:00 +03:00
Anton Danilkin
df18c4b042 Update weedle: use special instead of specials 2018-09-16 21:19:20 +03:00
Chinedu Francis Nwafili
54e3d87693
Fix linls 2018-09-16 08:19:18 -04:00
Chinedu Francis Nwafili
e1c173f05e
Link to API docs from README 2018-09-16 08:12:48 -04:00
Sendil Kumar N
2d5d485e46
Merge pull request #833 from brisad/object-define-properties
Add binding for Object.defineProperties()
2018-09-15 22:57:41 +02:00
Michael Hoffmann
191e7dc1fb Add binding for Object.defineProperties() 2018-09-15 22:30:27 +02:00
Ruben Schmidmeister
170ac21473
Add devicePixelRatio attribute 2018-09-15 12:42:23 +02:00
Alex Crichton
ae60bb4ba8 Translate LongLong types to f64
Any LongLong still present after flattening now gets translated to a `f64` type
so we can bind these types. While not a true integral value or truely 64-bits of
integer precision, it's all JS has anyway!
2018-09-14 18:54:29 -07:00
Alex Crichton
941397745d Enable DOMTimeStamp as UnsignedLongLong
This is apparently how webidl defines it!
2018-09-14 18:44:38 -07:00
Nick Fitzgerald
8da2e4dca2
Merge pull request #830 from alexcrichton/fix-web-sys-dep
Fix dependencies sections for `web-sys` in guide
2018-09-14 14:27:15 -07:00
Alex Crichton
87176b15bc Fix dependencies sections for web-sys in guide
Closes #829
2018-09-14 14:05:04 -07:00
Alex Crichton
b66d1064d0
Merge pull request #827 from joshtriplett/clean-up-generated-code
Clean up indentation and blanks in the generated --no-modules JavaScript
2018-09-14 09:28:09 -07:00
Josh Triplett
96a70c41be reset_indentation: Don't emit indentation on blank lines
This resulted in trailing whitespace in the generated file. In addition
to wasting space in a file that gets served over the wire, this also
gets highlighted as a problem when reviewing the generated file in an
editor that highlights trailing whitespace.
2018-09-13 22:13:07 -07:00
Josh Triplett
1c52fb1b2f Remove leading and trailing blanks from the --no-modules output
The output using modules already uses string formatting that carefully
avoids emitting leading and trailing blanks; adjust the --no-modules
output to match.
2018-09-13 22:10:59 -07:00
Alex Crichton
05a0a5c6a1
Merge pull request #825 from fitzgen/paint-table-of-contents
guide: Add paint example to the table of contents
2018-09-13 18:21:03 -07:00
Nick Fitzgerald
59f551f504
Merge pull request #824 from chinedufn/travis
Change CI example to use a release binary
2018-09-13 17:01:07 -07:00
Nick Fitzgerald
fa5551d91f guide: Add paint example to the table of contents 2018-09-13 16:36:57 -07:00
Chinedu Francis Nwafili
17db217fe9
Change CI example to use a releaase binary 2018-09-13 19:06:31 -04:00
Alex Crichton
dcb783741c
Merge pull request #823 from afdw/master
Add a section to the guide about the Paint example
2018-09-13 15:34:05 -07:00
Anton Danilkin
97fc9b64f8 Add a section to the guide about the Paint example 2018-09-14 00:46:53 +03:00
Alex Crichton
e1ea897d2f
Merge pull request #820 from afdw/master
Add paint example
2018-09-12 17:52:26 -07:00
Anton Danilkin
b9cc8e1270 Use Cell instead of RefCell 2018-09-13 03:38:22 +03:00
Nick Fitzgerald
2fc499d66d
Merge pull request #819 from fitzgen/webidl-interfaces-should-extend-object
webidl: All interfaces implicitly extend `Object`
2018-09-12 16:21:48 -07:00
Anton Danilkin
62b04e44c4 Add paint example 2018-09-13 02:10:36 +03:00
Nick Fitzgerald
c6ede65856
Merge pull request #818 from fitzgen/guide-wasm-bindgen-test
guide: Add documentation for testing with `wasm-bindgen-test`
2018-09-12 15:40:31 -07:00