aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/canvas/canvas_paint_thread.rs15
-rw-r--r--components/constellation/Cargo.toml1
-rw-r--r--components/constellation/constellation.rs31
-rw-r--r--components/constellation/lib.rs1
-rw-r--r--components/layout/Cargo.toml1
-rw-r--r--components/layout/animation.rs9
-rw-r--r--components/layout/lib.rs1
-rw-r--r--components/layout_thread/lib.rs42
-rw-r--r--components/script/dom/bindings/str.rs2
-rw-r--r--components/script/dom/headers.rs251
-rw-r--r--components/script/dom/mod.rs1
-rw-r--r--components/script/dom/testbinding.rs4
-rw-r--r--components/script/dom/webidls/Headers.webidl22
-rw-r--r--components/script/dom/webidls/TestBinding.webidl2
-rw-r--r--components/script/dom/window.rs6
-rw-r--r--components/script/dom/xmlhttprequest.rs18
-rw-r--r--components/script/script_thread.rs16
-rw-r--r--components/script_layout_interface/message.rs5
-rw-r--r--components/script_traits/lib.rs32
-rw-r--r--components/servo/Cargo.lock57
-rw-r--r--components/style/animation.rs21
-rw-r--r--components/style/context.rs5
-rw-r--r--components/style/lib.rs1
-rw-r--r--components/style/matching.rs3
-rw-r--r--components/style/timer.rs58
-rw-r--r--ports/cef/Cargo.lock57
-rw-r--r--ports/cef/window.rs2
-rw-r--r--ports/geckolib/glue.rs2
-rw-r--r--ports/glutin/window.rs2
-rw-r--r--python/tidy/servo_tidy/tidy.py1
-rw-r--r--resources/prefs.json1
-rw-r--r--tests/unit/script/headers.rs74
-rw-r--r--tests/unit/script/lib.rs1
-rw-r--r--tests/wpt/mozilla/meta/MANIFEST.json6
-rw-r--r--tests/wpt/mozilla/meta/css/animations/__dir__.ini2
-rw-r--r--tests/wpt/mozilla/tests/css/animations/basic-linear-width.html33
-rw-r--r--tests/wpt/mozilla/tests/mozilla/interfaces.html1
-rw-r--r--tests/wpt/mozilla/tests/mozilla/interfaces.worker.js1
38 files changed, 586 insertions, 202 deletions
diff --git a/components/canvas/canvas_paint_thread.rs b/components/canvas/canvas_paint_thread.rs
index 23989a45f18..2eeb827d73c 100644
--- a/components/canvas/canvas_paint_thread.rs
+++ b/components/canvas/canvas_paint_thread.rs
@@ -17,7 +17,6 @@ use ipc_channel::ipc::{self, IpcSender};
use num_traits::ToPrimitive;
use std::borrow::ToOwned;
use std::mem;
-use util::opts;
use util::thread::spawn_named;
use webrender_traits;
@@ -78,8 +77,8 @@ struct CanvasPaintState<'a> {
}
impl<'a> CanvasPaintState<'a> {
- fn new() -> CanvasPaintState<'a> {
- let antialias = if opts::get().enable_canvas_antialiasing {
+ fn new(antialias: bool) -> CanvasPaintState<'a> {
+ let antialias = if antialias {
AntialiasMode::Default
} else {
AntialiasMode::None
@@ -101,7 +100,8 @@ impl<'a> CanvasPaintState<'a> {
impl<'a> CanvasPaintThread<'a> {
fn new(size: Size2D<i32>,
- webrender_api_sender: Option<webrender_traits::RenderApiSender>) -> CanvasPaintThread<'a> {
+ webrender_api_sender: Option<webrender_traits::RenderApiSender>,
+ antialias: bool) -> CanvasPaintThread<'a> {
let draw_target = CanvasPaintThread::create(size);
let path_builder = draw_target.create_path_builder();
let webrender_api = webrender_api_sender.map(|wr| wr.create_api());
@@ -109,7 +109,7 @@ impl<'a> CanvasPaintThread<'a> {
CanvasPaintThread {
drawtarget: draw_target,
path_builder: path_builder,
- state: CanvasPaintState::new(),
+ state: CanvasPaintState::new(antialias),
saved_states: vec![],
webrender_api: webrender_api,
webrender_image_key: webrender_image_key,
@@ -119,11 +119,12 @@ impl<'a> CanvasPaintThread<'a> {
/// Creates a new `CanvasPaintThread` and returns an `IpcSender` to
/// communicate with it.
pub fn start(size: Size2D<i32>,
- webrender_api_sender: Option<webrender_traits::RenderApiSender>)
+ webrender_api_sender: Option<webrender_traits::RenderApiSender>,
+ antialias: bool)
-> IpcSender<CanvasMsg> {
let (sender, receiver) = ipc::channel::<CanvasMsg>().unwrap();
spawn_named("CanvasThread".to_owned(), move || {
- let mut painter = CanvasPaintThread::new(size, webrender_api_sender);
+ let mut painter = CanvasPaintThread::new(size, webrender_api_sender, antialias);
loop {
let msg = receiver.recv();
match msg.unwrap() {
diff --git a/components/constellation/Cargo.toml b/components/constellation/Cargo.toml
index f2cf43340de..83d8aac997a 100644
--- a/components/constellation/Cargo.toml
+++ b/components/constellation/Cargo.toml
@@ -13,7 +13,6 @@ path = "lib.rs"
backtrace = "0.2.1"
canvas = {path = "../canvas"}
canvas_traits = {path = "../canvas_traits"}
-clipboard = {git = "https://github.com/aweinstock314/rust-clipboard"}
compositing = {path = "../compositing"}
devtools_traits = {path = "../devtools_traits"}
euclid = "0.7.1"
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs
index b03ad1c0d79..af6237ddd8b 100644
--- a/components/constellation/constellation.rs
+++ b/components/constellation/constellation.rs
@@ -13,7 +13,6 @@ use backtrace::Backtrace;
use canvas::canvas_paint_thread::CanvasPaintThread;
use canvas::webgl_paint_thread::WebGLPaintThread;
use canvas_traits::CanvasMsg;
-use clipboard::ClipboardContext;
use compositing::SendableFrameTree;
use compositing::compositor_thread::CompositorProxy;
use compositing::compositor_thread::Msg as ToCompositorMsg;
@@ -172,9 +171,6 @@ pub struct Constellation<Message, LTF, STF> {
window_size: WindowSizeData,
- /// Means of accessing the clipboard
- clipboard_ctx: Option<ClipboardContext>,
-
/// Bits of state used to interact with the webdriver implementation
webdriver: WebDriverData,
@@ -476,11 +472,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
ScaleFactor::new(opts::get().device_pixels_per_px.unwrap_or(1.0)),
},
phantom: PhantomData,
- clipboard_ctx: if state.supports_clipboard {
- ClipboardContext::new().ok()
- } else {
- None
- },
webdriver: WebDriverData::new(),
scheduler_chan: TimerScheduler::start(),
child_processes: Vec::new(),
@@ -851,26 +842,11 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
}
FromScriptMsg::GetClipboardContents(sender) => {
- let result = match self.clipboard_ctx {
- Some(ref ctx) => match ctx.get_contents() {
- Ok(result) => result,
- Err(e) => {
- warn!("Error getting clipboard contents ({}), defaulting to empty string", e);
- "".to_owned()
- },
- },
- None => "".to_owned()
- };
- if let Err(e) = sender.send(result) {
+ if let Err(e) = sender.send("".to_owned()) {
warn!("Failed to send clipboard ({})", e);
}
}
- FromScriptMsg::SetClipboardContents(s) => {
- if let Some(ref mut ctx) = self.clipboard_ctx {
- if let Err(e) = ctx.set_contents(s) {
- warn!("Error setting clipboard contents ({})", e);
- }
- }
+ FromScriptMsg::SetClipboardContents(_) => {
}
FromScriptMsg::SetVisible(pipeline_id, visible) => {
debug!("constellation got set visible messsage");
@@ -1750,7 +1726,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
size: &Size2D<i32>,
response_sender: IpcSender<IpcSender<CanvasMsg>>) {
let webrender_api = self.webrender_api_sender.clone();
- let sender = CanvasPaintThread::start(*size, webrender_api);
+ let sender = CanvasPaintThread::start(*size, webrender_api,
+ opts::get().enable_canvas_antialiasing);
if let Err(e) = response_sender.send(sender) {
warn!("Create canvas paint thread response failed ({})", e);
}
diff --git a/components/constellation/lib.rs b/components/constellation/lib.rs
index aeeeae8a1d2..d4df0d47b1a 100644
--- a/components/constellation/lib.rs
+++ b/components/constellation/lib.rs
@@ -15,7 +15,6 @@
extern crate backtrace;
extern crate canvas;
extern crate canvas_traits;
-extern crate clipboard;
extern crate compositing;
extern crate devtools_traits;
extern crate euclid;
diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml
index 3add6b14976..9c83648128a 100644
--- a/components/layout/Cargo.toml
+++ b/components/layout/Cargo.toml
@@ -38,7 +38,6 @@ smallvec = "0.1"
string_cache = {version = "0.2.20", features = ["heap_size"]}
style = {path = "../style"}
style_traits = {path = "../style_traits"}
-time = "0.1"
unicode-bidi = "0.2"
unicode-script = {version = "0.1", features = ["harfbuzz"]}
url = {version = "1.0.0", features = ["heap_size"]}
diff --git a/components/layout/animation.rs b/components/layout/animation.rs
index 4087479ed47..5a67b1af5bf 100644
--- a/components/layout/animation.rs
+++ b/components/layout/animation.rs
@@ -14,7 +14,7 @@ use script_traits::{AnimationState, LayoutMsg as ConstellationMsg};
use std::collections::HashMap;
use std::sync::mpsc::Receiver;
use style::animation::{Animation, update_style_for_animation};
-use time;
+use style::timer::Timer;
/// Processes any new animations that were discovered after style recalculation.
/// Also expire any old animations that have completed, inserting them into
@@ -23,7 +23,8 @@ pub fn update_animation_state(constellation_chan: &IpcSender<ConstellationMsg>,
running_animations: &mut HashMap<OpaqueNode, Vec<Animation>>,
expired_animations: &mut HashMap<OpaqueNode, Vec<Animation>>,
new_animations_receiver: &Receiver<Animation>,
- pipeline_id: PipelineId) {
+ pipeline_id: PipelineId,
+ timer: &Timer) {
let mut new_running_animations = vec![];
while let Ok(animation) = new_animations_receiver.try_recv() {
let mut should_push = true;
@@ -37,7 +38,7 @@ pub fn update_animation_state(constellation_chan: &IpcSender<ConstellationMsg>,
if let Animation::Keyframes(_, ref anim_name, ref mut anim_state) = *anim {
if *name == *anim_name {
debug!("update_animation_state: Found other animation {}", name);
- anim_state.update_from_other(&state);
+ anim_state.update_from_other(&state, timer);
should_push = false;
break;
}
@@ -57,7 +58,7 @@ pub fn update_animation_state(constellation_chan: &IpcSender<ConstellationMsg>,
return
}
- let now = time::precise_time_s();
+ let now = timer.seconds();
// Expire old running animations.
//
// TODO: Do not expunge Keyframes animations, since we need that state if
diff --git a/components/layout/lib.rs b/components/layout/lib.rs
index f05b21c3628..b6f10c7fa89 100644
--- a/components/layout/lib.rs
+++ b/components/layout/lib.rs
@@ -50,7 +50,6 @@ extern crate smallvec;
#[macro_use(atom, ns)] extern crate string_cache;
extern crate style;
extern crate style_traits;
-extern crate time;
extern crate unicode_bidi;
extern crate unicode_script;
extern crate url;
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index 7fc12535ff7..592a6cda6a4 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -110,11 +110,13 @@ use style::refcell::RefCell;
use style::selector_matching::Stylist;
use style::servo_selector_impl::USER_OR_USER_AGENT_STYLESHEETS;
use style::stylesheets::{Stylesheet, CSSRuleIteratorExt};
+use style::timer::Timer;
use style::workqueue::WorkQueue;
use url::Url;
use util::geometry::MAX_RECT;
use util::ipc::OptionalIpcSender;
use util::opts;
+use util::prefs::PREFS;
use util::thread;
use util::thread_state;
@@ -226,6 +228,10 @@ pub struct LayoutThread {
// Webrender interface, if enabled.
webrender_api: Option<webrender_traits::RenderApi>,
+
+ /// The timer object to control the timing of the animations. This should
+ /// only be a test-mode timer during testing for animations.
+ timer: Timer,
}
impl LayoutThreadFactory for LayoutThread {
@@ -459,13 +465,20 @@ impl LayoutThread {
offset_parent_response: OffsetParentResponse::empty(),
margin_style_response: MarginStyleResponse::empty(),
stacking_context_scroll_offsets: HashMap::new(),
- })),
- error_reporter: CSSErrorReporter {
- pipelineid: id,
- script_chan: Arc::new(Mutex::new(script_chan)),
- },
- webrender_image_cache:
- Arc::new(RwLock::new(HashMap::with_hasher(Default::default()))),
+ })),
+ error_reporter: CSSErrorReporter {
+ pipelineid: id,
+ script_chan: Arc::new(Mutex::new(script_chan)),
+ },
+ webrender_image_cache:
+ Arc::new(RwLock::new(HashMap::with_hasher(Default::default()))),
+ timer:
+ if PREFS.get("layout.animations.test.enabled")
+ .as_boolean().unwrap_or(false) {
+ Timer::test_mode()
+ } else {
+ Timer::new()
+ },
}
}
@@ -501,6 +514,7 @@ impl LayoutThread {
expired_animations: self.expired_animations.clone(),
error_reporter: self.error_reporter.clone(),
local_context_creation_data: Mutex::new(local_style_context_creation_data),
+ timer: self.timer.clone(),
},
image_cache_thread: self.image_cache_thread.clone(),
image_cache_sender: Mutex::new(self.image_cache_sender.clone()),
@@ -653,6 +667,9 @@ impl LayoutThread {
let _rw_data = possibly_locked_rw_data.lock();
sender.send(self.epoch).unwrap();
},
+ Msg::AdvanceClockMs(how_many) => {
+ self.handle_advance_clock_ms(how_many, possibly_locked_rw_data);
+ }
Msg::GetWebFontLoadState(sender) => {
let _rw_data = possibly_locked_rw_data.lock();
let outstanding_web_fonts = self.outstanding_web_fonts.load(Ordering::SeqCst);
@@ -795,6 +812,14 @@ impl LayoutThread {
possibly_locked_rw_data.block(rw_data);
}
+ /// Advances the animation clock of the document.
+ fn handle_advance_clock_ms<'a, 'b>(&mut self,
+ how_many_ms: i32,
+ possibly_locked_rw_data: &mut RwData<'a, 'b>) {
+ self.timer.increment(how_many_ms as f64 / 1000.0);
+ self.tick_all_animations(possibly_locked_rw_data);
+ }
+
/// Sets quirks mode for the document, causing the quirks mode stylesheet to be used.
fn handle_set_quirks_mode<'a, 'b>(&self, possibly_locked_rw_data: &mut RwData<'a, 'b>) {
let mut rw_data = possibly_locked_rw_data.lock();
@@ -1350,7 +1375,8 @@ impl LayoutThread {
&mut *self.running_animations.write().unwrap(),
&mut *self.expired_animations.write().unwrap(),
&self.new_animations_receiver,
- self.id);
+ self.id,
+ &self.timer);
profile(time::ProfilerCategory::LayoutRestyleDamagePropagation,
self.profiler_metadata(),
diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs
index 5d79d29b77b..c73a08d182b 100644
--- a/components/script/dom/bindings/str.rs
+++ b/components/script/dom/bindings/str.rs
@@ -15,7 +15,7 @@ use std::str::{Bytes, FromStr};
use string_cache::Atom;
/// Encapsulates the IDL `ByteString` type.
-#[derive(JSTraceable, Clone, Eq, PartialEq, HeapSizeOf)]
+#[derive(JSTraceable, Clone, Eq, PartialEq, HeapSizeOf, Debug)]
pub struct ByteString(Vec<u8>);
impl ByteString {
diff --git a/components/script/dom/headers.rs b/components/script/dom/headers.rs
new file mode 100644
index 00000000000..e97edc00572
--- /dev/null
+++ b/components/script/dom/headers.rs
@@ -0,0 +1,251 @@
+/* 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/. */
+
+use dom::bindings::cell::DOMRefCell;
+use dom::bindings::codegen::Bindings::HeadersBinding;
+use dom::bindings::codegen::Bindings::HeadersBinding::HeadersMethods;
+use dom::bindings::error::Error;
+use dom::bindings::global::GlobalRef;
+use dom::bindings::js::Root;
+use dom::bindings::reflector::{Reflector, reflect_dom_object};
+use dom::bindings::str::{ByteString, is_token};
+use hyper;
+use std::result::Result;
+
+#[dom_struct]
+pub struct Headers {
+ reflector_: Reflector,
+ guard: Guard,
+ #[ignore_heap_size_of = "Defined in hyper"]
+ header_list: DOMRefCell<hyper::header::Headers>
+}
+
+// https://fetch.spec.whatwg.org/#concept-headers-guard
+#[derive(JSTraceable, HeapSizeOf, PartialEq)]
+pub enum Guard {
+ Immutable,
+ Request,
+ RequestNoCors,
+ Response,
+ None,
+}
+
+impl Headers {
+ pub fn new_inherited() -> Headers {
+ Headers {
+ reflector_: Reflector::new(),
+ guard: Guard::None,
+ header_list: DOMRefCell::new(hyper::header::Headers::new()),
+ }
+ }
+
+ pub fn new(global: GlobalRef) -> Root<Headers> {
+ reflect_dom_object(box Headers::new_inherited(), global, HeadersBinding::Wrap)
+ }
+}
+
+impl HeadersMethods for Headers {
+ // https://fetch.spec.whatwg.org/#concept-headers-append
+ fn Append(&self, name: ByteString, value: ByteString) -> Result<(), Error> {
+ // Step 1
+ let value = normalize_value(value);
+
+ // Step 2
+ let (valid_name, valid_value) = try!(validate_name_and_value(name, value));
+ // Step 3
+ if self.guard == Guard::Immutable {
+ return Err(Error::Type("Guard is immutable".to_string()));
+ }
+
+ // Step 4
+ if self.guard == Guard::Request && is_forbidden_header_name(&valid_name) {
+ return Ok(());
+ }
+
+ // Step 5
+ if self.guard == Guard::RequestNoCors && !is_cors_safelisted_request_header(&valid_name) {
+ return Ok(());
+ }
+
+ // Step 6
+ if self.guard == Guard::Response && is_forbidden_response_header(&valid_name) {
+ return Ok(());
+ }
+
+ // Step 7
+ self.header_list.borrow_mut().set_raw(valid_name, vec![valid_value]);
+ return Ok(());
+ }
+}
+
+// TODO
+// "Content-Type" once parsed, the value should be
+// `application/x-www-form-urlencoded`, `multipart/form-data`,
+// or `text/plain`.
+// "DPR", "Downlink", "Save-Data", "Viewport-Width", "Width":
+// once parsed, the value should not be failure.
+// https://fetch.spec.whatwg.org/#cors-safelisted-request-header
+fn is_cors_safelisted_request_header(name: &str) -> bool {
+ match name {
+ "accept" |
+ "accept-language" |
+ "content-language" => true,
+ _ => false,
+ }
+}
+
+// https://fetch.spec.whatwg.org/#forbidden-response-header-name
+fn is_forbidden_response_header(name: &str) -> bool {
+ match name {
+ "set-cookie" |
+ "set-cookie2" => true,
+ _ => false,
+ }
+}
+
+// https://fetch.spec.whatwg.org/#forbidden-header-name
+pub fn is_forbidden_header_name(name: &str) -> bool {
+ let disallowed_headers =
+ ["accept-charset", "accept-encoding",
+ "access-control-request-headers",
+ "access-control-request-method",
+ "connection", "content-length",
+ "cookie", "cookie2", "date", "dnt",
+ "expect", "host", "keep-alive", "origin",
+ "referer", "te", "trailer", "transfer-encoding",
+ "upgrade", "via"];
+
+ let disallowed_header_prefixes = ["sec-", "proxy-"];
+
+ disallowed_headers.iter().any(|header| *header == name) ||
+ disallowed_header_prefixes.iter().any(|prefix| name.starts_with(prefix))
+}
+
+// There is some unresolved confusion over the definition of a name and a value.
+// The fetch spec [1] defines a name as "a case-insensitive byte
+// sequence that matches the field-name token production. The token
+// productions are viewable in [2]." A field-name is defined as a
+// token, which is defined in [3].
+// ISSUE 1:
+// It defines a value as "a byte sequence that matches the field-content token production."
+// To note, there is a difference between field-content and
+// field-value (which is made up of fied-content and obs-fold). The
+// current definition does not allow for obs-fold (which are white
+// space and newlines) in values. So perhaps a value should be defined
+// as "a byte sequence that matches the field-value token production."
+// However, this would then allow values made up entirely of white space and newlines.
+// RELATED ISSUE 2:
+// According to a previously filed Errata ID: 4189 in [4], "the
+// specified field-value rule does not allow single field-vchar
+// surrounded by whitespace anywhere". They provided a fix for the
+// field-content production, but ISSUE 1 has still not been resolved.
+// The production definitions likely need to be re-written.
+// [1] https://fetch.spec.whatwg.org/#concept-header-value
+// [2] https://tools.ietf.org/html/rfc7230#section-3.2
+// [3] https://tools.ietf.org/html/rfc7230#section-3.2.6
+// [4] https://www.rfc-editor.org/errata_search.php?rfc=7230
+fn validate_name_and_value(name: ByteString, value: ByteString)
+ -> Result<(String, Vec<u8>), Error> {
+ if !is_field_name(&name) {
+ return Err(Error::Type("Name is not valid".to_string()));
+ }
+ if !is_field_content(&value) {
+ return Err(Error::Type("Value is not valid".to_string()));
+ }
+ match String::from_utf8(name.into()) {
+ Ok(ns) => Ok((ns, value.into())),
+ _ => Err(Error::Type("Non-UTF8 header name found".to_string())),
+ }
+}
+
+// Removes trailing and leading HTTP whitespace bytes.
+// https://fetch.spec.whatwg.org/#concept-header-value-normalize
+pub fn normalize_value(value: ByteString) -> ByteString {
+ match (index_of_first_non_whitespace(&value), index_of_last_non_whitespace(&value)) {
+ (Some(begin), Some(end)) => ByteString::new(value[begin..end + 1].to_owned()),
+ _ => ByteString::new(vec![]),
+ }
+}
+
+fn is_HTTP_whitespace(byte: u8) -> bool {
+ byte == b'\t' || byte == b'\n' || byte == b'\r' || byte == b' '
+}
+
+fn index_of_first_non_whitespace(value: &ByteString) -> Option<usize> {
+ for (index, &byte) in value.iter().enumerate() {
+ if !is_HTTP_whitespace(byte) {
+ return Some(index);
+ }
+ }
+ None
+}
+
+fn index_of_last_non_whitespace(value: &ByteString) -> Option<usize> {
+ for (index, &byte) in value.iter().enumerate().rev() {
+ if !is_HTTP_whitespace(byte) {
+ return Some(index);
+ }
+ }
+ None
+}
+
+// http://tools.ietf.org/html/rfc7230#section-3.2
+fn is_field_name(name: &ByteString) -> bool {
+ is_token(&*name)
+}
+
+// https://tools.ietf.org/html/rfc7230#section-3.2
+// http://www.rfc-editor.org/errata_search.php?rfc=7230
+// Errata ID: 4189
+// field-content = field-vchar [ 1*( SP / HTAB / field-vchar )
+// field-vchar ]
+fn is_field_content(value: &ByteString) -> bool {
+ if value.len() == 0 {
+ return false;
+ }
+ if !is_field_vchar(value[0]) {
+ return false;
+ }
+
+ for &ch in &value[1..value.len() - 1] {
+ if !is_field_vchar(ch) || !is_space(ch) || !is_htab(ch) {
+ return false;
+ }
+ }
+
+ if !is_field_vchar(value[value.len() - 1]) {
+ return false;
+ }
+
+ return true;
+}
+
+fn is_space(x: u8) -> bool {
+ x == b' '
+}
+
+fn is_htab(x: u8) -> bool {
+ x == b'\t'
+}
+
+// https://tools.ietf.org/html/rfc7230#section-3.2
+fn is_field_vchar(x: u8) -> bool {
+ is_vchar(x) || is_obs_text(x)
+}
+
+// https://tools.ietf.org/html/rfc5234#appendix-B.1
+fn is_vchar(x: u8) -> bool {
+ match x {
+ 0x21...0x7E => true,
+ _ => false,
+ }
+}
+
+// http://tools.ietf.org/html/rfc7230#section-3.2.6
+fn is_obs_text(x: u8) -> bool {
+ match x {
+ 0x80...0xFF => true,
+ _ => false,
+ }
+}
diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs
index d76721ed040..172026c4d8e 100644
--- a/components/script/dom/mod.rs
+++ b/components/script/dom/mod.rs
@@ -269,6 +269,7 @@ pub mod focusevent;
pub mod forcetouchevent;
pub mod formdata;
pub mod hashchangeevent;
+pub mod headers;
pub mod htmlanchorelement;
pub mod htmlappletelement;
pub mod htmlareaelement;
diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs
index 64fb6fb7578..8ee6dfe8025 100644
--- a/components/script/dom/testbinding.rs
+++ b/components/script/dom/testbinding.rs
@@ -581,6 +581,10 @@ impl TestBindingMethods for TestBinding {
}
}
+ fn AdvanceClock(&self, ms: i32) {
+ self.global().r().as_window().advance_animation_clock(ms);
+ }
+
fn Panic(&self) { panic!("explicit panic from script") }
}
diff --git a/components/script/dom/webidls/Headers.webidl b/components/script/dom/webidls/Headers.webidl
new file mode 100644
index 00000000000..038dbe46f74
--- /dev/null
+++ b/components/script/dom/webidls/Headers.webidl
@@ -0,0 +1,22 @@
+/* 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/. */
+
+// https://fetch.spec.whatwg.org/#headers-class
+
+/* typedef (Headers or sequence<sequence<ByteString>>) HeadersInit; */
+
+/* [Constructor(optional HeadersInit init),*/
+ [Exposed=(Window,Worker)]
+
+interface Headers {
+ [Throws]
+ void append(ByteString name, ByteString value);
+};
+
+/* void delete(ByteString name);
+ * ByteString? get(ByteString name);
+ * boolean has(ByteString name);
+ * void set(ByteString name, ByteString value);
+ * iterable<ByteString, ByteString>;
+ * }; */
diff --git a/components/script/dom/webidls/TestBinding.webidl b/components/script/dom/webidls/TestBinding.webidl
index 355141a4d92..48e647ee7bc 100644
--- a/components/script/dom/webidls/TestBinding.webidl
+++ b/components/script/dom/webidls/TestBinding.webidl
@@ -424,6 +424,8 @@ interface TestBinding {
static void prefControlledStaticMethodDisabled();
[Pref="dom.testbinding.prefcontrolled.enabled"]
const unsigned short prefControlledConstDisabled = 0;
+ [Pref="layout.animations.test.enabled"]
+ void advanceClock(long millis);
[Pref="dom.testbinding.prefcontrolled2.enabled"]
readonly attribute boolean prefControlledAttributeEnabled;
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 4878f33f994..07509a92e4a 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -1030,6 +1030,12 @@ impl Window {
recv.recv().unwrap_or((Size2D::zero(), Point2D::zero()))
}
+ /// Advances the layout animation clock by `delta` milliseconds, and then
+ /// forces a reflow.
+ pub fn advance_animation_clock(&self, delta: i32) {
+ self.layout_chan.send(Msg::AdvanceClockMs(delta)).unwrap();
+ }
+
/// Reflows the page unconditionally if possible and not suppressed. This
/// method will wait for the layout thread to complete (but see the `TODO`
/// below). If there is no window size yet, the page is presumed invisible
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 9ac02936673..5cef702c01a 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -25,6 +25,7 @@ use dom::document::DocumentSource;
use dom::document::{Document, IsHTMLDocument};
use dom::event::{Event, EventBubbles, EventCancelable};
use dom::eventtarget::EventTarget;
+use dom::headers::is_forbidden_header_name;
use dom::progressevent::ProgressEvent;
use dom::xmlhttprequesteventtarget::XMLHttpRequestEventTarget;
use dom::xmlhttprequestupload::XMLHttpRequestUpload;
@@ -409,21 +410,8 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
// Step 5
// Disallowed headers and header prefixes:
// https://fetch.spec.whatwg.org/#forbidden-header-name
- let disallowedHeaders =
- ["accept-charset", "accept-encoding",
- "access-control-request-headers",
- "access-control-request-method",
- "connection", "content-length",
- "cookie", "cookie2", "date", "dnt",
- "expect", "host", "keep-alive", "origin",
- "referer", "te", "trailer", "transfer-encoding",
- "upgrade", "via"];
-
- let disallowedHeaderPrefixes = ["sec-", "proxy-"];
-
- if disallowedHeaders.iter().any(|header| *header == s) ||
- disallowedHeaderPrefixes.iter().any(|prefix| s.starts_with(prefix)) {
- return Ok(())
+ if is_forbidden_header_name(s) {
+ return Ok(());
} else {
s
}
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index ec2401d6f61..1a32477b999 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -886,22 +886,12 @@ impl ScriptThread {
fn handle_msg_from_constellation(&self, msg: ConstellationControlMsg) {
match msg {
- ConstellationControlMsg::AttachLayout(_) =>
- panic!("should have handled AttachLayout already"),
ConstellationControlMsg::Navigate(pipeline_id, subpage_id, load_data) =>
self.handle_navigate(pipeline_id, Some(subpage_id), load_data),
ConstellationControlMsg::SendEvent(id, event) =>
self.handle_event(id, event),
ConstellationControlMsg::ResizeInactive(id, new_size) =>
self.handle_resize_inactive_msg(id, new_size),
- ConstellationControlMsg::Viewport(..) =>
- panic!("should have handled Viewport already"),
- ConstellationControlMsg::SetScrollState(..) =>
- panic!("should have handled SetScrollState already"),
- ConstellationControlMsg::Resize(..) =>
- panic!("should have handled Resize already"),
- ConstellationControlMsg::ExitPipeline(..) =>
- panic!("should have handled ExitPipeline already"),
ConstellationControlMsg::GetTitle(pipeline_id) =>
self.handle_get_title_msg(pipeline_id),
ConstellationControlMsg::Freeze(pipeline_id) =>
@@ -943,6 +933,12 @@ impl ScriptThread {
self.handle_css_error_reporting(pipeline_id, filename, line, column, msg),
ConstellationControlMsg::Reload(pipeline_id) =>
self.handle_reload(pipeline_id),
+ msg @ ConstellationControlMsg::AttachLayout(..) |
+ msg @ ConstellationControlMsg::Viewport(..) |
+ msg @ ConstellationControlMsg::SetScrollState(..) |
+ msg @ ConstellationControlMsg::Resize(..) |
+ msg @ ConstellationControlMsg::ExitPipeline(..) =>
+ panic!("should have handled {:?} already", msg),
}
}
diff --git a/components/script_layout_interface/message.rs b/components/script_layout_interface/message.rs
index 22370b043c3..ce97c805bb2 100644
--- a/components/script_layout_interface/message.rs
+++ b/components/script_layout_interface/message.rs
@@ -40,6 +40,11 @@ pub enum Msg {
/// Requests that the layout thread render the next frame of all animations.
TickAnimations,
+ /// Updates layout's timer for animation testing from script.
+ ///
+ /// The inner field is the number of *milliseconds* to advance.
+ AdvanceClockMs(i32),
+
/// Requests that the layout thread reflow with a newly-loaded Web font.
ReflowWithNewlyLoadedWebFont,
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs
index f57ed29f43c..175cc0b82f2 100644
--- a/components/script_traits/lib.rs
+++ b/components/script_traits/lib.rs
@@ -61,6 +61,7 @@ use profile_traits::mem;
use profile_traits::time as profile_time;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::collections::HashMap;
+use std::fmt;
use std::sync::mpsc::{Sender, Receiver};
use style_traits::{PagePx, ViewportPx};
use url::Url;
@@ -207,6 +208,37 @@ pub enum ConstellationControlMsg {
Reload(PipelineId),
}
+impl fmt::Debug for ConstellationControlMsg {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ use self::ConstellationControlMsg::*;
+ write!(formatter, "ConstellationMsg::{}", match *self {
+ AttachLayout(..) => "AttachLayout",
+ Resize(..) => "Resize",
+ ResizeInactive(..) => "ResizeInactive",
+ ExitPipeline(..) => "ExitPipeline",
+ SendEvent(..) => "SendEvent",
+ Viewport(..) => "Viewport",
+ SetScrollState(..) => "SetScrollState",
+ GetTitle(..) => "GetTitle",
+ Freeze(..) => "Freeze",
+ Thaw(..) => "Thaw",
+ ChangeFrameVisibilityStatus(..) => "ChangeFrameVisibilityStatus",
+ NotifyVisibilityChange(..) => "NotifyVisibilityChange",
+ Navigate(..) => "Navigate",
+ MozBrowserEvent(..) => "MozBrowserEvent",
+ UpdateSubpageId(..) => "UpdateSubpageId",
+ FocusIFrame(..) => "FocusIFrame",
+ WebDriverScriptCommand(..) => "WebDriverScriptCommand",
+ TickAllAnimations(..) => "TickAllAnimations",
+ WebFontLoaded(..) => "WebFontLoaded",
+ DispatchFrameLoadEvent { .. } => "DispatchFrameLoadEvent",
+ FramedContentChanged(..) => "FramedContentChanged",
+ ReportCSSError(..) => "ReportCSSError",
+ Reload(..) => "Reload",
+ })
+ }
+}
+
/// Used to determine if a script has any pending asynchronous activity.
#[derive(Copy, Clone, Debug, PartialEq, Deserialize, Serialize)]
pub enum DocumentState {
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock
index e8db00d2aa6..d7eb68f237a 100644
--- a/components/servo/Cargo.lock
+++ b/components/servo/Cargo.lock
@@ -174,11 +174,6 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
-name = "block"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
name = "blurz"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -264,29 +259,6 @@ dependencies = [
]
[[package]]
-name = "clipboard"
-version = "0.1.2"
-source = "git+https://github.com/aweinstock314/rust-clipboard#f4c5c1d3c1759f0a167091405d11af1f9584fb1f"
-dependencies = [
- "clipboard-win 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "objc-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "objc_id 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "x11 2.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "clipboard-win"
-version = "1.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "windows-error 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "cmake"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -360,7 +332,6 @@ dependencies = [
"backtrace 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas 0.0.1",
"canvas_traits 0.0.1",
- "clipboard 0.1.2 (git+https://github.com/aweinstock314/rust-clipboard)",
"compositing 0.0.1",
"devtools_traits 0.0.1",
"euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1165,7 +1136,6 @@ dependencies = [
"string_cache 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"style_traits 0.0.1",
- "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1568,24 +1538,6 @@ dependencies = [
]
[[package]]
-name = "objc-foundation"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "block 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "objc_id 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "objc_id"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "odds"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2656,15 +2608,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
-name = "windows-error"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "ws2_32-sys"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/components/style/animation.rs b/components/style/animation.rs
index c9529f7b99f..c36cde3caea 100644
--- a/components/style/animation.rs
+++ b/components/style/animation.rs
@@ -20,7 +20,7 @@ use selectors::matching::DeclarationBlock;
use std::sync::Arc;
use std::sync::mpsc::Sender;
use string_cache::Atom;
-use time;
+use timer::Timer;
use values::computed::Time;
/// This structure represents a keyframes animation current iteration state.
@@ -122,7 +122,9 @@ impl KeyframesAnimationState {
///
/// There are some bits of state we can't just replace, over all taking in
/// account times, so here's that logic.
- pub fn update_from_other(&mut self, other: &Self) {
+ pub fn update_from_other(&mut self,
+ other: &Self,
+ timer: &Timer) {
use self::KeyframesRunningState::*;
debug!("KeyframesAnimationState::update_from_other({:?}, {:?})", self, other);
@@ -146,11 +148,11 @@ impl KeyframesAnimationState {
// If we're pausing the animation, compute the progress value.
match (&mut self.running_state, old_running_state) {
(&mut Running, Paused(progress))
- => new_started_at = time::precise_time_s() - (self.duration * progress),
+ => new_started_at = timer.seconds() - (self.duration * progress),
(&mut Paused(ref mut new), Paused(old))
=> *new = old,
(&mut Paused(ref mut progress), Running)
- => *progress = (time::precise_time_s() - old_started_at) / old_duration,
+ => *progress = (timer.seconds() - old_started_at) / old_duration,
_ => {},
}
@@ -341,7 +343,8 @@ impl PropertyAnimation {
pub fn start_transitions_if_applicable(new_animations_sender: &Sender<Animation>,
node: OpaqueNode,
old_style: &ComputedValues,
- new_style: &mut Arc<ComputedValues>)
+ new_style: &mut Arc<ComputedValues>,
+ timer: &Timer)
-> bool {
let mut had_animations = false;
for i in 0..new_style.get_box().transition_property_count() {
@@ -355,7 +358,7 @@ pub fn start_transitions_if_applicable(new_animations_sender: &Sender<Animation>
// Kick off the animation.
let box_style = new_style.get_box();
- let now = time::precise_time_s();
+ let now = timer.seconds();
let start_time =
now + (box_style.transition_delay_mod(i).seconds() as f64);
new_animations_sender
@@ -424,7 +427,7 @@ pub fn maybe_start_animations(context: &SharedStyleContext,
}
let delay = box_style.animation_delay_mod(i).seconds();
- let now = time::precise_time_s();
+ let now = context.timer.seconds();
let animation_start = now + delay as f64;
let duration = box_style.animation_duration_mod(i).seconds();
let iteration_state = match box_style.animation_iteration_count_mod(i) {
@@ -497,7 +500,7 @@ where Damage: TRestyleDamage {
match *animation {
Animation::Transition(_, start_time, ref frame, _) => {
debug!("update_style_for_animation: transition found");
- let now = time::precise_time_s();
+ let now = context.timer.seconds();
let mut new_style = (*style).clone();
let updated_style = update_style_for_animation_frame(&mut new_style,
now, start_time,
@@ -516,7 +519,7 @@ where Damage: TRestyleDamage {
let started_at = state.started_at;
let now = match state.running_state {
- KeyframesRunningState::Running => time::precise_time_s(),
+ KeyframesRunningState::Running => context.timer.seconds(),
KeyframesRunningState::Paused(progress) => started_at + duration * progress,
};
diff --git a/components/style/context.rs b/components/style/context.rs
index 3515728b4cf..f1c5ac3f307 100644
--- a/components/style/context.rs
+++ b/components/style/context.rs
@@ -15,6 +15,7 @@ use std::cell::RefCell;
use std::collections::HashMap;
use std::sync::mpsc::Sender;
use std::sync::{Arc, Mutex, RwLock};
+use timer::Timer;
/// This structure is used to create a local style context from a shared one.
pub struct LocalStyleContextCreationInfo {
@@ -57,6 +58,10 @@ pub struct SharedStyleContext {
/// Data needed to create the local style context from the shared one.
pub local_context_creation_data: Mutex<LocalStyleContextCreationInfo>,
+
+ /// The current timer for transitions and animations. This is needed to test
+ /// them.
+ pub timer: Timer,
}
pub struct LocalStyleContext {
diff --git a/components/style/lib.rs b/components/style/lib.rs
index 673e8311b02..1ad47061062 100644
--- a/components/style/lib.rs
+++ b/components/style/lib.rs
@@ -101,6 +101,7 @@ pub mod sink;
pub mod str;
pub mod stylesheets;
mod tid;
+pub mod timer;
pub mod traversal;
#[macro_use]
#[allow(non_camel_case_types)]
diff --git a/components/style/matching.rs b/components/style/matching.rs
index 42320d2ecdd..2c4dfc990cd 100644
--- a/components/style/matching.rs
+++ b/components/style/matching.rs
@@ -435,7 +435,8 @@ trait PrivateMatchMethods: TNode
new_animations_sender,
this_opaque,
&**style,
- &mut this_style);
+ &mut this_style,
+ &shared_context.timer);
}
cacheable = cacheable && !animations_started
diff --git a/components/style/timer.rs b/components/style/timer.rs
new file mode 100644
index 00000000000..619e93e80f1
--- /dev/null
+++ b/components/style/timer.rs
@@ -0,0 +1,58 @@
+/* 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/. */
+use time;
+
+/// The `TimerMode` is used to determine what time should the `Timer` return,
+/// either a fixed value (in the `Test` mode), or the actual time (in the
+/// `Current` mode).
+#[derive(Debug, Clone)]
+enum TimerMode {
+ Test(f64),
+ Current,
+}
+
+/// A `Timer` struct that takes care of giving the current time for animations.
+///
+/// This is needed to be allowed to hook the time in the animations' test-mode.
+#[derive(Debug, Clone)]
+pub struct Timer {
+ mode: TimerMode,
+}
+
+impl Timer {
+ /// Creates a new "normal" timer, i.e., a "Current" mode timer.
+ #[inline]
+ pub fn new() -> Self {
+ Timer {
+ mode: TimerMode::Current,
+ }
+ }
+
+ /// Creates a new "test mode" timer, with initial time 0.
+ #[inline]
+ pub fn test_mode() -> Self {
+ Timer {
+ mode: TimerMode::Test(0.),
+ }
+ }
+
+ /// Returns the current time, at least from the caller's perspective. In
+ /// test mode returns whatever the value is.
+ pub fn seconds(&self) -> f64 {
+ match self.mode {
+ TimerMode::Test(test_value) => test_value,
+ TimerMode::Current => time::precise_time_s(),
+ }
+ }
+
+ /// Increments the current clock. Panics if the clock is not on test mode.
+ pub fn increment(&mut self, by: f64) {
+ match self.mode {
+ TimerMode::Test(ref mut val)
+ => *val += by,
+ TimerMode::Current
+ => panic!("Timer::increment called for a non-test mode timer. This is a bug."),
+ }
+ }
+}
diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock
index 26e0b902f4c..591371cbfc0 100644
--- a/ports/cef/Cargo.lock
+++ b/ports/cef/Cargo.lock
@@ -148,11 +148,6 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
-name = "block"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
name = "blurz"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -238,29 +233,6 @@ dependencies = [
]
[[package]]
-name = "clipboard"
-version = "0.1.2"
-source = "git+https://github.com/aweinstock314/rust-clipboard#f4c5c1d3c1759f0a167091405d11af1f9584fb1f"
-dependencies = [
- "clipboard-win 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "objc-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "objc_id 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "x11 2.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "clipboard-win"
-version = "1.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "windows-error 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "cmake"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -319,7 +291,6 @@ dependencies = [
"backtrace 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas 0.0.1",
"canvas_traits 0.0.1",
- "clipboard 0.1.2 (git+https://github.com/aweinstock314/rust-clipboard)",
"compositing 0.0.1",
"devtools_traits 0.0.1",
"euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1074,7 +1045,6 @@ dependencies = [
"string_cache 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"style_traits 0.0.1",
- "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1442,24 +1412,6 @@ dependencies = [
]
[[package]]
-name = "objc-foundation"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "block 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "objc_id 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "objc_id"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "odds"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2518,15 +2470,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
-name = "windows-error"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "ws2_32-sys"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/ports/cef/window.rs b/ports/cef/window.rs
index e5c2cd5f4db..4e0b67a96b0 100644
--- a/ports/cef/window.rs
+++ b/ports/cef/window.rs
@@ -504,7 +504,7 @@ impl WindowMethods for Window {
}
fn supports_clipboard(&self) -> bool {
- true
+ false
}
}
diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs
index 9d8e8ec5129..f1da1fe14b5 100644
--- a/ports/geckolib/glue.rs
+++ b/ports/geckolib/glue.rs
@@ -31,6 +31,7 @@ use style::properties::{ComputedValues, PropertyDeclarationBlock, parse_one_decl
use style::selector_impl::{SelectorImplExt, PseudoElementCascadeType};
use style::sequential;
use style::stylesheets::{Stylesheet, Origin};
+use style::timer::Timer;
use traversal::RecalcStyleOnly;
use url::Url;
use wrapper::{DUMMY_BASE_URL, GeckoDocument, GeckoElement, GeckoNode, NonOpaqueStyleData};
@@ -106,6 +107,7 @@ fn restyle_subtree(node: GeckoNode, raw_data: *mut RawServoStyleSet) {
expired_animations: per_doc_data.expired_animations.clone(),
error_reporter: Box::new(StdoutErrorReporter),
local_context_creation_data: Mutex::new(local_context_data),
+ timer: Timer::new(),
};
if node.is_dirty() || node.has_dirty_descendants() {
diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs
index 4e154a5f677..4327f80412a 100644
--- a/ports/glutin/window.rs
+++ b/ports/glutin/window.rs
@@ -930,7 +930,7 @@ impl WindowMethods for Window {
}
fn supports_clipboard(&self) -> bool {
- true
+ false
}
}
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py
index fc52fbedd82..02e3263d64d 100644
--- a/python/tidy/servo_tidy/tidy.py
+++ b/python/tidy/servo_tidy/tidy.py
@@ -88,6 +88,7 @@ WEBIDL_STANDARDS = [
"//drafts.csswg.org/cssom",
"//drafts.fxtf.org",
"//encoding.spec.whatwg.org",
+ "//fetch.spec.whatwg.org",
"//html.spec.whatwg.org",
"//url.spec.whatwg.org",
"//xhr.spec.whatwg.org",
diff --git a/resources/prefs.json b/resources/prefs.json
index 64ac5353cdb..35961dee0e2 100644
--- a/resources/prefs.json
+++ b/resources/prefs.json
@@ -45,6 +45,7 @@
"js.mem.gc.empty_chunk_count_max": 30,
"js.mem.gc.zeal.level": 0,
"js.mem.gc.zeal.frequency": 100,
+ "layout.animations.test.enabled": false,
"layout.columns.enabled": false,
"layout.column-width.enabled": false,
"layout.column-count.enabled": false,
diff --git a/tests/unit/script/headers.rs b/tests/unit/script/headers.rs
new file mode 100644
index 00000000000..5334056ec70
--- /dev/null
+++ b/tests/unit/script/headers.rs
@@ -0,0 +1,74 @@
+/* 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/. */
+
+use script::dom::bindings::str::ByteString;
+use script::dom::headers;
+
+#[test]
+fn test_normalize_empty_bytestring() {
+ // empty ByteString test
+ let empty_bytestring = ByteString::new(vec![]);
+ let actual = headers::normalize_value(empty_bytestring);
+ let expected = ByteString::new(vec![]);
+ assert_eq!(actual, expected);
+}
+
+#[test]
+fn test_normalize_all_whitespace_bytestring() {
+ // All whitespace test. A horizontal tab, a line feed, a carriage return , and a space
+ let all_whitespace_bytestring = ByteString::new(vec![b'\t', b'\n', b'\r', b' ']);
+ let actual = headers::normalize_value(all_whitespace_bytestring);
+ let expected = ByteString::new(vec![]);
+ assert_eq!(actual, expected);
+}
+
+#[test]
+fn test_normalize_non_empty_no_whitespace_bytestring() {
+ // Non-empty, no whitespace ByteString test
+ let no_whitespace_bytestring = ByteString::new(vec![b'S', b'!']);
+ let actual = headers::normalize_value(no_whitespace_bytestring);
+ let expected = ByteString::new(vec![b'S', b'!']);
+ assert_eq!(actual, expected);
+}
+
+#[test]
+fn test_normalize_non_empty_leading_whitespace_bytestring() {
+ // Non-empty, leading whitespace, no trailing whitespace ByteString test
+ let leading_whitespace_bytestring = ByteString::new(vec![b'\t', b'\n', b' ', b'\r', b'S', b'!']);
+ let actual = headers::normalize_value(leading_whitespace_bytestring);
+ let expected = ByteString::new(vec![b'S', b'!']);
+ assert_eq!(actual, expected);
+}
+
+#[test]
+fn test_normalize_non_empty_no_leading_whitespace_trailing_whitespace_bytestring() {
+ // Non-empty, no leading whitespace, but with trailing whitespace ByteString test
+ let trailing_whitespace_bytestring = ByteString::new(vec![b'S', b'!', b'\t', b'\n', b' ', b'\r']);
+ let actual = headers::normalize_value(trailing_whitespace_bytestring);
+ let expected = ByteString::new(vec![b'S', b'!']);
+ assert_eq!(actual, expected);
+}
+
+#[test]
+fn test_normalize_non_empty_leading_and_trailing_whitespace_bytestring() {
+ // Non-empty, leading whitespace, and trailing whitespace ByteString test
+ let whitespace_sandwich_bytestring =
+ ByteString::new(vec![b'\t', b'\n', b' ', b'\r', b'S', b'!', b'\t', b'\n', b' ', b'\r']);
+ let actual = headers::normalize_value(whitespace_sandwich_bytestring);
+ let expected = ByteString::new(vec![b'S', b'!']);
+ assert_eq!(actual, expected);
+}
+
+#[test]
+fn test_normalize_non_empty_leading_trailing_and_internal_whitespace_bytestring() {
+ // Non-empty, leading whitespace, trailing whitespace,
+ // and internal whitespace ByteString test
+ let whitespace_bigmac_bytestring =
+ ByteString::new(vec![b'\t', b'\n', b' ', b'\r', b'S',
+ b'\t', b'\n', b' ', b'\r', b'!',
+ b'\t', b'\n', b' ', b'\r']);
+ let actual = headers::normalize_value(whitespace_bigmac_bytestring);
+ let expected = ByteString::new(vec![b'S', b'\t', b'\n', b' ', b'\r', b'!']);
+ assert_eq!(actual, expected);
+}
diff --git a/tests/unit/script/lib.rs b/tests/unit/script/lib.rs
index 9267038f9bd..e05f96f1f0f 100644
--- a/tests/unit/script/lib.rs
+++ b/tests/unit/script/lib.rs
@@ -12,3 +12,4 @@ extern crate url;
#[cfg(test)] mod origin;
#[cfg(all(test, target_pointer_width = "64"))] mod size_of;
#[cfg(test)] mod textinput;
+#[cfg(test)] mod headers;
diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json
index d11b5f3e1cc..3fedff120e5 100644
--- a/tests/wpt/mozilla/meta/MANIFEST.json
+++ b/tests/wpt/mozilla/meta/MANIFEST.json
@@ -6120,6 +6120,12 @@
]
},
"testharness": {
+ "css/animations/basic-linear-width.html": [
+ {
+ "path": "css/animations/basic-linear-width.html",
+ "url": "/_mozilla/css/animations/basic-linear-width.html"
+ }
+ ],
"css/empty-keyframes.html": [
{
"path": "css/empty-keyframes.html",
diff --git a/tests/wpt/mozilla/meta/css/animations/__dir__.ini b/tests/wpt/mozilla/meta/css/animations/__dir__.ini
new file mode 100644
index 00000000000..696581b4a4a
--- /dev/null
+++ b/tests/wpt/mozilla/meta/css/animations/__dir__.ini
@@ -0,0 +1,2 @@
+prefs: ["layout.animations.test.enabled:true",
+ "dom.testbinding.enabled:true"]
diff --git a/tests/wpt/mozilla/tests/css/animations/basic-linear-width.html b/tests/wpt/mozilla/tests/css/animations/basic-linear-width.html
new file mode 100644
index 00000000000..634b09dca59
--- /dev/null
+++ b/tests/wpt/mozilla/tests/css/animations/basic-linear-width.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>Animation test: Linear animation repeated infinitely.</title>
+<style>
+ .animatable {
+ width: 50px;
+ height: 50px;
+ background: red;
+ animation: foo 1s infinite linear;
+ }
+ @keyframes foo {
+ from { width: 0; }
+ to { width: 500px; }
+ }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div class="animatable"></div>
+<script>
+var div = document.querySelector('.animatable');
+async_test(function(t) {
+ window.addEventListener('load', function() {
+ var test = new window.TestBinding();
+ test.advanceClock(500);
+ assert_equals(getComputedStyle(div).getPropertyValue('width'), '250px');
+ test.advanceClock(500);
+ assert_equals(getComputedStyle(div).getPropertyValue('width'), '500px');
+ test.advanceClock(500);
+ assert_equals(getComputedStyle(div).getPropertyValue('width'), '250px');
+ t.done();
+ })
+})
+</script>
diff --git a/tests/wpt/mozilla/tests/mozilla/interfaces.html b/tests/wpt/mozilla/tests/mozilla/interfaces.html
index f33834c4908..95dfa65ad82 100644
--- a/tests/wpt/mozilla/tests/mozilla/interfaces.html
+++ b/tests/wpt/mozilla/tests/mozilla/interfaces.html
@@ -48,6 +48,7 @@ test_interfaces([
"FocusEvent",
"FormData",
"HashChangeEvent",
+ "Headers",
"HTMLAnchorElement",
"HTMLAppletElement",
"HTMLAreaElement",
diff --git a/tests/wpt/mozilla/tests/mozilla/interfaces.worker.js b/tests/wpt/mozilla/tests/mozilla/interfaces.worker.js
index aa723ef9ee5..79b99d4f1de 100644
--- a/tests/wpt/mozilla/tests/mozilla/interfaces.worker.js
+++ b/tests/wpt/mozilla/tests/mozilla/interfaces.worker.js
@@ -44,6 +44,7 @@ test_interfaces([
"FocusEvent",
"FormData",
"HashChangeEvent",
+ "Headers",
"HTMLAnchorElement",
"HTMLAppletElement",
"HTMLAreaElement",