Allow passing a method, request body, and headers to the pipeline in LoadUrlMsg

This commit is contained in:
Manish Goregaokar 2014-10-09 14:09:15 +05:30
parent 15b508ac10
commit ad16c52a6b
10 changed files with 75 additions and 35 deletions

1
Cargo.lock generated
View file

@ -322,6 +322,7 @@ dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure#b357751c04a89a87e6ef1f0cebe5f20957dd112d)", "azure 0.1.0 (git+https://github.com/servo/rust-azure#b357751c04a89a87e6ef1f0cebe5f20957dd112d)",
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#166a601ff3e0fc3a64ca1a9090d02c8d4f22b61a)", "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#166a601ff3e0fc3a64ca1a9090d02c8d4f22b61a)",
"geom 0.1.0 (git+https://github.com/servo/rust-geom#90add8d65273c8a46aa16d73959e29a51d0c282d)", "geom 0.1.0 (git+https://github.com/servo/rust-geom#90add8d65273c8a46aa16d73959e29a51d0c282d)",
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo#92019011b0cdf1bffc8c584830de1bf330d79d0d)",
"io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface#7038341220bd7e86e21118fac2cbc6bd50890e47)", "io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface#7038341220bd7e86e21118fac2cbc6bd50890e47)",
"layers 0.1.0 (git+https://github.com/servo/rust-layers#180d3ff2f28d239e32d01982c76be5c97d5763a8)", "layers 0.1.0 (git+https://github.com/servo/rust-layers#180d3ff2f28d239e32d01982c76be5c97d5763a8)",
"url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)", "url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)",

View file

@ -39,7 +39,7 @@ use png;
use servo_msg::compositor_msg::{Blank, Epoch, FinishedLoading, IdleRenderState, LayerId}; use servo_msg::compositor_msg::{Blank, Epoch, FinishedLoading, IdleRenderState, LayerId};
use servo_msg::compositor_msg::{ReadyState, RenderingRenderState, RenderState, Scrollable}; use servo_msg::compositor_msg::{ReadyState, RenderingRenderState, RenderState, Scrollable};
use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, LoadUrlMsg, NavigateMsg}; use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, LoadUrlMsg, NavigateMsg};
use servo_msg::constellation_msg::{PipelineId, ResizedWindowMsg, WindowSizeData}; use servo_msg::constellation_msg::{LoadData, PipelineId, ResizedWindowMsg, WindowSizeData};
use servo_msg::constellation_msg; use servo_msg::constellation_msg;
use servo_util::geometry::{PagePx, ScreenPx, ViewportPx}; use servo_util::geometry::{PagePx, ScreenPx, ViewportPx};
use servo_util::memory::MemoryProfilerChan; use servo_util::memory::MemoryProfilerChan;
@ -726,7 +726,7 @@ impl IOCompositor {
layers"), layers"),
}; };
let msg = LoadUrlMsg(root_pipeline_id, Url::parse(url_string.as_slice()).unwrap()); let msg = LoadUrlMsg(root_pipeline_id, LoadData::new(Url::parse(url_string.as_slice()).unwrap()));
let ConstellationChan(ref chan) = self.constellation_chan; let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(msg); chan.send(msg);
} }

View file

@ -17,7 +17,7 @@ use servo_msg::compositor_msg::LayerId;
use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, FailureMsg, Failure, FrameRectMsg}; use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, FailureMsg, Failure, FrameRectMsg};
use servo_msg::constellation_msg::{IFrameSandboxState, IFrameUnsandboxed, InitLoadUrlMsg}; use servo_msg::constellation_msg::{IFrameSandboxState, IFrameUnsandboxed, InitLoadUrlMsg};
use servo_msg::constellation_msg::{LoadCompleteMsg, LoadIframeUrlMsg, LoadUrlMsg, Msg, NavigateMsg}; use servo_msg::constellation_msg::{LoadCompleteMsg, LoadIframeUrlMsg, LoadUrlMsg, Msg, NavigateMsg};
use servo_msg::constellation_msg::{NavigationType, PipelineId, RendererReadyMsg, ResizedWindowMsg}; use servo_msg::constellation_msg::{LoadData, NavigationType, PipelineId, RendererReadyMsg, ResizedWindowMsg};
use servo_msg::constellation_msg::{SubpageId, WindowSizeData}; use servo_msg::constellation_msg::{SubpageId, WindowSizeData};
use servo_msg::constellation_msg; use servo_msg::constellation_msg;
use servo_net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient}; use servo_net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
@ -292,7 +292,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
id: PipelineId, id: PipelineId,
subpage_id: Option<SubpageId>, subpage_id: Option<SubpageId>,
script_pipeline: Option<Rc<Pipeline>>, script_pipeline: Option<Rc<Pipeline>>,
url: Url) load_data: LoadData)
-> Rc<Pipeline> { -> Rc<Pipeline> {
let pipe = Pipeline::create::<LTF, STF>(id, let pipe = Pipeline::create::<LTF, STF>(id,
subpage_id, subpage_id,
@ -306,7 +306,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
self.window_size, self.window_size,
self.opts.clone(), self.opts.clone(),
script_pipeline, script_pipeline,
url); load_data);
pipe.load(); pipe.load();
Rc::new(pipe) Rc::new(pipe)
} }
@ -364,9 +364,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
// Load a new page, usually -- but not always -- from a mouse click or typed url // Load a new page, usually -- but not always -- from a mouse click or typed url
// If there is already a pending page (self.pending_frames), it will not be overridden; // If there is already a pending page (self.pending_frames), it will not be overridden;
// However, if the id is not encompassed by another change, it will be. // However, if the id is not encompassed by another change, it will be.
LoadUrlMsg(source_id, url) => { LoadUrlMsg(source_id, load_data) => {
debug!("constellation got URL load message"); debug!("constellation got URL load message");
self.handle_load_url_msg(source_id, url); self.handle_load_url_msg(source_id, load_data);
} }
// A page loaded through one of several methods above has completed all parsing, // A page loaded through one of several methods above has completed all parsing,
// script, and reflow messages have been sent. // script, and reflow messages have been sent.
@ -449,7 +449,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
let new_id = self.get_next_pipeline_id(); let new_id = self.get_next_pipeline_id();
let pipeline = self.new_pipeline(new_id, subpage_id, None, let pipeline = self.new_pipeline(new_id, subpage_id, None,
Url::parse("about:failure").unwrap()); LoadData::new(Url::parse("about:failure").unwrap()));
self.pending_frames.push(FrameChange{ self.pending_frames.push(FrameChange{
before: Some(pipeline_id), before: Some(pipeline_id),
@ -466,7 +466,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
fn handle_init_load(&mut self, url: Url) { fn handle_init_load(&mut self, url: Url) {
let next_pipeline_id = self.get_next_pipeline_id(); let next_pipeline_id = self.get_next_pipeline_id();
let pipeline = self.new_pipeline(next_pipeline_id, None, None, url); let pipeline = self.new_pipeline(next_pipeline_id, None, None, LoadData::new(url));
self.pending_frames.push(FrameChange { self.pending_frames.push(FrameChange {
before: None, before: None,
@ -573,7 +573,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
source Id of LoadIframeUrlMsg does have an associated pipeline in source Id of LoadIframeUrlMsg does have an associated pipeline in
constellation. This should be impossible.").clone(); constellation. This should be impossible.").clone();
let source_url = source_pipeline.url.clone(); let source_url = source_pipeline.load_data.url.clone();
let same_script = (source_url.host() == url.host() && let same_script = (source_url.host() == url.host() &&
source_url.port() == url.port()) && sandbox == IFrameUnsandboxed; source_url.port() == url.port()) && sandbox == IFrameUnsandboxed;
@ -591,7 +591,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
next_pipeline_id, next_pipeline_id,
Some(subpage_id), Some(subpage_id),
new_pipeline, new_pipeline,
url LoadData::new(url)
); );
let rect = self.pending_sizes.pop(&(source_pipeline_id, subpage_id)); let rect = self.pending_sizes.pop(&(source_pipeline_id, subpage_id));
@ -608,8 +608,8 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
self.pipelines.insert(pipeline.id, pipeline); self.pipelines.insert(pipeline.id, pipeline);
} }
fn handle_load_url_msg(&mut self, source_id: PipelineId, url: Url) { fn handle_load_url_msg(&mut self, source_id: PipelineId, load_data: LoadData) {
debug!("Constellation: received message to load {:s}", url.to_string()); debug!("Constellation: received message to load {:s}", load_data.url.to_string());
// Make sure no pending page would be overridden. // Make sure no pending page would be overridden.
let source_frame = self.current_frame().as_ref().unwrap().find(source_id).expect( let source_frame = self.current_frame().as_ref().unwrap().find(source_id).expect(
"Constellation: received a LoadUrlMsg from a pipeline_id associated "Constellation: received a LoadUrlMsg from a pipeline_id associated
@ -635,7 +635,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
let subpage_id = source_frame.pipeline.subpage_id; let subpage_id = source_frame.pipeline.subpage_id;
let next_pipeline_id = self.get_next_pipeline_id(); let next_pipeline_id = self.get_next_pipeline_id();
let pipeline = self.new_pipeline(next_pipeline_id, subpage_id, None, url); let pipeline = self.new_pipeline(next_pipeline_id, subpage_id, None, load_data);
self.pending_frames.push(FrameChange{ self.pending_frames.push(FrameChange{
before: Some(source_id), before: Some(source_id),

View file

@ -11,14 +11,13 @@ use devtools_traits::DevtoolsControlChan;
use gfx::render_task::{PaintPermissionGranted, PaintPermissionRevoked}; use gfx::render_task::{PaintPermissionGranted, PaintPermissionRevoked};
use gfx::render_task::{RenderChan, RenderTask}; use gfx::render_task::{RenderChan, RenderTask};
use servo_msg::constellation_msg::{ConstellationChan, Failure, PipelineId, SubpageId}; use servo_msg::constellation_msg::{ConstellationChan, Failure, PipelineId, SubpageId};
use servo_msg::constellation_msg::WindowSizeData; use servo_msg::constellation_msg::{LoadData, WindowSizeData};
use servo_net::image_cache_task::ImageCacheTask; use servo_net::image_cache_task::ImageCacheTask;
use gfx::font_cache_task::FontCacheTask; use gfx::font_cache_task::FontCacheTask;
use servo_net::resource_task::ResourceTask; use servo_net::resource_task::ResourceTask;
use servo_util::opts::Opts; use servo_util::opts::Opts;
use servo_util::time::TimeProfilerChan; use servo_util::time::TimeProfilerChan;
use std::rc::Rc; use std::rc::Rc;
use url::Url;
/// A uniquely-identifiable pipeline of script task, layout task, and render task. /// A uniquely-identifiable pipeline of script task, layout task, and render task.
pub struct Pipeline { pub struct Pipeline {
@ -29,8 +28,8 @@ pub struct Pipeline {
pub render_chan: RenderChan, pub render_chan: RenderChan,
pub layout_shutdown_port: Receiver<()>, pub layout_shutdown_port: Receiver<()>,
pub render_shutdown_port: Receiver<()>, pub render_shutdown_port: Receiver<()>,
/// The most recently loaded url /// The most recently loaded page
pub url: Url, pub load_data: LoadData,
} }
/// The subset of the pipeline that is needed for layer composition. /// The subset of the pipeline that is needed for layer composition.
@ -58,7 +57,7 @@ impl Pipeline {
window_size: WindowSizeData, window_size: WindowSizeData,
opts: Opts, opts: Opts,
script_pipeline: Option<Rc<Pipeline>>, script_pipeline: Option<Rc<Pipeline>>,
url: Url) load_data: LoadData)
-> Pipeline { -> Pipeline {
let layout_pair = ScriptTaskFactory::create_layout_channel(None::<&mut STF>); let layout_pair = ScriptTaskFactory::create_layout_channel(None::<&mut STF>);
let (render_port, render_chan) = RenderChan::new(); let (render_port, render_chan) = RenderChan::new();
@ -134,7 +133,7 @@ impl Pipeline {
render_chan, render_chan,
layout_shutdown_port, layout_shutdown_port,
render_shutdown_port, render_shutdown_port,
url) load_data)
} }
pub fn new(id: PipelineId, pub fn new(id: PipelineId,
@ -144,7 +143,7 @@ impl Pipeline {
render_chan: RenderChan, render_chan: RenderChan,
layout_shutdown_port: Receiver<()>, layout_shutdown_port: Receiver<()>,
render_shutdown_port: Receiver<()>, render_shutdown_port: Receiver<()>,
url: Url) load_data: LoadData)
-> Pipeline { -> Pipeline {
Pipeline { Pipeline {
id: id, id: id,
@ -154,13 +153,13 @@ impl Pipeline {
render_chan: render_chan, render_chan: render_chan,
layout_shutdown_port: layout_shutdown_port, layout_shutdown_port: layout_shutdown_port,
render_shutdown_port: render_shutdown_port, render_shutdown_port: render_shutdown_port,
url: url, load_data: load_data,
} }
} }
pub fn load(&self) { pub fn load(&self) {
let ScriptControlChan(ref chan) = self.script_chan; let ScriptControlChan(ref chan) = self.script_chan;
chan.send(LoadMsg(self.id, self.url.clone())); chan.send(LoadMsg(self.id, self.load_data.clone()));
} }
pub fn grant_paint_permission(&self) { pub fn grant_paint_permission(&self) {

View file

@ -17,6 +17,10 @@ git = "https://github.com/servo/rust-azure"
[dependencies.geom] [dependencies.geom]
git = "https://github.com/servo/rust-geom" git = "https://github.com/servo/rust-geom"
[dependencies.http]
git = "https://github.com/servo/rust-http"
branch = "servo"
[dependencies.layers] [dependencies.layers]
git = "https://github.com/servo/rust-layers" git = "https://github.com/servo/rust-layers"

View file

@ -8,6 +8,8 @@
use geom::rect::Rect; use geom::rect::Rect;
use geom::size::TypedSize2D; use geom::size::TypedSize2D;
use geom::scale_factor::ScaleFactor; use geom::scale_factor::ScaleFactor;
use http::headers::request::HeaderCollection as RequestHeaderCollection;
use http::method::{Method, Get};
use layers::geometry::DevicePixel; use layers::geometry::DevicePixel;
use servo_util::geometry::{PagePx, ViewportPx}; use servo_util::geometry::{PagePx, ViewportPx};
use std::comm::{channel, Sender, Receiver}; use std::comm::{channel, Sender, Receiver};
@ -55,13 +57,35 @@ pub enum Msg {
InitLoadUrlMsg(Url), InitLoadUrlMsg(Url),
LoadCompleteMsg(PipelineId, Url), LoadCompleteMsg(PipelineId, Url),
FrameRectMsg(PipelineId, SubpageId, Rect<f32>), FrameRectMsg(PipelineId, SubpageId, Rect<f32>),
LoadUrlMsg(PipelineId, Url), LoadUrlMsg(PipelineId, LoadData),
LoadIframeUrlMsg(Url, PipelineId, SubpageId, IFrameSandboxState), LoadIframeUrlMsg(Url, PipelineId, SubpageId, IFrameSandboxState),
NavigateMsg(NavigationDirection), NavigateMsg(NavigationDirection),
RendererReadyMsg(PipelineId), RendererReadyMsg(PipelineId),
ResizedWindowMsg(WindowSizeData), ResizedWindowMsg(WindowSizeData),
} }
/// Similar to net::resource_task::LoadData
/// can be passed to LoadUrlMsg to load a page with GET/POST
/// parameters or headers
#[deriving(Clone)]
pub struct LoadData {
pub url: Url,
pub method: Method,
pub headers: RequestHeaderCollection,
pub data: Option<Vec<u8>>,
}
impl LoadData {
pub fn new(url: Url) -> LoadData {
LoadData {
url: url,
method: Get,
headers: RequestHeaderCollection::new(),
data: None,
}
}
}
/// Represents the two different ways to which a page can be navigated /// Represents the two different ways to which a page can be navigated
#[deriving(Clone, PartialEq, Hash)] #[deriving(Clone, PartialEq, Hash)]
pub enum NavigationType { pub enum NavigationType {

View file

@ -6,6 +6,7 @@
extern crate azure; extern crate azure;
extern crate geom; extern crate geom;
extern crate http;
extern crate layers; extern crate layers;
extern crate serialize; extern crate serialize;
extern crate "util" as servo_util; extern crate "util" as servo_util;

View file

@ -25,6 +25,7 @@ use encoding::types::{Encoding, DecodeReplace};
use hubbub::hubbub; use hubbub::hubbub;
use hubbub::hubbub::{NullNs, HtmlNs, MathMlNs, SvgNs, XLinkNs, XmlNs, XmlNsNs}; use hubbub::hubbub::{NullNs, HtmlNs, MathMlNs, SvgNs, XLinkNs, XmlNs, XmlNsNs};
use servo_net::resource_task::{Load, LoadData, Payload, Done, ResourceTask, load_whole_resource}; use servo_net::resource_task::{Load, LoadData, Payload, Done, ResourceTask, load_whole_resource};
use servo_msg::constellation_msg::LoadData as MsgLoadData;
use servo_util::str::DOMString; use servo_util::str::DOMString;
use servo_util::task::spawn_named; use servo_util::task::spawn_named;
use std::ascii::StrAsciiExt; use std::ascii::StrAsciiExt;
@ -283,10 +284,12 @@ pub fn build_element_from_tag(tag: DOMString, ns: Namespace, prefix: Option<DOMS
return ElementCast::from_temporary(HTMLUnknownElement::new(tag, prefix, document)); return ElementCast::from_temporary(HTMLUnknownElement::new(tag, prefix, document));
} }
// The url from msg_load_data is ignored here
pub fn parse_html(page: &Page, pub fn parse_html(page: &Page,
document: JSRef<Document>, document: JSRef<Document>,
input: HTMLInput, input: HTMLInput,
resource_task: ResourceTask) resource_task: ResourceTask,
msg_load_data: Option<MsgLoadData>)
-> HtmlParserResult { -> HtmlParserResult {
debug!("Hubbub: parsing {:?}", input); debug!("Hubbub: parsing {:?}", input);
@ -303,7 +306,14 @@ pub fn parse_html(page: &Page,
InputUrl(ref url) => { InputUrl(ref url) => {
// Wait for the LoadResponse so that the parser knows the final URL. // Wait for the LoadResponse so that the parser knows the final URL.
let (input_chan, input_port) = channel(); let (input_chan, input_port) = channel();
resource_task.send(Load(LoadData::new(url.clone()), input_chan)); let mut load_data = LoadData::new(url.clone());
msg_load_data.map(|m| {
load_data.headers = m.headers;
load_data.method = m.method;
load_data.data = m.data;
});
resource_task.send(Load(load_data, input_chan));
let load_response = input_port.recv(); let load_response = input_port.recv();
debug!("Fetched page; metadata is {:?}", load_response.metadata); debug!("Fetched page; metadata is {:?}", load_response.metadata);

View file

@ -47,7 +47,7 @@ use script_traits::ReflowCompleteMsg;
use servo_msg::compositor_msg::{FinishedLoading, LayerId, Loading}; use servo_msg::compositor_msg::{FinishedLoading, LayerId, Loading};
use servo_msg::compositor_msg::{ScriptListener}; use servo_msg::compositor_msg::{ScriptListener};
use servo_msg::constellation_msg::{ConstellationChan, LoadCompleteMsg, LoadUrlMsg, NavigationDirection}; use servo_msg::constellation_msg::{ConstellationChan, LoadCompleteMsg, LoadUrlMsg, NavigationDirection};
use servo_msg::constellation_msg::{PipelineId, Failure, FailureMsg, WindowSizeData}; use servo_msg::constellation_msg::{LoadData, PipelineId, Failure, FailureMsg, WindowSizeData};
use servo_msg::constellation_msg; use servo_msg::constellation_msg;
use servo_net::image_cache_task::ImageCacheTask; use servo_net::image_cache_task::ImageCacheTask;
use servo_net::resource_task::ResourceTask; use servo_net::resource_task::ResourceTask;
@ -484,7 +484,7 @@ impl ScriptTask {
match msg { match msg {
// TODO(tkuehn) need to handle auxiliary layouts for iframes // TODO(tkuehn) need to handle auxiliary layouts for iframes
FromConstellation(AttachLayoutMsg(_)) => fail!("should have handled AttachLayoutMsg already"), FromConstellation(AttachLayoutMsg(_)) => fail!("should have handled AttachLayoutMsg already"),
FromConstellation(LoadMsg(id, url)) => self.load(id, url), FromConstellation(LoadMsg(id, load_data)) => self.load(id, load_data),
FromScript(TriggerLoadMsg(id, url)) => self.trigger_load(id, url), FromScript(TriggerLoadMsg(id, url)) => self.trigger_load(id, url),
FromScript(TriggerFragmentMsg(id, url)) => self.trigger_fragment(id, url), FromScript(TriggerFragmentMsg(id, url)) => self.trigger_fragment(id, url),
FromConstellation(SendEventMsg(id, event)) => self.handle_event(id, event), FromConstellation(SendEventMsg(id, event)) => self.handle_event(id, event),
@ -698,7 +698,8 @@ impl ScriptTask {
/// The entry point to document loading. Defines bindings, sets up the window and document /// The entry point to document loading. Defines bindings, sets up the window and document
/// objects, parses HTML and CSS, and kicks off initial layout. /// objects, parses HTML and CSS, and kicks off initial layout.
fn load(&self, pipeline_id: PipelineId, url: Url) { fn load(&self, pipeline_id: PipelineId, load_data: LoadData) {
let url = load_data.url.clone();
debug!("ScriptTask: loading {} on page {:?}", url, pipeline_id); debug!("ScriptTask: loading {} on page {:?}", url, pipeline_id);
let mut page = self.page.borrow_mut(); let mut page = self.page.borrow_mut();
@ -750,7 +751,7 @@ impl ScriptTask {
let parser_input = if !is_javascript { let parser_input = if !is_javascript {
InputUrl(url.clone()) InputUrl(url.clone())
} else { } else {
let evalstr = url.non_relative_scheme_data().unwrap(); let evalstr = load_data.url.non_relative_scheme_data().unwrap();
let jsval = window.evaluate_js_with_result(evalstr); let jsval = window.evaluate_js_with_result(evalstr);
let strval = FromJSValConvertible::from_jsval(self.get_cx(), jsval, Empty); let strval = FromJSValConvertible::from_jsval(self.get_cx(), jsval, Empty);
InputString(strval.unwrap_or("".to_string())) InputString(strval.unwrap_or("".to_string()))
@ -763,7 +764,8 @@ impl ScriptTask {
hubbub_html_parser::parse_html(&*page, hubbub_html_parser::parse_html(&*page,
*document, *document,
parser_input, parser_input,
self.resource_task.clone()); self.resource_task.clone(),
Some(load_data));
let HtmlParserResult { let HtmlParserResult {
discovery_port discovery_port
@ -1038,7 +1040,7 @@ impl ScriptTask {
/// for the given pipeline. /// for the given pipeline.
fn trigger_load(&self, pipeline_id: PipelineId, url: Url) { fn trigger_load(&self, pipeline_id: PipelineId, url: Url) {
let ConstellationChan(ref const_chan) = self.constellation_chan; let ConstellationChan(ref const_chan) = self.constellation_chan;
const_chan.send(LoadUrlMsg(pipeline_id, url)); const_chan.send(LoadUrlMsg(pipeline_id, LoadData::new(url)));
} }
/// The entry point for content to notify that a fragment url has been requested /// The entry point for content to notify that a fragment url has been requested

View file

@ -21,12 +21,11 @@ extern crate serialize;
use devtools_traits::DevtoolsControlChan; use devtools_traits::DevtoolsControlChan;
use servo_msg::constellation_msg::{ConstellationChan, PipelineId, Failure, WindowSizeData}; use servo_msg::constellation_msg::{ConstellationChan, PipelineId, Failure, WindowSizeData};
use servo_msg::constellation_msg::SubpageId; use servo_msg::constellation_msg::{LoadData, SubpageId};
use servo_msg::compositor_msg::ScriptListener; use servo_msg::compositor_msg::ScriptListener;
use servo_net::image_cache_task::ImageCacheTask; use servo_net::image_cache_task::ImageCacheTask;
use servo_net::resource_task::ResourceTask; use servo_net::resource_task::ResourceTask;
use std::any::Any; use std::any::Any;
use url::Url;
use geom::point::Point2D; use geom::point::Point2D;
@ -42,7 +41,7 @@ pub struct NewLayoutInfo {
/// Messages sent from the constellation to the script task /// Messages sent from the constellation to the script task
pub enum ConstellationControlMsg { pub enum ConstellationControlMsg {
/// Loads a new URL on the specified pipeline. /// Loads a new URL on the specified pipeline.
LoadMsg(PipelineId, Url), LoadMsg(PipelineId, LoadData),
/// Gives a channel and ID to a layout task, as well as the ID of that layout's parent /// Gives a channel and ID to a layout task, as well as the ID of that layout's parent
AttachLayoutMsg(NewLayoutInfo), AttachLayoutMsg(NewLayoutInfo),
/// Window resized. Sends a DOM event eventually, but first we combine events. /// Window resized. Sends a DOM event eventually, but first we combine events.