Bug 1239552 - Disable frame script global scope; r?automatedtester
By default, frame scripts each have their own scope, so they can declare
global variables without causing conflicts with any other frame scripts.
The current code switches off that behaviour, meaning that the script's
scope is shared with any other frame scripts in the same frame.
This patch changes it so that each loaded frame script gets its own
scope. This works around the problem that on Windows in officially
branded builds, IPC message handlers are registered twice causing a race
condition in the IPC communication between driver.js and listener.js.
This is not a solution for fixing the core of the problem.
MozReview-Commit-ID: Fcjmi7tq5eA
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -334,17 +334,20 @@ GeckoDriver.prototype.whenBrowserStarted
// so send the ack here. Otherwise, make a note of how many child scripts
// will be loaded so we known when it's safe to return.
if (mm.childCount !== 0) {
this.curBrowser.frameRegsPending = mm.childCount;
}
}
if (!Preferences.get(CONTENT_LISTENER_PREF) || !isNewSession) {
- mm.loadFrameScript(FRAME_SCRIPT, true, true);
+ // load listener into the remote frame
+ // and any applicable new frames
+ // opened after this call
+ mm.loadFrameScript(FRAME_SCRIPT, true);
Preferences.set(CONTENT_LISTENER_PREF, true);
}
} else {
logger.error(
`Could not load listener into content for page ${win.location.href}`);
}
};