Commit graph

135 commits

Author SHA1 Message Date
Ms2ger
68d603a6d0 Move TrustedNodeAddress to script_layout_interface. 2016-06-20 19:08:06 +02:00
Anthony Ramine
919a4774dd Avoid a literal "&Root<T>" in its PartialEq impl 2016-05-31 14:57:47 +02:00
Anthony Ramine
d95f5edc2d Cleanup RootCollection methods
The methods `root` and `unroot` should both be unsafe and take
a `*const Reflector`.
2016-05-31 14:52:55 +02:00
Anthony Ramine
b45f1918d1 Remove JS::from_rooted 2016-05-31 14:43:58 +02:00
Matt Brubeck
eaf4c5e5c5 Fix unused import warning in script::dom::bindings::js 2016-05-16 09:19:55 -07:00
Josh Matthews
293d465c59 Make debug logging for tracing JS objects more informative. 2016-05-11 08:34:48 -04:00
bors-servo
bbcbd35095 Auto merge of #10546 - stjepang:fix-typo-in-jsrs, r=Ms2ger
Fix typo: `cannot not outlive` -> `cannot outlive`

A `Root` cannot outlive the `RootCollection` it is recorded in.
The docs were saying otherwise.

r? @jdm

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10546)
<!-- Reviewable:end -->
2016-04-13 06:30:59 +05:30
Stjepan Glavina
524bf440e7 Fix typo: cannot not outlive -> cannot outlive 2016-04-12 19:20:44 +02:00
Ms2ger
0d732ebb5f Implement Clone for Root. 2016-04-11 10:29:13 +02:00
Daniel Robertson
7a35ef1555 Implement RootedReference<T> for Option<JS<T>>
An implementation of RootedReference for Option<JS<T>> based off of
other implementations of RootedReference for Option wrapped types.
2016-02-16 22:40:03 +00:00
Anthony Ramine
cb5cd8d881 Say farewell to in-tree HeapSizeOf 2016-02-04 22:03:32 +01:00
Ms2ger
ff0992401e Remove remaining reference to the long-disappeared JSRef type. 2016-01-18 09:52:23 +01:00
rohan.prinja
1f02c4ebbb task -> thread 2016-01-10 17:58:13 +09:00
Johannes Linke
6b215f38ee Fix a bunch of clippy lints 2016-01-02 23:27:15 +01:00
Ms2ger
0c61be7a57 Rustfmt some of script. 2015-11-18 11:14:05 +01:00
bors-servo
92f9e58310 Auto merge of #8286 - eefriedman:no-move, r=nox
Remove unnecessary uses of #[no_move]

The patch makes RootCollection a bit safer by making the StackRootTLS hold
it in place.

RootedVec was doing an extremely delicate dance and just hoping nobody
messed it up; switch to a Box to be safe.

CodeGenRust seemed to be using no_move for no particularly good reason.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8286)
<!-- Reviewable:end -->
2015-11-08 12:51:00 +05:30
Eli Friedman
1a50fce67c Clean up some code related to #[no_move].
The patch makes RootCollection a bit safer by making the StackRootTLS hold
it in place.

The use of no_move in CodeGenRust was leftover from when roots couldn't
be moved.
2015-11-07 21:17:24 -08:00
David Zbarsky
722aa86c89 Get rid of a bunch of explicit derefs 2015-11-03 19:51:46 -08:00
rohan.prinja
6e774ea6eb merge from master 2015-11-03 19:01:23 +09:00
nxnfufunezn
d8ef3809a6 Removed JS::root Fixes #8251 2015-10-31 18:15:16 +05:30
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
rohan.prinja
4a4f041948 remove get_rooted() and replace all references to it with references to get() 2015-10-29 21:48:39 +09:00
Ms2ger
85a57b5111 Add thread assertions to js.rs. 2015-10-29 11:56:17 +01:00
Bobby Holley
630b9f8fa0 Implement Hash and Eq for JS<T> and LayoutJS<T>. 2015-10-27 12:41:14 -07:00
bors-servo
6b95c3957b Auto merge of #8097 - wenderen:8090-partialeq-for-mutheap, r=nox
implement PartialEq for MutHeap<JS<T>> and MutNullableHeap<JS<T>>

for #8090

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8097)
<!-- Reviewable:end -->
2015-10-26 06:08:01 -05:00
Rohan Prinja
c1abb4fdb2 clean code as per code review 2015-10-26 03:52:05 +09:00
Eli Friedman
81ecf7824c Make unrooted_must_root a bit more aggressive.
Basically, instead of trying to check for specific kinds of statements,
just check the types of all local variables.

Also included are some commented-out proposals for some slightly more
aggressive lints which might be useful (but trigger a little too
frequently at the moment).
2015-10-23 14:43:44 -07:00
Rohan Prinja
fe59b62db7 make changes according to code review (#8097) 2015-10-24 01:42:22 +09:00
Matt Brubeck
e9f9eaa61c Fix type in MutHeap docs 2015-10-21 12:27:04 -07:00
Rohan Prinja
d9f8f68615 add equal() methods for comparisons with other types 2015-10-22 03:05:13 +09:00
Rohan Prinja
5e8dc366de in PartialEq impls, use Self instead of explicitly naming the struct type 2015-10-22 01:05:48 +09:00
bors-servo
674589c370 Auto merge of #8041 - nox:castable, r=jdm
Introduce trait Castable

Removes all those messy FooCast structures in InheritTypes.rs.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8041)
<!-- Reviewable:end -->
2015-10-21 07:57:32 -06:00
Ms2ger
4e8033b739 Remove unused JS::assign. 2015-10-21 12:17:50 +02: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
Rohan Prinja
ab70c8c942 implement PartialEq for MutHeap<JS<T>> and MutNullableHeap<JS<T>> 2015-10-21 01:40:19 +09:00
Anthony Ramine
6c7f37061b Implement Deref<Target=T> for JS<T> where T: Reflectable
We can only borrow JS<T> from rooted things, so it's safe to deref it.
The only types that provide mutable JS<T> things are MutHeap<JS<T>> and
MutNullableHeap<JS<T>>, which don't actually expose that they contain
JS<T> values.
2015-10-17 01:58:52 +02:00
Eli Friedman
5713867778 Fix documentation for JS<T> and friends. 2015-10-15 14:03:57 -07:00
Eli Friedman
5bdf6bb1d3 Fix remaining MutHeap methods not to expose JS<T>. 2015-10-15 14:03:57 -07:00
Eli Friedman
57584e74c6 Make get() and set() on MutNullableHeap use the correct types.
get() must always return a rooted value, because we have no way of
ensuring the value won't be invalidated. set() takes an &T because it's
convenient; there isn't any need to expose JS<T>.
2015-10-15 14:03:56 -07:00
Eli Friedman
88a1cbb28b Stop implementing Copy for JS<T>.
A copy of a JS<T> doesn't have the rooting properties of the original,
so it makes no sense for it to implement Copy.
2015-10-15 14:02:45 -07:00
Manish Goregaokar
8819f0d8b8 Update script to work with lint changes 2015-10-16 01:20:27 +05:30
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
Ms2ger
3781567c19 Stop implementing Reflectable for JS<T> (fixes #2285).
It's not generally safe to expose the contents of a JS<T>.
2015-09-13 16:47:12 +02:00
Manish Goregaokar
54c036cd66 Elide most 'a lifetimes 2015-09-04 08:55:51 +05:30
bors-servo
532fd19d69 Auto merge of #7361 - jxs:master, r=Ms2ger
make dom_struct derive HeapSizeOf

closes #7357

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7361)
<!-- Reviewable:end -->
2015-08-27 02:35:45 -06:00
João Oliveira
8d86f89f63 Remove get_unsound_ref_forever function
closes #7383
2015-08-27 01:36:43 +01:00
João Oliveira
fd87c8cb3e make dom_struct derive HeapSizeOf,
closes #7357
2015-08-27 01:17:48 +01:00