diff options
| -rw-r--r-- | background_scripts/main.coffee | 12 | ||||
| -rw-r--r-- | background_scripts/marks.coffee | 2 | ||||
| -rw-r--r-- | content_scripts/mode.coffee | 2 | ||||
| -rw-r--r-- | content_scripts/mode_insert.coffee | 4 | ||||
| -rw-r--r-- | content_scripts/scroller.coffee | 4 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 4 | ||||
| -rw-r--r-- | lib/dom_utils.coffee | 2 | ||||
| -rw-r--r-- | pages/options.coffee | 2 | ||||
| -rw-r--r-- | tests/unit_tests/test_chrome_stubs.coffee | 4 |
9 files changed, 16 insertions, 20 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 72f87a7e..70739eae 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -99,7 +99,7 @@ TabOperations = tabConfig = url: Utils.convertToUrl request.url index: request.tab.index + 1 - selected: true + active: true windowId: request.tab.windowId openerTabId: request.tab.id chrome.tabs.create tabConfig, callback @@ -127,11 +127,11 @@ toggleMuteTab = do -> selectSpecificTab = (request) -> chrome.tabs.get(request.id, (tab) -> chrome.windows.update(tab.windowId, { focused: true }) - chrome.tabs.update(request.id, { selected: true })) + chrome.tabs.update(request.id, { active: true })) moveTab = ({count, tab, registryEntry}) -> count = -count if registryEntry.command == "moveTabLeft" - chrome.tabs.getAllInWindow null, (tabs) -> + chrome.tabs.query { currentWindow: true }, (tabs) -> pinnedCount = (tabs.filter (tab) -> tab.pinned).length minIndex = if tab.pinned then 0 else pinnedCount maxIndex = (if tab.pinned then pinnedCount else tabs.length) - 1 @@ -226,7 +226,7 @@ removeTabsRelative = (direction, {tab: activeTab}) -> # Selects a tab before or after the currently selected tab. # - direction: "next", "previous", "first" or "last". selectTab = (direction, {count, tab}) -> - chrome.tabs.getAllInWindow null, (tabs) -> + chrome.tabs.query { currentWindow: true }, (tabs) -> if 1 < tabs.length toSelect = switch direction @@ -238,7 +238,7 @@ selectTab = (direction, {count, tab}) -> Math.min tabs.length - 1, count - 1 when "last" Math.max 0, tabs.length - count - chrome.tabs.update tabs[toSelect].id, selected: true + chrome.tabs.update tabs[toSelect].id, active: true chrome.tabs.onUpdated.addListener (tabId, changeInfo, tab) -> return unless changeInfo.status == "loading" # Only do this once per URL change. @@ -467,7 +467,7 @@ do showUpgradeMessage = -> Settings.set "previousVersion", currentVersion chrome.notifications.onClicked.addListener (id) -> if id == notificationId - chrome.tabs.getSelected null, (tab) -> + chrome.tabs.query { active: true, currentWindow: true }, ([tab]) -> TabOperations.openUrlInNewTab {tab, tabId: tab.id, url: "https://github.com/philc/vimium#release-notes"} else # We need to wait for the user to accept the "notifications" permission. diff --git a/background_scripts/marks.coffee b/background_scripts/marks.coffee index dbc14671..33c467a7 100644 --- a/background_scripts/marks.coffee +++ b/background_scripts/marks.coffee @@ -57,7 +57,7 @@ Marks = # Focus an existing tab and scroll to the given position within it. gotoPositionInTab: ({ tabId, scrollX, scrollY, markName }) -> - chrome.tabs.update tabId, {selected: true}, -> + chrome.tabs.update tabId, { active: true }, -> chrome.tabs.sendMessage tabId, {name: "setScrollPosition", scrollX, scrollY} # The tab we're trying to find no longer exists. We either find another tab with a matching URL and use it, diff --git a/content_scripts/mode.coffee b/content_scripts/mode.coffee index c1dea59a..2d8cc9cc 100644 --- a/content_scripts/mode.coffee +++ b/content_scripts/mode.coffee @@ -81,7 +81,7 @@ class Mode _name: "mode-#{@id}/exitOnEscape" "keydown": (event) => return @continueBubbling unless KeyboardUtils.isEscape event - @exit event, event.srcElement + @exit event, event.target DomUtils.suppressKeyupAfterEscape handlerStack # If @options.exitOnBlur is truthy, then it should be an element. The mode will exit when that element diff --git a/content_scripts/mode_insert.coffee b/content_scripts/mode_insert.coffee index a998a040..73a24112 100644 --- a/content_scripts/mode_insert.coffee +++ b/content_scripts/mode_insert.coffee @@ -18,14 +18,14 @@ class InsertMode extends Mode return @suppressEvent return @passEventToPage unless event.type == 'keydown' and KeyboardUtils.isEscape event - target = event.srcElement + target = event.target if target and DomUtils.isFocusable target # Remove the focus, so the user can't just get back into insert mode by typing in the same input box. target.blur() else if target?.shadowRoot and @insertModeLock # An editable element in a shadow DOM is focused; blur it. @insertModeLock.blur() - @exit event, event.srcElement + @exit event, event.target DomUtils.suppressKeyupAfterEscape handlerStack defaults = diff --git a/content_scripts/scroller.coffee b/content_scripts/scroller.coffee index b4a0d799..56862d49 100644 --- a/content_scripts/scroller.coffee +++ b/content_scripts/scroller.coffee @@ -143,11 +143,11 @@ CoreScroller = @keyIsDown = true @time += 1 unless event.repeat @lastEvent = event - keyup: => + keyup: (event) => handlerStack.alwaysContinueBubbling => @keyIsDown = false @time += 1 - blur: => + blur: (event) => handlerStack.alwaysContinueBubbling => @time += 1 if event.target == window diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 6447092b..93238642 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -248,9 +248,9 @@ Frame = window.removeEventListener "focus", focusHandler window.removeEventListener "resize", resizeHandler Frame.postMessage "registerFrame" - window.addEventListener "focus", focusHandler = -> + window.addEventListener "focus", focusHandler = (event) -> postRegisterFrame() if event.target == window - window.addEventListener "resize", resizeHandler = -> + window.addEventListener "resize", resizeHandler = (event) -> postRegisterFrame() unless DomUtils.windowIsTooSmall() init: -> diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index fad5ffbf..500332e0 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -342,7 +342,7 @@ DomUtils = # If the element is rendered in a shadow DOM via a <content> element, the <content> element will be # returned, so the shadow DOM is traversed rather than passed over. getContainingElement: (element) -> - element.getDestinationInsertionPoints()[0] or element.parentElement + element.getDestinationInsertionPoints?()[0] or element.parentElement # This tests whether a window is too small to be useful. windowIsTooSmall: -> diff --git a/pages/options.coffee b/pages/options.coffee index 0a71611a..8683b7ed 100644 --- a/pages/options.coffee +++ b/pages/options.coffee @@ -265,7 +265,7 @@ initOptionsPage = -> maintainLinkHintsView() initPopupPage = -> - chrome.tabs.getSelected null, (tab) -> + chrome.tabs.query { active: true, currentWindow: true }, ([tab]) -> exclusions = null document.getElementById("optionsLink").setAttribute "href", chrome.runtime.getURL("pages/options.html") diff --git a/tests/unit_tests/test_chrome_stubs.coffee b/tests/unit_tests/test_chrome_stubs.coffee index bea13df3..53ca805d 100644 --- a/tests/unit_tests/test_chrome_stubs.coffee +++ b/tests/unit_tests/test_chrome_stubs.coffee @@ -41,8 +41,6 @@ exports.chrome = getViews: -> [] tabs: - onSelectionChanged: - addListener: () -> true onUpdated: addListener: () -> true onAttached: @@ -51,8 +49,6 @@ exports.chrome = addListener: () -> true onRemoved: addListener: () -> true - onActiveChanged: - addListener: () -> true onActivated: addListener: () -> true onReplaced: |
