зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1681968 - [marionette] Remove unused wins map from Marionette driver module r=marionette-reviewers,whimboo
Depends on D98781 Differential Revision: https://phabricator.services.mozilla.com/D99462
This commit is contained in:
Родитель
d22631c4d7
Коммит
b4654f4fca
|
@ -487,59 +487,6 @@ browser.Context = class {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The window storage is used to save browsing context ids mapped to weak
|
||||
* references of Window objects.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* let wins = new browser.Windows();
|
||||
* wins.set(browser.browsingContext.id, window);
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let win = wins.get(browser.browsingContext.id);
|
||||
*
|
||||
*/
|
||||
browser.Windows = class extends Map {
|
||||
/**
|
||||
* Save a weak reference to the Window object.
|
||||
*
|
||||
* @param {string} id
|
||||
* Browsing context id.
|
||||
* @param {Window} win
|
||||
* Window object to save.
|
||||
*
|
||||
* @return {browser.Windows}
|
||||
* Instance of self.
|
||||
*/
|
||||
set(id, win) {
|
||||
let wref = Cu.getWeakReference(win);
|
||||
super.set(id, wref);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the window object stored by provided |id|.
|
||||
*
|
||||
* @param {string} id
|
||||
* Browsing context id.
|
||||
*
|
||||
* @return {Window}
|
||||
* Saved window object.
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* If |id| is not in the store.
|
||||
*/
|
||||
get(id) {
|
||||
let wref = super.get(id);
|
||||
if (!wref) {
|
||||
throw new RangeError();
|
||||
}
|
||||
return wref.get();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Marionette representation of the {@link ChromeWindow} window state.
|
||||
*
|
||||
|
|
|
@ -119,7 +119,6 @@ this.GeckoDriver = function(server) {
|
|||
this._server = server;
|
||||
|
||||
this.sessionID = null;
|
||||
this.wins = new browser.Windows();
|
||||
this.browsers = {};
|
||||
|
||||
// Maps permanentKey to browsing context id: WeakMap.<Object, number>
|
||||
|
@ -517,11 +516,6 @@ GeckoDriver.prototype.addBrowser = function(win) {
|
|||
|
||||
this.browsers[winId] = context;
|
||||
this.curBrowser = this.browsers[winId];
|
||||
if (!this.wins.has(winId)) {
|
||||
// add this to seenItems so we can guarantee
|
||||
// the user will get winId as this window's id
|
||||
this.wins.set(winId, win);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -631,9 +625,6 @@ GeckoDriver.prototype.registerBrowser = function(browserElement) {
|
|||
) {
|
||||
this.curBrowser.register(browserElement);
|
||||
}
|
||||
|
||||
const browsingContext = browserElement.browsingContext;
|
||||
this.wins.set(browsingContext.id, browsingContext.currentWindowGlobal);
|
||||
};
|
||||
|
||||
GeckoDriver.prototype.registerPromise = function() {
|
||||
|
@ -1682,7 +1673,7 @@ GeckoDriver.prototype.switchToWindow = async function(cmd) {
|
|||
* Find a specific window according to some filter function.
|
||||
*
|
||||
* @param {Iterable.<Window>} winIterable
|
||||
* Iterable that emits Windows.
|
||||
* Iterable that emits Window objects.
|
||||
* @param {function(Window, number): boolean} filter
|
||||
* A callback function taking two arguments; the window and
|
||||
* the outerId of the window, and returning a boolean indicating
|
||||
|
|
Загрузка…
Ссылка в новой задаче