Attempt to fix a problem with lots of errors being logged in the console

This commit is contained in:
Kuba Orlik 2022-07-07 20:00:00 +02:00
parent c22c8a9045
commit d512e3cede

View File

@ -3,7 +3,7 @@ import { getshorthost, makeThrottle } from './util';
import { RequestCluster } from './request-cluster';
import { SaferEmitter } from './safer-emitter';
function setDomainsNumber(counter: number, tabId: number) {
function setDomainsCount(counter: number, tabId: number) {
browser.browserAction.setBadgeText({ text: counter < 0 ? '0' : counter.toString(), tabId });
browser.browserAction.setTitle({
title: 'Rentgen',
@ -35,11 +35,13 @@ export default class Memory extends SaferEmitter {
? browser.browserAction.setBadgeBackgroundColor({ color: '#ff726b' })
: browser.browserAction.setBadgeBackgroundColor({ color: '#ffb900' });
setDomainsNumber(
if (request.tabId >= 0) {
setDomainsCount(
Object.values(this.getClustersForOrigin(request.origin)).length,
request.tabId
);
}
}
constructor() {
super();