Commit graph

160 commits

Author SHA1 Message Date
Alan Jeffrey
9be4fd56ce Removed util. 2016-12-14 18:04:37 -06:00
Corey Farwell
449f6337d4 Rename Reflectable to DomObject.
Fixes https://github.com/servo/servo/issues/8473.
2016-12-08 08:50:35 -10:00
Anthony Ramine
445701d138 Update js, AGAIN 2016-11-27 12:19:19 +01:00
Ms2ger
558afe1786 Update js. 2016-11-02 13:25:49 +01:00
Emilio Cobos Álvarez
d7e2b40484
webgl: Honor ArrayBuffer or ArrayBufferView in bufferData and bufferSubData. 2016-10-09 13:23:39 +02:00
Emilio Cobos Álvarez
602246a14c
script: Mark as unsafe multiple array_buffer_view_to_xxx functions that take a raw JSObject pointer. 2016-10-09 12:32:37 +02:00
Emilio Cobos Álvarez
ea8f115b8c
webgl: A few fixes regarding the nullability of WebGL parameters. 2016-10-09 12:32:37 +02:00
Ms2ger
2d83e5a788 Implement the MozMap type.
Fixes #13144.
2016-09-21 14:03:34 +02:00
Ms2ger
6023560863 Improve jsid_to_str's name and documentation. 2016-09-21 13:17:03 +02:00
Ms2ger
6ef5894f01 Remove the throw_type_error call from FromJSValConvertible::from_jsval. 2016-08-24 15:15:40 +02:00
Guillaume Gomez
2f3f4a5bd6 Update rust-mozjs dependency 2016-08-24 12:56:49 +02:00
Josh Matthews
7539eb496b Avoid unnecessary JS_WrapValue calls for DOM reflectors. 2016-07-12 08:22:50 -04:00
Anthony Ramine
cdc7bca944 Move DOMString back to script
This entirely removes the 'non-geckolib' feature of the util crate.
2016-05-24 10:54:57 +02:00
Anthony Ramine
eb94f1a918 Update SpiderMonkey 2016-05-03 18:36:11 +02:00
Ms2ger
03d4bacc05 Use num-traits in script. 2016-04-20 15:23:43 +02:00
Matt Brubeck
6882ce8ec1 Lower the logging level of a really chatty fn 2016-04-19 12:16:43 -07:00
Peter
3e78b54d46 Fixed compile error in generated code, when webidl constructors have same number of args
Edited test webidl to show issue, and fix
2016-03-03 20:21:48 +00:00
Anthony Ramine
71092e142d Bump js to get fix from servo/rust-mozjs#237 2016-02-12 17:15:09 +01:00
Emilio Cobos Álvarez
3327f00bce script: Implement FromJSValConvertible for Root<T> 2016-01-15 13:51:05 +01:00
Bobby Holley
dec296ddbc Use features to prevent the util component from entraining the world in GeckoLib builds. 2016-01-11 19:38:43 -08:00
Emilio Cobos Álvarez
d30f05554b conversions: Make a is_type_compatible method for ArrayBufferViews. 2016-01-04 15:51:01 +01:00
Emilio Cobos Álvarez
43d395a682 conversions: Add a checked version to array_buffer_view_data 2016-01-04 15:29:24 +01:00
Emilio Cobos Álvarez
9ad49c8aa1 conversion: Extrapolate array_buffer_view_data
And use it instead of the raw jsapi calls.
2016-01-04 15:19:29 +01:00
Ms2ger
964c8355b7 Remove an unused trait. 2015-11-20 11:39:03 +01:00
Ms2ger
0c61be7a57 Rustfmt some of script. 2015-11-18 11:14:05 +01:00
bors-servo
62acdd303b Auto merge of #8477 - asajeffrey:opaque-domstring, r=asajeffrey
Opaque DOMString

This patch makes DOMString an opaque wrapper round String (currently it's a transparent wrapper).

The changes are:

* Replacing DOMString(foo) by DOMString::from(foo).
* Replacing foo.0 by String::from(foo).
* Adding functions clear, push_str and extend for in-place mutation of DOMStrings.
* Replacing DOMString by String in other threads (devtools, storage and filereader).
* Making DOMString implement !Send.
* Removing the pub attribute from the contents of DOMString.

This enables experimenting with other string representations in the DOM.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8477)
<!-- Reviewable:end -->
2015-11-13 07:17:30 +05:30
bors-servo
e63b1e83d4 Auto merge of #8147 - nox:weakref, r=Ms2ger
Implement weak-referenceable JS-managed objects

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8147)
<!-- Reviewable:end -->
2015-11-13 06:22:40 +05:30
Alan Jeffrey
84bde75b42 Replaced DOMString constructor by conversion functions.
Replaced DOMString(...) by DOMString::from(...).
Replaced ....0 by String::from(...).
Removed any uses of .to_owner() in DOMString::from("...").
2015-11-12 17:52:59 -06:00
Anthony Ramine
72c67efe96 Introduce trait WeakReferenceable
This allows to take weak references of JS-managed DOM objects.
2015-11-12 12:51:50 +01:00
Ms2ger
6d2ae85c1f Use the conversion traits from js. 2015-11-12 10:48:58 +01:00
Ms2ger
acb24e80b8 Use throw_type_error and throw_range_error from js. 2015-11-12 10:20:19 +01:00
Emilio Cobos Álvarez
e33330db4e Implement WebIDL sequence return value using JS_NewArrayObject1
This commits changes the creation of the array to use the length, and
sets the elements later.

Reference implementation:
07ed19e582/js/xpconnect/public/nsTArrayHelpers.h (L16)
2015-11-11 18:30:34 +01:00
Emilio Cobos Álvarez
63aa6862b4 Implement WebIDL sequence return values 2015-11-11 17:13:59 +01:00
Anthony Ramine
acb13dc899 Support variadic interface arguments (fixes #8159)
We use a RootedVec value in codegen, of which we use the `r()` method to
pass `&[&T]` to the interface methods.
2015-11-11 14:52:21 +01:00
Anthony Ramine
b290a3161d Clean up the conversion routines
Functions returning `Root<T>` are prefixed by "root_" and the ones returning
`*const T` by "native_".

Functions taking `*mut JSObject` are now suffixed by "_from_object" and the ones
taking `&T` by "_from_reflector".
2015-11-11 14:19:30 +01:00
Ms2ger
6b75078503 Make DOMString a newtype around String, rather than a typedef.
This should make it somewhat easier to experiment with alternative
representations in the future. To reduce churn, this commit leaves the String
field public, though.

Also, this will allow us to use the default String type to represent the IDL
USVString type, which explicitly forbids unpaired surrogates, ans as such is
a better match to the Rust String type.
2015-11-04 12:09:11 +01:00
Ms2ger
e6aa976462 Use DOMString::new() somewhat consistently. 2015-11-04 12:09:10 +01:00
David Zbarsky
722aa86c89 Get rid of a bunch of explicit derefs 2015-11-03 19:51:46 -08:00
rohan.prinja
51df8e310b rearrange imports to be in alphabetical order 2015-10-30 20:28:59 +09:00
rohan.prinja
45224028db more refactoring 2015-10-30 20:26:29 +09:00
rohan.prinja
bb2536cd01 move Castable into dom::bindings::inheritance 2015-10-30 20:24:42 +09:00
Ms2ger
2a2ab23dfb Update js. 2015-10-28 18:02:10 +01:00
Anthony Ramine
13ea3ac413 Introduce trait Castable
This trait is used to hold onto the downcast and upcast functions of all
castable IDL interfaces. A castable IDL interface is one which either derives
from or is derived by other interfaces.

The deriving relation is represented by implementations of marker trait
DerivedFrom<T: Castable> generated in InheritTypes.

/^[ ]*use dom::bindings::codegen::InheritTypes::.*(Base|Cast|Derived)/ {
    /::[a-zA-Z]+(Base|Cast|Derived);/d
    s/([{ ])[a-zA-Z]+(Base|Cast|Derived), /\1/g
    s/([{ ])[a-zA-Z]+(Base|Cast|Derived), /\1/g
    s/, [a-zA-Z]+(Base|Cast|Derived)([},])/\2/g
    s/, [a-zA-Z]+(Base|Cast|Derived)([},])/\2/g
    /\{([a-zA-Z]+(Base|Cast|Derived))?\};$/d
    s/\{([a-zA-Z_]+)\};$/\1;/
}

s/([a-zA-Z]+)Cast::from_ref\(\&?\**([a-zA-Z_]+)(\.r\(\))?\)/\2.upcast::<\1>()/g
s/([a-zA-Z]+)Cast::from_ref\(\&?\**([a-zA-Z_]+)(\.[a-zA-Z_]+\(\))?\)/\2\3.upcast::<\1>()/g
s/\(([a-zA-Z]+)Cast::from_ref\)/\(Castable::upcast::<\1>\)/g

s/([a-zA-Z]+)Cast::from_root/Root::upcast::<\1>/g

s/([a-zA-Z]+)Cast::from_layout_js\(\&([a-zA-Z_.]+)\)/\2.upcast::<\1>()/g

s/([a-zA-Z]+)Cast::to_ref\(\&?\**([a-zA-Z_]+)(\.r\(\))?\)/\2.downcast::<\1>()/g
s/([a-zA-Z]+)Cast::to_ref\(\&?\**([a-zA-Z_]+)(\.[a-zA-Z_]+\(\))?\)/\2\3.downcast::<\1>()/g
s/\(([a-zA-Z]+)Cast::to_ref\)/\(Castable::downcast::<\1>\)/g

s/([a-zA-Z]+)Cast::to_root/Root::downcast::<\1>/g

s/([a-zA-Z]+)Cast::to_layout_js\(&?([a-zA-Z_.]+(\(\))?)\)/\2.downcast::<\1>()/g

s/\.is_document\(\)/.is::<Document>()/g
s/\.is_htmlanchorelement\(\)/.is::<HTMLAnchorElement>()/g
s/\.is_htmlappletelement\(\)/.is::<HTMLAppletElement>()/g
s/\.is_htmlareaelement\(\)/.is::<HTMLAreaElement>()/g
s/\.is_htmlbodyelement\(\)/.is::<HTMLBodyElement>()/g
s/\.is_htmlembedelement\(\)/.is::<HTMLEmbedElement>()/g
s/\.is_htmlfieldsetelement\(\)/.is::<HTMLFieldSetElement>()/g
s/\.is_htmlformelement\(\)/.is::<HTMLFormElement>()/g
s/\.is_htmlframesetelement\(\)/.is::<HTMLFrameSetElement>()/g
s/\.is_htmlhtmlelement\(\)/.is::<HTMLHtmlElement>()/g
s/\.is_htmlimageelement\(\)/.is::<HTMLImageElement>()/g
s/\.is_htmllegendelement\(\)/.is::<HTMLLegendElement>()/g
s/\.is_htmloptgroupelement\(\)/.is::<HTMLOptGroupElement>()/g
s/\.is_htmloptionelement\(\)/.is::<HTMLOptionElement>()/g
s/\.is_htmlscriptelement\(\)/.is::<HTMLScriptElement>()/g
s/\.is_htmltabledatacellelement\(\)/.is::<HTMLTableDataCellElement>()/g
s/\.is_htmltableheadercellelement\(\)/.is::<HTMLTableHeaderCellElement>()/g
s/\.is_htmltablerowelement\(\)/.is::<HTMLTableRowElement>()/g
s/\.is_htmltablesectionelement\(\)/.is::<HTMLTableSectionElement>()/g
s/\.is_htmltitleelement\(\)/.is::<HTMLTitleElement>()/g
2015-10-21 11:37:16 +02:00
Anthony Ramine
c77d3b965f Introduce IDLInterface::derives()
This method is given a DOMClass value and returns whether it derives from Self.

Interfaces with no descendants directly check whether the given DOMClass is the
same as their own.
2015-10-21 10:59:36 +02:00
Rahul Sharma
1141f00212 added spec link for type mapping 2015-10-15 19:28:56 +05:30
Michael Wu
3129fb2330 Throw on bad ByteStrings 2015-10-14 15:30:57 -04:00
Michael Wu
e733a7c46a Support the updated spidermonkey bindings 2015-10-14 15:30:52 -04:00
Patrick Walton
f2f91886ee script: Stop reallocating so much when converting DOM strings to JS
values.

`size_hint()` in `utf16_units()` seems busted, so we do it ourselves.
2015-09-27 15:40:48 -07:00
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
Brandon Fairchild
de3547e401 Fix reported test-tidy errors for unmerged import blocks
This merges import blocks that were reported by tidy as unmerged.
2015-09-19 12:50:14 -04:00