Skip to content

Commit db6587e

Browse files
committed
Fix #13 - Swich to Promises for FF 60
1 parent 99fe1fb commit db6587e

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

background-script.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ browser.storage.onChanged.addListener(function(changes) {
2323
});
2424

2525
browser.tabs.onActivated.addListener(function(activeInfo) {
26-
browser.tabs.get(activeInfo.tabId, function(activeTab) {
26+
browser.tabs.get(activeInfo.tabId).then(function(activeTab) {
2727
lastActiveTab = {
2828
"id": activeTab.id,
2929
"pinned": activeTab.pinned
@@ -35,20 +35,22 @@ browser.tabs.onCreated.addListener(function(tab) {
3535
if (lastActiveTab.pinned) {
3636
browser.tabs.query({
3737
windowId: tab.windowId
38-
}, function(tabs) {
38+
})
39+
.then(function(tabs) {
3940
// check if tab was opened from outside of firefox or is about:newtab
4041
if (tab.index != tabs.length - 1) {
41-
browser.tabs.move(tab.id, {
42+
return browser.tabs.move(tab.id, {
4243
index: -1
43-
}, function() {
44-
// in all cases scroll tab bar to the right
45-
browser.tabs.update(tab.id, { active: true });
46-
47-
if (loadInBackground) {
48-
browser.tabs.update(lastActiveTab.id, { active: true });
49-
}
5044
});
5145
}
46+
})
47+
.then(function() {
48+
// in all cases scroll tab bar to the right
49+
browser.tabs.update(tab.id, { active: true });
50+
51+
if (loadInBackground) {
52+
browser.tabs.update(lastActiveTab.id, { active: true });
53+
}
5254
});
5355
}
5456
});

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
"manifest_version": 2,
44
"name": "Pinned Tab Fix",
5-
"version": "2.0.7",
5+
"version": "2.2.0",
66

77
"description": "__MSG_extensionDescription__",
88
"homepage_url": "https://github.com/nralbrecht/pinned-tab-fix",

0 commit comments

Comments
 (0)