chromium / suspicious-site-reporter

Extension for reporting suspicious sites to Safe Browsing.
Apache License 2.0
96 stars 22 forks source link

Performance: Don't recompute scores unnecessarily #32

Closed ericlaw1979 closed 5 years ago

ericlaw1979 commented 5 years ago

background.js has

 chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
    setBrowserActionAndIcon(tab);
  });

This causes reevaluation of the score on every change to every tab, whether it's active or not and whether the change is meaningful (e.g. URL changes) or not (tab title or loading status changes).

The listener here should examine the changeInfo and ignore updates where url isn't in it, and ignore any tab which isn't active.

ericlaw1979 commented 5 years ago

Repro: Open https://bayden.com/test/title/andurl.htm

Observe the browser task manager: image