Commit graph

141 commits

Author SHA1 Message Date
Anthony Ramine
55dcee94be Bump heapsize to 0.3 2016-02-13 11:13:19 +01:00
Anthony Ramine
cb5cd8d881 Say farewell to in-tree HeapSizeOf 2016-02-04 22:03:32 +01:00
nxnfufunezn
e54929b4d7 Move ConstantSpec, NonNullJSNative and define_constants from utils to interface 2016-01-24 20:37:30 +05:30
Anthony Ramine
d13da7d9b3 Fix prototypes of interface objects (fixes #2665) 2016-01-12 17:15:44 +01:00
Anthony Ramine
833e0d2fac Refactor prototype initialisation
The function do_create_interface_objects is removed in favour of 4 functions:
create_callback_interface_object, create_interface_prototype_object,
create_noncallback_interface_object and create_named_constructors.

While this increases the amount of codegen'd code, this greatly improves the
readability of the code involved in this part of DOM, instead of having one function
doing 4 different things. We can always find a more adequate abstraction later.

NativeProperties and everything related to the interface objects have been removed
from the utils module.
2016-01-12 12:34:18 +01:00
Anthony Ramine
967948be06 Remove NativePropertyHooks 2016-01-12 12:34:18 +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
Ms2ger
b7b5c79787 Rename the browsercontext module. 2015-12-11 15:27:27 -05:00
Ms2ger
b353d70f44 Initialize the slots of global objects before a possible GC. 2015-12-10 12:08:42 -05:00
Anthony Ramine
60976406cc Implement [Unforgeable]
This is mostly stolen from Gecko. As there, we define the unforgeable members
on an object stored in the slots of the prototype object. They are then copied
onto instance objects when they are instantiated. It should be noted that
proxy objects see their unforgeable memebers defined on their expando object.

Unforgeable attributes aren't properly inherited in codegen (in a similar
fashion as getters and setters as filed in #5875) and require to be redefined
in derived interfaces. Fortunately, there are currently no such interfaces.

No unforgeable members can be included into the TestBinding interfaces for good
measure because they are not compatible with setters.

Given the unforgeable holder object has the same prototype as actual instances
of the interface, the finalize hook needs to check its slot pointer for nullity
before dropping it.

The new failing test isn't related to Unforgeable attributes, but to the fact
that all Document instances currently have a Location, even if their window
isn't in a browsing context.
2015-12-02 22:15:11 +01:00
Anthony Ramine
7547bcac24 Remove unused slot in prototype object (fixes #8588) 2015-11-30 14:48:24 +01:00
Brandon Fairchild
341e66f66d Remove #[allow(raw_pointer_derive)] attributes
The attributes are unused.

Fixes #8699.
2015-11-27 14:32:57 -05:00
Ms2ger
b7117893af Rename a confusing argument. 2015-11-19 16:18:28 +01:00
Ms2ger
0c61be7a57 Rustfmt some of script. 2015-11-18 11:14:05 +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
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
rohan.prinja
7032a5d1de more cleanup 2015-10-30 22:57:59 +09:00
rohan.prinja
51df8e310b rearrange imports to be in alphabetical order 2015-10-30 20:28:59 +09:00
rohan.prinja
9fd823e449 replace InheritTypes imports with inheritance imports 2015-10-30 20:26:30 +09:00
rohan.prinja
45224028db more refactoring 2015-10-30 20:26:29 +09:00
bors-servo
30ce2a84c1 Auto merge of #8242 - Ms2ger:update-js, r=metajack
Update js.



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8242)
<!-- Reviewable:end -->
2015-10-28 23:35:40 +05:30
Ms2ger
2a2ab23dfb Update js. 2015-10-28 18:02:10 +01:00
Nathan Froyd
c82b6ce843 move reserved slot setting for DOM globals
Moving this slot setting prior to initializing standard classes and
other initialization tasks means that we can effectively use JS_GC_ZEAL.

Fixes #6057.
2015-10-27 18:08:35 -04:00
Ms2ger
54d3462fa5 Use the new define_methods and define_properties functions from js. 2015-10-25 19:50:10 +01:00
Ms2ger
970b8aa8bc Remove the unused default implementation of Reflectable::init_reflector. 2015-10-23 17:21:04 +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
bors-servo
6111cf9ffc Auto merge of #7943 - pierrechevalier83:fix_issue_7941, r=Ms2ger
Clarify some code in do_create_interface_objects

rval.get() is believed to be always null upon entering this function.
This assumption is verified by the added assertion.
It makes more sense to move the block of code that was moved inside
the if statement which is the only place where it can be initialized.

Fixes #7941.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7943)
<!-- Reviewable:end -->
2015-10-19 09:37:03 -06:00
bors-servo
5a0a91eba7 Auto merge of #7972 - nox:codegen-heapsize, r=Ms2ger
Introduce DOMClass::heap_size_of

It holds a function pointer to the HeapSizeOf::heap_size_of_children()
implementation corresponding to that IDL interface.

This removes the need for a clumsly TypeId-based match expression in the
former heap_size_of_eventtarget() function.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7972)
<!-- Reviewable:end -->
2015-10-15 07:13:55 -06:00
Anthony Ramine
da67630931 Introduce DOMClass::heap_size_of
It holds a function pointer to the HeapSizeOf::heap_size_of_children()
implementation corresponding to that IDL interface.

This removes the need for a clumsly TypeId-based match expression in the
former heap_size_of_eventtarget() function.
2015-10-14 21:52:16 +02:00
Michael Wu
e733a7c46a Support the updated spidermonkey bindings 2015-10-14 15:30:52 -04:00
Anthony Ramine
aab2c40389 Generate the TypeId enums in codegen 2015-10-14 18:45:35 +02:00
Pierre Chevalier
a6a685e954 Clarify some code in do_create_interface_objects
rval.get() is believed to be always null upon entering this function.
This assumption is verified by the added assertion.
It makes more sense to move the block of code that was moved inside
the if statement which is the only place where it can be initialized.

Fixes #7941.
2015-10-10 18:13:37 +01:00
Andriy Kunitsin
7301609c18 Changed dom_class type to Option<&'static DOMClass> 2015-10-09 19:57:22 +03: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
Michael Wu
941f7dc04b Move EventTargetTypeId/NodeTypeId to DOMClass 2015-09-12 01:09:46 +02:00
Manish Goregaokar
e94df1ed5c Remove needless returns 2015-09-04 09:13:48 +05:30
Manish Goregaokar
54c036cd66 Elide most 'a lifetimes 2015-09-04 08:55:51 +05:30
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
Ms2ger
a9671550ff Update js. 2015-08-18 12:21:03 +02:00
João Oliveira
067a22a868 Replace uses of for foo in bar.iter(),
and `for foo in bar.iter_mut(), and for foo in bar.into_iter()
(continuation of #7197)
2015-08-18 01:46:11 +01:00
João Oliveira
0038580abf Replace uses of for foo in bar.iter() and for foo in bar.iter_mut()
closes #7197
2015-08-15 02:27:39 +01:00
Josh Matthews
8620fe5995 Start reporting memory usage for Window and all nodes in all DOM trees for frame treese in script tasks. 2015-08-03 23:05:00 -04:00
bors-servo
4837dd9a1c Auto merge of #6850 - servo:rustup_2015-07-30, r=SimonSapin
Upgrade to rustc 1.3.0-dev (87055a68c 2015-07-30)

This builds and passes unit tests.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6850)
<!-- Reviewable:end -->
2015-07-30 14:46:13 -06:00
Simon Sapin
2b62041997 Remove usage of the deprecated box () (expr) syntax. 2015-07-30 18:01:44 +02:00
Josh Matthews
b2cf27ba5d Use an actual byte string when defining the prototype of named constructors. Fixes #6730. 2015-07-29 12:39:26 -04:00
Akos Kiss
fa86ea4f6f Add aarch64-unknown-linux-gnu support
* Adding dependencies
* Replacing `i8` with `libc::c_char` to build properly on platforms
  where char is unsigned.
2015-07-23 22:52:17 +00:00
Manish Goregaokar
f6f0a7e4aa Make stmt part of unrooted_must_root handle type parameters (fixes #6651) 2015-07-22 00:00:14 +05:30