auto merge of #4542 : servo/servo/pre-rustup_20141221, r=saneyuki

In particular, this contains changes to qualify enums where rust will require it, and to stop using some features that will be removed.
This commit is contained in:
bors-servo 2015-01-04 12:39:47 -07:00
commit ba8cf6b0e6
63 changed files with 445 additions and 439 deletions

View file

@ -18,10 +18,10 @@ use time::{now, Timespec};
use hyper::header::{Headers, Header, HeaderFormat, HeaderView};
use hyper::header::common::util as header_util;
use hyper::client::Request;
use hyper::mime::{mod, Mime};
use hyper::mime::{Mime, TopLevel, SubLevel};
use hyper::header::common::{ContentType, Host};
use hyper::method::{Method, Get, Head, Post, Options};
use hyper::status::Success;
use hyper::method::Method;
use hyper::status::StatusClass::Success;
use url::{SchemeData, Url};
@ -118,7 +118,7 @@ impl CORSRequest {
let mut cors_response = CORSResponse::new();
let mut preflight = self.clone(); // Step 1
preflight.method = Options; // Step 2
preflight.method = Method::Options; // Step 2
preflight.headers = Headers::new(); // Step 3
// Step 4
preflight.headers.set(AccessControlRequestMethod(self.method.clone()));
@ -364,9 +364,9 @@ fn is_simple_header(h: &HeaderView) -> bool {
match h.name().to_ascii_lower().as_slice() {
"accept" | "accept-language" | "content-language" => true,
"content-type" => match h.value() {
Some(&ContentType(Mime(mime::Text, mime::Plain, _))) |
Some(&ContentType(Mime(mime::Application, mime::WwwFormUrlEncoded, _))) |
Some(&ContentType(Mime(mime::Multipart, mime::FormData, _))) => true,
Some(&ContentType(Mime(TopLevel::Text, SubLevel::Plain, _))) |
Some(&ContentType(Mime(TopLevel::Application, SubLevel::WwwFormUrlEncoded, _))) |
Some(&ContentType(Mime(TopLevel::Multipart, SubLevel::FormData, _))) => true,
_ => false
@ -377,7 +377,7 @@ fn is_simple_header(h: &HeaderView) -> bool {
fn is_simple_method(m: &Method) -> bool {
match *m {
Get | Head | Post => true,
Method::Get | Method::Head | Method::Post => true,
_ => false
}
}

View file

@ -674,7 +674,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
default = "None"
else:
assert defaultValue.type.tag() == IDLType.Tags.domstring
value = "str::from_utf8(data).unwrap().into_string()"
value = "str::from_utf8(&data).unwrap().into_string()"
if type.nullable():
value = "Some(%s)" % value

View file

@ -39,7 +39,7 @@ use geom::rect::Rect;
use html5ever::tree_builder::QuirksMode;
use hyper::header::Headers;
use hyper::method::Method;
use js::jsapi::{JSObject, JSTracer, JS_CallTracer, JSTRACE_OBJECT};
use js::jsapi::{JSObject, JSTracer, JS_CallTracer, JSGCTraceKind};
use js::jsval::JSVal;
use js::rust::Cx;
use layout_interface::{LayoutRPC, LayoutChan};
@ -106,7 +106,7 @@ pub fn trace_object(tracer: *mut JSTracer, description: &str, obj: *mut JSObject
(*tracer).debugPrintIndex = -1;
(*tracer).debugPrintArg = name.as_ptr() as *const libc::c_void;
debug!("tracing {}", description);
JS_CallTracer(tracer, obj as *mut libc::c_void, JSTRACE_OBJECT);
JS_CallTracer(tracer, obj as *mut libc::c_void, JSGCTraceKind::JSTRACE_OBJECT);
}
}

View file

@ -13,7 +13,8 @@ use geom::point::Point2D;
use geom::rect::Rect;
use geom::size::Size2D;
use canvas::canvas_paint_task::{CanvasMsg, CanvasPaintTask, ClearRect, Close, FillRect, Recreate, StrokeRect};
use canvas::canvas_paint_task::{CanvasMsg, CanvasPaintTask};
use canvas::canvas_paint_task::CanvasMsg::{ClearRect, Close, FillRect, Recreate, StrokeRect};
#[dom_struct]
pub struct CanvasRenderingContext2D {

View file

@ -1396,7 +1396,7 @@ impl<'a> style::TElement<'a> for JSRef<'a, Element> {
}
pub trait ActivationElementHelpers<'a> {
fn as_maybe_activatable(&'a self) -> Option<&'a Activatable + 'a>;
fn as_maybe_activatable(&'a self) -> Option<&'a (Activatable + 'a)>;
fn click_in_progress(self) -> bool;
fn set_click_in_progress(self, click: bool);
fn nearest_activable_element(self) -> Option<Temporary<Element>>;
@ -1404,12 +1404,12 @@ pub trait ActivationElementHelpers<'a> {
}
impl<'a> ActivationElementHelpers<'a> for JSRef<'a, Element> {
fn as_maybe_activatable(&'a self) -> Option<&'a Activatable + 'a> {
fn as_maybe_activatable(&'a self) -> Option<&'a (Activatable + 'a)> {
let node: JSRef<Node> = NodeCast::from_ref(*self);
match node.type_id() {
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) => {
let element: &'a JSRef<'a, HTMLInputElement> = HTMLInputElementCast::to_borrowed_ref(self).unwrap();
Some(element as &'a Activatable + 'a)
Some(element as &'a (Activatable + 'a))
},
_ => {
None

View file

@ -21,7 +21,7 @@ use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
use dom::htmlinputelement::HTMLInputElement;
use dom::htmltextareaelement::HTMLTextAreaElement;
use dom::node::{Node, NodeHelpers, NodeTypeId, document_from_node, window_from_node};
use hyper::method::Post;
use hyper::method::Method;
use servo_msg::constellation_msg::LoadData;
use servo_util::str::DOMString;
use script_task::{ScriptChan, ScriptMsg};
@ -196,7 +196,7 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> {
load_data.url.query = Some(parsed_data);
},
("http", FormMethod::FormPost) | ("https", FormMethod::FormPost) => {
load_data.method = Post;
load_data.method = Method::Post;
load_data.data = Some(parsed_data.into_bytes());
},
// https://html.spec.whatwg.org/multipage/forms.html#submit-get-action

View file

@ -22,9 +22,9 @@ use dom::virtualmethods::VirtualMethods;
use dom::window::Window;
use page::IterablePage;
use servo_msg::constellation_msg::{PipelineId, SubpageId};
use servo_msg::constellation_msg::{IFrameSandboxed, IFrameUnsandboxed};
use servo_msg::constellation_msg::{ConstellationChan, ScriptLoadedURLInIFrameMsg};
use servo_msg::constellation_msg::{PipelineId, SubpageId, ConstellationChan};
use servo_msg::constellation_msg::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
use servo_msg::constellation_msg::Msg as ConstellationMsg;
use servo_util::str::DOMString;
use std::ascii::AsciiExt;
@ -123,7 +123,7 @@ impl<'a> HTMLIFrameElementHelpers for JSRef<'a, HTMLIFrameElement> {
}));
let ConstellationChan(ref chan) = page.constellation_chan;
chan.send(ScriptLoadedURLInIFrameMsg(url, page.id, subpage_id, sandboxed));
chan.send(ConstellationMsg::ScriptLoadedURLInIFrame(url, page.id, subpage_id, sandboxed));
}
}

View file

@ -61,7 +61,7 @@ impl<'a> PrivateHTMLImageElementHelpers for JSRef<'a, HTMLImageElement> {
// inform the image cache to load this, but don't store a
// handle.
image_cache.send(image_cache_task::Prefetch(img_url));
image_cache.send(image_cache_task::Msg::Prefetch(img_url));
}
}
}

View file

@ -69,7 +69,7 @@ impl<'a> ProcessDataURL for JSRef<'a, HTMLObjectElement> {
if is_image_data(uri.as_slice()) {
let data_url = Url::parse(uri.as_slice()).unwrap();
// Issue #84
image_cache.send(image_cache_task::Prefetch(data_url));
image_cache.send(image_cache_task::Msg::Prefetch(data_url));
}
}
_ => { }

View file

@ -145,76 +145,76 @@ pub trait VirtualMethods {
/// method call on the trait object will invoke the corresponding method on the
/// concrete type, propagating up the parent hierarchy unless otherwise
/// interrupted.
pub fn vtable_for<'a>(node: &'a JSRef<'a, Node>) -> &'a VirtualMethods + 'a {
pub fn vtable_for<'a>(node: &'a JSRef<'a, Node>) -> &'a (VirtualMethods + 'a) {
match node.type_id() {
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) => {
let element: &'a JSRef<'a, HTMLAnchorElement> = HTMLAnchorElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)) => {
let element: &'a JSRef<'a, HTMLAreaElement> = HTMLAreaElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement)) => {
let element: &'a JSRef<'a, HTMLBodyElement> = HTMLBodyElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) => {
let element: &'a JSRef<'a, HTMLButtonElement> = HTMLButtonElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLCanvasElement)) => {
let element: &'a JSRef<'a, HTMLCanvasElement> = HTMLCanvasElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFieldSetElement)) => {
let element: &'a JSRef<'a, HTMLFieldSetElement> = HTMLFieldSetElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLImageElement)) => {
let element: &'a JSRef<'a, HTMLImageElement> = HTMLImageElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLIFrameElement)) => {
let element: &'a JSRef<'a, HTMLIFrameElement> = HTMLIFrameElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) => {
let element: &'a JSRef<'a, HTMLInputElement> = HTMLInputElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement)) => {
let element: &'a JSRef<'a, HTMLLinkElement> = HTMLLinkElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLObjectElement)) => {
let element: &'a JSRef<'a, HTMLObjectElement> = HTMLObjectElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptGroupElement)) => {
let element: &'a JSRef<'a, HTMLOptGroupElement> = HTMLOptGroupElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement)) => {
let element: &'a JSRef<'a, HTMLOptionElement> = HTMLOptionElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLScriptElement)) => {
let element: &'a JSRef<'a, HTMLScriptElement> = HTMLScriptElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) => {
let element: &'a JSRef<'a, HTMLSelectElement> = HTMLSelectElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLStyleElement)) => {
let element: &'a JSRef<'a, HTMLStyleElement> = HTMLStyleElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableElement)) => {
let element: &'a JSRef<'a, HTMLTableElement> =
HTMLTableElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(
HTMLElementTypeId::HTMLTableCellElement(
@ -224,37 +224,37 @@ pub fn vtable_for<'a>(node: &'a JSRef<'a, Node>) -> &'a VirtualMethods + 'a {
HTMLTableCellElementTypeId::HTMLTableHeaderCellElement))) => {
let element: &'a JSRef<'a, HTMLTableCellElement> =
HTMLTableCellElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableRowElement)) => {
let element: &'a JSRef<'a, HTMLTableRowElement> =
HTMLTableRowElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableSectionElement)) => {
let element: &'a JSRef<'a, HTMLTableSectionElement> =
HTMLTableSectionElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => {
let element: &'a JSRef<'a, HTMLTextAreaElement> = HTMLTextAreaElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTitleElement)) => {
let element: &'a JSRef<'a, HTMLTitleElement> =
HTMLTitleElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(ElementTypeId::Element) => {
let element: &'a JSRef<'a, Element> = ElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
NodeTypeId::Element(_) => {
let element: &'a JSRef<'a, HTMLElement> = HTMLElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a
element as &'a (VirtualMethods + 'a)
}
_ => {
node as &'a VirtualMethods + 'a
node as &'a (VirtualMethods + 'a)
}
}
}

View file

@ -36,13 +36,15 @@ use hyper::header::Headers;
use hyper::header::common::{Accept, ContentLength, ContentType};
use hyper::http::RawStatus;
use hyper::mime::{mod, Mime};
use hyper::method::{Method, Get, Head, Connect, Trace, Extension};
use hyper::method::Method;
use js::jsapi::{JS_ParseJSON, JSContext};
use js::jsapi::JS_ClearPendingException;
use js::jsval::{JSVal, NullValue, UndefinedValue};
use net::resource_task::{ResourceTask, ResourceCORSData, Load, LoadData, LoadResponse, Payload, Done};
use net::resource_task::{ResourceTask, ResourceCORSData, LoadData, LoadResponse};
use net::resource_task::ControlMsg::Load;
use net::resource_task::ProgressMsg::{Payload, Done};
use cors::{allow_cross_origin_request, CORSRequest, RequestMode};
use servo_util::str::DOMString;
use servo_util::task::spawn_named;
@ -173,7 +175,7 @@ impl XMLHttpRequest {
response_xml: Default::default(),
response_headers: DOMRefCell::new(Headers::new()),
request_method: DOMRefCell::new(Get),
request_method: DOMRefCell::new(Method::Get),
request_url: DOMRefCell::new(None),
request_headers: DOMRefCell::new(Headers::new()),
request_body_len: Cell::new(0),
@ -360,8 +362,8 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
// Step 2
match maybe_method {
// Step 4
Some(Connect) | Some(Trace) => Err(Security),
Some(Extension(ref t)) if t.as_slice() == "TRACK" => Err(Security),
Some(Method::Connect) | Some(Method::Trace) => Err(Security),
Some(Method::Extension(ref t)) if t.as_slice() == "TRACK" => Err(Security),
Some(_) if method.is_token() => {
*self.request_method.borrow_mut() = maybe_method.unwrap();
@ -493,7 +495,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
}
let data = match *self.request_method.borrow() {
Get | Head => None, // Step 3
Method::Get | Method::Head => None, // Step 3
_ => data
};
let extracted = data.as_ref().map(|d| d.extract());
@ -955,7 +957,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
match self.response_headers.borrow().get() {
Some(&ContentType(mime::Mime(_, _, ref params))) => {
for &(ref name, ref value) in params.iter() {
if name == &mime::Charset {
if name == &mime::Attr::Charset {
encoding = encoding_from_whatwg_label(value.to_string().as_slice()).unwrap_or(encoding);
}
}

View file

@ -23,7 +23,6 @@ extern crate hyper;
extern crate js;
extern crate libc;
extern crate msg;
extern crate native;
extern crate net;
extern crate rustrt;
extern crate serialize;

View file

@ -21,7 +21,7 @@ use parse::Parser;
use encoding::all::UTF_8;
use encoding::types::{Encoding, DecoderTrap};
use servo_net::resource_task::{Payload, Done, LoadResponse};
use servo_net::resource_task::{ProgressMsg, LoadResponse};
use servo_util::task_state;
use servo_util::task_state::IN_HTML_PARSER;
use std::ascii::AsciiExt;
@ -186,15 +186,15 @@ pub fn parse_html(document: JSRef<Document>,
_ => {
for msg in load_response.progress_port.iter() {
match msg {
Payload(data) => {
ProgressMsg::Payload(data) => {
// FIXME: use Vec<u8> (html5ever #34)
let data = UTF_8.decode(data.as_slice(), DecoderTrap::Replace).unwrap();
parser.parse_chunk(data);
}
Done(Err(err)) => {
ProgressMsg::Done(Err(err)) => {
panic!("Failed to load page URL {}, error: {}", url.serialize(), err);
}
Done(Ok(())) => break,
ProgressMsg::Done(Ok(())) => break,
}
}
}

View file

@ -38,22 +38,23 @@ use devtools;
use devtools_traits::{DevtoolsControlChan, DevtoolsControlPort, NewGlobal, GetRootNode, DevtoolsPageInfo};
use devtools_traits::{DevtoolScriptControlMsg, EvaluateJS, GetDocumentElement};
use devtools_traits::{GetChildren, GetLayout, ModifyAttribute};
use script_traits::{CompositorEvent, ResizeEvent, ReflowEvent, ClickEvent, MouseDownEvent};
use script_traits::{MouseMoveEvent, MouseUpEvent, ConstellationControlMsg, ScriptTaskFactory};
use script_traits::{ResizeMsg, AttachLayoutMsg, GetTitleMsg, KeyEvent, LoadMsg, ViewportMsg};
use script_traits::{ResizeInactiveMsg, ExitPipelineMsg, NewLayoutInfo, OpaqueScriptLayoutChannel};
use script_traits::{ScriptControlChan, ReflowCompleteMsg, SendEventMsg};
use servo_msg::compositor_msg::{FinishedLoading, LayerId, Loading, PerformingLayout};
use servo_msg::compositor_msg::{ScriptListener};
use servo_msg::constellation_msg::{ConstellationChan, LoadCompleteMsg};
use servo_msg::constellation_msg::{LoadData, LoadUrlMsg, NavigationDirection, PipelineId};
use servo_msg::constellation_msg::{Failure, FailureMsg, WindowSizeData, Key, KeyState};
use servo_msg::constellation_msg::{KeyModifiers, SUPER, SHIFT, CONTROL, ALT, Repeated, Pressed};
use servo_msg::constellation_msg::{Released};
use script_traits::CompositorEvent;
use script_traits::CompositorEvent::{ResizeEvent, ReflowEvent, ClickEvent};
use script_traits::CompositorEvent::{MouseDownEvent, MouseUpEvent};
use script_traits::CompositorEvent::{MouseMoveEvent, KeyEvent};
use script_traits::{NewLayoutInfo, OpaqueScriptLayoutChannel};
use script_traits::{ConstellationControlMsg, ScriptControlChan};
use script_traits::ScriptTaskFactory;
use servo_msg::compositor_msg::ReadyState::{FinishedLoading, Loading, PerformingLayout};
use servo_msg::compositor_msg::{LayerId, ScriptListener};
use servo_msg::constellation_msg::{ConstellationChan};
use servo_msg::constellation_msg::{LoadData, NavigationDirection, PipelineId};
use servo_msg::constellation_msg::{Failure, Msg, WindowSizeData, Key, KeyState};
use servo_msg::constellation_msg::{KeyModifiers, SUPER, SHIFT, CONTROL, ALT};
use servo_msg::constellation_msg::{PipelineExitType};
use servo_msg::constellation_msg;
use servo_msg::constellation_msg::Msg as ConstellationMsg;
use servo_net::image_cache_task::ImageCacheTask;
use servo_net::resource_task::{ResourceTask, Load};
use servo_net::resource_task::{ResourceTask, ControlMsg};
use servo_net::resource_task::LoadData as NetLoadData;
use servo_net::storage_task::StorageTask;
use servo_util::geometry::to_frac_px;
@ -313,7 +314,7 @@ impl ScriptTaskFactory for ScriptTask {
// This must always be the very last operation performed before the task completes
failsafe.neuter();
}, FailureMsg(failure_msg), const_chan, false);
}, ConstellationMsg::Failure(failure_msg), const_chan, false);
}
}
@ -505,15 +506,15 @@ impl ScriptTask {
// This has to be handled before the ResizeMsg below,
// otherwise the page may not have been added to the
// child list yet, causing the find() to fail.
MixedMessage::FromConstellation(AttachLayoutMsg(new_layout_info)) => {
MixedMessage::FromConstellation(ConstellationControlMsg::AttachLayout(new_layout_info)) => {
self.handle_new_layout(new_layout_info);
}
MixedMessage::FromConstellation(ResizeMsg(id, size)) => {
MixedMessage::FromConstellation(ConstellationControlMsg::Resize(id, size)) => {
let page = self.page.borrow_mut();
let page = page.find(id).expect("resize sent to nonexistent pipeline");
page.resize_event.set(Some(size));
}
MixedMessage::FromConstellation(ViewportMsg(id, rect)) => {
MixedMessage::FromConstellation(ConstellationControlMsg::Viewport(id, rect)) => {
let page = self.page.borrow_mut();
let inner_page = page.find(id).expect("Page rect message sent to nonexistent pipeline");
if inner_page.set_page_clip_rect_with_new_viewport(rect) {
@ -544,7 +545,7 @@ impl ScriptTask {
// Process the gathered events.
for msg in sequential.into_iter() {
match msg {
MixedMessage::FromConstellation(ExitPipelineMsg(id, exit_type)) => {
MixedMessage::FromConstellation(ConstellationControlMsg::ExitPipeline(id, exit_type)) => {
if self.handle_exit_pipeline_msg(id, exit_type) {
return false
}
@ -560,24 +561,23 @@ impl ScriptTask {
fn handle_msg_from_constellation(&self, msg: ConstellationControlMsg) {
match msg {
// TODO(tkuehn) need to handle auxiliary layouts for iframes
AttachLayoutMsg(_) =>
panic!("should have handled AttachLayoutMsg already"),
LoadMsg(id, load_data) =>
ConstellationControlMsg::AttachLayout(_) =>
panic!("should have handled AttachLayout already"),
ConstellationControlMsg::Load(id, load_data) =>
self.load(id, load_data),
SendEventMsg(id, event) =>
ConstellationControlMsg::SendEvent(id, event) =>
self.handle_event(id, event),
ReflowCompleteMsg(id, reflow_id) =>
ConstellationControlMsg::ReflowComplete(id, reflow_id) =>
self.handle_reflow_complete_msg(id, reflow_id),
ResizeInactiveMsg(id, new_size) =>
ConstellationControlMsg::ResizeInactive(id, new_size) =>
self.handle_resize_inactive_msg(id, new_size),
ViewportMsg(..) =>
panic!("should have handled ViewportMsg already"),
ResizeMsg(..) =>
panic!("should have handled ResizeMsg already"),
ExitPipelineMsg(..) =>
panic!("should have handled ExitPipelineMsg already"),
GetTitleMsg(pipeline_id) =>
ConstellationControlMsg::Viewport(..) =>
panic!("should have handled Viewport already"),
ConstellationControlMsg::Resize(..) =>
panic!("should have handled Resize already"),
ConstellationControlMsg::ExitPipeline(..) =>
panic!("should have handled ExitPipeline already"),
ConstellationControlMsg::GetTitle(pipeline_id) =>
self.handle_get_title_msg(pipeline_id),
}
}
@ -677,7 +677,7 @@ impl ScriptTask {
/// TODO(tkuehn): is it ever possible to navigate only on a subframe?
fn handle_navigate_msg(&self, direction: NavigationDirection) {
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(constellation_msg::NavigateMsg(direction));
chan.send(ConstellationMsg::Navigate(direction));
}
/// Window was resized, but this script was not active, so don't reflow yet
@ -807,7 +807,7 @@ impl ScriptTask {
let (parser_input, final_url) = if !is_javascript {
// Wait for the LoadResponse so that the parser knows the final URL.
let (input_chan, input_port) = channel();
self.resource_task.send(Load(NetLoadData {
self.resource_task.send(ControlMsg::Load(NetLoadData {
url: url,
method: load_data.method,
headers: load_data.headers,
@ -882,7 +882,7 @@ impl ScriptTask {
*page.fragment_name.borrow_mut() = final_url.fragment.clone();
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(LoadCompleteMsg);
chan.send(ConstellationMsg::LoadComplete);
// Notify devtools that a new script global exists.
match self.devtools_chan {
@ -1054,7 +1054,7 @@ impl ScriptTask {
/// for the given pipeline.
fn trigger_load(&self, pipeline_id: PipelineId, load_data: LoadData) {
let ConstellationChan(ref const_chan) = self.constellation_chan;
const_chan.send(LoadUrlMsg(pipeline_id, load_data));
const_chan.send(ConstellationMsg::LoadUrl(pipeline_id, load_data));
}
/// The entry point for content to notify that a fragment url has been requested