EFForg/https-everywhere — pull request #39 by semenko (2013-12-30 21:07:58+00:00)
Title: Chrome: background.js performance / displayPageAction

(for issue #12)

I'll hold off on other pull requests so @jsha's changes for Switch Planner can have happier merges :)

This updates some comments and makes changes to displayPageAction.

displayPageAction tests to see if we can add the pageAction icon to an address bar.

It only needs to happen *once* per tab (if there's an applicable ruleset), but currently happens hundreds-to-thousands of times, as /every single request/ triggers it multiple times (in onBeforeRequest, in onCompleted, and via tabs.onUpdated).

This removes two unnecessary hooks (in dd0bdb4), then removes the worst offender under onBeforeRequest (blocking) and adds a timer (in 1d5df8f).

_____

Later on, if people like the idea, I might switch from pageAction to browserAction (https://developer.chrome.com/extensions/browserAction.html)

Then, use setBadgeText to actively count & display the number of re-written hostnames. Kinda' like disconnect.me:

![image](https://f.cloud.github.com/assets/167135/1824363/672efc86-7195-11e3-995e-70405d13761f.png)

Signed-off-by: Nick Semenkovich \