Bug 1529976 - only parse spec capabilities that are objects. r=jgraham
authorAlexis Beingessner <a.beingessner@gmail.com>
Tue, 26 Feb 2019 18:12:05 +0000
changeset 519079 2a9b9f7b3b695a07705960bd2ddc3824f2e21357
parent 519078 1165806614a45faf998da7ffe8f670e94a5f9030
child 519080 8c60d3a2fcc499bac3e232d666ff4491143085e6
child 519081 e6333b7c1331dd7c04d27cbf51c8e25eb201d8b3
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham
bugs1529976
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1529976 - only parse spec capabilities that are objects. r=jgraham Differential Revision: https://phabricator.services.mozilla.com/D21237
testing/webdriver/src/command.rs
--- a/testing/webdriver/src/command.rs
+++ b/testing/webdriver/src/command.rs
@@ -444,16 +444,19 @@ pub enum NewSessionParameters {
 
 impl<'de> Deserialize<'de> for NewSessionParameters {
     fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
     where
         D: Deserializer<'de>,
     {
         let value = serde_json::Value::deserialize(deserializer)?;
         if let Some(caps) = value.get("capabilities") {
+            if !caps.is_object() {
+                return Err(de::Error::custom("capabilities must be objects"));
+            }
             let caps = SpecNewSessionParameters::deserialize(caps).map_err(de::Error::custom)?;
             return Ok(NewSessionParameters::Spec(caps));
         }
 
         warn!("You are using deprecated legacy session negotiation patterns (desiredCapabilities/requiredCapabilities), see https://developer.mozilla.org/en-US/docs/Web/WebDriver/Capabilities#Legacy");
         let legacy = LegacyNewSessionParameters::deserialize(value).map_err(de::Error::custom)?;
         Ok(NewSessionParameters::Legacy(legacy))
     }