1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-22 18:32:45 +01:00

Use block scope to isolate context

This commit is contained in:
Raymond Hill 2023-02-24 18:02:28 -05:00
parent 191f2f00d6
commit 454a03a98f
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 6 additions and 6 deletions

View File

@ -668,7 +668,7 @@ if ( webext.browserAction instanceof Object ) {
// https://github.com/uBlockOrigin/uBlock-issues/issues/32
// Ensure ImageData for toolbar icon is valid before use.
vAPI.setIcon = (( ) => {
{
const browserAction = vAPI.browserAction;
const titleTemplate =
browser.runtime.getManifest().browser_action.default_title +
@ -765,7 +765,7 @@ vAPI.setIcon = (( ) => {
// bit 2 = badge color
// bit 3 = hide badge
return async function(tabId, details) {
vAPI.setIcon = async function(tabId, details) {
tabId = toTabId(tabId);
if ( tabId === 0 ) { return; }
@ -808,7 +808,7 @@ vAPI.setIcon = (( ) => {
vAPI.contextMenu.onMustUpdate(tabId);
}
};
})();
}
browser.browserAction.onClicked.addListener(function(tab) {
vAPI.tabs.open({

View File

@ -1059,7 +1059,7 @@ vAPI.tabs = new vAPI.Tabs();
// Update visual of extension icon.
µb.updateToolbarIcon = (( ) => {
{
const tabIdToDetails = new Map();
const computeBadgeColor = (bits) => {
@ -1118,7 +1118,7 @@ vAPI.tabs = new vAPI.Tabs();
// bit 2 = badge color
// bit 3 = hide badge
return function(tabId, newParts = 0b0111) {
µb.updateToolbarIcon = function(tabId, newParts = 0b0111) {
if ( typeof tabId !== 'number' ) { return; }
if ( vAPI.isBehindTheSceneTabId(tabId) ) { return; }
const currentParts = tabIdToDetails.get(tabId);
@ -1133,7 +1133,7 @@ vAPI.tabs = new vAPI.Tabs();
}
tabIdToDetails.set(tabId, newParts);
};
})();
}
/******************************************************************************/