mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
Bug 1423282 - Remove legacy action chain browser close guard. r=automatedtester,maja_zf
It turns out that we no longer need to guard against the browser/frame closing when using the legacy actions module. This means we can get rid of GeckoDriver#addFrameCloseListener, which again populates mozBrowserClose and adds handlers for the related mozbrowserclose event. The mozbrowsercloseevent was set for every case of Marionette:ok, Marionette:done, and Marionette:error IPC messages. These events are still in use in testing/marionette/proxy.js, but with this patch we stop listening for these events in testing/marionette/driver.js. MozReview-Commit-ID: jp34kh7nqD --HG-- extra : rebase_source : b9551972717c9c399806b7c7e1e2a1adc99593c5
This commit is contained in:
parent
abd2686324
commit
1ce25757d1
@ -136,10 +136,7 @@ this.GeckoDriver = function(appId, server) {
|
||||
this.mainFrame = null;
|
||||
// chrome iframe that currently has focus
|
||||
this.curFrame = null;
|
||||
this.mozBrowserClose = null;
|
||||
this.currentFrameElement = null;
|
||||
// frame ID of the current remote frame, used for mozbrowserclose events
|
||||
this.oopFrameId = null;
|
||||
this.observing = null;
|
||||
this._browserIds = new WeakMap();
|
||||
|
||||
@ -1843,14 +1840,8 @@ GeckoDriver.prototype.switchToFrame = async function(cmd) {
|
||||
let {win: winId, frame: frameId} = res;
|
||||
this.mm = this.curBrowser.frameManager.getFrameMM(winId, frameId);
|
||||
|
||||
let registerBrowsers = this.registerPromise();
|
||||
let browserListening = this.listeningPromise();
|
||||
|
||||
this.oopFrameId =
|
||||
this.curBrowser.frameManager.switchToFrame(winId, frameId);
|
||||
|
||||
await registerBrowsers;
|
||||
await browserListening;
|
||||
await this.registerPromise();
|
||||
await this.listeningPromise();
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -1889,7 +1880,6 @@ GeckoDriver.prototype.singleTap = async function(cmd) {
|
||||
"Command 'singleTap' is not yet available in chrome context");
|
||||
|
||||
case Context.Content:
|
||||
this.addFrameCloseListener("tap");
|
||||
await this.listener.singleTap(webEl, x, y);
|
||||
break;
|
||||
}
|
||||
@ -1970,7 +1960,6 @@ GeckoDriver.prototype.actionChain = async function(cmd, resp) {
|
||||
break;
|
||||
|
||||
case Context.Content:
|
||||
this.addFrameCloseListener("action chain");
|
||||
resp.body.value = await this.listener.actionChain(chain, nextId);
|
||||
break;
|
||||
}
|
||||
@ -1997,8 +1986,6 @@ GeckoDriver.prototype.multiAction = async function(cmd) {
|
||||
this._assertAndDismissModal();
|
||||
|
||||
let {value, max_length} = cmd.parameters; // eslint-disable-line camelcase
|
||||
|
||||
this.addFrameCloseListener("multi action chain");
|
||||
await this.listener.multiAction(value, max_length);
|
||||
};
|
||||
|
||||
@ -2151,13 +2138,6 @@ GeckoDriver.prototype.clickElement = async function(cmd) {
|
||||
break;
|
||||
|
||||
case Context.Content:
|
||||
// We need to protect against the click causing an OOP frame
|
||||
// to close. This fires the mozbrowserclose event when it closes
|
||||
// so we need to listen for it and then just send an error back.
|
||||
// The person making the call should be aware something is not right
|
||||
// and handle accordingly.
|
||||
this.addFrameCloseListener("click");
|
||||
|
||||
let click = this.listener.clickElement(
|
||||
{webElRef: webEl.toJSON(), pageTimeout: this.timeouts.pageLoad});
|
||||
|
||||
@ -3356,17 +3336,6 @@ GeckoDriver.prototype.uninstallAddon = function(cmd) {
|
||||
/* eslint-disable consistent-return */
|
||||
GeckoDriver.prototype.receiveMessage = function(message) {
|
||||
switch (message.name) {
|
||||
case "Marionette:ok":
|
||||
case "Marionette:done":
|
||||
case "Marionette:error":
|
||||
// check if we need to remove the mozbrowserclose listener
|
||||
if (this.mozBrowserClose !== null) {
|
||||
let win = this.getCurrentWindow();
|
||||
win.removeEventListener("mozbrowserclose", this.mozBrowserClose, true);
|
||||
this.mozBrowserClose = null;
|
||||
}
|
||||
break;
|
||||
|
||||
case "Marionette:switchedToFrame":
|
||||
if (message.json.restorePrevious) {
|
||||
this.currentFrameElement = this.previousFrameElement;
|
||||
|
@ -112,9 +112,6 @@ frame.Manager = class {
|
||||
* ChromeMessageBroadcaster or ChromeMessageSender.
|
||||
*/
|
||||
addMessageManagerListeners(mm) {
|
||||
mm.addWeakMessageListener("Marionette:ok", this.driver);
|
||||
mm.addWeakMessageListener("Marionette:done", this.driver);
|
||||
mm.addWeakMessageListener("Marionette:error", this.driver);
|
||||
mm.addWeakMessageListener("Marionette:emitTouchEvent", this.driver);
|
||||
mm.addWeakMessageListener("Marionette:switchedToFrame", this.driver);
|
||||
mm.addWeakMessageListener("Marionette:getVisibleCookies", this.driver);
|
||||
@ -131,9 +128,6 @@ frame.Manager = class {
|
||||
* ChromeMessageBroadcaster or ChromeMessageSender.
|
||||
*/
|
||||
removeMessageManagerListeners(mm) {
|
||||
mm.removeWeakMessageListener("Marionette:ok", this.driver);
|
||||
mm.removeWeakMessageListener("Marionette:done", this.driver);
|
||||
mm.removeWeakMessageListener("Marionette:error", this.driver);
|
||||
mm.removeWeakMessageListener("Marionette:switchedToFrame", this.driver);
|
||||
mm.removeWeakMessageListener("Marionette:getVisibleCookies", this.driver);
|
||||
mm.removeWeakMessageListener(
|
||||
|
Loading…
Reference in New Issue
Block a user