aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/compositing/compositor.rs13
-rw-r--r--components/compositing/compositor_thread.rs2
-rw-r--r--components/constellation/constellation.rs69
-rw-r--r--components/constellation/pipeline.rs7
-rw-r--r--components/layout/construct.rs6
-rw-r--r--components/layout/fragment.rs2
-rw-r--r--components/layout/layout_thread.rs24
-rw-r--r--components/layout/opaque_node.rs4
-rw-r--r--components/layout/wrapper.rs57
-rw-r--r--components/msg/constellation_msg.rs4
-rw-r--r--components/net/blob_loader.rs87
-rw-r--r--components/net/filemanager_thread.rs48
-rw-r--r--components/net/lib.rs2
-rw-r--r--components/net_traits/blob_url_store.rs50
-rw-r--r--components/net_traits/filemanager_thread.rs4
-rw-r--r--components/net_traits/lib.rs25
-rw-r--r--components/plugins/lints/unrooted_must_root.rs15
-rw-r--r--components/script/Cargo.toml2
-rw-r--r--components/script/dom/attr.rs2
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py33
-rw-r--r--components/script/dom/bindings/error.rs10
-rw-r--r--components/script/dom/bindings/interface.rs48
-rw-r--r--components/script/dom/bindings/str.rs7
-rw-r--r--components/script/dom/bluetooth.rs5
-rw-r--r--components/script/dom/document.rs7
-rw-r--r--components/script/dom/element.rs72
-rw-r--r--components/script/dom/eventtarget.rs4
-rw-r--r--components/script/dom/htmlanchorelement.rs3
-rw-r--r--components/script/dom/htmlappletelement.rs2
-rw-r--r--components/script/dom/htmlareaelement.rs2
-rw-r--r--components/script/dom/htmlbaseelement.rs3
-rw-r--r--components/script/dom/htmlbodyelement.rs3
-rw-r--r--components/script/dom/htmlcanvaselement.rs2
-rw-r--r--components/script/dom/htmlelement.rs2
-rw-r--r--components/script/dom/htmlfontelement.rs2
-rw-r--r--components/script/dom/htmlformelement.rs2
-rw-r--r--components/script/dom/htmlhrelement.rs3
-rw-r--r--components/script/dom/htmliframeelement.rs8
-rw-r--r--components/script/dom/htmlimageelement.rs3
-rw-r--r--components/script/dom/htmlinputelement.rs3
-rw-r--r--components/script/dom/htmllabelelement.rs2
-rw-r--r--components/script/dom/htmllinkelement.rs3
-rw-r--r--components/script/dom/htmlmetaelement.rs3
-rw-r--r--components/script/dom/htmlselectelement.rs3
-rw-r--r--components/script/dom/htmltablecellelement.rs3
-rw-r--r--components/script/dom/htmltableelement.rs4
-rw-r--r--components/script/dom/htmltablerowelement.rs3
-rw-r--r--components/script/dom/htmltablesectionelement.rs2
-rw-r--r--components/script/dom/htmltextareaelement.rs3
-rw-r--r--components/script/dom/macros.rs2
-rw-r--r--components/script/dom/node.rs49
-rw-r--r--components/script/dom/virtualmethods.rs4
-rw-r--r--components/script/dom/webidls/ChildNode.webidl7
-rw-r--r--components/script/dom/webidls/Element.webidl2
-rw-r--r--components/script/dom/webidls/ParentNode.webidl4
-rw-r--r--components/script/dom/window.rs21
-rw-r--r--components/script/dom/workerglobalscope.rs6
-rw-r--r--components/script/dom/xmlhttprequest.rs25
-rw-r--r--components/script/layout_interface.rs15
-rw-r--r--components/script/lib.rs2
-rw-r--r--components/script/script_thread.rs13
-rw-r--r--components/script_traits/lib.rs4
-rw-r--r--components/servo/Cargo.lock192
-rw-r--r--components/style/font_face.rs32
-rw-r--r--components/util/lib.rs1
-rw-r--r--components/webdriver_server/lib.rs4
66 files changed, 714 insertions, 342 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs
index fb471ab90f9..6bfa6c992e4 100644
--- a/components/compositing/compositor.rs
+++ b/components/compositing/compositor.rs
@@ -576,9 +576,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.change_page_url(pipeline_id, url);
}
- (Msg::SetFrameTree(frame_tree, response_chan, new_constellation_chan),
+ (Msg::SetFrameTree(frame_tree, response_chan),
ShutdownState::NotShuttingDown) => {
- self.set_frame_tree(&frame_tree, response_chan, new_constellation_chan);
+ self.set_frame_tree(&frame_tree, response_chan);
self.send_viewport_rects_for_all_layers();
self.title_for_main_frame();
}
@@ -846,8 +846,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
fn set_frame_tree(&mut self,
frame_tree: &SendableFrameTree,
- response_chan: IpcSender<()>,
- new_constellation_chan: Sender<ConstellationMsg>) {
+ response_chan: IpcSender<()>) {
if let Err(e) = response_chan.send(()) {
warn!("Sending reponse to set frame tree failed ({}).", e);
}
@@ -874,8 +873,6 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.create_pipeline_details_for_frame_tree(&frame_tree);
- // Initialize the new constellation channel by sending it the root window size.
- self.constellation_chan = new_constellation_chan;
self.send_window_size(WindowSizeType::Initial);
self.frame_tree_id.next();
@@ -1803,8 +1800,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
fn on_navigation_window_event(&self, direction: WindowNavigateMsg) {
let direction = match direction {
- windowing::WindowNavigateMsg::Forward => NavigationDirection::Forward,
- windowing::WindowNavigateMsg::Back => NavigationDirection::Back,
+ windowing::WindowNavigateMsg::Forward => NavigationDirection::Forward(1),
+ windowing::WindowNavigateMsg::Back => NavigationDirection::Back(1),
};
let msg = ConstellationMsg::Navigate(None, direction);
if let Err(e) = self.constellation_chan.send(msg) {
diff --git a/components/compositing/compositor_thread.rs b/components/compositing/compositor_thread.rs
index 910e6817d76..325cdc3d104 100644
--- a/components/compositing/compositor_thread.rs
+++ b/components/compositing/compositor_thread.rs
@@ -141,7 +141,7 @@ pub enum Msg {
/// Alerts the compositor that the given pipeline has changed whether it is running animations.
ChangeRunningAnimationsState(PipelineId, AnimationState),
/// Replaces the current frame tree, typically called during main frame navigation.
- SetFrameTree(SendableFrameTree, IpcSender<()>, Sender<ConstellationMsg>),
+ SetFrameTree(SendableFrameTree, IpcSender<()>),
/// The load of a page has begun: (can go back, can go forward).
LoadStart(bool, bool),
/// The load of a page has completed: (can go back, can go forward, is root frame).
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs
index c1cee272d76..cdf66a006fb 100644
--- a/components/constellation/constellation.rs
+++ b/components/constellation/constellation.rs
@@ -85,9 +85,6 @@ pub struct Constellation<Message, LTF, STF> {
/// A channel through which script messages can be sent to this object.
script_sender: IpcSender<FromScriptMsg>,
- /// A channel through which compositor messages can be sent to this object.
- compositor_sender: Sender<FromCompositorMsg>,
-
/// A channel through which layout thread messages can be sent to this object.
layout_sender: IpcSender<FromLayoutMsg>,
@@ -311,22 +308,20 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
STF: ScriptThreadFactory<Message=Message>
{
pub fn start(state: InitialConstellationState) -> Sender<FromCompositorMsg> {
- let (ipc_script_sender, ipc_script_receiver) = ipc::channel().expect("ipc channel failure");
- let script_receiver = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_script_receiver);
+ let (compositor_sender, compositor_receiver) = channel();
- let (ipc_layout_sender, ipc_layout_receiver) = ipc::channel().expect("ipc channel failure");
- let layout_receiver = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_layout_receiver);
+ spawn_named("Constellation".to_owned(), move || {
+ let (ipc_script_sender, ipc_script_receiver) = ipc::channel().expect("ipc channel failure");
+ let script_receiver = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_script_receiver);
- let (ipc_panic_sender, ipc_panic_receiver) = ipc::channel().expect("ipc channel failure");
- let panic_receiver = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_panic_receiver);
+ let (ipc_layout_sender, ipc_layout_receiver) = ipc::channel().expect("ipc channel failure");
+ let layout_receiver = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_layout_receiver);
- let (compositor_sender, compositor_receiver) = channel();
- let compositor_sender_clone = compositor_sender.clone();
+ let (ipc_panic_sender, ipc_panic_receiver) = ipc::channel().expect("ipc channel failure");
+ let panic_receiver = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_panic_receiver);
- spawn_named("Constellation".to_owned(), move || {
let mut constellation: Constellation<Message, LTF, STF> = Constellation {
script_sender: ipc_script_sender,
- compositor_sender: compositor_sender_clone,
layout_sender: ipc_layout_sender,
script_receiver: script_receiver,
panic_sender: ipc_panic_sender,
@@ -1278,34 +1273,35 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// Get the ids for the previous and next pipelines.
let (prev_pipeline_id, next_pipeline_id) = match self.frames.get_mut(&frame_id) {
Some(frame) => {
+ let prev = frame.current;
let next = match direction {
- NavigationDirection::Forward => {
- match frame.next.pop() {
- None => {
- warn!("no next page to navigate to");
- return;
- },
- Some(next) => {
- frame.prev.push(frame.current);
- next
- },
+ NavigationDirection::Forward(delta) => {
+ if delta > frame.next.len() && delta > 0 {
+ return warn!("Invalid navigation delta");
}
+ let new_next_len = frame.next.len() - (delta - 1);
+ frame.prev.push(frame.current);
+ frame.prev.extend(frame.next.drain(new_next_len..).rev());
+ frame.current = match frame.next.pop() {
+ Some(frame) => frame,
+ None => return warn!("Could not get next frame for forward navigation"),
+ };
+ frame.current
}
- NavigationDirection::Back => {
- match frame.prev.pop() {
- None => {
- warn!("no previous page to navigate to");
- return;
- },
- Some(prev) => {
- frame.next.push(frame.current);
- prev
- },
+ NavigationDirection::Back(delta) => {
+ if delta > frame.prev.len() && delta > 0 {
+ return warn!("Invalid navigation delta");
}
+ let new_prev_len = frame.prev.len() - (delta - 1);
+ frame.next.push(frame.current);
+ frame.next.extend(frame.prev.drain(new_prev_len..).rev());
+ frame.current = match frame.prev.pop() {
+ Some(frame) => frame,
+ None => return warn!("Could not get prev frame for back navigation"),
+ };
+ frame.current
}
};
- let prev = frame.current;
- frame.current = next;
(prev, next)
},
None => {
@@ -2031,8 +2027,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
if let Some(frame_tree) = self.frame_to_sendable(root_frame_id) {
let (chan, port) = ipc::channel().expect("Failed to create IPC channel!");
self.compositor_proxy.send(ToCompositorMsg::SetFrameTree(frame_tree,
- chan,
- self.compositor_sender.clone()));
+ chan));
if port.recv().is_err() {
warn!("Compositor has discarded SetFrameTree");
return; // Our message has been discarded, probably shutting down.
diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs
index 0d92cf8baa2..578ccae0927 100644
--- a/components/constellation/pipeline.rs
+++ b/components/constellation/pipeline.rs
@@ -136,12 +136,13 @@ impl Pipeline {
let (script_chan, content_ports) = match state.script_chan {
Some(script_chan) => {
- let (containing_pipeline_id, subpage_id, _) =
+ let (containing_pipeline_id, subpage_id, frame_type) =
state.parent_info.expect("script_pipeline != None but subpage_id == None");
let new_layout_info = NewLayoutInfo {
containing_pipeline_id: containing_pipeline_id,
new_pipeline_id: state.id,
subpage_id: subpage_id,
+ frame_type: frame_type,
load_data: state.load_data.clone(),
paint_chan: layout_to_paint_chan.clone().to_opaque(),
panic_chan: state.panic_chan.clone(),
@@ -204,7 +205,7 @@ impl Pipeline {
let unprivileged_pipeline_content = UnprivilegedPipelineContent {
id: state.id,
- parent_info: state.parent_info.map(|(parent_id, subpage_id, _)| (parent_id, subpage_id)),
+ parent_info: state.parent_info,
constellation_chan: state.constellation_chan,
scheduler_chan: state.scheduler_chan,
devtools_chan: script_to_devtools_chan,
@@ -371,7 +372,7 @@ impl Pipeline {
#[derive(Deserialize, Serialize)]
pub struct UnprivilegedPipelineContent {
id: PipelineId,
- parent_info: Option<(PipelineId, SubpageId)>,
+ parent_info: Option<(PipelineId, SubpageId, FrameType)>,
constellation_chan: IpcSender<ScriptMsg>,
layout_to_constellation_chan: IpcSender<LayoutMsg>,
scheduler_chan: IpcSender<TimerEventRequest>,
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index 8d37b6aa6ba..3dfcfdf2689 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -34,9 +34,9 @@ use inline::{InlineFragmentNodeInfo, LAST_FRAGMENT_OF_ELEMENT};
use list_item::{ListItemFlow, ListStyleTypeContent};
use multicol::{MulticolFlow, MulticolColumnFlow};
use parallel;
-use script::dom::bindings::inheritance::{CharacterDataTypeId, ElementTypeId};
-use script::dom::bindings::inheritance::{HTMLElementTypeId, NodeTypeId};
-use script::dom::htmlobjectelement::is_image_data;
+use script::layout_interface::is_image_data;
+use script::layout_interface::{CharacterDataTypeId, ElementTypeId};
+use script::layout_interface::{HTMLElementTypeId, NodeTypeId};
use std::borrow::ToOwned;
use std::collections::LinkedList;
use std::marker::PhantomData;
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs
index 705868a5afe..640b7acce1a 100644
--- a/components/layout/fragment.rs
+++ b/components/layout/fragment.rs
@@ -30,7 +30,7 @@ use net_traits::image::base::{Image, ImageMetadata};
use net_traits::image_cache_thread::{ImageOrMetadataAvailable, UsePlaceholder};
use range::*;
use rustc_serialize::{Encodable, Encoder};
-use script::dom::htmlcanvaselement::HTMLCanvasData;
+use script::layout_interface::HTMLCanvasData;
use std::borrow::ToOwned;
use std::cmp::{max, min};
use std::collections::LinkedList;
diff --git a/components/layout/layout_thread.rs b/components/layout/layout_thread.rs
index b48813a0c31..5bef2050932 100644
--- a/components/layout/layout_thread.rs
+++ b/components/layout/layout_thread.rs
@@ -47,7 +47,7 @@ use query::process_offset_parent_query;
use query::{LayoutRPCImpl, process_content_box_request, process_content_boxes_request};
use query::{process_node_geometry_request, process_node_layer_id_request, process_node_scroll_area_request};
use query::{process_node_overflow_request, process_resolved_style_request, process_margin_style_query};
-use script::dom::node::OpaqueStyleAndLayoutData;
+use script::layout_interface::OpaqueStyleAndLayoutData;
use script::layout_interface::{LayoutRPC, OffsetParentResponse, NodeOverflowResponse, MarginStyleResponse};
use script::layout_interface::{Msg, NewLayoutThreadInfo, Reflow, ReflowQueryType, ScriptReflow};
use script::reporter::CSSErrorReporter;
@@ -355,19 +355,23 @@ fn add_font_face_rules(stylesheet: &Stylesheet,
font_cache_thread: &FontCacheThread,
font_cache_sender: &IpcSender<()>,
outstanding_web_fonts_counter: &Arc<AtomicUsize>) {
- for font_face in stylesheet.effective_rules(&device).font_face() {
- for source in &font_face.sources {
- if opts::get().load_webfonts_synchronously {
- let (sender, receiver) = ipc::channel().unwrap();
+ if opts::get().load_webfonts_synchronously {
+ let (sender, receiver) = ipc::channel().unwrap();
+ for font_face in stylesheet.effective_rules(&device).font_face() {
+ for source in font_face.effective_sources() {
font_cache_thread.add_web_font(font_face.family.clone(),
- (*source).clone(),
- sender);
+ (*source).clone(),
+ sender.clone());
receiver.recv().unwrap();
- } else {
+ }
+ }
+ } else {
+ for font_face in stylesheet.effective_rules(&device).font_face() {
+ for source in font_face.effective_sources() {
outstanding_web_fonts_counter.fetch_add(1, Ordering::SeqCst);
font_cache_thread.add_web_font(font_face.family.clone(),
- (*source).clone(),
- (*font_cache_sender).clone());
+ (*source).clone(),
+ (*font_cache_sender).clone());
}
}
}
diff --git a/components/layout/opaque_node.rs b/components/layout/opaque_node.rs
index 023b9cb34c0..a05a49d48e6 100644
--- a/components/layout/opaque_node.rs
+++ b/components/layout/opaque_node.rs
@@ -6,8 +6,8 @@
use gfx::display_list::OpaqueNode;
use libc::{c_void, uintptr_t};
-use script::dom::bindings::js::LayoutJS;
-use script::dom::node::Node;
+use script::layout_interface::LayoutJS;
+use script::layout_interface::Node;
use script::layout_interface::TrustedNodeAddress;
use script_traits::UntrustedNodeAddress;
diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs
index 10dde4b2ff0..b6c5266c2cb 100644
--- a/components/layout/wrapper.rs
+++ b/components/layout/wrapper.rs
@@ -39,22 +39,12 @@ use incremental::RestyleDamage;
use msg::constellation_msg::PipelineId;
use opaque_node::OpaqueNodeMethods;
use range::Range;
-use script::dom::attr::AttrValue;
-use script::dom::bindings::inheritance::{CharacterDataTypeId, ElementTypeId};
-use script::dom::bindings::inheritance::{HTMLElementTypeId, NodeTypeId};
-use script::dom::bindings::js::LayoutJS;
-use script::dom::characterdata::LayoutCharacterDataHelpers;
-use script::dom::document::{Document, LayoutDocumentHelpers};
-use script::dom::element::{Element, LayoutElementHelpers, RawLayoutElementHelpers};
-use script::dom::htmlcanvaselement::{LayoutHTMLCanvasElementHelpers, HTMLCanvasData};
-use script::dom::htmliframeelement::HTMLIFrameElement;
-use script::dom::htmlimageelement::LayoutHTMLImageElementHelpers;
-use script::dom::htmlinputelement::{HTMLInputElement, LayoutHTMLInputElementHelpers};
-use script::dom::htmltextareaelement::{HTMLTextAreaElement, LayoutHTMLTextAreaElementHelpers};
-use script::dom::node::{CAN_BE_FRAGMENTED, HAS_CHANGED, HAS_DIRTY_DESCENDANTS, IS_DIRTY};
-use script::dom::node::{LayoutNodeHelpers, Node, OpaqueStyleAndLayoutData};
-use script::dom::text::Text;
-use script::layout_interface::TrustedNodeAddress;
+use script::layout_interface::{CAN_BE_FRAGMENTED, HAS_CHANGED, HAS_DIRTY_DESCENDANTS, IS_DIRTY};
+use script::layout_interface::{CharacterDataTypeId, Document, Element, ElementTypeId};
+use script::layout_interface::{HTMLCanvasData, HTMLElementTypeId, LayoutCharacterDataHelpers};
+use script::layout_interface::{LayoutDocumentHelpers, LayoutElementHelpers, LayoutJS};
+use script::layout_interface::{LayoutNodeHelpers, Node, NodeTypeId, OpaqueStyleAndLayoutData};
+use script::layout_interface::{RawLayoutElementHelpers, Text, TrustedNodeAddress};
use selectors::matching::{DeclarationBlock, ElementFlags};
use selectors::parser::{AttrSelector, NamespaceConstraint};
use smallvec::VecLike;
@@ -63,6 +53,7 @@ use std::marker::PhantomData;
use std::mem::{transmute, transmute_copy};
use std::sync::Arc;
use string_cache::{Atom, BorrowedAtom, BorrowedNamespace, Namespace};
+use style::attr::AttrValue;
use style::computed_values::content::ContentItem;
use style::computed_values::{content, display};
use style::dom::{PresentationalHintsSynthetizer, TDocument, TElement, TNode, UnsafeNode};
@@ -1142,39 +1133,25 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
fn selection(&self) -> Option<Range<ByteIndex>> {
let this = unsafe { self.get_jsmanaged() };
- let selection = if let Some(area) = this.downcast::<HTMLTextAreaElement>() {
- unsafe { area.selection_for_layout() }
- } else if let Some(input) = this.downcast::<HTMLInputElement>() {
- unsafe { input.selection_for_layout() }
- } else {
- return None;
- };
- selection.map(|range| Range::new(ByteIndex(range.start as isize),
- ByteIndex(range.len() as isize)))
+ this.selection().map(|range| {
+ Range::new(ByteIndex(range.start as isize),
+ ByteIndex(range.len() as isize))
+ })
}
fn image_url(&self) -> Option<Url> {
- unsafe {
- self.get_jsmanaged().downcast()
- .expect("not an image!")
- .image_url()
- }
+ let this = unsafe { self.get_jsmanaged() };
+ this.image_url()
}
fn canvas_data(&self) -> Option<HTMLCanvasData> {
- unsafe {
- let canvas_element = self.get_jsmanaged().downcast();
- canvas_element.map(|canvas| canvas.data())
- }
+ let this = unsafe { self.get_jsmanaged() };
+ this.canvas_data()
}
fn iframe_pipeline_id(&self) -> PipelineId {
- use script::dom::htmliframeelement::HTMLIFrameElementLayoutMethods;
- unsafe {
- let iframe_element = self.get_jsmanaged().downcast::<HTMLIFrameElement>()
- .expect("not an iframe element!");
- iframe_element.pipeline_id().unwrap()
- }
+ let this = unsafe { self.get_jsmanaged() };
+ this.iframe_pipeline_id()
}
fn get_colspan(&self) -> u32 {
diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs
index 7e64619db69..8d81702c465 100644
--- a/components/msg/constellation_msg.rs
+++ b/components/msg/constellation_msg.rs
@@ -244,8 +244,8 @@ impl LoadData {
#[derive(Clone, PartialEq, Eq, Copy, Hash, Debug, Deserialize, Serialize)]
pub enum NavigationDirection {
- Forward,
- Back,
+ Forward(usize),
+ Back(usize),
}
#[derive(Clone, PartialEq, Eq, Copy, Hash, Debug, Deserialize, Serialize)]
diff --git a/components/net/blob_loader.rs b/components/net/blob_loader.rs
new file mode 100644
index 00000000000..00b7f4ae083
--- /dev/null
+++ b/components/net/blob_loader.rs
@@ -0,0 +1,87 @@
+/* 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 filemanager_thread::BlobURLStore;
+use hyper::header::{DispositionType, ContentDisposition, DispositionParam};
+use hyper::header::{Headers, ContentType, ContentLength, Charset};
+use hyper::http::RawStatus;
+use mime::{Mime, Attr};
+use mime_classifier::MIMEClassifier;
+use net_traits::ProgressMsg::Done;
+use net_traits::blob_url_store::{parse_blob_url, BlobURLStoreEntry, BlobURLStoreError};
+use net_traits::response::HttpsState;
+use net_traits::{LoadConsumer, LoadData, Metadata, NetworkError};
+use resource_thread::{send_error, start_sending_sniffed_opt};
+use std::str;
+use std::sync::{Arc, RwLock};
+
+
+// TODO: Check on GET
+// https://w3c.github.io/FileAPI/#requestResponseModel
+
+pub fn load(load_data: LoadData, consumer: LoadConsumer,
+ blob_url_store: Arc<RwLock<BlobURLStore>>,
+ classifier: Arc<MIMEClassifier>) { // XXX: Move it into net process later
+
+ match parse_blob_url(&load_data.url) {
+ None => {
+ let format_err = NetworkError::Internal(format!("Invalid blob URL format {:?}", load_data.url));
+ send_error(load_data.url.clone(), format_err, consumer);
+ }
+ Some((uuid, _fragment)) => {
+ match blob_url_store.read().unwrap().request(uuid, &load_data.url.origin()) {
+ Ok(entry) => load_blob(&load_data, consumer, classifier, entry),
+ Err(e) => {
+ let err = match e {
+ BlobURLStoreError::InvalidKey =>
+ format!("Invalid blob URL key {:?}", uuid.simple().to_string()),
+ BlobURLStoreError::InvalidOrigin =>
+ format!("Invalid blob URL origin {:?}", load_data.url.origin()),
+ };
+ send_error(load_data.url.clone(), NetworkError::Internal(err), consumer);
+ }
+ }
+ }
+ }
+}
+
+fn load_blob(load_data: &LoadData,
+ start_chan: LoadConsumer,
+ classifier: Arc<MIMEClassifier>,
+ entry: &BlobURLStoreEntry) {
+ let content_type: Mime = entry.type_string.parse().unwrap_or(mime!(Text / Plain));
+ let charset = content_type.get_param(Attr::Charset);
+
+ let mut headers = Headers::new();
+
+ if let Some(ref name) = entry.filename {
+ let charset = charset.and_then(|c| c.as_str().parse().ok());
+ headers.set(ContentDisposition {
+ disposition: DispositionType::Inline,
+ parameters: vec![
+ DispositionParam::Filename(charset.unwrap_or(Charset::Us_Ascii),
+ None, name.as_bytes().to_vec())
+ ]
+ });
+ }
+
+ headers.set(ContentType(content_type.clone()));
+ headers.set(ContentLength(entry.size));
+
+ let metadata = Metadata {
+ final_url: load_data.url.clone(),
+ content_type: Some(ContentType(content_type.clone())),
+ charset: charset.map(|c| c.as_str().to_string()),
+ headers: Some(headers),
+ // https://w3c.github.io/FileAPI/#TwoHundredOK
+ status: Some(RawStatus(200, "OK".into())),
+ https_state: HttpsState::None,
+ };
+
+ if let Ok(chan) =
+ start_sending_sniffed_opt(start_chan, metadata, classifier,
+ &entry.bytes, load_data.context.clone()) {
+ let _ = chan.send(Done(Ok(())));
+ }
+}
diff --git a/components/net/filemanager_thread.rs b/components/net/filemanager_thread.rs
index fc65446a587..9c741d00d49 100644
--- a/components/net/filemanager_thread.rs
+++ b/components/net/filemanager_thread.rs
@@ -2,20 +2,27 @@
* 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 blob_loader;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
+use mime_classifier::MIMEClassifier;
use mime_guess::guess_mime_type_opt;
+use net_traits::blob_url_store::{BlobURLStoreEntry, BlobURLStoreError};
use net_traits::filemanager_thread::{FileManagerThreadMsg, FileManagerResult};
use net_traits::filemanager_thread::{SelectedFile, FileManagerThreadError};
use std::collections::HashMap;
use std::fs::File;
use std::io::Read;
use std::path::{Path, PathBuf};
+use std::sync::{Arc, RwLock};
+use url::Origin;
use util::thread::spawn_named;
use uuid::Uuid;
pub struct FileManager {
receiver: IpcReceiver<FileManagerThreadMsg>,
idmap: HashMap<Uuid, PathBuf>,
+ classifier: Arc<MIMEClassifier>,
+ blob_url_store: Arc<RwLock<BlobURLStore>>,
}
pub trait FileManagerThreadFactory {
@@ -41,6 +48,8 @@ impl FileManager {
FileManager {
receiver: recv,
idmap: HashMap::new(),
+ classifier: Arc::new(MIMEClassifier::new()),
+ blob_url_store: Arc::new(RwLock::new(BlobURLStore::new())),
}
}
@@ -52,6 +61,11 @@ impl FileManager {
FileManagerThreadMsg::SelectFiles(sender) => self.select_files(sender),
FileManagerThreadMsg::ReadFile(sender, id) => self.read_file(sender, id),
FileManagerThreadMsg::DeleteFileID(id) => self.delete_fileid(id),
+ FileManagerThreadMsg::LoadBlob(load_data, consumer) => {
+ blob_loader::load(load_data, consumer,
+ self.blob_url_store.clone(),
+ self.classifier.clone());
+ },
FileManagerThreadMsg::Exit => break,
}
}
@@ -156,3 +170,37 @@ impl FileManager {
self.idmap.remove(&id);
}
}
+
+pub struct BlobURLStore {
+ entries: HashMap<Uuid, (Origin, BlobURLStoreEntry)>,
+}
+
+impl BlobURLStore {
+ pub fn new() -> BlobURLStore {
+ BlobURLStore {
+ entries: HashMap::new(),
+ }
+ }
+
+ pub fn request(&self, id: Uuid, origin: &Origin) -> Result<&BlobURLStoreEntry, BlobURLStoreError> {
+ match self.entries.get(&id) {
+ Some(ref pair) => {
+ if pair.0 == *origin {
+ Ok(&pair.1)
+ } else {
+ Err(BlobURLStoreError::InvalidOrigin)
+ }
+ }
+ None => Err(BlobURLStoreError::InvalidKey)
+ }
+ }
+
+ pub fn add_entry(&mut self, id: Uuid, origin: Origin, blob: BlobURLStoreEntry) {
+ self.entries.insert(id, (origin, blob));
+ }
+
+ pub fn delete_entry(&mut self, id: Uuid) {
+ self.entries.remove(&id);
+ }
+}
+
diff --git a/components/net/lib.rs b/components/net/lib.rs
index 24912cfa2e5..80c6294c277 100644
--- a/components/net/lib.rs
+++ b/components/net/lib.rs
@@ -6,7 +6,6 @@
#![feature(custom_derive)]
#![feature(box_syntax)]
#![feature(fnbox)]
-#![feature(fs_time)]
#![feature(mpsc_select)]
#![feature(plugin)]
#![plugin(plugins)]
@@ -49,6 +48,7 @@ extern crate webrender_traits;
extern crate websocket;
pub mod about_loader;
+pub mod blob_loader;
pub mod bluetooth_thread;
pub mod chrome_loader;
pub mod connector;
diff --git a/components/net_traits/blob_url_store.rs b/components/net_traits/blob_url_store.rs
new file mode 100644
index 00000000000..85fa81aa341
--- /dev/null
+++ b/components/net_traits/blob_url_store.rs
@@ -0,0 +1,50 @@
+/* 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 ipc_channel::ipc::IpcSender;
+use std::str::FromStr;
+use url::Url;
+use uuid::Uuid;
+
+/// Errors returns to BlobURLStoreMsg::Request
+#[derive(Clone, Serialize, Deserialize)]
+pub enum BlobURLStoreError {
+ /// Invalid UUID key
+ InvalidKey,
+ /// Invalid URL origin
+ InvalidOrigin,
+}
+
+/// Blob URL store entry, a packaged form of Blob DOM object
+#[derive(Clone, Serialize, Deserialize)]
+pub struct BlobURLStoreEntry {
+ /// MIME type string
+ pub type_string: String,
+ /// Some filename if the backend of Blob is a file
+ pub filename: Option<String>,
+ /// Size of content in bytes
+ pub size: u64,
+ /// Content of blob
+ pub bytes: Vec<u8>,
+}
+
+/// Message-passing style interface between store and loader
+#[derive(Serialize, Deserialize)]
+pub enum BlobURLStoreMsg {
+ /// Request for an blob entry identified by uuid
+ Request(Uuid, IpcSender<Result<BlobURLStoreEntry, BlobURLStoreError>>),
+}
+
+/// Parse URL as Blob URL scheme's definition
+/// https://w3c.github.io/FileAPI/#DefinitionOfScheme
+pub fn parse_blob_url(url: &Url) -> Option<(Uuid, Option<&str>)> {
+ url.path_segments().and_then(|mut segments| {
+ let id_str = match (segments.next(), segments.next()) {
+ (Some(s), None) => s,
+ _ => return None,
+ };
+
+ Uuid::from_str(id_str).map(|id| (id, url.fragment())).ok()
+ })
+}
diff --git a/components/net_traits/filemanager_thread.rs b/components/net_traits/filemanager_thread.rs
index 2ced0701eff..07a6180834f 100644
--- a/components/net_traits/filemanager_thread.rs
+++ b/components/net_traits/filemanager_thread.rs
@@ -4,6 +4,7 @@
use ipc_channel::ipc::IpcSender;
use std::path::PathBuf;
+use super::{LoadConsumer, LoadData};
use uuid::Uuid;
#[derive(Debug, Deserialize, Serialize)]
@@ -29,6 +30,9 @@ pub enum FileManagerThreadMsg {
/// Delete the FileID entry
DeleteFileID(Uuid),
+ /// Load resource by Blob URL
+ LoadBlob(LoadData, LoadConsumer),
+
/// Shut down this thread
Exit,
}
diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs
index 4eab3e725e9..4af820b0ebd 100644
--- a/components/net_traits/lib.rs
+++ b/components/net_traits/lib.rs
@@ -43,6 +43,7 @@ use storage_thread::StorageThreadMsg;
use url::Url;
use websocket::header;
+pub mod blob_url_store;
pub mod bluetooth_scanfilter;
pub mod bluetooth_thread;
pub mod filemanager_thread;
@@ -573,3 +574,27 @@ pub enum NetworkError {
/// SSL validation error that has to be handled in the HTML parser
SslValidation(Url),
}
+
+/// Normalize `slice`, as defined by
+/// [the Fetch Spec](https://fetch.spec.whatwg.org/#concept-header-value-normalize).
+pub fn trim_http_whitespace(mut slice: &[u8]) -> &[u8] {
+ const HTTP_WS_BYTES: &'static [u8] = b"\x09\x0A\x0D\x20";
+
+ loop {
+ match slice.split_first() {
+ Some((first, remainder)) if HTTP_WS_BYTES.contains(first) =>
+ slice = remainder,
+ _ => break,
+ }
+ }
+
+ loop {
+ match slice.split_last() {
+ Some((last, remainder)) if HTTP_WS_BYTES.contains(last) =>
+ slice = remainder,
+ _ => break,
+ }
+ }
+
+ slice
+}
diff --git a/components/plugins/lints/unrooted_must_root.rs b/components/plugins/lints/unrooted_must_root.rs
index 9a9a43d62dc..6e6b6f516c2 100644
--- a/components/plugins/lints/unrooted_must_root.rs
+++ b/components/plugins/lints/unrooted_must_root.rs
@@ -5,7 +5,6 @@
use rustc::hir;
use rustc::hir::intravisit as visit;
use rustc::hir::map as ast_map;
-use rustc::hir::pat_util::pat_is_binding;
use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext};
use rustc::ty;
use syntax::attr::AttrMetaMethods;
@@ -199,14 +198,12 @@ impl<'a, 'b: 'a, 'tcx: 'a+'b> visit::Visitor<'a> for FnDefVisitor<'a, 'b, 'tcx>
fn visit_pat(&mut self, pat: &'a hir::Pat) {
let cx = self.cx;
- if let hir::PatKind::Ident(hir::BindingMode::BindByValue(_), _, _) = pat.node {
- if pat_is_binding(&cx.tcx.def_map.borrow(), pat) {
- let ty = cx.tcx.pat_ty(pat);
- if is_unrooted_ty(cx, ty, self.in_new_function) {
- cx.span_lint(UNROOTED_MUST_ROOT,
- pat.span,
- &format!("Expression of type {:?} must be rooted", ty))
- }
+ if let hir::PatKind::Binding(hir::BindingMode::BindByValue(_), _, _) = pat.node {
+ let ty = cx.tcx.pat_ty(pat);
+ if is_unrooted_ty(cx, ty, self.in_new_function) {
+ cx.span_lint(UNROOTED_MUST_ROOT,
+ pat.span,
+ &format!("Expression of type {:?} must be rooted", ty))
}
}
diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml
index b947fe330a3..056bb6f72bb 100644
--- a/components/script/Cargo.toml
+++ b/components/script/Cargo.toml
@@ -29,7 +29,7 @@ encoding = "0.2"
euclid = {version = "0.6.4", features = ["plugins"]}
fnv = "1.0"
gfx_traits = {path = "../gfx_traits"}
-heapsize = "0.3.0"
+heapsize = "0.3.6"
heapsize_plugin = "0.1.2"
html5ever = {version = "0.5.1", features = ["heap_size", "unstable"]}
hyper = {version = "0.9", features = ["serde-serialization"]}
diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs
index 43c1226b295..d5a00e6c1fa 100644
--- a/components/script/dom/attr.rs
+++ b/components/script/dom/attr.rs
@@ -18,7 +18,7 @@ use std::borrow::ToOwned;
use std::cell::Ref;
use std::mem;
use string_cache::{Atom, Namespace};
-pub use style::attr::{AttrIdentifier, AttrValue};
+use style::attr::{AttrIdentifier, AttrValue};
// https://dom.spec.whatwg.org/#interface-attr
#[dom_struct]
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 0caeddb3dfa..c356a7d066c 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -2494,12 +2494,13 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
properties should be a PropertyArrays instance.
"""
- def __init__(self, descriptor, properties):
+ def __init__(self, descriptor, properties, haveUnscopables):
args = [Argument('*mut JSContext', 'cx'), Argument('HandleObject', 'global'),
Argument('*mut ProtoOrIfaceArray', 'cache')]
CGAbstractMethod.__init__(self, descriptor, 'CreateInterfaceObjects', 'void', args,
unsafe=True)
self.properties = properties
+ self.haveUnscopables = haveUnscopables
def definition_body(self):
name = self.descriptor.interface.identifier.name
@@ -2530,7 +2531,10 @@ let mut prototype_proto = RootedObject::new(cx, ptr::null_mut());
%s;
assert!(!prototype_proto.ptr.is_null());""" % getPrototypeProto)]
- properties = {"id": name}
+ properties = {
+ "id": name,
+ "unscopables": "unscopable_names" if self.haveUnscopables else "&[]"
+ }
for arrayName in self.properties.arrayNames():
array = getattr(self.properties, arrayName)
if array.length():
@@ -2546,6 +2550,7 @@ create_interface_prototype_object(cx,
%(methods)s,
%(attrs)s,
%(consts)s,
+ %(unscopables)s,
prototype.handle_mut());
assert!(!prototype.ptr.is_null());
assert!((*cache)[PrototypeList::ID::%(id)s as usize].is_null());
@@ -5058,9 +5063,13 @@ class CGDescriptor(CGThing):
descriptor.shouldHaveGetConstructorObjectMethod()):
cgThings.append(CGGetConstructorObjectMethod(descriptor))
+ unscopableNames = []
for m in descriptor.interface.members:
if (m.isMethod() and
(not m.isIdentifierLess() or m == descriptor.operations["Stringifier"])):
+ if m.getExtendedAttribute("Unscopable"):
+ assert not m.isStatic()
+ unscopableNames.append(m.identifier.name)
if m.isStatic():
assert descriptor.interface.hasInterfaceObject()
cgThings.append(CGStaticMethod(descriptor, m))
@@ -5072,7 +5081,9 @@ class CGDescriptor(CGThing):
raise TypeError("Stringifier attributes not supported yet. "
"See https://github.com/servo/servo/issues/7590\n"
"%s" % m.location)
-
+ if m.getExtendedAttribute("Unscopable"):
+ assert not m.isStatic()
+ unscopableNames.append(m.identifier.name)
if m.isStatic():
assert descriptor.interface.hasInterfaceObject()
cgThings.append(CGStaticGetter(descriptor, m))
@@ -5106,10 +5117,6 @@ class CGDescriptor(CGThing):
if not descriptor.interface.isCallback():
cgThings.append(CGPrototypeJSClass(descriptor))
- properties = PropertyArrays(descriptor)
- cgThings.append(CGGeneric(str(properties)))
- cgThings.append(CGCreateInterfaceObjectsMethod(descriptor, properties))
-
# If there are no constant members, don't make a module for constants
constMembers = [m for m in descriptor.interface.members if m.isConst()]
if constMembers:
@@ -5156,13 +5163,25 @@ class CGDescriptor(CGThing):
cgThings.append(CGWrapMethod(descriptor))
+ haveUnscopables = False
if not descriptor.interface.isCallback():
+ if unscopableNames:
+ haveUnscopables = True
+ cgThings.append(
+ CGList([CGGeneric("const unscopable_names: &'static [&'static [u8]] = &["),
+ CGIndenter(CGList([CGGeneric(str_to_const_array(name)) for
+ name in unscopableNames], ",\n")),
+ CGGeneric("];\n")], "\n"))
if descriptor.concrete or descriptor.hasDescendants():
cgThings.append(CGIDLInterface(descriptor))
cgThings.append(CGInterfaceTrait(descriptor))
if descriptor.weakReferenceable:
cgThings.append(CGWeakReferenceableTrait(descriptor))
+ properties = PropertyArrays(descriptor)
+ cgThings.append(CGGeneric(str(properties)))
+ cgThings.append(CGCreateInterfaceObjectsMethod(descriptor, properties, haveUnscopables))
+
cgThings = CGList(cgThings, "\n")
# self.cgRoot = CGWrapper(CGNamespace(toBindingNamespace(descriptor.name),
# cgThings),
diff --git a/components/script/dom/bindings/error.rs b/components/script/dom/bindings/error.rs
index a9ee93663e7..ed0b81c4d64 100644
--- a/components/script/dom/bindings/error.rs
+++ b/components/script/dom/bindings/error.rs
@@ -121,12 +121,10 @@ pub unsafe fn throw_dom_exception(cx: *mut JSContext, global: GlobalRef, result:
}
/// Report a pending exception, thereby clearing it.
-pub fn report_pending_exception(cx: *mut JSContext, obj: *mut JSObject) {
- unsafe {
- if JS_IsExceptionPending(cx) {
- let _ac = JSAutoCompartment::new(cx, obj);
- JS_ReportPendingException(cx);
- }
+pub unsafe fn report_pending_exception(cx: *mut JSContext, obj: *mut JSObject) {
+ if JS_IsExceptionPending(cx) {
+ let _ac = JSAutoCompartment::new(cx, obj);
+ JS_ReportPendingException(cx);
}
}
diff --git a/components/script/dom/bindings/interface.rs b/components/script/dom/bindings/interface.rs
index 590e57ba8e0..500f262f3af 100644
--- a/components/script/dom/bindings/interface.rs
+++ b/components/script/dom/bindings/interface.rs
@@ -9,16 +9,18 @@ use dom::bindings::conversions::get_dom_class;
use dom::bindings::guard::Guard;
use dom::bindings::utils::get_proto_or_iface_array;
use js::error::throw_type_error;
-use js::glue::UncheckedUnwrapObject;
+use js::glue::{RUST_SYMBOL_TO_JSID, UncheckedUnwrapObject};
use js::jsapi::{Class, ClassExtension, ClassSpec, GetGlobalForObjectCrossCompartment};
-use js::jsapi::{HandleObject, HandleValue, JSClass, JSContext, JSFunctionSpec};
-use js::jsapi::{JSNative, JSFUN_CONSTRUCTOR, JSPROP_ENUMERATE, JSPROP_PERMANENT, JSPROP_READONLY};
-use js::jsapi::{JSPROP_RESOLVING, JSPropertySpec, JSString, JS_AtomizeAndPinString};
-use js::jsapi::{JS_DefineProperty, JS_DefineProperty1, JS_DefineProperty2, JS_DefineProperty4};
+use js::jsapi::{GetWellKnownSymbol, HandleObject, HandleValue, JSClass, JSContext};
+use js::jsapi::{JSFunctionSpec, JSNative, JSFUN_CONSTRUCTOR, JSPROP_ENUMERATE};
+use js::jsapi::{JSPROP_PERMANENT, JSPROP_READONLY, JSPROP_RESOLVING, JSPropertySpec};
+use js::jsapi::{JSString, JS_AtomizeAndPinString, JS_DefineProperty, JS_DefineProperty1};
+use js::jsapi::{JS_DefineProperty2, JS_DefineProperty4, JS_DefinePropertyById3};
use js::jsapi::{JS_GetClass, JS_GetFunctionObject, JS_GetPrototype, JS_LinkConstructorAndPrototype};
-use js::jsapi::{JS_NewFunction, JS_NewObject, JS_NewObjectWithUniqueType, JS_NewStringCopyN};
-use js::jsapi::{MutableHandleObject, MutableHandleValue, ObjectOps, RootedObject, RootedString};
-use js::jsapi::{RootedValue, Value};
+use js::jsapi::{JS_NewFunction, JS_NewObject, JS_NewObjectWithUniqueType};
+use js::jsapi::{JS_NewPlainObject, JS_NewStringCopyN, MutableHandleObject};
+use js::jsapi::{MutableHandleValue, ObjectOps, RootedId, RootedObject};
+use js::jsapi::{RootedString, RootedValue, SymbolCode, TrueHandleValue, Value};
use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, NullValue, UInt32Value};
use js::rust::{define_methods, define_properties};
use libc;
@@ -236,8 +238,22 @@ pub unsafe fn create_interface_prototype_object(
regular_methods: &[Guard<&'static [JSFunctionSpec]>],
regular_properties: &[Guard<&'static [JSPropertySpec]>],
constants: &[Guard<&[ConstantSpec]>],
+ unscopable_names: &[&[u8]],
rval: MutableHandleObject) {
create_object(cx, proto, class, regular_methods, regular_properties, constants, rval);
+
+ if !unscopable_names.is_empty() {
+ let mut unscopable_obj = RootedObject::new(cx, ptr::null_mut());
+ create_unscopable_object(cx, unscopable_names, unscopable_obj.handle_mut());
+
+ let unscopable_symbol = GetWellKnownSymbol(cx, SymbolCode::unscopables);
+ assert!(!unscopable_symbol.is_null());
+
+ let unscopable_id = RootedId::new(cx, RUST_SYMBOL_TO_JSID(unscopable_symbol));
+ assert!(JS_DefinePropertyById3(
+ cx, rval.handle(), unscopable_id.handle(), unscopable_obj.handle(),
+ JSPROP_READONLY, None, None))
+ }
}
/// Create and define the interface object of a non-callback interface.
@@ -375,6 +391,22 @@ unsafe fn create_object(
}
}
+unsafe fn create_unscopable_object(
+ cx: *mut JSContext,
+ names: &[&[u8]],
+ rval: MutableHandleObject) {
+ assert!(!names.is_empty());
+ assert!(rval.is_null());
+ rval.set(JS_NewPlainObject(cx));
+ assert!(!rval.ptr.is_null());
+ for &name in names {
+ assert!(*name.last().unwrap() == b'\0');
+ assert!(JS_DefineProperty(
+ cx, rval.handle(), name.as_ptr() as *const libc::c_char, TrueHandleValue,
+ JSPROP_READONLY, None, None));
+ }
+}
+
/// Conditionally define methods on an object.
pub unsafe fn define_guarded_methods(
cx: *mut JSContext,
diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs
index 3ee685fbe02..69565520899 100644
--- a/components/script/dom/bindings/str.rs
+++ b/components/script/dom/bindings/str.rs
@@ -8,7 +8,6 @@ use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::fmt;
use std::hash::{Hash, Hasher};
-use std::mem;
use std::ops;
use std::ops::{Deref, DerefMut};
use std::str;
@@ -31,12 +30,6 @@ impl ByteString {
str::from_utf8(&self.0).ok()
}
- /// Returns ownership of the underlying Vec<u8> and copies an empty
- /// vec in its place
- pub fn bytes(&mut self) -> Vec<u8> {
- mem::replace(&mut self.0, Vec::new())
- }
-
/// Returns the length.
pub fn len(&self) -> usize {
self.0.len()
diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs
index e00fb33cf59..7deca26c9d3 100644
--- a/components/script/dom/bluetooth.rs
+++ b/components/script/dom/bluetooth.rs
@@ -125,10 +125,9 @@ fn convert_request_device_options(options: &RequestDeviceOptions,
if let Some(ref opt_services) = options.optionalServices {
for opt_service in opt_services {
let uuid = try!(BluetoothUUID::GetService(global, opt_service.clone())).to_string();
- if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
- return Err(Security)
+ if !uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
+ optional_services.push(uuid);
}
- optional_services.push(uuid);
}
}
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 0897ccc24ae..6e4b4b030e8 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -4,7 +4,7 @@
use document_loader::{DocumentLoader, LoadType};
use dom::activation::{ActivationSource, synthetic_click_activation};
-use dom::attr::{Attr, AttrValue};
+use dom::attr::Attr;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectMethods;
use dom::bindings::codegen::Bindings::DocumentBinding;
@@ -120,6 +120,7 @@ use std::ptr;
use std::rc::Rc;
use std::sync::Arc;
use string_cache::{Atom, QualName};
+use style::attr::AttrValue;
use style::context::ReflowGoal;
use style::restyle_hints::ElementSnapshot;
use style::servo::Stylesheet;
@@ -1259,7 +1260,7 @@ impl Document {
pub fn trigger_mozbrowser_event(&self, event: MozBrowserEvent) {
if mozbrowser_enabled() {
- if let Some((containing_pipeline_id, subpage_id)) = self.window.parent_info() {
+ if let Some((containing_pipeline_id, subpage_id, _)) = self.window.parent_info() {
let event = ConstellationMsg::MozBrowserEvent(containing_pipeline_id,
subpage_id,
event);
@@ -2674,7 +2675,7 @@ impl DocumentMethods for Document {
.filter(|node| filter_by_name(&name, node.r()))
.peekable();
if let Some(first) = elements.next() {
- if elements.is_empty() {
+ if elements.peek().is_none() {
*found = true;
// TODO: Step 2.
// Step 3.
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index 0432be3987c..5b7c9ecf4aa 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -8,7 +8,6 @@ use app_units::Au;
use cssparser::{Color, ToCss};
use devtools_traits::AttrInfo;
use dom::activation::Activatable;
-use dom::attr::AttrValue;
use dom::attr::{Attr, AttrHelpersForLayout};
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::AttrBinding::AttrMethods;
@@ -85,7 +84,7 @@ use std::mem;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use string_cache::{Atom, BorrowedAtom, BorrowedNamespace, Namespace, QualName};
-use style::attr::LengthOrPercentageOrAuto;
+use style::attr::{AttrValue, LengthOrPercentageOrAuto};
use style::element_state::*;
use style::parser::ParserContextExtraData;
use style::properties::DeclaredValue;
@@ -120,6 +119,25 @@ pub enum ElementCreator {
ScriptCreated,
}
+pub enum AdjacentPosition {
+ BeforeBegin,
+ AfterEnd,
+ AfterBegin,
+ BeforeEnd,
+}
+
+impl AdjacentPosition {
+ pub fn parse(position: &str) -> Fallible<AdjacentPosition> {
+ match_ignore_ascii_case! { &*position,
+ "beforebegin" => Ok(AdjacentPosition::BeforeBegin),
+ "afterbegin" => Ok(AdjacentPosition::AfterBegin),
+ "beforeend" => Ok(AdjacentPosition::BeforeEnd),
+ "afterend" => Ok(AdjacentPosition::AfterEnd),
+ _ => Err(Error::Syntax)
+ }
+ }
+}
+
//
// Element methods
//
@@ -1253,31 +1271,30 @@ impl Element {
}
// https://dom.spec.whatwg.org/#insert-adjacent
- pub fn insert_adjacent(&self, where_: DOMString, node: &Node)
+ pub fn insert_adjacent(&self, where_: AdjacentPosition, node: &Node)
-> Fallible<Option<Root<Node>>> {
let self_node = self.upcast::<Node>();
- match &*where_ {
- "beforebegin" => {
+ match where_ {
+ AdjacentPosition::BeforeBegin => {
if let Some(parent) = self_node.GetParentNode() {
Node::pre_insert(node, &parent, Some(self_node)).map(Some)
} else {
Ok(None)
}
}
- "afterbegin" => {
+ AdjacentPosition::AfterBegin => {
Node::pre_insert(node, &self_node, self_node.GetFirstChild().r()).map(Some)
}
- "beforeend" => {
+ AdjacentPosition::BeforeEnd => {
Node::pre_insert(node, &self_node, None).map(Some)
}
- "afterend" => {
+ AdjacentPosition::AfterEnd => {
if let Some(parent) = self_node.GetParentNode() {
Node::pre_insert(node, &parent, self_node.GetNextSibling().r()).map(Some)
} else {
Ok(None)
}
}
- _ => Err(Error::Syntax)
}
}
@@ -1996,6 +2013,7 @@ impl ElementMethods for Element {
// https://dom.spec.whatwg.org/#dom-element-insertadjacentelement
fn InsertAdjacentElement(&self, where_: DOMString, element: &Element)
-> Fallible<Option<Root<Element>>> {
+ let where_ = try!(AdjacentPosition::parse(&*where_));
let inserted_node = try!(self.insert_adjacent(where_, element.upcast()));
Ok(inserted_node.map(|node| Root::downcast(node).unwrap()))
}
@@ -2007,8 +2025,44 @@ impl ElementMethods for Element {
let text = Text::new(data, &document_from_node(self));
// Step 2.
+ let where_ = try!(AdjacentPosition::parse(&*where_));
self.insert_adjacent(where_, text.upcast()).map(|_| ())
}
+
+ // https://w3c.github.io/DOM-Parsing/#dom-element-insertadjacenthtml
+ fn InsertAdjacentHTML(&self, position: DOMString, text: DOMString)
+ -> ErrorResult {
+ // Step 1.
+ let position = try!(AdjacentPosition::parse(&*position));
+
+ let context = match position {
+ AdjacentPosition::BeforeBegin | AdjacentPosition::AfterEnd => {
+ match self.upcast::<Node>().GetParentNode() {
+ Some(ref node) if node.is::<Document>() => {
+ return Err(Error::NoModificationAllowed)
+ }
+ None => return Err(Error::NoModificationAllowed),
+ Some(node) => node,
+ }
+ }
+ AdjacentPosition::AfterBegin | AdjacentPosition::BeforeEnd => {
+ Root::from_ref(self.upcast::<Node>())
+ }
+ };
+
+ // Step 2.
+ let context = match context.downcast::<Element>() {
+ Some(elem) if elem.local_name() != &atom!("html") ||
+ !elem.html_element_in_html_document() => Root::from_ref(elem),
+ _ => Root::upcast(HTMLBodyElement::new(atom!("body"), None, &*context.owner_doc()))
+ };
+
+ // Step 3.
+ let fragment = try!(context.upcast::<Node>().parse_fragment(text));
+
+ // Step 4.
+ context.insert_adjacent(position, fragment.upcast()).map(|_| ())
+ }
}
pub fn fragment_affecting_attributes() -> [Atom; 3] {
diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs
index ebacde4de4d..9f41abee7d7 100644
--- a/components/script/dom/eventtarget.rs
+++ b/components/script/dom/eventtarget.rs
@@ -425,7 +425,9 @@ impl EventTarget {
};
if !rv || handler.ptr.is_null() {
// Step 1.8.2
- report_pending_exception(cx, self.reflector().get_jsobject().get());
+ unsafe {
+ report_pending_exception(cx, self.reflector().get_jsobject().get());
+ }
// Step 1.8.1 / 1.8.3
return None;
}
diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs
index 4fb575dd1e2..161a7d43eaf 100644
--- a/components/script/dom/htmlanchorelement.rs
+++ b/components/script/dom/htmlanchorelement.rs
@@ -2,9 +2,7 @@
* 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::activation::Activatable;
-use dom::attr::AttrValue;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::AttrBinding::AttrMethods;
use dom::bindings::codegen::Bindings::HTMLAnchorElementBinding;
@@ -29,6 +27,7 @@ use num_traits::ToPrimitive;
use script_traits::MozBrowserEvent;
use std::default::Default;
use string_cache::Atom;
+use style::attr::AttrValue;
use url::Url;
use util::prefs::mozbrowser_enabled;
diff --git a/components/script/dom/htmlappletelement.rs b/components/script/dom/htmlappletelement.rs
index df46e89f06f..16d7e46b10e 100644
--- a/components/script/dom/htmlappletelement.rs
+++ b/components/script/dom/htmlappletelement.rs
@@ -2,7 +2,6 @@
* 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::attr::AttrValue;
use dom::bindings::codegen::Bindings::HTMLAppletElementBinding;
use dom::bindings::codegen::Bindings::HTMLAppletElementBinding::HTMLAppletElementMethods;
use dom::bindings::inheritance::Castable;
@@ -13,6 +12,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use string_cache::Atom;
+use style::attr::AttrValue;
#[dom_struct]
pub struct HTMLAppletElement {
diff --git a/components/script/dom/htmlareaelement.rs b/components/script/dom/htmlareaelement.rs
index 4e8139374f0..7998333810e 100644
--- a/components/script/dom/htmlareaelement.rs
+++ b/components/script/dom/htmlareaelement.rs
@@ -2,7 +2,6 @@
* 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::attr::AttrValue;
use dom::bindings::codegen::Bindings::HTMLAreaElementBinding;
use dom::bindings::codegen::Bindings::HTMLAreaElementBinding::HTMLAreaElementMethods;
use dom::bindings::inheritance::Castable;
@@ -15,6 +14,7 @@ use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use std::default::Default;
use string_cache::Atom;
+use style::attr::AttrValue;
#[dom_struct]
pub struct HTMLAreaElement {
diff --git a/components/script/dom/htmlbaseelement.rs b/components/script/dom/htmlbaseelement.rs
index 944b3675cba..e0c38b1ab41 100644
--- a/components/script/dom/htmlbaseelement.rs
+++ b/components/script/dom/htmlbaseelement.rs
@@ -2,7 +2,7 @@
* 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::attr::{Attr, AttrValue};
+use dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLBaseElementBinding;
use dom::bindings::codegen::Bindings::HTMLBaseElementBinding::HTMLBaseElementMethods;
use dom::bindings::inheritance::Castable;
@@ -14,6 +14,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::{Node, UnbindContext, document_from_node};
use dom::virtualmethods::VirtualMethods;
use string_cache::Atom;
+use style::attr::AttrValue;
use url::Url;
#[dom_struct]
diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs
index b5408d877ac..79dbd1438e4 100644
--- a/components/script/dom/htmlbodyelement.rs
+++ b/components/script/dom/htmlbodyelement.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::RGBA;
-use dom::attr::{Attr, AttrValue};
+use dom::attr::Attr;
use dom::bindings::codegen::Bindings::EventHandlerBinding::{EventHandlerNonNull, OnBeforeUnloadEventHandlerNonNull};
use dom::bindings::codegen::Bindings::HTMLBodyElementBinding::{self, HTMLBodyElementMethods};
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
@@ -18,6 +18,7 @@ use dom::node::{Node, document_from_node, window_from_node};
use dom::virtualmethods::VirtualMethods;
use script_traits::ScriptMsg as ConstellationMsg;
use string_cache::Atom;
+use style::attr::AttrValue;
use time;
use url::Url;
diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs
index 18dcb6d2e34..95073d49cd3 100644
--- a/components/script/dom/htmlcanvaselement.rs
+++ b/components/script/dom/htmlcanvaselement.rs
@@ -4,7 +4,6 @@
use canvas_traits::{CanvasMsg, FromLayoutMsg, CanvasData};
use dom::attr::Attr;
-use dom::attr::AttrValue;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasRenderingContext2DMethods;
use dom::bindings::codegen::Bindings::HTMLCanvasElementBinding;
@@ -33,6 +32,7 @@ use offscreen_gl_context::GLContextAttributes;
use rustc_serialize::base64::{STANDARD, ToBase64};
use std::iter::repeat;
use string_cache::Atom;
+use style::attr::AttrValue;
const DEFAULT_WIDTH: u32 = 300;
const DEFAULT_HEIGHT: u32 = 150;
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs
index 086eb6ff687..87bf5d92ff4 100644
--- a/components/script/dom/htmlelement.rs
+++ b/components/script/dom/htmlelement.rs
@@ -4,7 +4,6 @@
use dom::activation::{ActivationSource, synthetic_click_activation};
use dom::attr::Attr;
-use dom::attr::AttrValue;
use dom::bindings::codegen::Bindings::ElementBinding::ElementMethods;
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::codegen::Bindings::EventHandlerBinding::OnErrorEventHandlerNonNull;
@@ -35,6 +34,7 @@ use std::borrow::ToOwned;
use std::default::Default;
use std::rc::Rc;
use string_cache::Atom;
+use style::attr::AttrValue;
use style::element_state::*;
#[dom_struct]
diff --git a/components/script/dom/htmlfontelement.rs b/components/script/dom/htmlfontelement.rs
index 74526b569bb..5968efc7948 100644
--- a/components/script/dom/htmlfontelement.rs
+++ b/components/script/dom/htmlfontelement.rs
@@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::RGBA;
-use dom::attr::AttrValue;
use dom::bindings::codegen::Bindings::HTMLFontElementBinding;
use dom::bindings::codegen::Bindings::HTMLFontElementBinding::HTMLFontElementMethods;
use dom::bindings::inheritance::Castable;
@@ -15,6 +14,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use string_cache::Atom;
+use style::attr::AttrValue;
use style::values::specified;
use util::str::{HTML_SPACE_CHARACTERS, read_numbers};
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index 66121a422bb..fcc10e3d134 100644
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -2,7 +2,6 @@
* 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::attr::AttrValue;
use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
@@ -50,6 +49,7 @@ use std::borrow::ToOwned;
use std::cell::Cell;
use std::sync::mpsc::Sender;
use string_cache::Atom;
+use style::attr::AttrValue;
use task_source::TaskSource;
use task_source::dom_manipulation::DOMManipulationTask;
use url::form_urlencoded;
diff --git a/components/script/dom/htmlhrelement.rs b/components/script/dom/htmlhrelement.rs
index 1041319f907..a3127449fcc 100644
--- a/components/script/dom/htmlhrelement.rs
+++ b/components/script/dom/htmlhrelement.rs
@@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::RGBA;
-use dom::attr::AttrValue;
use dom::bindings::codegen::Bindings::HTMLHRElementBinding::{self, HTMLHRElementMethods};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{LayoutJS, Root};
@@ -14,7 +13,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use string_cache::Atom;
-use style::attr::LengthOrPercentageOrAuto;
+use style::attr::{AttrValue, LengthOrPercentageOrAuto};
#[dom_struct]
pub struct HTMLHRElement {
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index bc37f526f88..1c0e0c9cf1a 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use document_loader::{LoadType, LoadBlocker};
-use dom::attr::{Attr, AttrValue};
+use dom::attr::Attr;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::BrowserElementBinding::BrowserElementErrorEventDetail;
use dom::bindings::codegen::Bindings::BrowserElementBinding::BrowserElementIconChangeEventDetail;
@@ -42,7 +42,7 @@ use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
use script_traits::{IFrameLoadInfo, MozBrowserEvent, ScriptMsg as ConstellationMsg};
use std::cell::Cell;
use string_cache::Atom;
-use style::attr::LengthOrPercentageOrAuto;
+use style::attr::{AttrValue, LengthOrPercentageOrAuto};
use style::context::ReflowGoal;
use url::Url;
use util::prefs::mozbrowser_enabled;
@@ -468,12 +468,12 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/goBack
fn GoBack(&self) -> ErrorResult {
- Navigate(self, NavigationDirection::Back)
+ Navigate(self, NavigationDirection::Back(1))
}
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/goForward
fn GoForward(&self) -> ErrorResult {
- Navigate(self, NavigationDirection::Forward)
+ Navigate(self, NavigationDirection::Forward(1))
}
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/reload
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs
index 49f771824d3..06a5bf93abf 100644
--- a/components/script/dom/htmlimageelement.rs
+++ b/components/script/dom/htmlimageelement.rs
@@ -4,7 +4,6 @@
use app_units::Au;
use dom::attr::Attr;
-use dom::attr::AttrValue;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::HTMLImageElementBinding;
use dom::bindings::codegen::Bindings::HTMLImageElementBinding::HTMLImageElementMethods;
@@ -31,7 +30,7 @@ use script_runtime::ScriptThreadEventCategory::UpdateReplacedElement;
use script_thread::Runnable;
use std::sync::Arc;
use string_cache::Atom;
-use style::attr::LengthOrPercentageOrAuto;
+use style::attr::{AttrValue, LengthOrPercentageOrAuto};
use url::Url;
#[derive(JSTraceable, HeapSizeOf)]
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index a7bb9846bb9..4c164f2c819 100644
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -4,7 +4,7 @@
use caseless::compatibility_caseless_match_str;
use dom::activation::{Activatable, ActivationSource, synthetic_click_activation};
-use dom::attr::{Attr, AttrValue};
+use dom::attr::Attr;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use dom::bindings::codegen::Bindings::FileListBinding::FileListMethods;
@@ -39,6 +39,7 @@ use std::borrow::ToOwned;
use std::cell::Cell;
use std::ops::Range;
use string_cache::Atom;
+use style::attr::AttrValue;
use style::element_state::*;
use textinput::KeyReaction::{DispatchInput, Nothing, RedrawSelection, TriggerDefaultAction};
use textinput::Lines::Single;
diff --git a/components/script/dom/htmllabelelement.rs b/components/script/dom/htmllabelelement.rs
index e14dce36b88..6e808a14fc3 100644
--- a/components/script/dom/htmllabelelement.rs
+++ b/components/script/dom/htmllabelelement.rs
@@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::activation::{Activatable, ActivationSource, synthetic_click_activation};
-use dom::attr::AttrValue;
use dom::bindings::codegen::Bindings::HTMLLabelElementBinding;
use dom::bindings::codegen::Bindings::HTMLLabelElementBinding::HTMLLabelElementMethods;
use dom::bindings::inheritance::Castable;
@@ -18,6 +17,7 @@ use dom::htmlformelement::{FormControl, HTMLFormElement};
use dom::node::{document_from_node, Node};
use dom::virtualmethods::VirtualMethods;
use string_cache::Atom;
+use style::attr::AttrValue;
#[dom_struct]
pub struct HTMLLabelElement {
diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs
index a69ec5b9aa5..2b0056a8d65 100644
--- a/components/script/dom/htmllinkelement.rs
+++ b/components/script/dom/htmllinkelement.rs
@@ -4,7 +4,7 @@
use cssparser::Parser as CssParser;
use document_loader::LoadType;
-use dom::attr::{Attr, AttrValue};
+use dom::attr::Attr;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::HTMLLinkElementBinding;
use dom::bindings::codegen::Bindings::HTMLLinkElementBinding::HTMLLinkElementMethods;
@@ -36,6 +36,7 @@ use std::default::Default;
use std::mem;
use std::sync::{Arc, Mutex};
use string_cache::Atom;
+use style::attr::AttrValue;
use style::media_queries::{MediaQueryList, parse_media_query_list};
use style::parser::ParserContextExtraData;
use style::servo::Stylesheet;
diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs
index 13bf926cded..160b4a9c68e 100644
--- a/components/script/dom/htmlmetaelement.rs
+++ b/components/script/dom/htmlmetaelement.rs
@@ -2,7 +2,7 @@
* 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::attr::{Attr, AttrValue};
+use dom::attr::Attr;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::HTMLMetaElementBinding;
use dom::bindings::codegen::Bindings::HTMLMetaElementBinding::HTMLMetaElementMethods;
@@ -19,6 +19,7 @@ use dom::virtualmethods::VirtualMethods;
use std::ascii::AsciiExt;
use std::sync::Arc;
use string_cache::Atom;
+use style::attr::AttrValue;
use style::servo::Stylesheet;
use style::stylesheets::{CSSRule, Origin};
use style::viewport::ViewportRule;
diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs
index 8b04c9b00eb..26e1ad9b0c4 100644
--- a/components/script/dom/htmlselectelement.rs
+++ b/components/script/dom/htmlselectelement.rs
@@ -2,7 +2,7 @@
* 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::attr::{Attr, AttrValue};
+use dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLOptionElementBinding::HTMLOptionElementMethods;
use dom::bindings::codegen::Bindings::HTMLSelectElementBinding;
use dom::bindings::codegen::Bindings::HTMLSelectElementBinding::HTMLSelectElementMethods;
@@ -23,6 +23,7 @@ use dom::validation::Validatable;
use dom::validitystate::ValidityState;
use dom::virtualmethods::VirtualMethods;
use string_cache::Atom;
+use style::attr::AttrValue;
use style::element_state::*;
#[dom_struct]
diff --git a/components/script/dom/htmltablecellelement.rs b/components/script/dom/htmltablecellelement.rs
index ae54b915342..eeeafd8f977 100644
--- a/components/script/dom/htmltablecellelement.rs
+++ b/components/script/dom/htmltablecellelement.rs
@@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::RGBA;
-use dom::attr::AttrValue;
use dom::bindings::codegen::Bindings::HTMLTableCellElementBinding::HTMLTableCellElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::inheritance::Castable;
@@ -16,7 +15,7 @@ use dom::htmltablerowelement::HTMLTableRowElement;
use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use string_cache::Atom;
-use style::attr::LengthOrPercentageOrAuto;
+use style::attr::{AttrValue, LengthOrPercentageOrAuto};
const DEFAULT_COLSPAN: u32 = 1;
diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs
index a86381967b4..ec6e4b59efe 100644
--- a/components/script/dom/htmltableelement.rs
+++ b/components/script/dom/htmltableelement.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::RGBA;
-use dom::attr::{Attr, AttrValue};
+use dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods;
use dom::bindings::codegen::Bindings::HTMLTableElementBinding;
use dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementMethods;
@@ -24,7 +24,7 @@ use dom::node::{Node, document_from_node, window_from_node};
use dom::virtualmethods::VirtualMethods;
use std::cell::Cell;
use string_cache::Atom;
-use style::attr::{LengthOrPercentageOrAuto, parse_unsigned_integer};
+use style::attr::{AttrValue, LengthOrPercentageOrAuto, parse_unsigned_integer};
#[dom_struct]
pub struct HTMLTableElement {
diff --git a/components/script/dom/htmltablerowelement.rs b/components/script/dom/htmltablerowelement.rs
index 06669b74c18..92c62115bd4 100644
--- a/components/script/dom/htmltablerowelement.rs
+++ b/components/script/dom/htmltablerowelement.rs
@@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::RGBA;
-use dom::attr::AttrValue;
use dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementMethods;
use dom::bindings::codegen::Bindings::HTMLTableRowElementBinding::{self, HTMLTableRowElementMethods};
use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::HTMLTableSectionElementMethods;
@@ -23,7 +22,7 @@ use dom::htmltablesectionelement::HTMLTableSectionElement;
use dom::node::{Node, window_from_node};
use dom::virtualmethods::VirtualMethods;
use string_cache::Atom;
-
+use style::attr::AttrValue;
#[derive(JSTraceable)]
struct CellsFilter;
diff --git a/components/script/dom/htmltablesectionelement.rs b/components/script/dom/htmltablesectionelement.rs
index bc907c16324..7b047439743 100644
--- a/components/script/dom/htmltablesectionelement.rs
+++ b/components/script/dom/htmltablesectionelement.rs
@@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::RGBA;
-use dom::attr::AttrValue;
use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::{self, HTMLTableSectionElementMethods};
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::error::{ErrorResult, Fallible};
@@ -18,6 +17,7 @@ use dom::htmltablerowelement::HTMLTableRowElement;
use dom::node::{Node, window_from_node};
use dom::virtualmethods::VirtualMethods;
use string_cache::Atom;
+use style::attr::AttrValue;
#[dom_struct]
pub struct HTMLTableSectionElement {
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs
index 19d108d95cc..69fe9046dad 100644
--- a/components/script/dom/htmltextareaelement.rs
+++ b/components/script/dom/htmltextareaelement.rs
@@ -2,7 +2,7 @@
* 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::attr::{Attr, AttrValue};
+use dom::attr::Attr;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding;
@@ -29,6 +29,7 @@ use script_traits::ScriptMsg as ConstellationMsg;
use std::cell::Cell;
use std::ops::Range;
use string_cache::Atom;
+use style::attr::AttrValue;
use style::element_state::*;
use textinput::{KeyReaction, Lines, TextInput, SelectionDirection};
diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs
index 5983890e51a..3ad9713fb70 100644
--- a/components/script/dom/macros.rs
+++ b/components/script/dom/macros.rs
@@ -228,9 +228,9 @@ macro_rules! make_atomic_setter(
macro_rules! make_legacy_color_setter(
( $attr:ident, $htmlname:tt ) => (
fn $attr(&self, value: DOMString) {
- use dom::attr::AttrValue;
use dom::bindings::inheritance::Castable;
use dom::element::Element;
+ use style::attr::AttrValue;
let element = self.upcast::<Element>();
let value = AttrValue::from_legacy_color(value.into());
element.set_attribute(&atom!($htmlname), value)
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 384465a8039..3032abe0685 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -38,8 +38,11 @@ use dom::documenttype::DocumentType;
use dom::element::{Element, ElementCreator};
use dom::eventtarget::EventTarget;
use dom::htmlbodyelement::HTMLBodyElement;
+use dom::htmlcanvaselement::{LayoutHTMLCanvasElementHelpers, HTMLCanvasData};
use dom::htmlcollection::HTMLCollection;
use dom::htmlelement::HTMLElement;
+use dom::htmliframeelement::{HTMLIFrameElement, HTMLIFrameElementLayoutMethods};
+use dom::htmlimageelement::{HTMLImageElement, LayoutHTMLImageElementHelpers};
use dom::htmlinputelement::{HTMLInputElement, LayoutHTMLInputElementHelpers};
use dom::htmltextareaelement::{HTMLTextAreaElement, LayoutHTMLTextAreaElementHelpers};
use dom::nodelist::NodeList;
@@ -56,6 +59,7 @@ use html5ever::tree_builder::QuirksMode;
use js::jsapi::{JSContext, JSObject, JSRuntime};
use layout_interface::Msg;
use libc::{self, c_void, uintptr_t};
+use msg::constellation_msg::PipelineId;
use parse::html::parse_html_fragment;
use ref_slice::ref_slice;
use script_traits::UntrustedNodeAddress;
@@ -68,8 +72,10 @@ use std::cmp::max;
use std::default::Default;
use std::iter::{self, FilterMap, Peekable};
use std::mem;
+use std::ops::Range;
use string_cache::{Atom, Namespace, QualName};
use style::selector_impl::ServoSelectorImpl;
+use url::Url;
use util::thread_state;
use uuid::Uuid;
@@ -960,6 +966,10 @@ pub trait LayoutNodeHelpers {
unsafe fn init_style_and_layout_data(&self, OpaqueStyleAndLayoutData);
fn text_content(&self) -> String;
+ fn selection(&self) -> Option<Range<usize>>;
+ fn image_url(&self) -> Option<Url>;
+ fn canvas_data(&self) -> Option<HTMLCanvasData>;
+ fn iframe_pipeline_id(&self) -> PipelineId;
}
impl LayoutNodeHelpers for LayoutJS<Node> {
@@ -1067,6 +1077,39 @@ impl LayoutNodeHelpers for LayoutJS<Node> {
panic!("not text!")
}
+
+ #[allow(unsafe_code)]
+ fn selection(&self) -> Option<Range<usize>> {
+ if let Some(area) = self.downcast::<HTMLTextAreaElement>() {
+ return unsafe { area.selection_for_layout() };
+ }
+
+ if let Some(input) = self.downcast::<HTMLInputElement>() {
+ return unsafe { input.selection_for_layout() };
+ }
+
+ None
+ }
+
+ #[allow(unsafe_code)]
+ fn image_url(&self) -> Option<Url> {
+ unsafe {
+ self.downcast::<HTMLImageElement>()
+ .expect("not an image!")
+ .image_url()
+ }
+ }
+
+ fn canvas_data(&self) -> Option<HTMLCanvasData> {
+ self.downcast()
+ .map(|canvas| canvas.data())
+ }
+
+ fn iframe_pipeline_id(&self) -> PipelineId {
+ let iframe_element = self.downcast::<HTMLIFrameElement>()
+ .expect("not an iframe element!");
+ iframe_element.pipeline_id().unwrap()
+ }
}
@@ -1409,7 +1452,7 @@ impl Node {
0 => (),
// Step 6.1.2
1 => {
- if !parent.child_elements().is_empty() {
+ if !parent.child_elements().peek().is_none() {
return Err(Error::HierarchyRequest);
}
if let Some(child) = child {
@@ -1425,7 +1468,7 @@ impl Node {
},
// Step 6.2
NodeTypeId::Element(_) => {
- if !parent.child_elements().is_empty() {
+ if !parent.child_elements().peek().is_none() {
return Err(Error::HierarchyRequest);
}
if let Some(ref child) = child {
@@ -1452,7 +1495,7 @@ impl Node {
}
},
None => {
- if !parent.child_elements().is_empty() {
+ if !parent.child_elements().peek().is_none() {
return Err(Error::HierarchyRequest);
}
},
diff --git a/components/script/dom/virtualmethods.rs b/components/script/dom/virtualmethods.rs
index d8259307274..b42e8b676c3 100644
--- a/components/script/dom/virtualmethods.rs
+++ b/components/script/dom/virtualmethods.rs
@@ -2,7 +2,7 @@
* 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::attr::{Attr, AttrValue};
+use dom::attr::Attr;
use dom::bindings::inheritance::Castable;
use dom::bindings::inheritance::ElementTypeId;
use dom::bindings::inheritance::HTMLElementTypeId;
@@ -47,7 +47,7 @@ use dom::htmltextareaelement::HTMLTextAreaElement;
use dom::htmltitleelement::HTMLTitleElement;
use dom::node::{ChildrenMutation, CloneChildrenFlag, Node, UnbindContext};
use string_cache::Atom;
-
+use style::attr::AttrValue;
/// Trait to allow DOM nodes to opt-in to overriding (or adding to) common
/// behaviours. Replicates the effect of C++ virtual methods.
diff --git a/components/script/dom/webidls/ChildNode.webidl b/components/script/dom/webidls/ChildNode.webidl
index 1506ec17c21..ca642048d11 100644
--- a/components/script/dom/webidls/ChildNode.webidl
+++ b/components/script/dom/webidls/ChildNode.webidl
@@ -8,12 +8,13 @@
[NoInterfaceObject]
interface ChildNode {
- [Throws]
+ [Throws, Unscopable]
void before((Node or DOMString)... nodes);
- [Throws]
+ [Throws, Unscopable]
void after((Node or DOMString)... nodes);
- [Throws]
+ [Throws, Unscopable]
void replaceWith((Node or DOMString)... nodes);
+ [Unscopable]
void remove();
};
diff --git a/components/script/dom/webidls/Element.webidl b/components/script/dom/webidls/Element.webidl
index ee27b78d4e4..48aeed7fbbb 100644
--- a/components/script/dom/webidls/Element.webidl
+++ b/components/script/dom/webidls/Element.webidl
@@ -75,6 +75,8 @@ interface Element : Node {
Element? insertAdjacentElement(DOMString where_, Element element); // historical
[Throws]
void insertAdjacentText(DOMString where_, DOMString data);
+ [Throws]
+ void insertAdjacentHTML(DOMString position, DOMString html);
};
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface
diff --git a/components/script/dom/webidls/ParentNode.webidl b/components/script/dom/webidls/ParentNode.webidl
index 667dcc4671d..84da03e3643 100644
--- a/components/script/dom/webidls/ParentNode.webidl
+++ b/components/script/dom/webidls/ParentNode.webidl
@@ -17,9 +17,9 @@ interface ParentNode {
[Pure]
readonly attribute unsigned long childElementCount;
- [Throws]
+ [Throws, Unscopable]
void prepend((Node or DOMString)... nodes);
- [Throws]
+ [Throws, Unscopable]
void append((Node or DOMString)... nodes);
[Pure, Throws]
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 90c1ee1bdba..c8d327897d2 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -45,7 +45,7 @@ use js::rust::Runtime;
use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ResolvedStyleResponse, ScriptReflow};
use layout_interface::{LayoutRPC, Msg, Reflow, ReflowQueryType, MarginStyleResponse};
use libc;
-use msg::constellation_msg::{LoadData, PanicMsg, PipelineId, SubpageId};
+use msg::constellation_msg::{FrameType, LoadData, PanicMsg, PipelineId, SubpageId};
use msg::constellation_msg::{WindowSizeData, WindowSizeType};
use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
use net_traits::bluetooth_thread::BluetoothMethodMsg;
@@ -202,7 +202,7 @@ pub struct Window {
id: PipelineId,
/// Subpage id associated with this page, if any.
- parent_info: Option<(PipelineId, SubpageId)>,
+ parent_info: Option<(PipelineId, SubpageId, FrameType)>,
/// Global static data related to the DOM.
dom_static: GlobalStaticData,
@@ -330,7 +330,7 @@ impl Window {
self.parent_info.map(|p| p.1)
}
- pub fn parent_info(&self) -> Option<(PipelineId, SubpageId)> {
+ pub fn parent_info(&self) -> Option<(PipelineId, SubpageId, FrameType)> {
self.parent_info
}
@@ -1510,7 +1510,20 @@ impl Window {
self.current_state.get() == WindowState::Alive
}
+ // https://html.spec.whatwg.org/multipage/#top-level-browsing-context
+ pub fn is_top_level(&self) -> bool {
+ match self.parent_info {
+ Some((_, _, FrameType::IFrame)) => false,
+ _ => true,
+ }
+ }
+
+ // https://html.spec.whatwg.org/multipage/#parent-browsing-context
pub fn parent(&self) -> Option<Root<Window>> {
+ if self.is_top_level() {
+ return None;
+ }
+
let browsing_context = self.browsing_context();
browsing_context.frame_element().map(|frame_element| {
@@ -1559,7 +1572,7 @@ impl Window {
timer_event_chan: IpcSender<TimerEvent>,
layout_chan: Sender<Msg>,
id: PipelineId,
- parent_info: Option<(PipelineId, SubpageId)>,
+ parent_info: Option<(PipelineId, SubpageId, FrameType)>,
window_size: Option<WindowSizeData>)
-> Root<Window> {
let layout_rpc: Box<LayoutRPC> = {
diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs
index 89b4ed59bf9..b10916a4b6e 100644
--- a/components/script/dom/workerglobalscope.rs
+++ b/components/script/dom/workerglobalscope.rs
@@ -416,6 +416,7 @@ impl WorkerGlobalScopeMethods for WorkerGlobalScope {
impl WorkerGlobalScope {
+ #[allow(unsafe_code)]
pub fn execute_script(&self, source: DOMString) {
let mut rval = RootedValue::new(self.runtime.cx(), UndefinedValue());
match self.runtime.evaluate_script(
@@ -428,7 +429,10 @@ impl WorkerGlobalScope {
// TODO: An error needs to be dispatched to the parent.
// https://github.com/servo/servo/issues/6422
println!("evaluate_script failed");
- report_pending_exception(self.runtime.cx(), self.reflector().get_jsobject().get());
+ unsafe {
+ report_pending_exception(
+ self.runtime.cx(), self.reflector().get_jsobject().get());
+ }
}
}
}
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 18131bd5fd8..318d3bbc1ec 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -46,6 +46,7 @@ use js::jsapi::{JSContext, JS_ParseJSON, RootedValue};
use js::jsval::{JSVal, NullValue, UndefinedValue};
use msg::constellation_msg::{PipelineId, ReferrerPolicy};
use net_traits::CoreResourceMsg::Load;
+use net_traits::trim_http_whitespace;
use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata, NetworkError, RequestSource};
use net_traits::{LoadConsumer, LoadContext, LoadData, ResourceCORSData, CoreResourceThread, LoadOrigin};
use network_listener::{NetworkListener, PreInvoke};
@@ -1506,27 +1507,3 @@ pub fn is_field_value(slice: &[u8]) -> bool {
}
})
}
-
-/// Normalize `self`, as defined by
-/// [the Fetch Spec](https://fetch.spec.whatwg.org/#concept-header-value-normalize).
-pub fn trim_http_whitespace(mut slice: &[u8]) -> &[u8] {
- const HTTP_WS_BYTES: &'static [u8] = b"\x09\x0A\x0D\x20";
-
- loop {
- match slice.split_first() {
- Some((first, remainder)) if HTTP_WS_BYTES.contains(first) =>
- slice = remainder,
- _ => break,
- }
- }
-
- loop {
- match slice.split_last() {
- Some((last, remainder)) if HTTP_WS_BYTES.contains(last) =>
- slice = remainder,
- _ => break,
- }
- }
-
- slice
-}
diff --git a/components/script/layout_interface.rs b/components/script/layout_interface.rs
index 61c99bc530b..37b6d169481 100644
--- a/components/script/layout_interface.rs
+++ b/components/script/layout_interface.rs
@@ -7,7 +7,6 @@
//! the DOM to be placed in a separate crate from layout.
use app_units::Au;
-use dom::node::OpaqueStyleAndLayoutData;
use euclid::point::Point2D;
use euclid::rect::Rect;
use gfx_traits::{Epoch, LayerId};
@@ -27,7 +26,21 @@ use style::servo::Stylesheet;
use url::Url;
use util::ipc::OptionalOpaqueIpcSender;
+pub use dom::bindings::inheritance::{CharacterDataTypeId, ElementTypeId};
+pub use dom::bindings::inheritance::{HTMLElementTypeId, NodeTypeId};
+pub use dom::bindings::js::LayoutJS;
+pub use dom::characterdata::LayoutCharacterDataHelpers;
+pub use dom::document::{Document, LayoutDocumentHelpers};
+pub use dom::element::{Element, LayoutElementHelpers, RawLayoutElementHelpers};
+pub use dom::htmlcanvaselement::HTMLCanvasData;
+pub use dom::htmlobjectelement::is_image_data;
+pub use dom::node::{CAN_BE_FRAGMENTED, HAS_CHANGED, HAS_DIRTY_DESCENDANTS, IS_DIRTY};
+pub use dom::node::LayoutNodeHelpers;
+pub use dom::node::Node;
+pub use dom::node::OpaqueStyleAndLayoutData;
pub use dom::node::TrustedNodeAddress;
+pub use dom::text::Text;
+
/// Asynchronous messages that script can send to layout.
pub enum Msg {
diff --git a/components/script/lib.rs b/components/script/lib.rs
index f932c4d0291..50b0c47ac6b 100644
--- a/components/script/lib.rs
+++ b/components/script/lib.rs
@@ -15,7 +15,6 @@
#![feature(nonzero)]
#![feature(on_unimplemented)]
#![feature(optin_builtin_traits)]
-#![feature(peekable_is_empty)]
#![feature(plugin)]
#![feature(slice_patterns)]
#![feature(stmt_expr_attributes)]
@@ -39,6 +38,7 @@ extern crate canvas;
extern crate canvas_traits;
extern crate caseless;
extern crate core;
+#[macro_use]
extern crate cssparser;
extern crate devtools_traits;
extern crate encoding;
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index d32a10bb1a6..63fed6cf115 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -63,7 +63,7 @@ use js::jsval::UndefinedValue;
use js::rust::Runtime;
use layout_interface::{self, NewLayoutThreadInfo, ReflowQueryType};
use mem::heap_size_of_self_and_children;
-use msg::constellation_msg::{LoadData, PanicMsg, PipelineId, PipelineNamespace};
+use msg::constellation_msg::{FrameType, LoadData, PanicMsg, PipelineId, PipelineNamespace};
use msg::constellation_msg::{SubpageId, WindowSizeData, WindowSizeType};
use msg::webdriver_msg::WebDriverScriptCommand;
use net_traits::LoadData as NetLoadData;
@@ -130,7 +130,7 @@ struct InProgressLoad {
/// The pipeline which requested this load.
pipeline_id: PipelineId,
/// The parent pipeline and child subpage associated with this load, if any.
- parent_info: Option<(PipelineId, SubpageId)>,
+ parent_info: Option<(PipelineId, SubpageId, FrameType)>,
/// The current window size associated with this pipeline.
window_size: Option<WindowSizeData>,
/// Channel to the layout thread associated with this pipeline.
@@ -146,7 +146,7 @@ struct InProgressLoad {
impl InProgressLoad {
/// Create a new InProgressLoad object.
fn new(id: PipelineId,
- parent_info: Option<(PipelineId, SubpageId)>,
+ parent_info: Option<(PipelineId, SubpageId, FrameType)>,
layout_chan: Sender<layout_interface::Msg>,
window_size: Option<WindowSizeData>,
url: Url) -> InProgressLoad {
@@ -1126,6 +1126,7 @@ impl ScriptThread {
containing_pipeline_id,
new_pipeline_id,
subpage_id,
+ frame_type,
load_data,
paint_chan,
panic_chan,
@@ -1163,7 +1164,7 @@ impl ScriptThread {
.unwrap();
// Kick off the fetch for the new resource.
- let new_load = InProgressLoad::new(new_pipeline_id, Some((containing_pipeline_id, subpage_id)),
+ let new_load = InProgressLoad::new(new_pipeline_id, Some((containing_pipeline_id, subpage_id, frame_type)),
layout_chan, parent_window.window_size(),
load_data.url.clone());
self.start_page_load(new_load, load_data);
@@ -1459,7 +1460,7 @@ impl ScriptThread {
}
debug!("ScriptThread: loading {} on pipeline {:?}", incomplete.url, incomplete.pipeline_id);
- let frame_element = incomplete.parent_info.and_then(|(parent_id, subpage_id)| {
+ let frame_element = incomplete.parent_info.and_then(|(parent_id, subpage_id, _)| {
// The root context may not exist yet, if the parent of this frame
// exists in a different script thread.
let root_context = self.browsing_context.get();
@@ -1565,7 +1566,7 @@ impl ScriptThread {
// We have a new root frame tree.
self.browsing_context.set(Some(&new_context));
(new_context, ContextToRemove::Root)
- } else if let Some((parent, _)) = incomplete.parent_info {
+ } else if let Some((parent, _, _)) = incomplete.parent_info {
// Create a new context tree entry. This will be a child context.
let new_context = BrowsingContext::new(&window, frame_element, incomplete.pipeline_id);
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs
index 93239e5b42e..82795e4a43c 100644
--- a/components/script_traits/lib.rs
+++ b/components/script_traits/lib.rs
@@ -93,6 +93,8 @@ pub struct NewLayoutInfo {
pub new_pipeline_id: PipelineId,
/// Id of the new frame associated with this pipeline.
pub subpage_id: SubpageId,
+ /// Type of the new frame associated with this pipeline.
+ pub frame_type: FrameType,
/// Network request data which will be initiated by the script thread.
pub load_data: LoadData,
/// The paint channel, cast to `OptionalOpaqueIpcSender`. This is really an
@@ -307,7 +309,7 @@ pub struct InitialScriptState {
pub id: PipelineId,
/// The subpage ID of this pipeline to create in its pipeline parent.
/// If `None`, this is the root.
- pub parent_info: Option<(PipelineId, SubpageId)>,
+ pub parent_info: Option<(PipelineId, SubpageId, FrameType)>,
/// A channel with which messages can be sent to us (the script thread).
pub control_chan: IpcSender<ConstellationControlMsg>,
/// A port on which messages sent by the constellation to script can be received.
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock
index 55e0e8570a4..4c9bc35de3e 100644
--- a/components/servo/Cargo.lock
+++ b/components/servo/Cargo.lock
@@ -72,11 +72,11 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -90,7 +90,7 @@ dependencies = [
[[package]]
name = "aster"
-version = "0.16.0"
+version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -103,11 +103,11 @@ dependencies = [
"core-text 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-skia 0.20130412.9 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -145,7 +145,7 @@ dependencies = [
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -208,12 +208,12 @@ dependencies = [
"cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"plugins 0.0.1",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
]
@@ -291,12 +291,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "compiletest_helper"
version = "0.0.1"
dependencies = [
- "compiletest_rs 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiletest_rs 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "compiletest_rs"
-version = "0.1.2"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -321,8 +321,8 @@ dependencies = [
"plugins 0.0.1",
"profile_traits 0.0.1",
"script_traits 0.0.1",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -355,8 +355,8 @@ dependencies = [
"profile_traits 0.0.1",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1",
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
@@ -408,7 +408,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -432,11 +432,11 @@ version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -491,9 +491,9 @@ dependencies = [
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
"plugins 0.0.1",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
]
@@ -503,13 +503,13 @@ name = "devtools_traits"
version = "0.0.1"
dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"msg 0.0.1",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -659,13 +659,13 @@ name = "euclid"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -763,7 +763,7 @@ dependencies = [
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
"gfx_traits 0.0.1",
"harfbuzz-sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.5 (git+https://github.com/servo/rust-layers)",
@@ -778,8 +778,8 @@ dependencies = [
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"range 0.0.1",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-fontconfig 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"simd 0.1.0 (git+https://github.com/huonw/simd)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -809,13 +809,13 @@ version = "0.0.1"
dependencies = [
"azure 0.4.5 (git+https://github.com/servo/rust-azure)",
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.5 (git+https://github.com/servo/rust-layers)",
"msg 0.0.1",
"plugins 0.0.1",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -931,7 +931,7 @@ dependencies = [
[[package]]
name = "heapsize"
-version = "0.3.5"
+version = "0.3.6"
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)",
@@ -955,7 +955,7 @@ name = "html5ever"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -986,7 +986,7 @@ dependencies = [
"openssl 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-verify 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1058,8 +1058,8 @@ dependencies = [
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1077,9 +1077,9 @@ dependencies = [
[[package]]
name = "js"
version = "0.1.3"
-source = "git+https://github.com/servo/rust-mozjs#c6f6817a7beb7f310050e1dde88654a95de6df26"
+source = "git+https://github.com/servo/rust-mozjs#a5ec009853a6bd1c57d9c909a0d2994bc015cee2"
dependencies = [
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1118,7 +1118,7 @@ dependencies = [
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
"glx 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"io-surface 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1142,7 +1142,7 @@ dependencies = [
"fnv 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"gfx_traits 0.0.1",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"layout_traits 0.0.1",
@@ -1158,7 +1158,7 @@ dependencies = [
"script_traits 0.0.1",
"selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
@@ -1307,7 +1307,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -1346,15 +1346,15 @@ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.5 (git+https://github.com/servo/rust-layers)",
"plugins 0.0.1",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
@@ -1435,7 +1435,7 @@ dependencies = [
name = "net_traits"
version = "0.0.1"
dependencies = [
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1443,8 +1443,8 @@ dependencies = [
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
"uuid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1571,8 +1571,8 @@ dependencies = [
"gleam 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
"khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"x11 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1728,9 +1728,9 @@ dependencies = [
"plugins 0.0.1",
"profile_traits 0.0.1",
"regex 0.1.71 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"task_info 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
@@ -1753,30 +1753,30 @@ dependencies = [
"energymon 0.2.0 (git+https://github.com/energymon/energymon-rust.git)",
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"plugins 0.0.1",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "quasi"
-version = "0.10.0"
+version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "quasi_codegen"
-version = "0.10.0"
+version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "aster 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "aster 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "quasi_macros"
-version = "0.10.0"
+version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "quasi_codegen 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quasi_codegen 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -1800,12 +1800,12 @@ dependencies = [
name = "range"
version = "0.0.1"
dependencies = [
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -1884,7 +1884,7 @@ dependencies = [
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1910,7 +1910,7 @@ dependencies = [
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1",
"selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
@@ -1944,7 +1944,7 @@ dependencies = [
"devtools_traits 0.0.1",
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1953,8 +1953,8 @@ dependencies = [
"offscreen_gl_context 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"profile_traits 0.0.1",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1969,7 +1969,7 @@ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1984,17 +1984,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde"
-version = "0.7.5"
+version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde_codegen"
-version = "0.7.5"
+version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "aster 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "quasi 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "quasi_macros 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "aster 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quasi 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quasi_macros 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -2003,15 +2003,15 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_macros"
-version = "0.7.5"
+version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "serde_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_codegen 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -2140,12 +2140,12 @@ version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_generator 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -2158,7 +2158,7 @@ dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2167,8 +2167,8 @@ dependencies = [
"plugins 0.0.1",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1",
@@ -2200,12 +2200,12 @@ version = "0.0.1"
dependencies = [
"cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
]
@@ -2346,12 +2346,12 @@ version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -2386,7 +2386,7 @@ dependencies = [
"deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
- "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2398,8 +2398,8 @@ dependencies = [
"plugins 0.0.1",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"xdg 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2418,7 +2418,7 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -2553,8 +2553,8 @@ dependencies = [
"gleam 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"offscreen_gl_context 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_macros 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
diff --git a/components/style/font_face.rs b/components/style/font_face.rs
index d41daea2f50..6db70a86e25 100644
--- a/components/style/font_face.rs
+++ b/components/style/font_face.rs
@@ -6,6 +6,8 @@ use computed_values::font_family::FontFamily;
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
use parser::{ParserContext, log_css_error};
use properties::longhands::font_family::parse_one_family;
+use std::iter;
+use std::slice;
use url::Url;
#[derive(Clone, Debug, HeapSizeOf, PartialEq, Eq, Deserialize, Serialize)]
@@ -58,6 +60,36 @@ pub fn parse_font_face_block(context: &ParserContext, input: &mut Parser)
}
}
+pub struct EffectiveSourcesIter<'a>(slice::Iter<'a, Source>);
+
+impl FontFaceRule {
+ /// Returns the list of effective sources for that font-face, that is the
+ /// sources which don't list any format hint, or the ones which list at
+ /// least "truetype" or "opentype".
+ pub fn effective_sources(&self) -> EffectiveSourcesIter {
+ EffectiveSourcesIter(self.sources.iter())
+ }
+}
+
+impl<'a> iter::Iterator for EffectiveSourcesIter<'a> {
+ type Item = &'a Source;
+ fn next(&mut self) -> Option<&'a Source> {
+ self.0.find(|source| {
+ if let Source::Url(ref url_source) = **source {
+ let hints = &url_source.format_hints;
+ // We support only opentype fonts and truetype is an alias for
+ // that format. Sources without format hints need to be
+ // downloaded in case we support them.
+ hints.is_empty() || hints.iter().any(|hint| {
+ hint == "truetype" || hint == "opentype" || hint == "woff"
+ })
+ } else {
+ true
+ }
+ })
+ }
+}
+
enum FontFaceDescriptorDeclaration {
Family(FontFamily),
Src(Vec<Source>),
diff --git a/components/util/lib.rs b/components/util/lib.rs
index 7b7ad32811c..251103738ec 100644
--- a/components/util/lib.rs
+++ b/components/util/lib.rs
@@ -7,7 +7,6 @@
#![feature(custom_derive)]
#![feature(fnbox)]
#![feature(plugin)]
-#![feature(panic_handler)]
#![feature(reflect_marker)]
#![feature(step_by)]
diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs
index 6f7abee4c63..065ab0239bb 100644
--- a/components/webdriver_server/lib.rs
+++ b/components/webdriver_server/lib.rs
@@ -417,12 +417,12 @@ impl Handler {
}
fn handle_go_back(&self) -> WebDriverResult<WebDriverResponse> {
- self.constellation_chan.send(ConstellationMsg::Navigate(None, NavigationDirection::Back)).unwrap();
+ self.constellation_chan.send(ConstellationMsg::Navigate(None, NavigationDirection::Back(1))).unwrap();
Ok(WebDriverResponse::Void)
}
fn handle_go_forward(&self) -> WebDriverResult<WebDriverResponse> {
- self.constellation_chan.send(ConstellationMsg::Navigate(None, NavigationDirection::Forward)).unwrap();
+ self.constellation_chan.send(ConstellationMsg::Navigate(None, NavigationDirection::Forward(1))).unwrap();
Ok(WebDriverResponse::Void)
}