From 58ba1ac14870d1614cbdd13f9ea157ff22bdd879 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Fri, 1 May 2015 11:01:31 +0100 Subject: Ensure frames is defined. When we reinject content scripts into a tab where document.body is a frameset, no frames are registered, which causes frames to be undefined. --- background_scripts/main.coffee | 1 + 1 file changed, 1 insertion(+) (limited to 'background_scripts') diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 3a3392d8..37c65592 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -618,6 +618,7 @@ handleFrameFocused = (request, sender) -> # Rotate through frames to the frame count places after frameId. cycleToFrame = (frames, frameId, count = 0) -> + frames ||= [] # We can't always track which frame chrome has focussed, but here we learn that it's frameId; so add an # additional offset such that we do indeed start from frameId. count = (count + Math.max 0, frames.indexOf frameId) % frames.length -- cgit v1.2.3