diff options
Diffstat (limited to 'content_scripts')
| -rw-r--r-- | content_scripts/hud.coffee | 3 | ||||
| -rw-r--r-- | content_scripts/link_hints.coffee | 3 | ||||
| -rw-r--r-- | content_scripts/marks.coffee | 3 | ||||
| -rw-r--r-- | content_scripts/mode.coffee | 3 | ||||
| -rw-r--r-- | content_scripts/mode_find.coffee | 3 | ||||
| -rw-r--r-- | content_scripts/mode_insert.coffee | 3 | ||||
| -rw-r--r-- | content_scripts/mode_key_handler.coffee | 3 | ||||
| -rw-r--r-- | content_scripts/mode_visual.coffee | 3 | ||||
| -rw-r--r-- | content_scripts/scroller.coffee | 3 | ||||
| -rw-r--r-- | content_scripts/ui_component.coffee | 3 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 22 | ||||
| -rw-r--r-- | content_scripts/vomnibar.coffee | 3 | 
12 files changed, 36 insertions, 19 deletions
| diff --git a/content_scripts/hud.coffee b/content_scripts/hud.coffee index c2170914..6185d786 100644 --- a/content_scripts/hud.coffee +++ b/content_scripts/hud.coffee @@ -127,5 +127,6 @@ class Tween        }      """ -root = exports ? window +root = exports ? (window.root ?= {})  root.HUD = HUD +extend window, root unless exports? diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index f3e0ac84..8b5bb8d9 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -897,8 +897,9 @@ class WaitForEnter extends Mode            @exit()            callback false # false -> isSuccess. -root = exports ? window +root = exports ? (window.root ?= {})  root.LinkHints = LinkHints  root.HintCoordinator = HintCoordinator  # For tests:  extend root, {LinkHintsMode, LocalHints, AlphabetHints, WaitForEnter} +extend window, root unless exports? diff --git a/content_scripts/marks.coffee b/content_scripts/marks.coffee index 6eab3be6..55f3137c 100644 --- a/content_scripts/marks.coffee +++ b/content_scripts/marks.coffee @@ -84,5 +84,6 @@ Marks =                  @showMessage "Local mark not set", keyChar            DomUtils.consumeKeyup event -root = exports ? window +root = exports ? (window.root ?= {})  root.Marks =  Marks +extend window, root unless exports? diff --git a/content_scripts/mode.coffee b/content_scripts/mode.coffee index 9de423ff..2057d093 100644 --- a/content_scripts/mode.coffee +++ b/content_scripts/mode.coffee @@ -209,5 +209,6 @@ class SuppressAllKeyboardEvents extends Mode        suppressAllKeyboardEvents: true      super extend defaults, options -root = exports ? window +root = exports ? (window.root ?= {})  extend root, {Mode, SuppressAllKeyboardEvents} +extend window, root unless exports? diff --git a/content_scripts/mode_find.coffee b/content_scripts/mode_find.coffee index 5a2da741..5238ab34 100644 --- a/content_scripts/mode_find.coffee +++ b/content_scripts/mode_find.coffee @@ -215,6 +215,7 @@ getCurrentRange = ->      selection.collapseToStart() if selection.type == "Range"      selection.getRangeAt 0 -root = exports ? window +root = exports ? (window.root ?= {})  root.PostFindMode = PostFindMode  root.FindMode = FindMode +extend window, root unless exports? diff --git a/content_scripts/mode_insert.coffee b/content_scripts/mode_insert.coffee index 1dc66d52..a43a129f 100644 --- a/content_scripts/mode_insert.coffee +++ b/content_scripts/mode_insert.coffee @@ -129,6 +129,7 @@ class PassNextKeyMode extends Mode                @exit()          @passEventToPage -root = exports ? window +root = exports ? (window.root ?= {})  root.InsertMode = InsertMode  root.PassNextKeyMode = PassNextKeyMode +extend window, root unless exports? diff --git a/content_scripts/mode_key_handler.coffee b/content_scripts/mode_key_handler.coffee index 1b3b21e7..0e84b9fb 100644 --- a/content_scripts/mode_key_handler.coffee +++ b/content_scripts/mode_key_handler.coffee @@ -93,5 +93,6 @@ class KeyHandlerMode extends Mode        @exit() if @options.count? and --@options.count <= 0      @suppressEvent -root = exports ? window +root = exports ? (window.root ?= {})  root.KeyHandlerMode = KeyHandlerMode +extend window, root unless exports? diff --git a/content_scripts/mode_visual.coffee b/content_scripts/mode_visual.coffee index 28097005..f99e42f9 100644 --- a/content_scripts/mode_visual.coffee +++ b/content_scripts/mode_visual.coffee @@ -380,6 +380,7 @@ class CaretMode extends VisualMode            return true      false -root = exports ? window +root = exports ? (window.root ?= {})  root.VisualMode = VisualMode  root.VisualLineMode = VisualLineMode +extend window, root unless exports? diff --git a/content_scripts/scroller.coffee b/content_scripts/scroller.coffee index 56862d49..4a6c7edf 100644 --- a/content_scripts/scroller.coffee +++ b/content_scripts/scroller.coffee @@ -301,5 +301,6 @@ Scroller =          element = findScrollableElement element, "x", amount, 1          CoreScroller.scroll element, "x", amount, false -root = exports ? window +root = exports ? (window.root ?= {})  root.Scroller = Scroller +extend window, root unless exports? diff --git a/content_scripts/ui_component.coffee b/content_scripts/ui_component.coffee index 203f0c8c..c71bfb35 100644 --- a/content_scripts/ui_component.coffee +++ b/content_scripts/ui_component.coffee @@ -96,5 +96,6 @@ class UIComponent          @options = null          @postMessage "hidden" # Inform the UI component that it is hidden. -root = exports ? window +root = exports ? (window.root ?= {})  root.UIComponent = UIComponent +extend window, root unless exports? diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 96ce81a3..0beb2110 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -2,6 +2,12 @@  # This content script must be run prior to domReady so that we perform some operations very early.  # +root = exports ? (window.root ?= {}) +# On Firefox, sometimes the variables assigned to window are lost (bug 1408996), so we reinstall them. +# NOTE(mrmr1993): This bug leads to catastrophic failure (ie. nothing works and errors abound). +DomUtils.documentReady -> +  (extend ? root.extend) window, root +  isEnabledForUrl = true  isIncognitoMode = chrome.extension.inIncognitoContext  normalMode = null @@ -245,7 +251,7 @@ Frame =    postMessage: (handler, request = {}) -> @port.postMessage extend request, {handler}    linkHintsMessage: (request) -> HintCoordinator[request.messageType] request    registerFrameId: ({chromeFrameId}) -> -    frameId = window.frameId = chromeFrameId +    frameId = root.frameId = window.frameId = chromeFrameId      # We register a frame immediately only if it is focused or its window isn't tiny.  We register tiny      # frames later, when necessary.  This affects focusFrame() and link hints.      if windowIsFocused() or not DomUtils.windowIsTooSmall() @@ -327,7 +333,7 @@ focusThisFrame = (request) ->    document.activeElement.blur() if document.activeElement.tagName.toLowerCase() == "iframe"    flashFrame() if request.highlight -extend window, +extend root,    scrollToBottom: ->      Marks.setPreviousPosition()      Scroller.scrollTo "y", "max" @@ -345,7 +351,7 @@ extend window,    scrollLeft: (count) -> Scroller.scrollBy "x", -1 * Settings.get("scrollStepSize") * count    scrollRight: (count) -> Scroller.scrollBy "x", Settings.get("scrollStepSize") * count -extend window, +extend root,    reload: (count, options) ->      hard = options?.hard      window.location.reload(hard) @@ -654,12 +660,12 @@ findAndFollowRel = (value) ->          followLink(element)          return true -window.goPrevious = -> +root.goPrevious = ->    previousPatterns = Settings.get("previousPatterns") || ""    previousStrings = previousPatterns.split(",").filter( (s) -> s.trim().length )    findAndFollowRel("prev") || findAndFollowLink(previousStrings) -window.goNext = -> +root.goNext = ->    nextPatterns = Settings.get("nextPatterns") || ""    nextStrings = nextPatterns.split(",").filter( (s) -> s.trim().length )    findAndFollowRel("next") || findAndFollowLink(nextStrings) @@ -669,11 +675,11 @@ enterFindMode = ->    Marks.setPreviousPosition()    new FindMode() -window.showHelp = (sourceFrameId) -> +root.showHelp = (sourceFrameId) ->    HelpDialog.toggle {sourceFrameId, showAllCommandDetails: false}  # If we are in the help dialog iframe, then HelpDialog is already defined with the necessary functions. -window.HelpDialog ?= +root.HelpDialog ?=    helpUI: null    isShowing: -> @helpUI?.showing    abort: -> @helpUI.hide false if @isShowing() @@ -690,7 +696,6 @@ window.HelpDialog ?=  initializePreDomReady()  DomUtils.documentReady initializeOnDomReady -root = exports ? window  root.handlerStack = handlerStack  root.frameId = frameId  root.Frame = Frame @@ -701,3 +706,4 @@ extend root, {handleEscapeForFindMode, handleEnterForFindMode, performFind, perf    enterFindMode, focusThisFrame}  # These are exported only for the tests.  extend root, {installModes} +extend window, root unless exports? diff --git a/content_scripts/vomnibar.coffee b/content_scripts/vomnibar.coffee index 14d72e87..ad98aa48 100644 --- a/content_scripts/vomnibar.coffee +++ b/content_scripts/vomnibar.coffee @@ -58,5 +58,6 @@ Vomnibar =      HelpDialog.abort()      @vomnibarUI.activate extend options, { name: "activate", sourceFrameId, focus: true } -root = exports ? window +root = exports ? (window.root ?= {})  root.Vomnibar = Vomnibar +extend window, root unless exports? | 
