diff options
| author | Stephen Blott | 2015-05-05 08:41:50 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-05 08:41:50 +0100 |
| commit | 26052a9d351344f66fea190fca95d85eda4eb415 (patch) | |
| tree | 7325e864b5e4e9f4a1351291ea2445dd7923cbc9 | |
| parent | 290f5877b95585e73c6ac1b73b11d8df39b724cd (diff) | |
| download | vimium-26052a9d351344f66fea190fca95d85eda4eb415.tar.bz2 | |
Resolve space leak.
Remaining following 290f5877b95585e73c6ac1b73b11d8df39b724cd.
| -rw-r--r-- | background_scripts/main.coffee | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 103cc61e..c599d19e 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -385,7 +385,7 @@ setIcon = (request, sender) -> chrome.browserAction.setIcon tabId: sender.tab.id, path: path handleUpdateScrollPosition = (request, sender) -> - # See note re. sender.tab at unregisterFrame. + # See note regarding sender.tab at unregisterFrame. updateScrollPosition sender.tab, request.scrollX, request.scrollY if sender.tab? updateScrollPosition = (tab, scrollX, scrollY) -> @@ -679,6 +679,13 @@ chrome.tabs.onRemoved.addListener (tabId) -> # There are no remaining incognito-mode tabs, and findModeRawQueryListIncognito is set. chrome.storage.local.remove "findModeRawQueryListIncognito" +# Tidy up tab caches when tabs are removed. We cannot rely on unregisterFrame because Chrome does not always +# provide sender.tab there. +# NOTE(smblott) (2015-05-05) This may break restoreTab on legacy Chrome versions, but we'll be moving to +# chrome.sessions support only soon anyway. +chrome.tabs.onRemoved.addListener (tabId) -> + delete cache[tabId] for cache in [ frameIdsForTab, urlForTab, tabInfoMap ] + # Convenience function for development use. window.runTests = -> open(chrome.runtime.getURL('tests/dom_tests/dom_tests.html')) |
