diff options
-rw-r--r-- | components/compositing/constellation.rs | 5 | ||||
-rw-r--r-- | components/script/script_task.rs | 4 | ||||
-rw-r--r-- | components/script_traits/script_msg.rs | 2 | ||||
-rw-r--r-- | tests/wpt/mozilla/meta/MANIFEST.json | 6 | ||||
-rw-r--r-- | tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect.html | 18 | ||||
-rw-r--r-- | tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect_final.html | 1 | ||||
-rw-r--r-- | tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect_init.html | 1 |
7 files changed, 37 insertions, 0 deletions
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<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { 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 @@ +<!doctype html> +<meta charset="utf-8"> +<title>mozbrowserlocationchange with final url after redirect</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body></body> +<script> + async_test(function(t) { + var iframe = document.createElement("iframe"); + iframe.mozbrowser = "true"; + iframe.src = "redirect_init.html?pipe=status(302)|header(Location,redirect_final.html)"; + iframe.addEventListener("mozbrowserlocationchange", t.step_func(e => { + assert_equals(e.detail, new URL("redirect_final.html", location).href); + t.done(); + })); + document.body.appendChild(iframe); + }); +</script> 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 @@ +<h1>redirect_final</h1> 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 @@ +<h1>redirect_init</h1> |