From 268e2854396e1b02e12a4302970d9762b0349723 Mon Sep 17 00:00:00 2001 From: Paul Rouget Date: Wed, 6 Jan 2016 06:19:47 +0100 Subject: [PATCH] update pipeline url after redirections --- components/compositing/constellation.rs | 5 +++++ components/script/script_task.rs | 4 ++++ components/script_traits/script_msg.rs | 2 ++ tests/wpt/mozilla/meta/MANIFEST.json | 6 ++++++ .../tests/mozilla/mozbrowser/redirect.html | 18 ++++++++++++++++++ .../mozilla/mozbrowser/redirect_final.html | 1 + .../mozilla/mozbrowser/redirect_init.html | 1 + 7 files changed, 37 insertions(+) create mode 100644 tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect.html create mode 100644 tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect_final.html create mode 100644 tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect_init.html diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index 7edb7c32282..426138cf313 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -622,6 +622,11 @@ impl Constellation { debug!("constellation got activate document message"); self.handle_activate_document_msg(pipeline_id); } + // Update pipeline url after redirections + Request::Script(FromScriptMsg::SetFinalUrl(pipeline_id, final_url)) => { + debug!("constellation got set final url message"); + self.mut_pipeline(pipeline_id).url = final_url; + } Request::Script(FromScriptMsg::MozBrowserEvent(pipeline_id, subpage_id, event)) => { diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 6d9b2bee301..92a55c62ada 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -1648,6 +1648,10 @@ impl ScriptTask { // send the final url to the layout task. let LayoutChan(ref chan) = incomplete.layout_chan; chan.send(layout_interface::Msg::SetFinalUrl(final_url.clone())).unwrap(); + + // update the pipeline url + let ConstellationChan(ref chan) = self.constellation_chan; + chan.send(ConstellationMsg::SetFinalUrl(incomplete.pipeline_id, final_url.clone())).unwrap(); } debug!("ScriptTask: loading {} on page {:?}", incomplete.url.serialize(), incomplete.pipeline_id); diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs index 1916551ed79..869f2428379 100644 --- a/components/script_traits/script_msg.rs +++ b/components/script_traits/script_msg.rs @@ -79,4 +79,6 @@ pub enum ScriptMsg { ActivateDocument(PipelineId), /// Set the document state for a pipeline (used by screenshot / reftests) SetDocumentState(PipelineId, DocumentState), + /// Update the pipeline Url, which can change after redirections. + SetFinalUrl(PipelineId, Url), } diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 88add1dbdf1..309ca0d3fa8 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -5785,6 +5785,12 @@ "url": "/_mozilla/mozilla/mozbrowser/mozbrowsershowmodalprompt_event.html" } ], + "mozilla/mozbrowser/redirect.html": [ + { + "path": "mozilla/mozbrowser/redirect.html", + "url": "/_mozilla/mozilla/mozbrowser/redirect.html" + } + ], "mozilla/mozbrowser/reload.html": [ { "path": "mozilla/mozbrowser/reload.html", diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect.html new file mode 100644 index 00000000000..6d9c11fdbe2 --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect.html @@ -0,0 +1,18 @@ + + +mozbrowserlocationchange with final url after redirect + + + + diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect_final.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect_final.html new file mode 100644 index 00000000000..cd059ad53fc --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect_final.html @@ -0,0 +1 @@ +

redirect_final

diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect_init.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect_init.html new file mode 100644 index 00000000000..f6c7e1d9df5 --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect_init.html @@ -0,0 +1 @@ +

redirect_init