mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-03-14 08:58:14 -04:00
Retry setting icon with legacy sizes if it fails. Fix #1003.
This commit is contained in:
parent
cc95e49b6f
commit
0f61f18c91
@ -65,16 +65,27 @@ class ChromeTabs
|
|||||||
setIcon: (icon, tabId) ->
|
setIcon: (icon, tabId) ->
|
||||||
return unless icon?
|
return unless icon?
|
||||||
if tabId?
|
if tabId?
|
||||||
chrome.browserAction.setIcon({
|
params = {
|
||||||
imageData: icon
|
imageData: icon
|
||||||
tabId: tabId
|
tabId: tabId
|
||||||
}, @ignoreError)
|
}
|
||||||
else
|
else
|
||||||
chrome.browserAction.setIcon({imageData: icon}, @ignoreError)
|
params = {
|
||||||
|
imageData: icon
|
||||||
|
}
|
||||||
|
@_chromeSetIcon(params)
|
||||||
|
|
||||||
|
_chromeSetIcon: (params) ->
|
||||||
|
try
|
||||||
|
chrome.browserAction.setIcon(params, @ignoreError)
|
||||||
|
catch
|
||||||
|
# Some legacy Chrome versions will panic if there are other icon sizes.
|
||||||
|
params.imageData = {19: params.imageData[19], 38: params.imageData[38]}
|
||||||
|
chrome.browserAction.setIcon(params, @ignoreError)
|
||||||
|
|
||||||
clearIcon: (tabId) ->
|
clearIcon: (tabId) ->
|
||||||
return unless @_defaultAction?.icon?
|
return unless @_defaultAction?.icon?
|
||||||
chrome.browserAction.setIcon({
|
@_chromeSetIcon({
|
||||||
imageData: @_defaultAction.icon
|
imageData: @_defaultAction.icon
|
||||||
tabId: tabId
|
tabId: tabId
|
||||||
}, @ignoreError)
|
}, @ignoreError)
|
||||||
|
Loading…
Reference in New Issue
Block a user