From 3e1a242c7ef6b18fc9100652b7c4922b8c0cbe2d Mon Sep 17 00:00:00 2001 From: Alan Jeffrey Date: Thu, 5 Jan 2017 20:35:48 +0000 Subject: [PATCH 1/3] Increased default max-session-history to 20. --- components/config/opts.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/config/opts.rs b/components/config/opts.rs index ea1173c6443..36d012690f7 100644 --- a/components/config/opts.rs +++ b/components/config/opts.rs @@ -521,7 +521,7 @@ pub fn default_opts() -> Opts { userscripts: None, user_stylesheets: Vec::new(), output_file: None, - max_session_history: 16, + max_session_history: 20, replace_surrogates: false, gc_profile: false, load_webfonts_synchronously: false, @@ -615,7 +615,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult { "Probability of randomly closing a pipeline (for testing constellation hardening).", "0.0"); opts.optopt("", "random-pipeline-closure-seed", "A fixed seed for repeatbility of random pipeline closure.", ""); - opts.optopt("", "max-session-history", "Maximum amount of session history to store in each tab.", "16"); + opts.optopt("", "max-session-history", "Maximum amount of session history to store in each tab.", "20"); opts.optmulti("Z", "debug", "A comma-separated string of debug options. Pass help to show available options.", ""); opts.optflag("h", "help", "Print this message"); @@ -786,7 +786,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult { let max_session_history = opt_match.opt_str("max-session-history").map(|max| { max.parse().unwrap_or_else(|err| args_fail(&format!("Error parsing option: --max-session-history ({})", err))) - }).unwrap_or(16); + }).unwrap_or(20); if opt_match.opt_present("M") { MULTIPROCESS.store(true, Ordering::SeqCst) From 5fd284cf3ac6c874d44abaa7983726fd4fb4e158 Mon Sep 17 00:00:00 2001 From: Alan Jeffrey Date: Thu, 5 Jan 2017 12:08:03 +0000 Subject: [PATCH 2/3] Index the session past correctly when discarding. --- components/constellation/constellation.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index f5a5983fa9b..76537234f09 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -2110,7 +2110,8 @@ impl Constellation } else if let Some(frame) = self.frames.get_mut(&frame_change.frame_id) { debug!("Adding pipeline to existing frame."); frame.load(frame_change.new_pipeline_id, frame_change.url.clone()); - let evicted_id = frame.prev.get_mut(opts::get().max_session_history) + let evicted_id = frame.prev.len().checked_sub(opts::get().max_session_history) + .and_then(|index| frame.prev.get_mut(index)) .and_then(|entry| entry.pipeline_id.take()); (evicted_id, false, true, true) } else { From b401556f03001edb9099335b2936b9871fee50b8 Mon Sep 17 00:00:00 2001 From: Alan Jeffrey Date: Thu, 5 Jan 2017 15:38:25 +0000 Subject: [PATCH 3/3] Added a test to make sure that forward-then-back triggers a reload. --- tests/wpt/mozilla/meta/MANIFEST.json | 6 ++++ .../mozilla/servo-max-session-history.html | 36 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 tests/wpt/mozilla/tests/mozilla/servo-max-session-history.html diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 4f7b9c4ec43..c60b1486f1e 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -15128,6 +15128,12 @@ "url": "/_mozilla/mozilla/service-workers/service-worker-registration.html" } ], + "mozilla/servo-max-session-history.html": [ + { + "path": "mozilla/servo-max-session-history.html", + "url": "/_mozilla/mozilla/servo-max-session-history.html" + } + ], "mozilla/sigsegv.html": [ { "path": "mozilla/sigsegv.html", diff --git a/tests/wpt/mozilla/tests/mozilla/servo-max-session-history.html b/tests/wpt/mozilla/tests/mozilla/servo-max-session-history.html new file mode 100644 index 00000000000..7d60d8f3f9f --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/servo-max-session-history.html @@ -0,0 +1,36 @@ + + + + + + + +