mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 01:02:08 +01:00
code review: use setIcon w/ ImageData only for chromium-based browsers
This commit is contained in:
parent
82e5fa61b9
commit
a9a1cc3f3b
1 changed files with 11 additions and 6 deletions
|
@ -667,12 +667,17 @@ vAPI.setIcon = (function() {
|
|||
});
|
||||
}
|
||||
|
||||
if (
|
||||
vAPI.webextFlavor.soup.has('chromium') === false &&
|
||||
vAPI.webextFlavor.soup.has('firefox') === false
|
||||
) {
|
||||
return;
|
||||
}
|
||||
// As of 2018-05, benchmarks show that only Chromium benefits for sure
|
||||
// from using ImageData.
|
||||
//
|
||||
// Chromium creates a new ImageData instance every call to setIcon
|
||||
// with paths:
|
||||
// https://cs.chromium.org/chromium/src/extensions/renderer/resources/set_icon.js?l=56&rcl=99be185c25738437ecfa0dafba72a26114196631
|
||||
//
|
||||
// Firefox uses an internal cache for each setIcon's paths:
|
||||
// https://searchfox.org/mozilla-central/rev/5ff2d7683078c96e4b11b8a13674daded935aa44/browser/components/extensions/parent/ext-browserAction.js#631
|
||||
if ( vAPI.webextFlavor.soup.has('chromium') === false ) { return; }
|
||||
|
||||
let imgs = [
|
||||
{ i: 0, p: '16' }, { i: 0, p: '32' },
|
||||
{ i: 1, p: '16' }, { i: 1, p: '32' },
|
||||
|
|
Loading…
Reference in a new issue