aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-09-19 14:32:45 -0500
committerGitHub <noreply@github.com>2016-09-19 14:32:45 -0500
commit9876923b29ae7c4f2b763e368fc34fe8a051afc4 (patch)
tree6c7818483e8b876984e62305d3b04b34ca4b8345 /components/script/script_thread.rs
parent0b0495cff4c0062f1def279c8079ca76c58aef23 (diff)
parente9b2f1b916754ac57ab06326f49b0f1de5e1e9c0 (diff)
downloadservo-9876923b29ae7c4f2b763e368fc34fe8a051afc4.tar.gz
servo-9876923b29ae7c4f2b763e368fc34fe8a051afc4.zip
Auto merge of #13167 - ConnorGBrewster:reload_replace_current, r=asajeffrey
Replace current session entry when reloading <!-- Please describe your changes on the following line: --> This PR adds a replacement option when navigating. It replaces the current session history entry after a new page has been loaded. This will prevent reloading from adding a new entry to the session history. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #13123 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13167) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs22
1 files changed, 13 insertions, 9 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 4a19547138c..298323929c1 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -228,8 +228,9 @@ pub enum MainThreadScriptMsg {
/// should be closed (only dispatched to ScriptThread).
ExitWindow(PipelineId),
/// Begins a content-initiated load on the specified pipeline (only
- /// dispatched to ScriptThread).
- Navigate(PipelineId, LoadData),
+ /// dispatched to ScriptThread). Allows for a replace bool to be passed. If true,
+ /// the current entry will be replaced instead of a new entry being added.
+ Navigate(PipelineId, LoadData, bool),
/// Tasks that originate from the DOM manipulation task source
DOMManipulation(DOMManipulationTask),
/// Tasks that originate from the user interaction task source
@@ -877,8 +878,8 @@ impl ScriptThread {
fn handle_msg_from_constellation(&self, msg: ConstellationControlMsg) {
match msg {
- ConstellationControlMsg::Navigate(parent_pipeline_id, pipeline_id, load_data) =>
- self.handle_navigate(parent_pipeline_id, Some(pipeline_id), load_data),
+ ConstellationControlMsg::Navigate(parent_pipeline_id, pipeline_id, load_data, replace) =>
+ self.handle_navigate(parent_pipeline_id, Some(pipeline_id), load_data, replace),
ConstellationControlMsg::SendEvent(id, event) =>
self.handle_event(id, event),
ConstellationControlMsg::ResizeInactive(id, new_size) =>
@@ -933,8 +934,8 @@ impl ScriptThread {
fn handle_msg_from_script(&self, msg: MainThreadScriptMsg) {
match msg {
- MainThreadScriptMsg::Navigate(parent_pipeline_id, load_data) =>
- self.handle_navigate(parent_pipeline_id, None, load_data),
+ MainThreadScriptMsg::Navigate(parent_pipeline_id, load_data, replace) =>
+ self.handle_navigate(parent_pipeline_id, None, load_data, replace),
MainThreadScriptMsg::ExitWindow(id) =>
self.handle_exit_window_msg(id),
MainThreadScriptMsg::DocumentLoadsComplete(id) =>
@@ -2000,7 +2001,10 @@ impl ScriptThread {
/// https://html.spec.whatwg.org/multipage/#navigating-across-documents
/// The entry point for content to notify that a new load has been requested
/// for the given pipeline (specifically the "navigate" algorithm).
- fn handle_navigate(&self, parent_pipeline_id: PipelineId, pipeline_id: Option<PipelineId>, load_data: LoadData) {
+ fn handle_navigate(&self, parent_pipeline_id: PipelineId,
+ pipeline_id: Option<PipelineId>,
+ load_data: LoadData,
+ replace: bool) {
// Step 7.
{
let nurl = &load_data.url;
@@ -2026,12 +2030,12 @@ impl ScriptThread {
doc.find_iframe(pipeline_id)
});
if let Some(iframe) = iframe.r() {
- iframe.navigate_or_reload_child_browsing_context(Some(load_data));
+ iframe.navigate_or_reload_child_browsing_context(Some(load_data), replace);
}
}
None => {
self.constellation_chan
- .send(ConstellationMsg::LoadUrl(parent_pipeline_id, load_data))
+ .send(ConstellationMsg::LoadUrl(parent_pipeline_id, load_data, replace))
.unwrap();
}
}