Bug 1461130 - Don't convert filtered out windows in windows.getAll r=mixedpuppy

MozReview-Commit-ID: 2NkBIq5J4VF

--HG--
extra : rebase_source : 94df1ebbc40ab14b760f6ded192f0f2fb5cc6960
This commit is contained in:
Oriol Brufau 2018-05-12 20:54:01 +02:00
Родитель af3c5e06a6
Коммит d5d9fc268c
1 изменённых файлов: 6 добавлений и 8 удалений

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

@ -110,15 +110,13 @@ this.windows = class extends ExtensionAPI {
getAll: function(getInfo) {
let doNotCheckTypes = getInfo === null || getInfo.windowTypes === null;
function typeFilter(win) {
return doNotCheckTypes || getInfo.windowTypes.includes(win.type);
let windows = [];
for (let win of windowManager.getAll()) {
if (doNotCheckTypes || getInfo.windowTypes.includes(win.type)) {
windows.push(win.convert(getInfo));
}
}
let windows = Array.from(windowManager.getAll(), win => win.convert(getInfo))
.filter(typeFilter);
return Promise.resolve(windows);
return windows;
},
create: function(createData) {