Replace current session entry for reloads

This commit is contained in:
Connor Brewster 2016-09-02 23:28:20 -05:00
parent 0b0495cff4
commit e9b2f1b916
10 changed files with 89 additions and 57 deletions

View file

@ -588,5 +588,5 @@ fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<String>) {
debug!("following hyperlink to {}", url);
let window = document.window();
window.load_url(url);
window.load_url(url, false);
}

View file

@ -902,7 +902,7 @@ impl Runnable for PlannedNavigation {
fn handler(self: Box<PlannedNavigation>) {
if self.generation_id == self.form.root().generation_id.get() {
let script_chan = self.script_chan.clone();
script_chan.send(MainThreadScriptMsg::Navigate(self.pipeline_id, self.load_data)).unwrap();
script_chan.send(MainThreadScriptMsg::Navigate(self.pipeline_id, self.load_data, false)).unwrap();
}
}
}

View file

@ -100,7 +100,7 @@ impl HTMLIFrameElement {
(old_pipeline_id, new_pipeline_id)
}
pub fn navigate_or_reload_child_browsing_context(&self, load_data: Option<LoadData>) {
pub fn navigate_or_reload_child_browsing_context(&self, load_data: Option<LoadData>, replace: bool) {
let sandboxed = if self.is_sandboxed() {
IFrameSandboxed
} else {
@ -134,6 +134,7 @@ impl HTMLIFrameElement {
sandbox: sandboxed,
is_private: private_iframe,
frame_type: frame_type,
replace: replace,
};
window.constellation_chan()
.send(ConstellationMsg::ScriptLoadedURLInIFrame(load_info))
@ -150,7 +151,7 @@ impl HTMLIFrameElement {
let document = document_from_node(self);
self.navigate_or_reload_child_browsing_context(
Some(LoadData::new(url, document.get_referrer_policy(), Some(document.url().clone()))));
Some(LoadData::new(url, document.get_referrer_policy(), Some(document.url().clone()))), false);
}
#[allow(unsafe_code)]
@ -491,7 +492,7 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
fn Reload(&self, _hard_reload: bool) -> ErrorResult {
if self.Mozbrowser() {
if self.upcast::<Node>().is_in_doc() {
self.navigate_or_reload_child_browsing_context(None);
self.navigate_or_reload_child_browsing_context(None, true);
}
Ok(())
} else {

View file

@ -40,7 +40,7 @@ impl Location {
setter: fn(&mut Url, USVString)) {
let mut url = self.window.get_url();
setter(&mut url, value);
self.window.load_url(url);
self.window.load_url(url, false);
}
}
@ -51,13 +51,13 @@ impl LocationMethods for Location {
// _entry settings object_.
let base_url = self.window.get_url();
if let Ok(url) = base_url.join(&url.0) {
self.window.load_url(url);
self.window.load_url(url, false);
}
}
// https://html.spec.whatwg.org/multipage/#dom-location-reload
fn Reload(&self) {
self.window.load_url(self.get_url());
self.window.load_url(self.get_url(), true);
}
// https://html.spec.whatwg.org/multipage/#dom-location-hash
@ -106,7 +106,7 @@ impl LocationMethods for Location {
// https://html.spec.whatwg.org/multipage/#dom-location-href
fn SetHref(&self, value: USVString) {
if let Ok(url) = self.window.get_url().join(&value.0) {
self.window.load_url(url);
self.window.load_url(url, false);
}
}

View file

@ -1410,11 +1410,12 @@ impl Window {
}
/// Commence a new URL load which will either replace this window or scroll to a fragment.
pub fn load_url(&self, url: Url) {
pub fn load_url(&self, url: Url, replace: bool) {
let doc = self.Document();
self.main_thread_script_chan().send(
MainThreadScriptMsg::Navigate(self.id,
LoadData::new(url, doc.get_referrer_policy(), Some(doc.url().clone())))).unwrap();
LoadData::new(url, doc.get_referrer_policy(), Some(doc.url().clone())),
replace)).unwrap();
}
pub fn handle_fire_timer(&self, timer_id: TimerEventId) {