зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1819029 - [marionette] Fix returning response wrapped in "value" field. r=webdriver-reviewers,jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D171084
This commit is contained in:
Родитель
fef088321a
Коммит
db752eaf4c
|
@ -645,7 +645,7 @@ GeckoDriver.prototype.getContext = function() {
|
|||
* If an element that was passed as part of <var>args</var> or that is
|
||||
* returned as result has gone stale.
|
||||
*/
|
||||
GeckoDriver.prototype.executeScript = async function(cmd) {
|
||||
GeckoDriver.prototype.executeScript = function(cmd) {
|
||||
let { script, args } = cmd.parameters;
|
||||
let opts = {
|
||||
script: cmd.parameters.script,
|
||||
|
@ -656,7 +656,7 @@ GeckoDriver.prototype.executeScript = async function(cmd) {
|
|||
line: cmd.parameters.line,
|
||||
};
|
||||
|
||||
return { value: await this.execute_(script, args, opts) };
|
||||
return this.execute_(script, args, opts);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -717,7 +717,7 @@ GeckoDriver.prototype.executeScript = async function(cmd) {
|
|||
* If an element that was passed as part of <var>args</var> or that is
|
||||
* returned as result has gone stale.
|
||||
*/
|
||||
GeckoDriver.prototype.executeAsyncScript = async function(cmd) {
|
||||
GeckoDriver.prototype.executeAsyncScript = function(cmd) {
|
||||
let { script, args } = cmd.parameters;
|
||||
let opts = {
|
||||
script: cmd.parameters.script,
|
||||
|
@ -729,7 +729,7 @@ GeckoDriver.prototype.executeAsyncScript = async function(cmd) {
|
|||
async: true,
|
||||
};
|
||||
|
||||
return { value: await this.execute_(script, args, opts) };
|
||||
return this.execute_(script, args, opts);
|
||||
};
|
||||
|
||||
GeckoDriver.prototype.execute_ = async function(
|
||||
|
@ -2958,7 +2958,7 @@ GeckoDriver.prototype.setupReftest = async function(cmd) {
|
|||
};
|
||||
|
||||
/** Run a reftest. */
|
||||
GeckoDriver.prototype.runReftest = async function(cmd) {
|
||||
GeckoDriver.prototype.runReftest = function(cmd) {
|
||||
let {
|
||||
test,
|
||||
references,
|
||||
|
@ -2979,17 +2979,15 @@ GeckoDriver.prototype.runReftest = async function(cmd) {
|
|||
lazy.assert.string(expected);
|
||||
lazy.assert.array(references);
|
||||
|
||||
return {
|
||||
value: await this._reftest.run(
|
||||
test,
|
||||
references,
|
||||
expected,
|
||||
timeout,
|
||||
pageRanges,
|
||||
width,
|
||||
height
|
||||
),
|
||||
};
|
||||
return this._reftest.run(
|
||||
test,
|
||||
references,
|
||||
expected,
|
||||
timeout,
|
||||
pageRanges,
|
||||
width,
|
||||
height
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -3088,9 +3086,7 @@ GeckoDriver.prototype.print = async function(cmd) {
|
|||
printSettings
|
||||
);
|
||||
|
||||
return {
|
||||
value: btoa(binaryString),
|
||||
};
|
||||
return btoa(binaryString);
|
||||
};
|
||||
|
||||
GeckoDriver.prototype.setPermission = async function(cmd) {
|
||||
|
|
|
@ -16,7 +16,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
MarionettePrefs: "chrome://remote/content/marionette/prefs.sys.mjs",
|
||||
Message: "chrome://remote/content/marionette/message.sys.mjs",
|
||||
Response: "chrome://remote/content/marionette/message.sys.mjs",
|
||||
WebReference: "chrome://remote/content/marionette/element.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
|
||||
|
@ -302,11 +301,37 @@ export class TCPConnection {
|
|||
|
||||
let rv = await fn.bind(this.driver)(cmd);
|
||||
|
||||
// Bug 1819029: Some older commands cannot return a response wrapped within
|
||||
// a value field because it would break compatibility with geckodriver and
|
||||
// Marionette client. It's unlikely that we are going to fix that.
|
||||
//
|
||||
// Warning: No more commands should be added to this list!
|
||||
const commandsNoValueResponse = [
|
||||
"Marionette:Quit",
|
||||
"WebDriver:FindElements",
|
||||
"WebDriver:CloseChromeWindow",
|
||||
"WebDriver:CloseWindow",
|
||||
"WebDriver:FullscreenWindow",
|
||||
"WebDriver:GetCookies",
|
||||
"WebDriver:GetElementRect",
|
||||
"WebDriver:GetTimeouts",
|
||||
"WebDriver:GetWindowHandles",
|
||||
"WebDriver:GetWindowRect",
|
||||
"WebDriver:MaximizeWindow",
|
||||
"WebDriver:MinimizeWindow",
|
||||
"WebDriver:NewSession",
|
||||
"WebDriver:NewWindow",
|
||||
"WebDriver:SetWindowRect",
|
||||
];
|
||||
|
||||
if (rv != null) {
|
||||
if (lazy.WebReference.isReference(rv) || typeof rv != "object") {
|
||||
resp.body = { value: rv };
|
||||
} else {
|
||||
// By default the Response' constructor sets the body to `{ value: null }`.
|
||||
// As such we only want to override the value if it's neither `null` nor
|
||||
// `undefined`.
|
||||
if (commandsNoValueResponse.includes(cmd.name)) {
|
||||
resp.body = rv;
|
||||
} else {
|
||||
resp.body.value = rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -442,7 +442,9 @@ class TestQuitRestart(MarionetteTestCase):
|
|||
|
||||
self.marionette.start_session()
|
||||
|
||||
@unittest.skipIf(mozinfo.info["ccov"], "Bug 1789085 - Lost ServerSocket connection")
|
||||
@unittest.skipIf(
|
||||
mozinfo.info.get("ccov"), "Bug 1789085 - Lost ServerSocket connection"
|
||||
)
|
||||
def test_in_app_quit_with_callback_that_raises_an_exception(self):
|
||||
def errorneous_callback():
|
||||
raise Exception("foo")
|
||||
|
|
|
@ -1,16 +1,4 @@
|
|||
[get.py]
|
||||
[test_primitives[js_primitive2-py_primitive2\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_primitives[js_primitive3-py_primitive3\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_primitives_set_by_execute_script[js_primitive2-py_primitive2\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_primitives_set_by_execute_script[js_primitive3-py_primitive3\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_web_reference[frame-Frame\]]
|
||||
bug: 1274251
|
||||
expected: FAIL
|
||||
|
|
Загрузка…
Ссылка в новой задаче