mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Use FetchCanceller for document loads
This commit is contained in:
parent
78c8b4232f
commit
3900f5e616
11 changed files with 51 additions and 24 deletions
|
@ -1110,9 +1110,9 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
FromScriptMsg::PipelineExited => {
|
||||
self.handle_pipeline_exited(source_pipeline_id);
|
||||
}
|
||||
FromScriptMsg::InitiateNavigateRequest(req_init) => {
|
||||
FromScriptMsg::InitiateNavigateRequest(req_init, cancel_chan) => {
|
||||
debug!("constellation got initiate navigate request message");
|
||||
self.handle_navigate_request(source_pipeline_id, req_init);
|
||||
self.handle_navigate_request(source_pipeline_id, req_init, cancel_chan);
|
||||
}
|
||||
FromScriptMsg::ScriptLoadedURLInIFrame(load_info) => {
|
||||
debug!("constellation got iframe URL load message {:?} {:?} {:?}",
|
||||
|
@ -1689,14 +1689,15 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
|
||||
fn handle_navigate_request(&self,
|
||||
id: PipelineId,
|
||||
req_init: RequestInit) {
|
||||
req_init: RequestInit,
|
||||
cancel_chan: IpcReceiver<()>) {
|
||||
let listener = NetworkListener::new(
|
||||
req_init,
|
||||
id,
|
||||
self.public_resource_threads.clone(),
|
||||
self.network_listener_sender.clone());
|
||||
|
||||
listener.initiate_fetch();
|
||||
listener.initiate_fetch(Some(cancel_chan));
|
||||
}
|
||||
|
||||
// The script thread associated with pipeline_id has loaded a URL in an iframe via script. This
|
||||
|
|
|
@ -41,7 +41,7 @@ impl NetworkListener {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn initiate_fetch(&self) {
|
||||
pub fn initiate_fetch(&self, cancel_chan: Option<ipc::IpcReceiver<()>>) {
|
||||
let (ipc_sender, ipc_receiver) = ipc::channel().expect("Failed to create IPC channel!");
|
||||
|
||||
let mut listener = NetworkListener {
|
||||
|
@ -64,7 +64,7 @@ impl NetworkListener {
|
|||
|
||||
CoreResourceMsg::Fetch(
|
||||
listener.req_init.clone(),
|
||||
FetchChannels::ResponseMsg(ipc_sender, None))
|
||||
FetchChannels::ResponseMsg(ipc_sender, cancel_chan))
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -108,7 +108,11 @@ impl NetworkListener {
|
|||
referrer: metadata.referrer.clone(),
|
||||
});
|
||||
|
||||
self.initiate_fetch();
|
||||
// XXXManishearth we don't have the cancel_chan anymore and
|
||||
// can't use it here.
|
||||
//
|
||||
// Ideally the Fetch code would handle manual redirects on its own
|
||||
self.initiate_fetch(None);
|
||||
},
|
||||
_ => {
|
||||
// Response should be processed by script thread.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue