зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1612831 - [marionette] Remove no longer used handling of pending commands. r=marionette-reviewers,maja_zf
Now that all the navigation related code runs in the parent process there is no need anymore for handling pending commands. This was only necessary for navigation commands which could have caused remoteness changes and as such new instances of the framescript. In these cases the reply cannot be sent to the client unless the command has been finished. Differential Revision: https://phabricator.services.mozilla.com/D89717
This commit is contained in:
Родитель
2866bc388a
Коммит
fbcb446781
|
@ -176,14 +176,6 @@ browser.Context = class {
|
|||
// being the currently selected tab.
|
||||
this.tab = null;
|
||||
|
||||
// Commands which trigger a navigation can cause the frame script to be
|
||||
// moved to a different process. To not loose the currently active
|
||||
// command, or any other already pushed following command, store them as
|
||||
// long as they haven't been fully processed. The commands get flushed
|
||||
// after a new browser has been registered.
|
||||
this.pendingCommands = [];
|
||||
this._needsFlushPendingCommands = false;
|
||||
|
||||
this.frameRegsPending = 0;
|
||||
|
||||
this.getIdForBrowser = driver.getIdForBrowser.bind(driver);
|
||||
|
@ -509,45 +501,12 @@ browser.Context = class {
|
|||
|
||||
if (target === this.contentBrowser) {
|
||||
this.updateIdForBrowser(this.contentBrowser, uid);
|
||||
this._needsFlushPendingCommands = true;
|
||||
}
|
||||
}
|
||||
|
||||
// used to delete sessions
|
||||
this.knownFrames.push(uid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush any queued pending commands.
|
||||
*
|
||||
* Needs to be run after a process change for the frame script.
|
||||
*/
|
||||
flushPendingCommands() {
|
||||
if (!this._needsFlushPendingCommands) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.pendingCommands.forEach(cb => cb());
|
||||
this._needsFlushPendingCommands = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function intercepts commands interacting with content and queues
|
||||
* or executes them as needed.
|
||||
*
|
||||
* No commands interacting with content are safe to process until
|
||||
* the new listener script is loaded and registered itself.
|
||||
* This occurs when a command whose effect is asynchronous (such
|
||||
* as goBack) results in process change of the frame script and new
|
||||
* commands are subsequently posted to the server.
|
||||
*/
|
||||
executeWhenReady(cb) {
|
||||
if (this._needsFlushPendingCommands) {
|
||||
this.pendingCommands.push(cb);
|
||||
} else {
|
||||
cb();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -358,16 +358,14 @@ GeckoDriver.prototype.sendAsync = function(name, data, commandID) {
|
|||
payload.commandID = commandID;
|
||||
}
|
||||
|
||||
this.curBrowser.executeWhenReady(() => {
|
||||
if (this.curBrowser.curFrameId) {
|
||||
let target = `Marionette:${name}`;
|
||||
this.curBrowser.messageManager.sendAsyncMessage(target, payload);
|
||||
} else {
|
||||
throw new error.NoSuchWindowError(
|
||||
"No such content frame; perhaps the listener was not registered?"
|
||||
);
|
||||
}
|
||||
});
|
||||
if (this.curBrowser.curFrameId) {
|
||||
let target = `Marionette:${name}`;
|
||||
this.curBrowser.messageManager.sendAsyncMessage(target, payload);
|
||||
} else {
|
||||
throw new error.NoSuchWindowError(
|
||||
"No such content frame; perhaps the listener was not registered?"
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -3506,8 +3504,6 @@ GeckoDriver.prototype.receiveMessage = function(message) {
|
|||
);
|
||||
this.contentBrowsingContext = browsingContext;
|
||||
}
|
||||
|
||||
this.curBrowser.flushPendingCommands();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -3517,12 +3513,6 @@ GeckoDriver.prototype.receiveMessage = function(message) {
|
|||
};
|
||||
/* eslint-enable consistent-return */
|
||||
|
||||
GeckoDriver.prototype.responseCompleted = function() {
|
||||
if (this.curBrowser !== null) {
|
||||
this.curBrowser.pendingCommands = [];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieve the localized string for the specified entity id.
|
||||
*
|
||||
|
|
|
@ -372,7 +372,6 @@ class TCPConnection {
|
|||
* The response to send back to the client.
|
||||
*/
|
||||
sendToClient(resp) {
|
||||
this.driver.responseCompleted();
|
||||
this.sendMessage(resp);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче