2013-05-30 07:06:42 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2015-02-12 19:12:47 +00:00
|
|
|
#![feature(box_syntax)]
|
2016-08-14 13:26:21 +00:00
|
|
|
#![feature(conservative_impl_trait)]
|
2015-10-14 20:48:44 +00:00
|
|
|
#![feature(const_fn)]
|
2016-07-06 22:49:18 +00:00
|
|
|
#![feature(core_intrinsics)]
|
2015-03-23 12:57:50 +00:00
|
|
|
#![feature(custom_attribute)]
|
2015-07-02 00:27:40 +00:00
|
|
|
#![feature(custom_derive)]
|
2015-08-13 18:41:48 +00:00
|
|
|
#![feature(fnbox)]
|
2015-06-25 18:03:15 +00:00
|
|
|
#![feature(mpsc_select)]
|
|
|
|
#![feature(nonzero)]
|
2015-10-21 13:57:32 +00:00
|
|
|
#![feature(on_unimplemented)]
|
2016-05-24 09:07:29 +00:00
|
|
|
#![feature(optin_builtin_traits)]
|
2015-02-12 19:12:47 +00:00
|
|
|
#![feature(plugin)]
|
2015-08-10 20:05:02 +00:00
|
|
|
#![feature(slice_patterns)]
|
2016-05-11 12:43:41 +00:00
|
|
|
#![feature(stmt_expr_attributes)]
|
2016-06-01 10:09:21 +00:00
|
|
|
#![feature(question_mark)]
|
2016-10-04 16:58:56 +00:00
|
|
|
#![feature(try_borrow)]
|
2016-07-13 07:57:35 +00:00
|
|
|
#![feature(try_from)]
|
2013-10-22 16:16:17 +00:00
|
|
|
|
2015-03-21 11:12:45 +00:00
|
|
|
#![deny(unsafe_code)]
|
2014-09-20 22:35:08 +00:00
|
|
|
#![allow(non_snake_case)]
|
2014-06-28 01:25:07 +00:00
|
|
|
|
2015-09-01 14:33:02 +00:00
|
|
|
#![doc = "The script crate contains all matters DOM."]
|
2014-07-26 15:15:12 +00:00
|
|
|
|
2016-02-04 22:10:36 +00:00
|
|
|
#![plugin(heapsize_plugin)]
|
2016-02-25 16:12:11 +00:00
|
|
|
#![plugin(phf_macros)]
|
2015-03-18 17:25:00 +00:00
|
|
|
#![plugin(plugins)]
|
|
|
|
|
2015-11-28 14:04:11 +00:00
|
|
|
extern crate angle;
|
2015-09-30 21:19:33 +00:00
|
|
|
extern crate app_units;
|
2016-09-09 21:28:34 +00:00
|
|
|
extern crate audio_video_metadata;
|
2016-04-22 20:40:38 +00:00
|
|
|
#[allow(unused_extern_crates)]
|
2015-09-23 21:02:56 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate bitflags;
|
|
|
|
extern crate canvas_traits;
|
2015-10-02 19:26:05 +00:00
|
|
|
extern crate caseless;
|
2016-06-26 08:19:14 +00:00
|
|
|
extern crate cookie as cookie_rs;
|
2015-01-28 01:15:50 +00:00
|
|
|
extern crate core;
|
2016-06-08 13:29:42 +00:00
|
|
|
#[macro_use]
|
2014-06-06 21:22:25 +00:00
|
|
|
extern crate cssparser;
|
2015-09-23 21:02:56 +00:00
|
|
|
extern crate devtools_traits;
|
2014-03-19 16:35:17 +00:00
|
|
|
extern crate encoding;
|
2015-09-23 21:02:56 +00:00
|
|
|
extern crate euclid;
|
2015-06-10 14:23:11 +00:00
|
|
|
extern crate fnv;
|
2015-12-23 13:08:51 +00:00
|
|
|
extern crate gfx_traits;
|
2016-02-04 22:10:36 +00:00
|
|
|
extern crate heapsize;
|
2015-09-23 21:02:56 +00:00
|
|
|
extern crate html5ever;
|
2014-12-05 11:16:11 +00:00
|
|
|
extern crate hyper;
|
2016-08-12 17:23:10 +00:00
|
|
|
extern crate hyper_serde;
|
2015-10-27 04:29:04 +00:00
|
|
|
extern crate image;
|
2015-07-14 14:46:07 +00:00
|
|
|
extern crate ipc_channel;
|
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 18:03:35 +00:00
|
|
|
#[macro_use]
|
2014-03-19 16:35:17 +00:00
|
|
|
extern crate js;
|
2014-04-27 22:52:39 +00:00
|
|
|
extern crate libc;
|
2015-11-28 14:04:11 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate log;
|
2016-05-01 01:43:30 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate mime;
|
2016-06-20 17:06:52 +00:00
|
|
|
extern crate mime_guess;
|
2014-09-24 15:55:41 +00:00
|
|
|
extern crate msg;
|
2015-04-03 19:00:46 +00:00
|
|
|
extern crate net_traits;
|
2016-04-20 15:10:24 +00:00
|
|
|
extern crate num_traits;
|
2015-09-23 21:02:56 +00:00
|
|
|
extern crate offscreen_gl_context;
|
2016-05-27 17:03:56 +00:00
|
|
|
extern crate open;
|
2016-10-04 16:58:56 +00:00
|
|
|
extern crate parking_lot;
|
2016-02-25 16:12:11 +00:00
|
|
|
extern crate phf;
|
2015-11-28 14:04:11 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate profile_traits;
|
2015-09-23 21:02:56 +00:00
|
|
|
extern crate rand;
|
2016-06-20 17:54:20 +00:00
|
|
|
extern crate range;
|
2015-12-03 10:40:24 +00:00
|
|
|
extern crate ref_slice;
|
2016-03-16 15:31:18 +00:00
|
|
|
extern crate regex;
|
2015-05-05 14:11:30 +00:00
|
|
|
extern crate rustc_serialize;
|
2016-06-20 17:54:20 +00:00
|
|
|
extern crate script_layout_interface;
|
2014-08-08 20:17:40 +00:00
|
|
|
extern crate script_traits;
|
2016-02-03 01:34:11 +00:00
|
|
|
extern crate selectors;
|
2015-09-23 21:02:56 +00:00
|
|
|
extern crate serde;
|
2015-06-10 14:23:11 +00:00
|
|
|
extern crate smallvec;
|
2015-11-25 18:40:39 +00:00
|
|
|
#[macro_use(atom, ns)] extern crate string_cache;
|
2015-11-28 14:04:11 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate style;
|
2015-09-23 21:02:56 +00:00
|
|
|
extern crate time;
|
2016-07-25 13:14:09 +00:00
|
|
|
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
|
2016-05-04 16:10:40 +00:00
|
|
|
extern crate tinyfiledialogs;
|
2014-08-09 03:00:27 +00:00
|
|
|
extern crate url;
|
2015-11-28 14:04:11 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate util;
|
2014-09-19 13:15:03 +00:00
|
|
|
extern crate uuid;
|
2016-03-31 20:27:20 +00:00
|
|
|
extern crate webrender_traits;
|
2015-09-23 21:02:56 +00:00
|
|
|
extern crate websocket;
|
2015-12-04 21:38:40 +00:00
|
|
|
extern crate xml5ever;
|
2013-05-30 07:06:42 +00:00
|
|
|
|
2016-06-01 01:00:23 +00:00
|
|
|
pub mod bluetooth_blacklist;
|
2016-09-29 11:19:59 +00:00
|
|
|
mod body;
|
2015-09-23 21:02:56 +00:00
|
|
|
pub mod clipboard_provider;
|
|
|
|
mod devtools;
|
2015-05-11 19:35:33 +00:00
|
|
|
pub mod document_loader;
|
2015-01-28 20:15:53 +00:00
|
|
|
#[macro_use]
|
2015-02-01 08:36:49 +00:00
|
|
|
pub mod dom;
|
2016-09-29 19:28:54 +00:00
|
|
|
pub mod fetch;
|
2016-06-20 17:54:20 +00:00
|
|
|
pub mod layout_wrapper;
|
2015-08-04 03:24:41 +00:00
|
|
|
mod mem;
|
2015-04-16 16:33:06 +00:00
|
|
|
mod network_listener;
|
2016-04-13 10:39:38 +00:00
|
|
|
pub mod origin;
|
2015-09-23 21:02:56 +00:00
|
|
|
pub mod parse;
|
2016-04-06 07:51:21 +00:00
|
|
|
pub mod script_runtime;
|
2015-09-23 21:02:56 +00:00
|
|
|
#[allow(unsafe_code)]
|
2016-01-10 10:19:04 +00:00
|
|
|
pub mod script_thread;
|
servo: Merge #11727 - Integrate service worker manager thread (from creativcoder:swmanager); r=jdm
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes are part of #11091
<!-- Either: -->
- [X] There are tests for these changes at my [gh-pages](https://github.com/creativcoder/gsoc16/tree/gh-pages) branch to test the instantiation of service workers by their manager, but will need to discuss how that would integrate into master.
Changes:
- Introduces a `ServiceWorkerManager`, which maintains an map of registered service workers as well as a map of active workers keyed by their `scope_url`.
- Adds the initialization of ServiceWorkerManager, at the `script::init()`, which makes it available as a single entity listening for requests from different script threads.
- Adds a timeout thread in `serviceworkerglobalscope`, which terminates the workers, after a timeout of 60 secs, thereby removing it from the active workers list.
- Adds the matching of scope urls, in longest prefix way rather than path structural way, according to [spec](https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#scope-match-algorithm).
- Make ServiceWorkerManager, the holder of network sender, instead of script thread, so it can send `CustomResponse`.
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Source-Repo: https://github.com/servo/servo
Source-Revision: 513811f6b40d522bc425c2588320b889614f2973
2016-07-18 16:50:59 +00:00
|
|
|
mod serviceworker_manager;
|
2016-03-10 20:08:27 +00:00
|
|
|
mod task_source;
|
2014-11-13 17:57:33 +00:00
|
|
|
pub mod textinput;
|
2015-09-18 20:44:48 +00:00
|
|
|
mod timers;
|
2015-10-21 23:48:49 +00:00
|
|
|
mod unpremultiplytable;
|
2015-04-23 18:41:11 +00:00
|
|
|
mod webdriver_handlers;
|
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 22:46:55 +00:00
|
|
|
|
2015-08-24 17:52:03 +00:00
|
|
|
use dom::bindings::codegen::RegisterBindings;
|
2016-08-25 11:31:46 +00:00
|
|
|
use dom::bindings::proxyhandler;
|
servo: Merge #11727 - Integrate service worker manager thread (from creativcoder:swmanager); r=jdm
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes are part of #11091
<!-- Either: -->
- [X] There are tests for these changes at my [gh-pages](https://github.com/creativcoder/gsoc16/tree/gh-pages) branch to test the instantiation of service workers by their manager, but will need to discuss how that would integrate into master.
Changes:
- Introduces a `ServiceWorkerManager`, which maintains an map of registered service workers as well as a map of active workers keyed by their `scope_url`.
- Adds the initialization of ServiceWorkerManager, at the `script::init()`, which makes it available as a single entity listening for requests from different script threads.
- Adds a timeout thread in `serviceworkerglobalscope`, which terminates the workers, after a timeout of 60 secs, thereby removing it from the active workers list.
- Adds the matching of scope urls, in longest prefix way rather than path structural way, according to [spec](https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#scope-match-algorithm).
- Make ServiceWorkerManager, the holder of network sender, instead of script thread, so it can send `CustomResponse`.
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Source-Repo: https://github.com/servo/servo
Source-Revision: 513811f6b40d522bc425c2588320b889614f2973
2016-07-18 16:50:59 +00:00
|
|
|
use script_traits::SWManagerSenders;
|
|
|
|
use serviceworker_manager::ServiceWorkerManager;
|
2015-08-24 17:52:03 +00:00
|
|
|
|
2015-09-01 14:33:02 +00:00
|
|
|
#[cfg(target_os = "linux")]
|
2015-07-23 12:18:35 +00:00
|
|
|
#[allow(unsafe_code)]
|
|
|
|
fn perform_platform_specific_initialization() {
|
|
|
|
use std::mem;
|
2015-10-13 14:49:56 +00:00
|
|
|
// 4096 is default max on many linux systems
|
|
|
|
const MAX_FILE_LIMIT: libc::rlim_t = 4096;
|
2015-07-23 12:18:35 +00:00
|
|
|
|
|
|
|
// Bump up our number of file descriptors to save us from impending doom caused by an onslaught
|
|
|
|
// of iframes.
|
|
|
|
unsafe {
|
2015-10-13 14:49:56 +00:00
|
|
|
let mut rlim: libc::rlimit = mem::uninitialized();
|
|
|
|
match libc::getrlimit(libc::RLIMIT_NOFILE, &mut rlim) {
|
|
|
|
0 => {
|
|
|
|
if rlim.rlim_cur >= MAX_FILE_LIMIT {
|
|
|
|
// we have more than enough
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
rlim.rlim_cur = match rlim.rlim_max {
|
|
|
|
libc::RLIM_INFINITY => MAX_FILE_LIMIT,
|
|
|
|
_ => {
|
|
|
|
if rlim.rlim_max < MAX_FILE_LIMIT {
|
|
|
|
rlim.rlim_max
|
|
|
|
} else {
|
|
|
|
MAX_FILE_LIMIT
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2016-01-03 03:46:34 +00:00
|
|
|
match libc::setrlimit(libc::RLIMIT_NOFILE, &rlim) {
|
2015-10-13 14:49:56 +00:00
|
|
|
0 => (),
|
|
|
|
_ => warn!("Failed to set file count limit"),
|
|
|
|
};
|
|
|
|
},
|
|
|
|
_ => warn!("Failed to get file count limit"),
|
|
|
|
};
|
2015-07-23 12:18:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-01 14:33:02 +00:00
|
|
|
#[cfg(not(target_os = "linux"))]
|
2015-07-23 12:18:35 +00:00
|
|
|
fn perform_platform_specific_initialization() {}
|
|
|
|
|
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 22:46:55 +00:00
|
|
|
#[allow(unsafe_code)]
|
servo: Merge #11727 - Integrate service worker manager thread (from creativcoder:swmanager); r=jdm
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes are part of #11091
<!-- Either: -->
- [X] There are tests for these changes at my [gh-pages](https://github.com/creativcoder/gsoc16/tree/gh-pages) branch to test the instantiation of service workers by their manager, but will need to discuss how that would integrate into master.
Changes:
- Introduces a `ServiceWorkerManager`, which maintains an map of registered service workers as well as a map of active workers keyed by their `scope_url`.
- Adds the initialization of ServiceWorkerManager, at the `script::init()`, which makes it available as a single entity listening for requests from different script threads.
- Adds a timeout thread in `serviceworkerglobalscope`, which terminates the workers, after a timeout of 60 secs, thereby removing it from the active workers list.
- Adds the matching of scope urls, in longest prefix way rather than path structural way, according to [spec](https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#scope-match-algorithm).
- Make ServiceWorkerManager, the holder of network sender, instead of script thread, so it can send `CustomResponse`.
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Source-Repo: https://github.com/servo/servo
Source-Revision: 513811f6b40d522bc425c2588320b889614f2973
2016-07-18 16:50:59 +00:00
|
|
|
pub fn init(sw_senders: SWManagerSenders) {
|
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 22:46:55 +00:00
|
|
|
unsafe {
|
2016-08-25 11:31:46 +00:00
|
|
|
proxyhandler::init();
|
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 22:46:55 +00:00
|
|
|
}
|
2015-07-23 12:18:35 +00:00
|
|
|
|
servo: Merge #11727 - Integrate service worker manager thread (from creativcoder:swmanager); r=jdm
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes are part of #11091
<!-- Either: -->
- [X] There are tests for these changes at my [gh-pages](https://github.com/creativcoder/gsoc16/tree/gh-pages) branch to test the instantiation of service workers by their manager, but will need to discuss how that would integrate into master.
Changes:
- Introduces a `ServiceWorkerManager`, which maintains an map of registered service workers as well as a map of active workers keyed by their `scope_url`.
- Adds the initialization of ServiceWorkerManager, at the `script::init()`, which makes it available as a single entity listening for requests from different script threads.
- Adds a timeout thread in `serviceworkerglobalscope`, which terminates the workers, after a timeout of 60 secs, thereby removing it from the active workers list.
- Adds the matching of scope urls, in longest prefix way rather than path structural way, according to [spec](https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#scope-match-algorithm).
- Make ServiceWorkerManager, the holder of network sender, instead of script thread, so it can send `CustomResponse`.
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Source-Repo: https://github.com/servo/servo
Source-Revision: 513811f6b40d522bc425c2588320b889614f2973
2016-07-18 16:50:59 +00:00
|
|
|
// Spawn the service worker manager passing the constellation sender
|
|
|
|
ServiceWorkerManager::spawn_manager(sw_senders);
|
|
|
|
|
2015-08-24 17:52:03 +00:00
|
|
|
// Create the global vtables used by the (generated) DOM
|
|
|
|
// bindings to implement JS proxies.
|
|
|
|
RegisterBindings::RegisterProxyHandlers();
|
|
|
|
|
2015-07-23 12:18:35 +00:00
|
|
|
perform_platform_specific_initialization();
|
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 22:46:55 +00:00
|
|
|
}
|