mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1621385
- Account for unaccesible tabs in mobile's WindowTracker.getAll. r=mixedpuppy
Differential Revision: https://phabricator.services.mozilla.com/D66310 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
cf6ef6a24b
commit
bf7b46f3d1
@ -1221,13 +1221,6 @@ class WindowManager extends WindowManagerBase {
|
||||
return this.getWrapper(window);
|
||||
}
|
||||
|
||||
canAccessWindow(window, context) {
|
||||
return (
|
||||
(context && context.canAccessWindow(window)) ||
|
||||
this.extension.canAccessWindow(window)
|
||||
);
|
||||
}
|
||||
|
||||
*getAll(context) {
|
||||
for (let window of windowTracker.browserWindows()) {
|
||||
if (!this.canAccessWindow(window, context)) {
|
||||
|
@ -585,9 +585,15 @@ class WindowManager extends WindowManagerBase {
|
||||
return this.getWrapper(window);
|
||||
}
|
||||
|
||||
*getAll() {
|
||||
*getAll(context) {
|
||||
for (let window of windowTracker.browserWindows()) {
|
||||
yield this.getWrapper(window);
|
||||
if (!this.canAccessWindow(window, context)) {
|
||||
continue;
|
||||
}
|
||||
let wrapped = this.getWrapper(window);
|
||||
if (wrapped) {
|
||||
yield wrapped;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2070,6 +2070,23 @@ class WindowManagerBase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this window can be accessed by the extension in the given
|
||||
* context.
|
||||
*
|
||||
* @param {DOMWindow} window
|
||||
* The browser window that is being tested
|
||||
* @param {BaseContext|null} context
|
||||
* The extension context for which this test is being performed.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
canAccessWindow(window, context) {
|
||||
return (
|
||||
(context && context.canAccessWindow(window)) ||
|
||||
this.extension.canAccessWindow(window)
|
||||
);
|
||||
}
|
||||
|
||||
// The JSDoc validator does not support @returns tags in abstract functions or
|
||||
// star functions without return statements.
|
||||
/* eslint-disable valid-jsdoc */
|
||||
|
Loading…
Reference in New Issue
Block a user