aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2015-08-17 21:29:41 -0700
committerMichael Howell <michael@notriddle.com>2015-08-18 17:35:09 -0700
commitaf31e8ed0f3f74908fb2c970e8b2f254ba0d70bd (patch)
treeda37325a6c18ac6bf1857c8828a2574ee702678a /components/script/script_task.rs
parent72fa45155b93a9763967cf215e3a9e60e3883cd9 (diff)
downloadservo-af31e8ed0f3f74908fb2c970e8b2f254ba0d70bd.tar.gz
servo-af31e8ed0f3f74908fb2c970e8b2f254ba0d70bd.zip
Navigate to a new page even when there's a fragment.
Closes #7169
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs27
1 files changed, 18 insertions, 9 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index faf1f06d202..c23316f4061 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -82,6 +82,7 @@ use util::opts;
use euclid::Rect;
use euclid::point::Point2D;
use hyper::header::{LastModified, Headers};
+use hyper::method::Method;
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
use js::glue::CollectServoSizes;
@@ -1727,16 +1728,24 @@ impl ScriptTask {
/// for the given pipeline (specifically the "navigate" algorithm).
fn handle_navigate(&self, pipeline_id: PipelineId, subpage_id: Option<SubpageId>, load_data: LoadData) {
// Step 8.
- if let Some(fragment) = load_data.url.fragment {
- let page = get_page(&self.root_page(), pipeline_id);
- let document = page.document();
- match document.r().find_fragment_node(fragment) {
- Some(ref node) => {
- self.scroll_fragment_point(pipeline_id, node.r());
+ {
+ let nurl = &load_data.url;
+ if let Some(ref fragment) = nurl.fragment {
+ let page = get_page(&self.root_page(), pipeline_id);
+ let document = page.document();
+ let document = document.r();
+ let url = document.url();
+ if url.scheme == nurl.scheme && url.scheme_data == nurl.scheme_data &&
+ url.query == nurl.query && load_data.method == Method::Get {
+ match document.find_fragment_node(&*fragment) {
+ Some(ref node) => {
+ self.scroll_fragment_point(pipeline_id, node.r());
+ }
+ None => {}
+ }
+ return;
}
- None => {}
}
- return;
}
match subpage_id {
@@ -1767,7 +1776,7 @@ impl ScriptTask {
let document = page.document();
let fragment_node = window.r().steal_fragment_name()
- .and_then(|name| document.r().find_fragment_node(name));
+ .and_then(|name| document.r().find_fragment_node(&*name));
match fragment_node {
Some(ref node) => self.scroll_fragment_point(pipeline_id, node.r()),
None => {}