aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/html
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2014-10-09 14:09:15 +0530
committerManish Goregaokar <manishsmail@gmail.com>2014-10-09 14:09:29 +0530
commitad16c52a6b9b29867518beea161a5bb876086df5 (patch)
treefe7f79fe078d2964e2f3a3ddbb2fa2c78825fb99 /components/script/html
parent15b508ac10d0e98ba10474b6ab091017ae95804e (diff)
downloadservo-ad16c52a6b9b29867518beea161a5bb876086df5.tar.gz
servo-ad16c52a6b9b29867518beea161a5bb876086df5.zip
Allow passing a method, request body, and headers to the pipeline in LoadUrlMsg
Diffstat (limited to 'components/script/html')
-rw-r--r--components/script/html/hubbub_html_parser.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/components/script/html/hubbub_html_parser.rs b/components/script/html/hubbub_html_parser.rs
index 36d39562938..409bfa01a9a 100644
--- a/components/script/html/hubbub_html_parser.rs
+++ b/components/script/html/hubbub_html_parser.rs
@@ -25,6 +25,7 @@ use encoding::types::{Encoding, DecodeReplace};
use hubbub::hubbub;
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_msg::constellation_msg::LoadData as MsgLoadData;
use servo_util::str::DOMString;
use servo_util::task::spawn_named;
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));
}
+// The url from msg_load_data is ignored here
pub fn parse_html(page: &Page,
document: JSRef<Document>,
input: HTMLInput,
- resource_task: ResourceTask)
+ resource_task: ResourceTask,
+ msg_load_data: Option<MsgLoadData>)
-> HtmlParserResult {
debug!("Hubbub: parsing {:?}", input);
@@ -303,7 +306,14 @@ pub fn parse_html(page: &Page,
InputUrl(ref url) => {
// Wait for the LoadResponse so that the parser knows the final URL.
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();
debug!("Fetched page; metadata is {:?}", load_response.metadata);