function toggleTitle(title) {
if (title === "this") {
browser.action.setTitle({ title: "that" });
} else {
browser.action.setTitle({ title: "this" });
}
}
browser.action.onClicked.addListener(() => {
let gettingTitle = browser.action.getTitle({});
gettingTitle.then(toggleTitle);
});action.setTitle() / notebook
action.setTitle()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.