Bug 1466388 - Android webext popup should not be considered to be the active or highlighted tab draft
authorOriol Brufau <oriol-bugzilla@hotmail.com>
Sun, 03 Jun 2018 03:00:39 +0200
changeset 803334 c416dfcf2ca7e942562e259bca5a2d6c6475da55
parent 800319 4e9446f9e8f0a75c7ffe063f1dfb311cc90d56cf
push id112073
push userbmo:oriol-bugzilla@hotmail.com
push dateSun, 03 Jun 2018 10:33:27 +0000
bugs1466388
milestone62.0a1
Bug 1466388 - Android webext popup should not be considered to be the active or highlighted tab MozReview-Commit-ID: 3WVoR80ICzo
mobile/android/components/extensions/test/mochitest/test_ext_tabs_query.html
toolkit/components/extensions/parent/ext-tabs-base.js
--- a/mobile/android/components/extensions/test/mochitest/test_ext_tabs_query.html
+++ b/mobile/android/components/extensions/test/mochitest/test_ext_tabs_query.html
@@ -43,16 +43,18 @@ add_task(async function test_query_highl
       "popup.html": `<script src="popup.js"><\/script>`,
       "popup.js": async function popupScript() {
         let active = await browser.tabs.query({active: true});
         let highlighted = await browser.tabs.query({highlighted: true});
 
         browser.test.assertEq(1, active.length, "should have one active tab");
         browser.test.assertEq(1, highlighted.length, "should have one highlighted tab");
         browser.test.assertEq(active[0].id, highlighted[0].id, "the active and highlighted tabs are the same one");
+        browser.test.assertEq(true, active[0].active, "the tab should be considered to be active");
+        browser.test.assertEq(true, active[0].highlighted, "the tab should be considered to be highlighted");
 
         browser.test.sendMessage("tabs.query.popup");
       },
     },
   });
 
   const {BrowserApp} = Services.wm.getMostRecentWindow("navigator:browser");
   let tabs = [];
--- a/toolkit/components/extensions/parent/ext-tabs-base.js
+++ b/toolkit/components/extensions/parent/ext-tabs-base.js
@@ -574,18 +574,18 @@ class TabBase {
    *        this tab hasn't been initialized yet.
    * @returns {object}
    */
   convert(fallbackTab = null) {
     let result = {
       id: this.id,
       index: this.index,
       windowId: this.windowId,
-      highlighted: this.selected,
-      active: this.selected,
+      highlighted: this.highlighted,
+      active: this.active,
       pinned: this.pinned,
       status: this.status,
       hidden: this.hidden,
       discarded: this.discarded,
       incognito: this.incognito,
       width: this.width,
       height: this.height,
       lastAccessed: this.lastAccessed,