Skip to content

Commit

Permalink
Fixed: Breaking change in tabs.onUpdated properties
Browse files Browse the repository at this point in the history
  • Loading branch information
mbnuqw committed Mar 25, 2021
1 parent 72ab96e commit e471eee
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
14 changes: 11 additions & 3 deletions addon/actions/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,17 @@ async function updateTabsTree() {
function setupTabsListeners() {
browser.tabs.onCreated.addListener(this.actions.onTabCreated)
browser.tabs.onRemoved.addListener(this.actions.onTabRemoved)
browser.tabs.onUpdated.addListener(this.actions.onTabUpdated, {
properties: ['pinned', 'title', 'status'],
})
try {
// From v88 (https://bugzilla.mozilla.org/show_bug.cgi?id=1680279)
browser.tabs.onUpdated.addListener(this.actions.onTabUpdated, {
properties: ['pinned', 'title', 'status', 'url'],
})
} catch (err) {
// Before v88 (Remove after next ESR - v91)
browser.tabs.onUpdated.addListener(this.actions.onTabUpdated, {
properties: ['pinned', 'title', 'status'],
})
}
browser.tabs.onActivated.addListener(this.actions.onTabActivated)
browser.tabs.onMoved.addListener(this.actions.onTabMoved)
browser.tabs.onAttached.addListener(this.actions.onTabAttached)
Expand Down
27 changes: 15 additions & 12 deletions src/sidebar/handlers/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -821,18 +821,21 @@ function onTabActivated(info) {
*/
function setupTabsListeners() {
browser.tabs.onCreated.addListener(this.handlers.onTabCreated)
browser.tabs.onUpdated.addListener(this.handlers.onTabUpdated, {
properties: [
'audible',
'discarded',
'favIconUrl',
'hidden',
'mutedInfo',
'pinned',
'status',
'title',
],
})
try {
// From v88 (https://bugzilla.mozilla.org/show_bug.cgi?id=1680279)
browser.tabs.onUpdated.addListener(this.handlers.onTabUpdated, {
// prettier-ignore
properties: ['audible','discarded','favIconUrl','hidden','mutedInfo','pinned','status',
'title','url'],
})
} catch (err) {
// Before v88 (Remove after next ESR - v91)
browser.tabs.onUpdated.addListener(this.handlers.onTabUpdated, {
// prettier-ignore
properties: ['audible','discarded','favIconUrl','hidden','mutedInfo','pinned','status',
'title'],
})
}
browser.tabs.onRemoved.addListener(this.handlers.onTabRemoved)
browser.tabs.onMoved.addListener(this.handlers.onTabMoved)
browser.tabs.onDetached.addListener(this.handlers.onTabDetached)
Expand Down

0 comments on commit e471eee

Please sign in to comment.