Bug 1489814 - Add 'populate' parameter in 'tabs.highlight'. r=mixedpuppy

Differential Revision: https://phabricator.services.mozilla.com/D7240

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Oriol Brufau 2018-10-05 13:42:33 +00:00
Родитель 5fef7a02a1
Коммит 82cfa8e2d9
3 изменённых файлов: 11 добавлений и 2 удалений

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

@ -1282,7 +1282,7 @@ this.tabs = class extends ExtensionAPI {
if (!gMultiSelectEnabled) {
throw new ExtensionError(`tabs.highlight is currently experimental and must be enabled with the ${MULTISELECT_PREFNAME} preference.`);
}
let {windowId, tabs} = highlightInfo;
let {windowId, tabs, populate} = highlightInfo;
if (windowId == null) {
windowId = Window.WINDOW_ID_CURRENT;
}
@ -1299,7 +1299,7 @@ this.tabs = class extends ExtensionAPI {
}
return tab;
});
return windowManager.convert(window, {populate: true});
return windowManager.convert(window, {populate});
},
},
};

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

@ -800,6 +800,12 @@
"description": "The window that contains the tabs.",
"minimum": -2
},
"populate": {
"type": "boolean",
"optional": true,
"default": true,
"description": "If true, the $(ref:windows.Window) returned will have a <var>tabs</var> property that contains a list of the $(ref:tabs.Tab) objects. The <code>Tab</code> objects only contain the <code>url</code>, <code>title</code> and <code>favIconUrl</code> properties if the extension's manifest file includes the <code>\"tabs\"</code> permission. If false, the $(ref:windows.Window) won't have the <var>tabs</var> property."
},
"tabs": {
"description": "One or more tab indices to highlight.",
"choices": [

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

@ -68,6 +68,9 @@ add_task(async function test_highlighted() {
browser.test.assertEq(3, window.tabs.length, "Returned window should be populated");
window = await browser.tabs.highlight({tabs: 2, populate: false});
browser.test.assertFalse("tabs" in window, "Returned window shouldn't be populated");
browser.test.notifyPass("test-finished");
},
});