Bug 1337509 - Do not create tab objects with an unsupported 'selected' property. r?bsilverberg
MozReview-Commit-ID: 4Bi6LdNUxMo
--- a/browser/components/extensions/ext-utils.js
+++ b/browser/components/extensions/ext-utils.js
@@ -528,17 +528,16 @@ class Tab extends TabBase {
* @returns {Object}
* @static
*/
static convertFromSessionStoreClosedData(extension, tabData, window = null) {
let result = {
sessionId: String(tabData.closedId),
index: tabData.pos ? tabData.pos : 0,
windowId: window && windowTracker.getId(window),
- selected: false,
highlighted: false,
active: false,
pinned: false,
incognito: Boolean(tabData.state && tabData.state.isPrivate),
};
if (extension.tabManager.hasTabPermission(tabData)) {
let entries = tabData.state ? tabData.state.entries : tabData.entries;
--- a/browser/components/extensions/test/browser/browser_ext_sessions_getRecentlyClosed_tabs.js
+++ b/browser/components/extensions/test/browser/browser_ext_sessions_getRecentlyClosed_tabs.js
@@ -3,16 +3,19 @@
"use strict";
function expectedTabInfo(tab, window) {
let browser = tab.linkedBrowser;
return {
url: browser.currentURI.spec,
title: browser.contentTitle,
favIconUrl: window.gBrowser.getIcon(tab),
+ // 'selected' is marked as unsupported in schema, so we've removed it.
+ // For more details, see bug 1337509
+ selected: undefined,
};
}
function checkTabInfo(expected, actual) {
for (let prop in expected) {
is(actual[prop], expected[prop], `Expected value found for ${prop} of tab object.`);
}
}
--- a/browser/components/extensions/test/browser/browser_ext_tabs_create.js
+++ b/browser/components/extensions/test/browser/browser_ext_tabs_create.js
@@ -36,16 +36,19 @@ add_task(function* test_create_options()
function runTests() {
const DEFAULTS = {
index: 2,
windowId: activeWindow,
active: true,
pinned: false,
url: "about:newtab",
+ // 'selected' is marked as unsupported in schema, so we've removed it.
+ // For more details, see bug 1337509
+ selected: undefined,
};
let tests = [
{
create: {url: "http://example.com/"},
result: {url: "http://example.com/"},
},
{
--- a/browser/components/extensions/test/browser/browser_ext_tabs_duplicate.js
+++ b/browser/components/extensions/test/browser/browser_ext_tabs_duplicate.js
@@ -17,18 +17,18 @@ add_task(function* testDuplicateTab() {
let source = tabs[1];
// By moving it 0, we check that the new tab is created next
// to the existing one.
browser.tabs.move(source.id, {index: 0}, () => {
browser.tabs.duplicate(source.id, (tab) => {
browser.test.assertEq("http://example.net/", tab.url);
// Should be the second tab, next to the one duplicated.
browser.test.assertEq(1, tab.index);
- // Should be selected by default.
- browser.test.assertTrue(tab.selected);
+ // Should be active by default.
+ browser.test.assertTrue(tab.active);
browser.test.notifyPass("tabs.duplicate");
});
});
});
},
});
yield extension.startup();
--- a/browser/components/extensions/test/browser/head_sessions.js
+++ b/browser/components/extensions/test/browser/head_sessions.js
@@ -19,17 +19,17 @@ function checkWindow(window) {
is(window[prop], false, `closed window has the expected value for ${prop}`);
}
for (let prop of ["state", "type"]) {
is(window[prop], "normal", `closed window has the expected value for ${prop}`);
}
}
function checkTab(tab, windowId, incognito) {
- for (let prop of ["selected", "highlighted", "active", "pinned"]) {
+ for (let prop of ["highlighted", "active", "pinned"]) {
is(tab[prop], false, `closed tab has the expected value for ${prop}`);
}
is(tab.windowId, windowId, "closed tab has the expected value for windowId");
is(tab.incognito, incognito, "closed tab has the expected value for incognito");
}
function checkRecentlyClosed(recentlyClosed, expectedCount, windowId, incognito = false) {
let sessionIds = new Set();
--- a/toolkit/components/extensions/ExtensionTabs.jsm
+++ b/toolkit/components/extensions/ExtensionTabs.jsm
@@ -456,17 +456,16 @@ class TabBase {
*
* @returns {object}
*/
convert() {
let result = {
id: this.id,
index: this.index,
windowId: this.windowId,
- selected: this.selected,
highlighted: this.selected,
active: this.selected,
pinned: this.pinned,
status: this.status,
incognito: this.incognito,
width: this.width,
height: this.height,
audible: this.audible,