diff options
Diffstat (limited to 'content_scripts')
| -rw-r--r-- | content_scripts/mode.coffee | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/content_scripts/mode.coffee b/content_scripts/mode.coffee index cab97b32..c7c6bd55 100644 --- a/content_scripts/mode.coffee +++ b/content_scripts/mode.coffee @@ -41,6 +41,7 @@ class Mode @handlers = [] @exitHandlers = [] @modeIsActive = true + @modeIsExiting = false @name = @options.name || "anonymous" @count = ++count @@ -189,8 +190,10 @@ class Mode exit: -> if @modeIsActive @log "deactivate:", @id - handler() for handler in @exitHandlers - handlerStack.remove handlerId for handlerId in @handlers + unless @modeIsExiting + @modeIsExiting = true + handler() for handler in @exitHandlers + handlerStack.remove handlerId for handlerId in @handlers Mode.modes = Mode.modes.filter (mode) => mode != @ @modeIsActive = false @setIndicator() |
