Bug 1337509 - Do not create tab objects with an unsupported 'selected' property. r=bsilverberg,mixedpuppy
authorTushar Saini (:shatur) <tushar.saini1285@gmail.com>
Tue, 18 Apr 2017 22:07:38 +0530
changeset 353883 e9a5d4f62461ee0db07a41f59b73163ec106bc3e
parent 353882 4a1023c9c098810251bc5bb21b5d2617982fa15d
child 353960 f8c02d5b3679982a63411eb65139df21998a4819
child 353963 de686e9e9a9adcbd8beac03fc6487c3a44ffa83e
push id31680
push userkwierso@gmail.com
push dateWed, 19 Apr 2017 23:57:00 +0000
treeherdermozilla-central@e9a5d4f62461 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsilverberg, mixedpuppy
bugs1337509
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1337509 - Do not create tab objects with an unsupported 'selected' property. r=bsilverberg,mixedpuppy MozReview-Commit-ID: 4Bi6LdNUxMo
browser/components/extensions/ext-utils.js
browser/components/extensions/test/browser/browser_ext_sessions_getRecentlyClosed_tabs.js
browser/components/extensions/test/browser/browser_ext_tabs_create.js
browser/components/extensions/test/browser/browser_ext_tabs_duplicate.js
browser/components/extensions/test/browser/head_sessions.js
toolkit/components/extensions/ExtensionTabs.jsm
--- a/browser/components/extensions/ext-utils.js
+++ b/browser/components/extensions/ext-utils.js
@@ -552,17 +552,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,