Bug 1430077 - Separate clearing session state from deregistering listeners. r=whimboo

With the forthcoming window tracking changes the message listeners of
the content frame script are left listening for the duration of the
Marionette lifetime, and not for the duration of the Marionette session.

To prepare for the window tracking refactoring, we will want to
remove message listeners separately from clearing the session state.
Functionally, this patch changes nothing in Marionette for the moment,
except we send two IPC messages to the frame script instead of one.

MozReview-Commit-ID: DwVBCpvk9V9

--HG--
extra : rebase_source : d473a51209eeaf20967303af5aec7376e38fd283
This commit is contained in:
Andreas Tolfsen 2018-01-12 13:30:23 +00:00
Родитель b70e3acf47
Коммит 681ae6c180
2 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -2767,6 +2767,7 @@ GeckoDriver.prototype.deleteSession = function() {
// frame scripts can be safely reused
Preferences.set(CONTENT_LISTENER_PREF, false);
globalMessageManager.broadcastAsyncMessage("Marionette:Session:Delete");
globalMessageManager.broadcastAsyncMessage("Marionette:Deregister");
for (let win of this.windows) {

Просмотреть файл

@ -558,6 +558,7 @@ function startListeners() {
addMessageListener("Marionette:reftestWait", reftestWaitFn);
addMessageListener("Marionette:releaseActions", releaseActionsFn);
addMessageListener("Marionette:sendKeysToElement", sendKeysToElementFn);
addMessageListener("Marionette:Session:Delete", deleteSession);
addMessageListener("Marionette:singleTap", singleTapFn);
addMessageListener("Marionette:switchToFrame", switchToFrame);
addMessageListener("Marionette:switchToParentFrame", switchToParentFrame);
@ -595,13 +596,16 @@ function deregister() {
removeMessageListener("Marionette:refresh", refresh);
removeMessageListener("Marionette:releaseActions", releaseActionsFn);
removeMessageListener("Marionette:sendKeysToElement", sendKeysToElementFn);
removeMessageListener("Marionette:Session:Delete", deleteSession);
removeMessageListener("Marionette:singleTap", singleTapFn);
removeMessageListener("Marionette:switchToFrame", switchToFrame);
removeMessageListener("Marionette:switchToParentFrame", switchToParentFrame);
removeMessageListener("Marionette:switchToShadowRoot", switchToShadowRootFn);
removeMessageListener("Marionette:takeScreenshot", takeScreenshotFn);
removeMessageListener("Marionette:waitForPageLoaded", waitForPageLoaded);
}
function deleteSession() {
seenEls.clear();
// reset container frame to the top-most frame
curContainer = {frame: content, shadowRoot: null};