aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ports/servoshell/desktop/cli.rs6
-rw-r--r--ports/servoshell/prefs.rs28
-rw-r--r--resources/wpt-prefs.json3
-rw-r--r--tests/wpt/meta/MANIFEST.json2
-rw-r--r--tests/wpt/mozilla/meta-legacy-layout/mozilla/interfaces.html.ini1
-rw-r--r--tests/wpt/mozilla/meta/mozilla/interfaces.html.ini1
-rw-r--r--tests/wpt/mozilla/meta/webxr/create_session.https.html.ini4
-rw-r--r--tests/wpt/mozilla/meta/webxr/obtain_frame.https.html.ini3
-rw-r--r--tests/wpt/mozilla/meta/webxr/sessionavailable.https.html.ini2
-rw-r--r--tests/wpt/tests/tools/wptrunner/wptrunner/executors/executorservo.py1
10 files changed, 36 insertions, 15 deletions
diff --git a/ports/servoshell/desktop/cli.rs b/ports/servoshell/desktop/cli.rs
index 5eb8ad7a3aa..cde1cf8ee7a 100644
--- a/ports/servoshell/desktop/cli.rs
+++ b/ports/servoshell/desktop/cli.rs
@@ -45,6 +45,12 @@ pub fn main() {
"A preference to set to disable",
"dom.webgpu.enabled=false",
);
+ opts.optmulti(
+ "",
+ "prefs-file",
+ "Load in additional prefs from a file.",
+ "--prefs-file /path/to/prefs.json",
+ );
let opts_matches;
let content_process_token;
diff --git a/ports/servoshell/prefs.rs b/ports/servoshell/prefs.rs
index d11754b8608..100fa80c4fd 100644
--- a/ports/servoshell/prefs.rs
+++ b/ports/servoshell/prefs.rs
@@ -22,15 +22,17 @@ pub fn register_user_prefs(opts_matches: &Matches) {
.filter(|path| path.exists());
let mut userprefs = if let Some(path) = user_prefs_path {
- let mut file = File::open(path).expect("Error opening user prefs");
- let mut txt = String::new();
- file.read_to_string(&mut txt)
- .expect("Can't read user prefs file");
- prefs::read_prefs_map(&txt).expect("Can't parse user prefs file")
+ read_prefs_file(path.to_str().expect("Failed to read user prefs"))
} else {
HashMap::new()
};
+ let prefs_from_files: Vec<HashMap<String, PrefValue>> = opts_matches
+ .opt_strs("prefs-file")
+ .iter()
+ .map(|path| read_prefs_file(path))
+ .collect();
+
let argprefs: HashMap<String, PrefValue> = opts_matches
.opt_strs("pref")
.iter()
@@ -54,16 +56,30 @@ pub fn register_user_prefs(opts_matches: &Matches) {
})
.collect();
- // --pref overrides user prefs.json
+ // Apply --prefs-file prefs first
+ for prefs in prefs_from_files {
+ userprefs.extend(prefs);
+ }
+
+ // Then apply individually passed prefs from --pref
userprefs.extend(argprefs);
prefs::add_user_prefs(userprefs);
}
+fn read_prefs_file(path: &str) -> HashMap<String, PrefValue> {
+ let mut file = File::open(path).expect("Error opening user prefs");
+ let mut txt = String::new();
+ file.read_to_string(&mut txt)
+ .expect("Can't read user prefs file");
+ prefs::read_prefs_map(&txt).expect("Can't parse user prefs file")
+}
+
#[cfg(test)]
fn test_parse_pref(arg: &str) {
let mut opts = getopts::Options::new();
opts.optmulti("", "pref", "", "");
+ opts.optmulti("", "prefs-file", "", "");
let args = vec!["servo".to_string(), "--pref".to_string(), arg.to_string()];
let matches = match opts::from_cmdline_args(opts, &args) {
opts::ArgumentParsingResult::ContentProcess(m, _) => m,
diff --git a/resources/wpt-prefs.json b/resources/wpt-prefs.json
new file mode 100644
index 00000000000..c9b43ee5c3b
--- /dev/null
+++ b/resources/wpt-prefs.json
@@ -0,0 +1,3 @@
+{
+ "dom.webxr.test": true
+}
diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json
index 3f1a6990028..4cad61a9c92 100644
--- a/tests/wpt/meta/MANIFEST.json
+++ b/tests/wpt/meta/MANIFEST.json
@@ -489596,7 +489596,7 @@
[]
],
"executorservo.py": [
- "9c938b6e75e27c61167294a941629928fa33db73",
+ "c23f7632c9ef5f0acbdbb569db41f741ccf9de89",
[]
],
"executorservodriver.py": [
diff --git a/tests/wpt/mozilla/meta-legacy-layout/mozilla/interfaces.html.ini b/tests/wpt/mozilla/meta-legacy-layout/mozilla/interfaces.html.ini
new file mode 100644
index 00000000000..32a9f966eeb
--- /dev/null
+++ b/tests/wpt/mozilla/meta-legacy-layout/mozilla/interfaces.html.ini
@@ -0,0 +1 @@
+prefs: [dom.webxr.test: false] \ No newline at end of file
diff --git a/tests/wpt/mozilla/meta/mozilla/interfaces.html.ini b/tests/wpt/mozilla/meta/mozilla/interfaces.html.ini
new file mode 100644
index 00000000000..32a9f966eeb
--- /dev/null
+++ b/tests/wpt/mozilla/meta/mozilla/interfaces.html.ini
@@ -0,0 +1 @@
+prefs: [dom.webxr.test: false] \ No newline at end of file
diff --git a/tests/wpt/mozilla/meta/webxr/create_session.https.html.ini b/tests/wpt/mozilla/meta/webxr/create_session.https.html.ini
deleted file mode 100644
index c0325487984..00000000000
--- a/tests/wpt/mozilla/meta/webxr/create_session.https.html.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[create_session.https.html]
- expected: ERROR
- [create_session]
- expected: TIMEOUT
diff --git a/tests/wpt/mozilla/meta/webxr/obtain_frame.https.html.ini b/tests/wpt/mozilla/meta/webxr/obtain_frame.https.html.ini
deleted file mode 100644
index 20ce7049b26..00000000000
--- a/tests/wpt/mozilla/meta/webxr/obtain_frame.https.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[obtain_frame.https.html]
- [obtain_frame]
- expected: FAIL
diff --git a/tests/wpt/mozilla/meta/webxr/sessionavailable.https.html.ini b/tests/wpt/mozilla/meta/webxr/sessionavailable.https.html.ini
index c59b0117b7f..7ba0583f901 100644
--- a/tests/wpt/mozilla/meta/webxr/sessionavailable.https.html.ini
+++ b/tests/wpt/mozilla/meta/webxr/sessionavailable.https.html.ini
@@ -1,4 +1,4 @@
[sessionavailable.https.html]
- expected: ERROR
+ expected: TIMEOUT
[Requesting immersive session in a sessionavailable handler should succeed]
expected: TIMEOUT
diff --git a/tests/wpt/tests/tools/wptrunner/wptrunner/executors/executorservo.py b/tests/wpt/tests/tools/wptrunner/wptrunner/executors/executorservo.py
index 9c938b6e75e..c23f7632c9e 100644
--- a/tests/wpt/tests/tools/wptrunner/wptrunner/executors/executorservo.py
+++ b/tests/wpt/tests/tools/wptrunner/wptrunner/executors/executorservo.py
@@ -78,6 +78,7 @@ class ServoExecutor(ProcessTestExecutor):
args += ["--user-stylesheet", stylesheet]
for pref, value in self.environment.get('prefs', {}).items():
args += ["--pref", f"{pref}={value}"]
+ args += ["--prefs-file", "resources/wpt-prefs.json"]
if self.browser.ca_certificate_path:
args += ["--certificate-path", self.browser.ca_certificate_path]
if extra_args: