aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authorStephen Blott2017-02-11 07:27:55 +0000
committerGitHub2017-02-11 07:27:55 +0000
commit771b0abc9d60a31d29cb59de6edfe529a5e3005c (patch)
tree4f462e37944285c1d70061b84836f15203a37875 /background_scripts
parentb12ed93d0b96df90511d3331e8a5f54e7b1b7da4 (diff)
parent97586506fb861c9ca0af1e7fd4941ed0ec5b1b9b (diff)
downloadvimium-771b0abc9d60a31d29cb59de6edfe529a5e3005c.tar.bz2
Merge pull request #2426 from mrmr1993/no-depreciated-apis
Replace depreciated APIs
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/main.coffee12
-rw-r--r--background_scripts/marks.coffee2
2 files changed, 7 insertions, 7 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,