aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authorStephen Blott2014-11-23 16:36:56 +0000
committerStephen Blott2014-11-23 16:36:56 +0000
commit4de8e668be6ff09637fbaa5e2eff2825e13f1fd6 (patch)
treee7283eb505cee3cb5c38082c396f864969eb7ea6 /background_scripts
parentd10229e391c6b8c938da4ac71fe1ac968e21c5a0 (diff)
downloadvimium-4de8e668be6ff09637fbaa5e2eff2825e13f1fd6.tar.bz2
Frames; more cleanup and simplification.
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/main.coffee20
1 files changed, 9 insertions, 11 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 722091a4..10e6121f 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -600,23 +600,21 @@ openOptionsPageInNewTab = ->
chrome.tabs.create({ url: chrome.runtime.getURL("pages/options.html"), index: tab.index + 1 }))
registerFrame = (request, sender) ->
- frameIdsForTab[sender.tab.id] ?= []
- # Don't store frameset containers; focusing them is no use.
- frameIdsForTab[sender.tab.id].push request.frameId unless request.is_frameset
+ (frameIdsForTab[sender.tab.id] ?= []).push request.frameId
unregisterFrame = (request, sender) ->
tabId = sender.tab.id
- return unless frameIdsForTab[tabId]?
-
- if request.is_top # The whole tab is closing, so we can drop the frames list.
- updateOpenTabs sender.tab
- else
- frameIdsForTab[tabId] = frameIdsForTab[tabId].filter (id) -> id != request.frameId
+ if frameIdsForTab[tabId]?
+ if request.tab_is_closing
+ updateOpenTabs sender.tab
+ else
+ frameIdsForTab[tabId] = frameIdsForTab[tabId].filter (id) -> id != request.frameId
handleFrameFocused = (request, sender) ->
tabId = sender.tab.id
- frameIdsForTab[tabId] =
- [request.frameId, (frameIdsForTab[tabId].filter (id) -> id != request.frameId)...]
+ if frameIdsForTab[tabId]?
+ frameIdsForTab[tabId] =
+ [request.frameId, (frameIdsForTab[tabId].filter (id) -> id != request.frameId)...]
# Port handler mapping
portHandlers =