Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 937fd4a

Browse files
committed
Backed out 4 changesets (bug 1604506, bug 1602547, bug 1602544) for failing at /printcmd.py and /user_prompts.py
Backed out changeset cad798d12930 (bug 1602544) Backed out changeset 531ee079b538 (bug 1604506) Backed out changeset 29c893010729 (bug 1604506) Backed out changeset 43fd1d4b1ba1 (bug 1602547)
1 parent 7e10ffb commit 937fd4a

6 files changed

Lines changed: 1 addition & 526 deletions

File tree

testing/geckodriver/src/command.rs

Lines changed: 0 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ pub fn extension_routes() -> Vec<(Method, &'static str, GeckoExtensionRoute)> {
5252
"/session/{sessionId}/moz/screenshot/full",
5353
GeckoExtensionRoute::TakeFullScreenshot,
5454
),
55-
(
56-
Method::POST,
57-
"/session/{sessionId}/moz/print",
58-
GeckoExtensionRoute::Print,
59-
),
6055
];
6156
}
6257

@@ -69,7 +64,6 @@ pub enum GeckoExtensionRoute {
6964
InstallAddon,
7065
UninstallAddon,
7166
TakeFullScreenshot,
72-
Print,
7367
}
7468

7569
impl WebDriverExtensionRoute for GeckoExtensionRoute {
@@ -114,7 +108,6 @@ impl WebDriverExtensionRoute for GeckoExtensionRoute {
114108
GeckoExtensionCommand::UninstallAddon(serde_json::from_value(body_data.clone())?)
115109
}
116110
TakeFullScreenshot => GeckoExtensionCommand::TakeFullScreenshot,
117-
Print => GeckoExtensionCommand::Print(serde_json::from_value(body_data.clone())?),
118111
};
119112

120113
Ok(WebDriverCommand::Extension(command))
@@ -130,7 +123,6 @@ pub enum GeckoExtensionCommand {
130123
InstallAddon(AddonInstallParameters),
131124
UninstallAddon(AddonUninstallParameters),
132125
TakeFullScreenshot,
133-
Print(PrintParameters),
134126
}
135127

136128
impl WebDriverExtensionCommand for GeckoExtensionCommand {
@@ -144,7 +136,6 @@ impl WebDriverExtensionCommand for GeckoExtensionCommand {
144136
XblAnonymousByAttribute(_, x) => Some(serde_json::to_value(x).unwrap()),
145137
XblAnonymousChildren(_) => None,
146138
TakeFullScreenshot => None,
147-
Print(x) => Some(serde_json::to_value(x).unwrap()),
148139
}
149140
}
150141
}
@@ -241,113 +232,6 @@ pub struct LogOptions {
241232
pub level: Option<logging::Level>,
242233
}
243234

244-
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
245-
#[serde(default, rename_all = "camelCase")]
246-
pub struct PrintParameters {
247-
pub orientation: PrintOrientation,
248-
#[serde(deserialize_with = "deserialize_to_print_scale_f64")]
249-
pub scale: f64,
250-
pub background: bool,
251-
pub page: PrintPage,
252-
pub margin: PrintMargins,
253-
pub page_ranges: Vec<String>,
254-
pub shrink_to_fit: bool,
255-
}
256-
257-
impl Default for PrintParameters {
258-
fn default() -> Self {
259-
PrintParameters {
260-
orientation: PrintOrientation::default(),
261-
scale: 1.0,
262-
background: false,
263-
page: PrintPage::default(),
264-
margin: PrintMargins::default(),
265-
page_ranges: Vec::new(),
266-
shrink_to_fit: true,
267-
}
268-
}
269-
}
270-
271-
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
272-
#[serde(rename_all = "lowercase")]
273-
pub enum PrintOrientation {
274-
Landscape,
275-
Portrait,
276-
}
277-
278-
impl Default for PrintOrientation {
279-
fn default() -> Self {
280-
PrintOrientation::Portrait
281-
}
282-
}
283-
284-
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
285-
#[serde(default)]
286-
pub struct PrintPage {
287-
#[serde(deserialize_with = "deserialize_to_positive_f64")]
288-
pub width: f64,
289-
#[serde(deserialize_with = "deserialize_to_positive_f64")]
290-
pub height: f64,
291-
}
292-
293-
impl Default for PrintPage {
294-
fn default() -> Self {
295-
PrintPage {
296-
width: 21.59,
297-
height: 27.94,
298-
}
299-
}
300-
}
301-
302-
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
303-
#[serde(default)]
304-
pub struct PrintMargins {
305-
#[serde(deserialize_with = "deserialize_to_positive_f64")]
306-
pub top: f64,
307-
#[serde(deserialize_with = "deserialize_to_positive_f64")]
308-
pub bottom: f64,
309-
#[serde(deserialize_with = "deserialize_to_positive_f64")]
310-
pub left: f64,
311-
#[serde(deserialize_with = "deserialize_to_positive_f64")]
312-
pub right: f64,
313-
}
314-
315-
impl Default for PrintMargins {
316-
fn default() -> Self {
317-
PrintMargins {
318-
top: 1.0,
319-
bottom: 1.0,
320-
left: 1.0,
321-
right: 1.0,
322-
}
323-
}
324-
}
325-
326-
fn deserialize_to_positive_f64<'de, D>(deserializer: D) -> Result<f64, D::Error>
327-
where
328-
D: Deserializer<'de>,
329-
{
330-
let val = f64::deserialize(deserializer)?;
331-
if val < 0.0 {
332-
return Err(de::Error::custom(format!("{} is negative", val)));
333-
};
334-
Ok(val)
335-
}
336-
337-
fn deserialize_to_print_scale_f64<'de, D>(deserializer: D) -> Result<f64, D::Error>
338-
where
339-
D: Deserializer<'de>,
340-
{
341-
let val = f64::deserialize(deserializer)?;
342-
if val < 0.1 || val > 2.0 {
343-
return Err(de::Error::custom(format!(
344-
"{} is outside range 0.1-2",
345-
val
346-
)));
347-
};
348-
Ok(val)
349-
}
350-
351235
#[cfg(test)]
352236
mod tests {
353237
use serde_json::json;
@@ -506,36 +390,4 @@ mod tests {
506390
assert!(serde_json::from_value::<P>(json!({"name": "foo"})).is_err());
507391
assert!(serde_json::from_value::<P>(json!({"name": "foo", "value": null})).is_err());
508392
}
509-
510-
#[test]
511-
fn test_json_gecko_print_defaults() {
512-
let params = PrintParameters::default();
513-
assert_de(&params, json!({}));
514-
}
515-
516-
#[test]
517-
fn test_json_gecko_print() {
518-
let params = PrintParameters {
519-
orientation: PrintOrientation::Landscape,
520-
page: PrintPage {
521-
width: 10.0,
522-
..Default::default()
523-
},
524-
margin: PrintMargins {
525-
top: 10.0,
526-
..Default::default()
527-
},
528-
scale: 1.5,
529-
..Default::default()
530-
};
531-
assert_de(
532-
&params,
533-
json!({"orientation": "landscape", "page": {"width": 10}, "margin": {"top": 10}, "scale": 1.5}),
534-
);
535-
}
536-
537-
#[test]
538-
fn test_json_gecko_scale_invalid() {
539-
assert!(serde_json::from_value::<AddonInstallParameters>(json!({"scale": 3})).is_err());
540-
}
541393
}

testing/geckodriver/src/marionette.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use crate::android::{AndroidHandler};
22
use crate::command::{
33
AddonInstallParameters, AddonUninstallParameters, GeckoContextParameters,
4-
GeckoExtensionCommand, GeckoExtensionRoute, PrintParameters,
5-
XblLocatorParameters, CHROME_ELEMENT_KEY,
4+
GeckoExtensionCommand, GeckoExtensionRoute, XblLocatorParameters, CHROME_ELEMENT_KEY,
65
};
76
use marionette_rs::common::{
87
Cookie as MarionetteCookie, Date as MarionetteDate, Frame as MarionetteFrame,
@@ -879,7 +878,6 @@ impl MarionetteSession {
879878
InstallAddon(_) => WebDriverResponse::Generic(resp.into_value_response(true)?),
880879
UninstallAddon(_) => WebDriverResponse::Void,
881880
TakeFullScreenshot => WebDriverResponse::Generic(resp.into_value_response(true)?),
882-
Print(_) => WebDriverResponse::Generic(resp.into_value_response(true)?),
883881
},
884882
})
885883
}
@@ -1158,7 +1156,6 @@ impl MarionetteCommand {
11581156
Extension(ref extension) => match extension {
11591157
GetContext => (Some("Marionette:GetContext"), None),
11601158
InstallAddon(x) => (Some("Addon:Install"), Some(x.to_marionette())),
1161-
Print(x) => (Some("WebDriver:Print"), Some(x.to_marionette())),
11621159
SetContext(x) => (Some("Marionette:SetContext"), Some(x.to_marionette())),
11631160
UninstallAddon(x) => (Some("Addon:Uninstall"), Some(x.to_marionette())),
11641161
XblAnonymousByAttribute(e, x) => {
@@ -1535,16 +1532,6 @@ impl ToMarionette<Map<String, Value>> for GeckoContextParameters {
15351532
}
15361533
}
15371534

1538-
impl ToMarionette<Map<String, Value>> for PrintParameters {
1539-
fn to_marionette(&self) -> WebDriverResult<Map<String, Value>> {
1540-
Ok(try_opt!(
1541-
serde_json::to_value(self)?.as_object(),
1542-
ErrorStatus::UnknownError,
1543-
"Expected an object").clone()
1544-
)
1545-
}
1546-
}
1547-
15481535
impl ToMarionette<Map<String, Value>> for XblLocatorParameters {
15491536
fn to_marionette(&self) -> WebDriverResult<Map<String, Value>> {
15501537
let mut value = Map::new();

testing/marionette/assert.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -242,26 +242,6 @@ assert.number = function(obj, msg = "") {
242242
return assert.that(Number.isFinite, msg)(obj);
243243
};
244244

245-
/**
246-
* Asserts that <var>obj</var> is a positive number.
247-
*
248-
* @param {?} obj
249-
* Value to test.
250-
* @param {string=} msg
251-
* Custom error message.
252-
*
253-
* @return {number}
254-
* <var>obj</var> is returned unaltered.
255-
*
256-
* @throws {InvalidArgumentError}
257-
* If <var>obj</var> is not a positive integer.
258-
*/
259-
assert.positiveNumber = function(obj, msg = "") {
260-
assert.number(obj, msg);
261-
msg = msg || pprint`Expected ${obj} to be >= 0`;
262-
return assert.that(n => n >= 0, msg)(obj);
263-
};
264-
265245
/**
266246
* Asserts that <var>obj</var> is callable.
267247
*

0 commit comments

Comments
 (0)