Commit graph

55 commits

Author SHA1 Message Date
Eduard Burtescu
da092febcb servo: Merge #11872 - Replace return_address usage for rooting with stack guards and convenience macros (from eddyb:back-to-roots); r=Ms2ger
The existing `Rooted` and `RootedVec` users were migrated the the following two macros:
```rust
let x = Rooted::new(cx, value);
// Was changed to:
rooted!(in(cx) let x = value);
// Which expands to:
let mut __root = Rooted::new_unrooted(value);
let x = RootedGuard::new(cx, &mut __root);
```
```rust
let mut v = RootedVec::new();
v.extend(iterator);
// Was changed to:
rooted_vec!(let v <- iterator);
// Which expands to:
let mut __root = RootableVec::new();
let v = RootedVec::new(&mut __root, iterator);
```

The `rooted!` macro depends on servo/rust-mozjs#272.
These APIs based on two types, a container to be rooted and a rooting guard, allow implementing both `Rooted`-style rooting and `Traceable`-based rooting in stable Rust, without abusing `return_address`.

Such macros may have been tried before, but in 1.9 their hygiene is broken, they work only since 1.10.

Sadly, `Rooted` is a FFI type and completely exposed, so I cannot prevent anyone from creating their own, although all fields but the value get overwritten by `RootedGuard::new` anyway.
`RootableVec` OTOH is *guaranteed* to be empty when not rooted, which makes it harmless AFAICT.

By fixing rust-lang/rust#34227, this PR enables Servo to build with `-Zorbit`.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix rust-lang/rust#34227
- [x] These changes do not require tests because they are not functional changes

Source-Repo: https://github.com/servo/servo
Source-Revision: 80cb0cf8214fd52d2884724614c40cb278ee7575
2016-07-04 11:03:35 -07:00
Guillaume Gomez
7de5a9ff82 servo: Merge #11496 - Implement Range::createContextualFragment (from GuillaumeGomez:range); r=nox
Source-Repo: https://github.com/servo/servo
Source-Revision: 51d41c5161fe61ad28cd0db98632633967832823
2016-06-03 05:32:42 -05:00
Anthony Ramine
5aa3cb5ed3 servo: Merge #11326 - Move DOMString back to script (from nox:non-geckolib); r=Ms2ger
Source-Repo: https://github.com/servo/servo
Source-Revision: 6abcd793d780369767385b01b02ee725d6b10585
2016-05-24 02:07:29 -07:00
Keith Yeung
1ea43593ad servo: Merge #9796 - Implement Stringifier for Range (from KiChjang:range-stringifier); r=jdm
Source-Repo: https://github.com/servo/servo
Source-Revision: fa93d3f4674c0e326a644826f5c394136a858f2b
2016-03-10 07:06:06 +05:01
Anthony Ramine
9c9ecfeffe servo: Merge #9799 - Fix step 14.2 of Range::ExtractContents (from nox:range-extractcontents); r=KiChjang
We need the last inclusive ancestor of start node that is not an inclusive ancestor
of end node, not the first that is an inclusive ancestor of it.

Source-Repo: https://github.com/servo/servo
Source-Revision: dfdeabf57df02cf4b8a878b3b9933a08d156082d
2016-02-29 04:42:28 +05:01
Anthony Ramine
68cac04d75 servo: Merge #9797 - Fix step 1 of Range::InsertNode (from nox:range-insertnode); r=KiChjang
The method needs to throw when trying to insert start node into range.

Source-Repo: https://github.com/servo/servo
Source-Revision: b3964a89585539082982160f5f4fb4bd05ddac2f
2016-02-29 03:49:06 +05:01
Emilio Cobos Álvarez
333988b913 servo: Merge #9795 - script: Fix remaining bugs from Range.deleteContents (from emilio:other-range-bugs); r=nox
This makes all the `Range.deleteContents` tests pass.

I changed some `try!()`s for `unwraps()` because those calls are actually infallible.

r? @nox

Source-Repo: https://github.com/servo/servo
Source-Revision: 492e3241715e125df3587c8454ce52c925377152
2016-02-28 23:29:41 +05:01
Anthony Ramine
0bedd662a0 servo: Merge #9793 - Fix step 6 of Range::DeleteContents (from nox:range-deletecontents); r=ecoal95
Source-Repo: https://github.com/servo/servo
Source-Revision: be6940db59a2e8bf4fac45911848edbc8cd3dd8d
2016-02-28 19:52:51 +05:01
Anthony Ramine
08f5c3da70 servo: Merge #9532 - Say farewell to in-tree HeapSizeOf (from nox:dedup-heapsize); r=Manishearth
Source-Repo: https://github.com/servo/servo
Source-Revision: 2a6707ce58df27d93e865bffb6b44d396b810c99
2016-02-05 03:11:36 +05:01
Anthony Ramine
ef99a3f214 servo: Merge #8506 - Properly propagate changes when range or trees are mutated (from nox:finish-ranges); r=dzbarsky
Does the same thing as #6817, but storing Range instances directly in their start and end containers.

Cc @dzbarsky

Source-Repo: https://github.com/servo/servo
Source-Revision: 89ab368258eb827b0dcc8d6e6deecd3ed3c1de71
2015-12-26 03:39:15 +05:01
Guillaume Gomez
e2ebe34e9f servo: Merge #8675 - Add XMLDocument object (from GuillaumeGomez:master); r=nox
Fixes #8000

(Still working on it)

Source-Repo: https://github.com/servo/servo
Source-Revision: 99223656fbf6cade8c41d161a9e61a39f58ec796
2015-11-27 19:00:04 +05:01
David Zbarsky
95f8c3c02e servo: Merge #6826 - Implement Range#deleteContents (from dzbarsky:deletecontents); r=jdm
Sadly calling ExtractContents and discarding the result doesn't do the right thing.
It may be worth having a CutContents method that takes an `Option<DocumentFragment>` and switch the behavior based on it, to share the code between DeleteContents and ExtractContents, like what Gecko does.  Maybe a followup.

Source-Repo: https://github.com/servo/servo
Source-Revision: e7b19249489eff7a7fd49bf458ee7bd681f8ad13
2015-11-25 19:26:02 +05:01
Ms2ger
7cb2a13f43 servo: Merge #8312 - Make DOMString a newtype around String, rather than a typedef (from Ms2ger:DOMString); r=jdm
Source-Repo: https://github.com/servo/servo
Source-Revision: abfd1fb1bf071961bc8a581927eaa96a2d3e2cba
2015-11-04 16:18:41 +05:01
David Zbarsky
ed7fd17b12 servo: Merge #8305 - Get rid of a bunch of explicit derefs (from dzbarsky:roots); r=Ms2ger,
Source-Repo: https://github.com/servo/servo
Source-Revision: 4b9fa13f2f6a1aa38d180367426498f01f6414c9
2015-11-04 10:34:54 +05:01
rohan.prinja
e8b504412b servo: Merge #8221 - move modules around (from ajnirp:8130-reorganise); r=jdm
for #8130

Source-Repo: https://github.com/servo/servo
Source-Revision: daad09d44245228fba9118316937add71bec7c58
2015-11-04 02:27:02 +05:01
Corey Farwell
9e37827713 servo: Merge #8279 - Fix some rust-clippy violations (from frewsxcv:clippy-fixes); r=eefriedman
Source-Repo: https://github.com/servo/servo
Source-Revision: 913ac568750502087a7f1693b3657a24cefd2460
2015-10-31 06:22:47 +05:01
Anthony Ramine
5feaf75b63 servo: Merge #8091 - Remove Rc<T> usage from Range (from nox:cleanup-range); r=eefriedman
I initially used this to correctly handle ranges when their respective containers
are mutated, to get weak references of Range objects. I now realise that the weak
references should be handled at a lower level, closer to the JS-managed object.

Source-Repo: https://github.com/servo/servo
Source-Revision: e3bcf7bab7d0340fc7ebd0e58a2cde34e534c1cf
2015-10-23 16:00:00 -05:00
Anthony Ramine
bb8125a3da servo: Merge #8041 - Introduce trait Castable (from nox:castable); r=jdm
Removes all those messy FooCast structures in InheritTypes.rs.

Source-Repo: https://github.com/servo/servo
Source-Revision: 674589c370d978f543e71f995d58c5b28e6e9842
2015-10-21 07:57:32 -06:00
Anthony Ramine
1c1210fbba servo: Merge #8060 - Implement Deref<Target=T> for JS<T> where T: Reflectable (from nox:deref-js); r=Ms2ger
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.

Source-Repo: https://github.com/servo/servo
Source-Revision: 1a376aa75d5de8781b17a673850860f8afd2c28f
2015-10-19 06:32:05 -06:00
Anthony Ramine
d5038d123e servo: Merge #7873 - Generate the various TypeId enums in codegen (from nox:codegen-typeid); r=Ms2ger
This frees us forever from caring about maintaining these enums. The last commit removes their use from the initialisation of interface objects derived from Node.

Source-Repo: https://github.com/servo/servo
Source-Revision: 32daa17d5cbcad02db0713e21e52410cdc60480e
2015-10-14 12:47:48 -06:00
Anthony Urena
1481b17cee servo: Merge #7882 - Refactor Error enum usage to consistently be qualified (from anthgur:consistent-enum-use); r=Ms2ger
Closes #7869

Source-Repo: https://github.com/servo/servo
Source-Revision: f5cd90805ec67fb52f73ec4cef9cef881a67522d
2015-10-06 04:58:17 -06:00
Brandon Fairchild
f7fb1e4b4a servo: Merge #7662 - Check for multiple import blocks separated by whitespace (from nerith:import); r=frewsxcv
Fixes #7381.

Source-Repo: https://github.com/servo/servo
Source-Revision: a0d3c9223f09757124b1520c4f17e94fa8bbe249
2015-09-19 13:34:51 -06:00
David Zbarsky
484d93a674 servo: Merge #7426 - Implement Range#surroundContents (from dzbarsky:surroundcontents); r=glennw
Source-Repo: https://github.com/servo/servo
Source-Revision: c349b7b3a1f335a9b57e4f41998c28656cd1e5ef
2015-09-09 21:54:06 -06:00
Anthony Ramine
c327bc7867 servo: Merge #7416 - Make the traits for the IDL interfaces take &self (from nox:methods-ref); r=frewsxcv
Source-Repo: https://github.com/servo/servo
Source-Revision: 71b277d5675556e61a82ae9dbf3105449c3a8275
2015-08-27 15:08:41 -06:00
Anthony Ramine
d2ee701ee9 servo: Merge #7401 - Remove helper traits (from nox:rm-helpers); r=Manishearth
Now that `JSRef<T>` is gone, there is no need to have helper traits.

Source-Repo: https://github.com/servo/servo
Source-Revision: 909429702972d53bf02dfe9a4aa93ea0cb588cf4
2015-08-27 09:38:48 -06:00
João Oliveira
d39bd47b08 servo: Merge #7361 - make dom_struct derive HeapSizeOf (from jxs:master); r=Ms2ger
closes #7357

Source-Repo: https://github.com/servo/servo
Source-Revision: 532fd19d69fd11d06bca7539c722a46fab2c4419
2015-08-27 02:35:45 -06:00
Johann Tuffe
5c3a5a67f5 servo: Merge #7265 - Add alphabetical order check for use statements (from tafia:tidy-use); r=Ms2ger
close #7112

Source-Repo: https://github.com/servo/servo
Source-Revision: a5fbb2f2a6fa79755f975feff2435abb6a5dd0e9
2015-08-20 07:43:56 -06:00
Manish Goregaokar
d4e45231ec servo: Merge #7224 - Integrate clippy into Servo; cleanup some of script (from Manishearth:clippy); r=Ms2ger
The integration is off by default for now. You can try it out with `./mach build --features "script/plugins/clippy"`.

We're using a branch of clippy with some of the lints changed to Allow, either because they don't apply to us, or because they're noisy and dwarf other warnings (but still should be fixed)

After going through the rest of Servo's warnings I'll figure out which lints we should be keeping.

There's a cargo bug with optional deps that makes it hard for this to work with Cargo.lock -- so this PR contains no changes to lockfiles (and running the build with clippy on may dirty the lockfile, though it gets fixed later)

Source-Repo: https://github.com/servo/servo
Source-Revision: 50e1c967e4299c1515575f73d407f5f6b977d818
2015-08-18 08:15:51 -06:00
Josh Matthews
6a81d499fc servo: Merge #7203 - Add automated style nit checks to test-tidy (from jdm:style); r=Ms2ger
Expands on the work by @wilmoz and cleans up the existing errors. Closes #7180. Closes #7111.

Source-Repo: https://github.com/servo/servo
Source-Revision: e74825f9fde8e222f4ba9bb24b2c2a3864c73e5f
2015-08-16 08:37:40 -06:00
Bogdan Cuza
b3e4dcef5f servo: Merge #7097 - Measure heap memory usage for more types. Fixes #6951 (from boghison:memtypes); r=jdm
Also adds HeapSizeOf implementations/derive for some types. I've used "Cannot calculate Heap size" as a reason everywhere, because my imagination is rather limited. If you'd like me to change this message for specific types, please write something like this: "Trusted - Cannot calculate Heap size for Trusted" so that it would be easier for me to replace them through a script :)

Source-Repo: https://github.com/servo/servo
Source-Revision: a03616f379c255cc6c9b6e1d04dd7d98bd9926ce
2015-08-13 13:16:14 -06:00
David Zbarsky
b789fa718f servo: Merge #6695 - Implement Range#extractContents (from dzbarsky:extractcontents); r=Ms2ger
Source-Repo: https://github.com/servo/servo
Source-Revision: bdf01ddd6050e2616bd154a58ac517b3eef44db0
2015-07-28 13:01:33 -06:00
Bogdan Cuza
e9c4da1e57 servo: Merge #6699 - Tidy check for FooMethods in components/script/dom/*.rs and color for tidy (from boghison:tidyspec); r=jdm
Source-Repo: https://github.com/servo/servo
Source-Revision: 14ccb22e679722ed3374c8facec21adcf0f2b247
2015-07-28 08:56:39 -06:00
David Zbarsky
8579214da1 servo: Merge #6625 - Implement Range#cloneContents (from dzbarsky:range-clonecontents); r=Ms2ger
Source-Repo: https://github.com/servo/servo
Source-Revision: a0cf597946446c427c54da363fe989ff68db4270
2015-07-18 02:42:29 -06:00
David Zbarsky
fb3700b6c0 servo: Merge #6568 - Implement Range#insertNode (from dzbarsky:delete_range); r=jdm
Gecko doesn't really follow the spec but it seems to throw a HierarchyRequest error when parent is null.
Any ideas who I should talk to about fixing the spec to account for the null checks?

Source-Repo: https://github.com/servo/servo
Source-Revision: acf47a02cf38b5c82e7c78cc1f6660a7daa9969a
2015-07-16 10:56:17 -06:00
David Winslow
b9c1f245a1 servo: Merge #6529 - Refactor #[jstraceable] to #[derive(JSTraceable)] (from dwins:master); r=Manishearth
fixes #6524.  I had to make an additional change not mentioned in the ticket - adding the `#[feature]` to enable deriving custom traits but I assume that's expected at this time.

Source-Repo: https://github.com/servo/servo
Source-Revision: bbb39082e0f640400546d2084a450a8675820a82
2015-07-01 18:27:40 -06:00
Michael Wu
cc12b0bb95 servo: Merge #6491 - Remove unnecessary uses of MutHeap (from michaelwu:mutable); r=metajack
Source-Repo: https://github.com/servo/servo
Source-Revision: b73eca160cc5d35faf422a946ec1d0812af89d6e
2015-06-26 20:36:04 -06:00
Michael Wu
7512d04e93 servo: Merge #6150 - Upgrade to Spidermonkey 39 (from servo:smupgrade3); r=mbrubeck
> Here it is.
>
> ~~There's two major things that are unfinished here:~~
> - ~~Dealing with the unroot_must_root lint. I'm not sure about the value of this lint with the new rooting API.~~ Done.
> - ~~Updating the Cargo.locks to point to the new SM and SM binding.~~ Done.
>
> I also included my fixes for the rust update, but these will disappear in a rebase. A rust update is necessary to support calling `Drop` on `Heap<T>` correctly when `Heap<T>` is inside a `Rc<T>`. Otherwise `&self` points to the wrong location.
>
> Incremental GC is disabled here. I'm not sure how to deal with the incremental barriers so that's left for later.
>
> Generational GC works. SM doesn't work without it.
>
> The biggest change here is to the rooting API. `Root` was made movable, and `Temporary` and `JSRef` was removed. Movable `Root`s means there's no need for `Temporary`, and `JSRef`s aren't needed generally since it can be assumed that being able to obtain a reference to a dom object means it's already rooted. References have their lifetime bound to the Roots that provided them. DOM objects that haven't passed through `reflect_dom_object` don't need to be rooted, and DOM objects that have passed through `reflect_dom_object` can't be obtained without being rooted through `native_from_reflector_jsmanaged` or `JS::<T>::root()`.
>
> Support for `Heap<T>` ended up messier than I expected. It's split into two commits, but only because it's a bit difficult to fold them together. Supporting `Heap<T>` properly requires that that `Heap::<T>::set()` be called on something that won't move. I removed the Copy and Clone trait from `Heap<T>` so `Cell` can't hold `Heap<T>` - only `UnsafeCell` can hold it.
>
> `CallbackObject` is a bit tricky - I moved all callbacks into `Rc<T>` in order to make sure that the pointer inside to a `*mut JSObject` doesn't move. This is necessary for supporting `Heap<T>`.
>
> `RootedCollectionSet` is very general purpose now. Anything with `JSTraceable` can be rooted by `RootedCollectionSet`/`RootedTraceable`. Right now, `RootedTraceable` is only used to hold down dom objects before they're fully attached to their reflector. I had to make a custom mechanism to dispatch the trace call - couldn't figure out how to get trait objects working for this case.
>
> This has been tested with the following zeal settings:
>
> GC after every allocation
> JS_GC_ZEAL=2,1
>
> GC after every 100 allocations (important for catching use-after-free bugs)
> JS_GC_ZEAL=2,100
>
> Verify pre barriers
> JS_GC_ZEAL=4,1
>
> Verify post barriers
> JS_GC_ZEAL=11,1

Source-Repo: https://github.com/servo/servo
Source-Revision: e7808c526c348fea5e3b48af70b7f1a066652097
2015-06-19 16:46:55 -06:00
Anthony Ramine
8bcfe1b851 servo: Merge #5931 - Remove helpers that correspond to DOM methods (from nox:rm-helpers); r=jdm
Source-Repo: https://github.com/servo/servo
Source-Revision: 16a7c792b564a6eab48391865a7060b8dba38284
2015-05-06 01:31:26 -05:00
Anthony Ramine
421aa02eae servo: Merge #5839 - Implement base machinery of Range (from nox:range); r=Manishearth
The actual boundary points are behind a Rc<_> value to let nodes be able to store weak references to them in the future.

Source-Repo: https://github.com/servo/servo
Source-Revision: 15c4372a8be9c2b73d9e09bd7684484e48d220e8
2015-04-30 05:59:55 -05:00
Anthony Ramine
39e9571d13 servo: Merge #5871 - Cleanup JS traits and methods (from nox:rootable); r=jdm
Source-Repo: https://github.com/servo/servo
Source-Revision: b8ae33e510ea30e3200834fc2f7fbc426b86701e
2015-04-28 04:23:05 -05:00
Corey Farwell
5c841a0070 servo: Merge #5677 - Update WHATWG links to use HTTPS (from frewsxcv:https); r=Ms2ger
Extracted this out of #5649

This commit was created with the following commands:

```
find . -iname "*.webidl" -type f -print0 | xargs -0 sed -i '' 's/http:\(.*\)whatwg.org/https:\1whatwg.org/g'
```

```
find . -iname "*.rs" -type f -print0 | xargs -0 sed -i '' 's/http:\(.*\)whatwg.org/https:\1whatwg.org/g'
```

Source-Repo: https://github.com/servo/servo
Source-Revision: 4997d3a112354a407365fede1ab1944834a2e13c
2015-04-14 02:57:41 -05:00
Matt McCoy
8fca9b5656 servo: Merge #4566 - Fixes #4164 Make Constructor and new functions take GlobalRef by value (from mattnenterprise:globalref-by-value); r=Ms2ger
Source-Repo: https://github.com/servo/servo
Source-Revision: 7800d98728bfa1375ad8b6a2dac7f2f35603b6d1
2015-01-08 13:12:55 -07:00
Ms2ger
3d0a04c20a servo: Merge #4526 - Move away from Root::deref (from servo:deref-1); r=Manishearth
This is a start towards fixing #3868. Not all callers have been fixed yet, so the `Deref` implementation remains for now.

Source-Repo: https://github.com/servo/servo
Source-Revision: 141b5d038fad3c0c44a6f1b309b8ca9edea54580
2015-01-02 09:22:51 -07:00
Manish Goregaokar
e0c8a4271d servo: Merge #4173 - plugins: Autogeneration of Reflectable; Inheritance lint (from Manishearth:a-more-dom-struct); r=kmcallister
Now `#[dom_struct]` also generates Reflectable impls, and there's another lint to ensure that a DOM struct only contains one bare DOM field (as the first field) or a Reflector.

A lot of this was generated by sed -- each autogenerated change has its own commit for easy review; these will be squashed later.

Source-Repo: https://github.com/servo/servo
Source-Revision: 56d1b16d1b3a18d5ffa1d9c32562d3b209851711
2014-12-27 22:12:45 -07:00
Tetsuharu OHZEKI
8bc1f6376b servo: Merge #4434 - script: Remove glob imports added in #4405 (from saneyuki:glob_script); r=jdm
#4406

Source-Repo: https://github.com/servo/servo
Source-Revision: 803e5ef7904f2843d8e44184f9154af079eea9fa
2014-12-18 15:57:48 -07:00
Michael Booth
8b0b657cb0 servo: Merge #4156 - Updated reflect_dom_object to be passed by value fixes #4122 (from Michael03:master); r=Ms2ger
This fixes issue #4122

Source-Repo: https://github.com/servo/servo
Source-Revision: ed45aa9efd6cf238a83fcae6a772886df61771f7
2014-12-02 05:24:49 -07:00
Ms2ger
aaaf47d3f6 servo: Merge #3780 - Cleanup Document (from Ms2ger:cleanup-document); r=jdm
Source-Repo: https://github.com/servo/servo
Source-Revision: 43b13e7548f16c0c2721120ebabd89e88ecaf17d
2014-10-23 11:36:40 -06:00
Manish Goregaokar
4271b077f4 servo: Merge #3684 - Add #[dom_struct], inline autogenerated trace() methods (from Manishearth:dom_struct); r=jdm
This attribute implies #[jstraceable], #[privatize], and #[must_root].

Source-Repo: https://github.com/servo/servo
Source-Revision: 9af090006017747809f5f72a8870bd516b20f483
2014-10-15 23:24:20 -06:00
Tim Taubert
993d0f5a2e servo: Merge #3666 - Privatize DOM (fixes #3644) (from ttaubert:issue/3644-privatize-dom); r=Manishearth
This PR removes public fields from all (hope I didn't miss any) DOM structs. Should |Page| be privatized as well? This PR additionally introduces a #[privatize] lint to ensure nobody accidentally re-introduces a public field.

All changesets compile separately if applied in the same order. Hope that helps reviewing but I can of course squash them before merging.

Source-Repo: https://github.com/servo/servo
Source-Revision: f350879574194bb612eac88e21d0920e9827afa7
2014-10-13 22:00:37 -06:00
ProgramFOX
6653f7d4f4 servo: Merge #3489 - Made some DOM fields private (from ProgramFOX:issue2242-2)
Reviewed-by: jdm
Source-Repo: https://github.com/servo/servo
Source-Revision: 39b6bd9b9586d101943055202a7e06eb8d349dd8
2014-09-26 19:30:33 -06:00