Bug 1529300 - Remove support for legacy {ELEMENT: <UUID>} web element objects. r=ato
authorchampionshuttler <shivams2799@gmail.com>
Sat, 02 Mar 2019 15:02:44 +0000
changeset 520034 b62eba3cf3b6a42eca5dd050c440ecae0260c9ff
parent 520033 668652ce3c1c76ee4d8ad025a7a3feeaafd8b7ed
child 520035 7f427fb15eae1d9addfa9e1db9a548235561ca4d
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)
reviewersato
bugs1529300
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 1529300 - Remove support for legacy {ELEMENT: <UUID>} web element objects. r=ato Differential Revision: https://phabricator.services.mozilla.com/D21667
testing/geckodriver/CHANGES.md
testing/geckodriver/src/command.rs
testing/geckodriver/src/marionette.rs
testing/webdriver/src/actions.rs
--- a/testing/geckodriver/CHANGES.md
+++ b/testing/geckodriver/CHANGES.md
@@ -4,16 +4,25 @@ Change log
 All notable changes to this program is documented in this file.
 
 
 Unreleased
 ----------
 
 ### Removed
 
+- Dropped support for legacy Selenium web element references
+
+  The legacy way of serialising web elements, using `{"ELEMENT": <UUID>}`,
+  has been removed in this release.  This may break older Selenium
+  clients and clients which are otherwise not compatible with the
+  WebDriver standard.
+
+  Thanks to Shivam Singhal for this patch.
+
 - Removed `--webdriver-port` command-line option
 
   `--webdriver-port <PORT>` was an undocumented alias for `--port`,
   initially used for backwards compatibility with clients
   prior to Selenium 3.0.0.
 
 ### Changed
 
--- a/testing/geckodriver/src/command.rs
+++ b/testing/geckodriver/src/command.rs
@@ -9,17 +9,16 @@ use std::fs::File;
 use std::io::prelude::*;
 use uuid::Uuid;
 use webdriver::command::{WebDriverCommand, WebDriverExtensionCommand};
 use webdriver::common::WebElement;
 use webdriver::error::{ErrorStatus, WebDriverError, WebDriverResult};
 use webdriver::httpapi::WebDriverExtensionRoute;
 
 pub const CHROME_ELEMENT_KEY: &'static str = "chromeelement-9fc5-4b51-a3c8-01716eedeb04";
-pub const LEGACY_ELEMENT_KEY: &'static str = "ELEMENT";
 
 pub fn extension_routes() -> Vec<(Method, &'static str, GeckoExtensionRoute)> {
     return vec![
         (
             Method::GET,
             "/session/{sessionId}/moz/context",
             GeckoExtensionRoute::GetContext,
         ),
--- a/testing/geckodriver/src/marionette.rs
+++ b/testing/geckodriver/src/marionette.rs
@@ -1,12 +1,11 @@
 use crate::command::{
     AddonInstallParameters, AddonUninstallParameters, GeckoContextParameters,
     GeckoExtensionCommand, GeckoExtensionRoute, XblLocatorParameters, CHROME_ELEMENT_KEY,
-    LEGACY_ELEMENT_KEY,
 };
 use mozprofile::preferences::Pref;
 use mozprofile::profile::Profile;
 use mozrunner::runner::{FirefoxProcess, FirefoxRunner, Runner, RunnerProcess};
 use serde::de::{self, Deserialize, Deserializer};
 use serde::ser::{Serialize, Serializer};
 use serde_json::{self, Map, Value};
 use std::error::Error;
@@ -388,22 +387,20 @@ impl MarionetteSession {
             json_data.as_object(),
             ErrorStatus::UnknownError,
             "Failed to convert data to an object"
         );
 
         let chrome_element = data.get(CHROME_ELEMENT_KEY);
         let element = data.get(ELEMENT_KEY);
         let frame = data.get(FRAME_KEY);
-        let legacy_element = data.get(LEGACY_ELEMENT_KEY);
         let window = data.get(WINDOW_KEY);
 
         let value = try_opt!(
             element
-                .or(legacy_element)
                 .or(chrome_element)
                 .or(frame)
                 .or(window),
             ErrorStatus::UnknownError,
             "Failed to extract web element from Marionette response"
         );
         let id = try_opt!(
             value.as_str(),
--- a/testing/webdriver/src/actions.rs
+++ b/testing/webdriver/src/actions.rs
@@ -924,17 +924,16 @@ mod test {
     }
 
     #[test]
     fn test_json_pointer_action_move_with_origin_webelement_and_legacy_element() {
         let json = r#"{
             "type":"pointerMove",
             "duration":100,
             "origin":{
-                "ELEMENT":"elem",
                 "element-6066-11e4-a52e-4f735466cecf":"elem"
             },
             "x":5,
             "y":10
         }"#;
         let data = PointerAction::Move(PointerMoveAction {
             duration: Some(100),
             origin: PointerOrigin::Element(WebElement { id: "elem".into() }),
@@ -946,17 +945,17 @@ mod test {
     }
 
     #[test]
     fn test_json_pointer_action_move_with_origin_only_legacy_element() {
         let json = r#"{
             "type":"pointerMove",
             "duration":100,
             "origin":{
-                "ELEMENT":"elem"
+                "element-6066-11e4-a52e-4f735466cecf":"elem"
             },
             "x":5,
             "y":10
         }"#;
 
         assert!(serde_json::from_str::<PointerOrigin>(&json).is_err());
     }