Bug 1392322 - Fix browserAction.setTitle for currently active tab on Android. r=mixedpuppy

MozReview-Commit-ID: 1Wka0zFxElD

--HG--
extra : rebase_source : 0537c9ab120f78e72b3e182f61504edd7d4ca5ee
This commit is contained in:
Luca Greco 2017-08-21 19:16:46 +02:00
parent 692daa6f92
commit 1bb1390f49
2 changed files with 32 additions and 1 deletions

View File

@ -84,7 +84,7 @@ class BrowserAction {
}
}
if (!tab || tab.selected) {
if (!tab || tab.getActive()) {
BrowserActions.update(this.uuid, {[prop]: value});
}
}

View File

@ -140,6 +140,37 @@ add_task(async function test_setTitle_and_getTitle() {
await extension.unload();
});
add_task(async function test_setTitle_activeTab() {
async function background() {
const tabs = await browser.tabs.query({active: true});
const tabId = tabs[0].id;
const title = "Customized browserAction title";
await browser.browserAction.setTitle({tabId, title});
browser.test.notifyPass("browserAction_setTitle_activeTab.done");
}
const extension = ExtensionTestUtils.loadExtension({
background,
manifest: {
"browser_action": {
"default_title": "Browser Action default title",
},
},
});
await extension.startup();
await extension.awaitFinish("browserAction_setTitle_activeTab.done");
is(BrowserActions.getNameForActiveTab(`{${extension.uuid}}`),
"Customized browserAction title",
"The browserAction title has been updated on the currently activeTab");
await extension.unload();
});
</script>
</body>