chromium / suspicious-site-reporter

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

Performance: Cache results / ignore URL Fragment changes #69

Open ericlaw1979 opened 3 years ago

ericlaw1979 commented 3 years ago

Repro:

Visit https://bayden.com/test/title/andurl.htm a page that updates its URL fragment every second.

OBSERVE:

System fans start up and CPU usage spikes dramatically.

image

URL Fragment change causes onUpdated to fire twice ({status:Loading, url:newURL} then {status:Complete}) and each time this causes full reevaluation of the site's score, even though the fragment isn't presently used in score calculation.

    chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
      if (tab.active && (changeInfo.url || changeInfo.status)) {
        setBrowserActionAndIcon(tab);
      }
    });