aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-01-14 15:08:56 -0800
committerGitHub <noreply@github.com>2017-01-14 15:08:56 -0800
commitd09bf70d220262e2c199abf61b4b78b7137d6665 (patch)
treead2e27adc7e8d8fe6fb04187e686840e72ac94fa
parent89c020f25887961570b9ec7c4ebf592e021c0ea8 (diff)
parent0fae39f468e84678c9bca27cd739a8a26f8bb5ae (diff)
downloadservo-d09bf70d220262e2c199abf61b4b78b7137d6665.tar.gz
servo-d09bf70d220262e2c199abf61b4b78b7137d6665.zip
Auto merge of #15026 - tydus101:max-session-fix, r=jdm
Max session fix <!-- Please describe your changes on the following line: --> Converted document discarding from an opt into a pref. Updated testing docs and changed all uses to pref api. --- <!-- 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 #14960 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because current test suite is sufficient <!-- 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/15026) <!-- Reviewable:end -->
-rw-r--r--components/config/opts.rs10
-rw-r--r--components/constellation/constellation.rs3
-rw-r--r--resources/prefs.json1
-rw-r--r--tests/wpt/mozilla/tests/mozilla/servo-max-session-history.html2
4 files changed, 4 insertions, 12 deletions
diff --git a/components/config/opts.rs b/components/config/opts.rs
index 32195664f2d..df2bb2e041e 100644
--- a/components/config/opts.rs
+++ b/components/config/opts.rs
@@ -68,9 +68,6 @@ pub struct Opts {
pub output_file: Option<String>,
- /// How much session history to keep in each tab.
- pub max_session_history: usize,
-
/// Replace unpaires surrogates in DOM strings with U+FFFD.
/// See https://github.com/servo/servo/issues/6564
pub replace_surrogates: bool,
@@ -521,7 +518,6 @@ pub fn default_opts() -> Opts {
userscripts: None,
user_stylesheets: Vec::new(),
output_file: None,
- max_session_history: 20,
replace_surrogates: false,
gc_profile: false,
load_webfonts_synchronously: false,
@@ -615,7 +611,6 @@ 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.", "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");
@@ -784,10 +779,6 @@ 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(20);
-
if opt_match.opt_present("M") {
MULTIPROCESS.store(true, Ordering::SeqCst)
}
@@ -829,7 +820,6 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
userscripts: opt_match.opt_default("userscripts", ""),
user_stylesheets: user_stylesheets,
output_file: opt_match.opt_str("o"),
- max_session_history: max_session_history,
replace_surrogates: debug_options.replace_surrogates,
gc_profile: debug_options.gc_profile,
load_webfonts_synchronously: debug_options.load_webfonts_synchronously,
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs
index fc67095dce7..15c0e258ea3 100644
--- a/components/constellation/constellation.rs
+++ b/components/constellation/constellation.rs
@@ -2136,7 +2136,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
} 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.len().checked_sub(opts::get().max_session_history)
+ let evicted_id = frame.prev.len()
+ .checked_sub(PREFS.get("session-history.max-length").as_u64().unwrap_or(20) as usize)
.and_then(|index| frame.prev.get_mut(index))
.and_then(|entry| entry.pipeline_id.take());
(evicted_id, false, true, true)
diff --git a/resources/prefs.json b/resources/prefs.json
index 67fea25b136..74c8fa7f9fe 100644
--- a/resources/prefs.json
+++ b/resources/prefs.json
@@ -56,6 +56,7 @@
"layout.viewport.enabled": false,
"layout.writing-mode.enabled": false,
"network.mime.sniff": false,
+ "session-history.max-length": 20,
"shell.builtin-key-shortcuts.enabled": true,
"shell.homepage": "https://servo.org",
"shell.native-titlebar.enabled": true
diff --git a/tests/wpt/mozilla/tests/mozilla/servo-max-session-history.html b/tests/wpt/mozilla/tests/mozilla/servo-max-session-history.html
index 7d60d8f3f9f..a137051a578 100644
--- a/tests/wpt/mozilla/tests/mozilla/servo-max-session-history.html
+++ b/tests/wpt/mozilla/tests/mozilla/servo-max-session-history.html
@@ -18,7 +18,7 @@
var go_forward_by = 24;
// The number of pages to go back by.
- // This should be more than the default --max-session-history,
+ // This should be more than the default session-history.max-length pref,
// to ensure that going back reloads the page.
var go_back_by = Math.min(page_number, 20);