mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1669174 - [marionette] Don't use Framescript when actors are enabled. r=marionette-reviewers,jgraham
Differential Revision: https://phabricator.services.mozilla.com/D99586
This commit is contained in:
parent
901717c85b
commit
014299c618
@ -146,10 +146,12 @@ this.GeckoDriver = function(server) {
|
||||
this.capabilities = new Capabilities();
|
||||
|
||||
this.mm = globalMessageManager;
|
||||
this.listener = proxy.toListener(
|
||||
this.sendAsync.bind(this),
|
||||
() => this.curBrowser
|
||||
);
|
||||
if (!MarionettePrefs.useActors) {
|
||||
this.listener = proxy.toListener(
|
||||
this.sendAsync.bind(this),
|
||||
() => this.curBrowser
|
||||
);
|
||||
}
|
||||
|
||||
// used for modal dialogs or tab modal alerts
|
||||
this.dialog = null;
|
||||
@ -281,7 +283,7 @@ GeckoDriver.prototype.QueryInterface = ChromeUtils.generateQI([
|
||||
|
||||
GeckoDriver.prototype.init = function() {
|
||||
if (MarionettePrefs.useActors) {
|
||||
// When using JSWindowActors, we should not rely on framescript events
|
||||
// When using JSWindowActors, we are not relying on framescript events
|
||||
return;
|
||||
}
|
||||
|
||||
@ -551,6 +553,11 @@ GeckoDriver.prototype.startBrowser = function(window, isNewSession = false) {
|
||||
* True if this is the first time we're talking to this browser.
|
||||
*/
|
||||
GeckoDriver.prototype.whenBrowserStarted = function(window, isNewSession) {
|
||||
// Do not load the framescript when actors are used.
|
||||
if (MarionettePrefs.useActors) {
|
||||
return;
|
||||
}
|
||||
|
||||
let mm = window.messageManager;
|
||||
if (mm) {
|
||||
if (!isNewSession) {
|
||||
@ -806,12 +813,6 @@ GeckoDriver.prototype.newSession = async function(cmd) {
|
||||
logger.info("Preemptively starting accessibility service in Chrome");
|
||||
}
|
||||
|
||||
let registerBrowsers, browserListening;
|
||||
if (!MarionettePrefs.useActors) {
|
||||
registerBrowsers = this.registerPromise();
|
||||
browserListening = this.listeningPromise();
|
||||
}
|
||||
|
||||
let waitForWindow = function() {
|
||||
let windowTypes;
|
||||
switch (this.appId) {
|
||||
@ -863,6 +864,17 @@ GeckoDriver.prototype.newSession = async function(cmd) {
|
||||
}
|
||||
};
|
||||
|
||||
let registerBrowsers;
|
||||
let browserListening;
|
||||
|
||||
if (MarionettePrefs.useActors) {
|
||||
registerCommandsActor();
|
||||
registerEventsActor();
|
||||
} else {
|
||||
registerBrowsers = this.registerPromise();
|
||||
browserListening = this.listeningPromise();
|
||||
}
|
||||
|
||||
if (!MarionettePrefs.contentListener) {
|
||||
waitForWindow.call(this);
|
||||
} else if (this.appId != APP_ID_FIREFOX && this.curBrowser === null) {
|
||||
@ -890,11 +902,6 @@ GeckoDriver.prototype.newSession = async function(cmd) {
|
||||
await browserListening;
|
||||
}
|
||||
|
||||
if (MarionettePrefs.useActors) {
|
||||
registerCommandsActor();
|
||||
registerEventsActor();
|
||||
}
|
||||
|
||||
if (this.mainFrame) {
|
||||
this.chromeBrowsingContext = this.mainFrame.browsingContext;
|
||||
this.mainFrame.focus();
|
||||
@ -3069,7 +3076,13 @@ GeckoDriver.prototype.closeChromeWindow = async function() {
|
||||
|
||||
/** Delete Marionette session. */
|
||||
GeckoDriver.prototype.deleteSession = function() {
|
||||
if (this.curBrowser !== null) {
|
||||
if (MarionettePrefs.useActors) {
|
||||
clearActionInputState();
|
||||
clearElementIdCache();
|
||||
|
||||
unregisterCommandsActor();
|
||||
unregisterEventsActor();
|
||||
} else if (this.curBrowser !== null) {
|
||||
// frame scripts can be safely reused
|
||||
MarionettePrefs.contentListener = false;
|
||||
|
||||
@ -3087,14 +3100,6 @@ GeckoDriver.prototype.deleteSession = function() {
|
||||
}
|
||||
}
|
||||
|
||||
if (MarionettePrefs.useActors) {
|
||||
clearElementIdCache();
|
||||
clearActionInputState();
|
||||
|
||||
unregisterCommandsActor();
|
||||
unregisterEventsActor();
|
||||
}
|
||||
|
||||
// reset to the top-most frame, and clear browsing context references
|
||||
this.mainFrame = null;
|
||||
this.chromeBrowsingContext = null;
|
||||
@ -3711,10 +3716,6 @@ GeckoDriver.prototype.receiveMessage = function(message) {
|
||||
return { frameId: message.json.frameId };
|
||||
|
||||
case "Marionette:ListenersAttached":
|
||||
if (MarionettePrefs.useActors) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.json.frameId === this.curBrowser.curFrameId) {
|
||||
const browsingContext = BrowsingContext.get(message.json.frameId);
|
||||
|
||||
|
@ -146,9 +146,7 @@ let executeScriptFn = dispatch(executeScript);
|
||||
let sendKeysToElementFn = dispatch(sendKeysToElement);
|
||||
|
||||
function startListeners() {
|
||||
if (!MarionettePrefs.useActors) {
|
||||
eventDispatcher.enable();
|
||||
}
|
||||
eventDispatcher.enable();
|
||||
|
||||
addMessageListener("Marionette:actionChain", actionChainFn);
|
||||
addMessageListener("Marionette:clearElement", clearElementFn);
|
||||
@ -190,9 +188,7 @@ function startListeners() {
|
||||
}
|
||||
|
||||
function deregister() {
|
||||
if (!MarionettePrefs.useActors) {
|
||||
eventDispatcher.disable();
|
||||
}
|
||||
eventDispatcher.disable();
|
||||
|
||||
removeMessageListener("Marionette:actionChain", actionChainFn);
|
||||
removeMessageListener("Marionette:clearElement", clearElementFn);
|
||||
|
Loading…
Reference in New Issue
Block a user