Skip to content

Commit

Permalink
fix(wx): wrap badge update in try block
Browse files Browse the repository at this point in the history
This solves load error under Chromium

Part of #218
  • Loading branch information
lidel committed May 24, 2017
1 parent cb6d239 commit 176325a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions add-on/src/lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,15 +383,19 @@ function updateBrowserActionBadge () {
badgeColor = '#8C8C8C'
badgeIcon = '/icons/ipfs-logo-off.svg'
}
return setBrowserActionBadge(badgeText, badgeColor, badgeIcon)
setBrowserActionBadge(badgeText, badgeColor, badgeIcon)
}

function setBrowserActionBadge (text, color, icon) {
return Promise.all([
browser.browserAction.setBadgeBackgroundColor({color: color}),
browser.browserAction.setBadgeText({text: text}),
browser.browserAction.setIcon({path: icon})
])
async function setBrowserActionBadge (text, color, icon) {
try {
await Promise.all([
browser.browserAction.setBadgeBackgroundColor({color: color}),
browser.browserAction.setBadgeText({text: text}),
browser.browserAction.setIcon({path: icon})
])
} catch (error) {
console.error('Unable to update browserAction badge due to error', error)
}
}

// OPTIONS
Expand Down
2 changes: 1 addition & 1 deletion add-on/src/popup/browser-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ async function activatePinButton () {
}

async function updatePageActions () {
console.log('running updatePageActions()')
// console.log('running updatePageActions()')
try {
const bg = await getBackgroundPage()
const currentTab = await getCurrentTab()
Expand Down

0 comments on commit 176325a

Please sign in to comment.