Skip to content

Commit

Permalink
getVisits works differently between firefox and chrome.
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-bixby committed Jan 3, 2018
1 parent 4f5058a commit 4c5e13b
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/background/main.js
Expand Up @@ -304,10 +304,9 @@ class Folder extends Bookmark {
if (getNodeType(node) === "bookmark") {
// history.getVisits() is faster than history.search() because
// history.search() checks title and url, plus does not match url exactly, so it takes longer.
var p = chrome.history.getVisits({
// chrome expects a callback to be the second argument, while browser-api doesn't and returns promise.
var p = browser.history.getVisits({
url: node.url
}, function (visitItems) {
log(visitItems);
});
promiseAry.push(p);
} else {
Expand Down Expand Up @@ -342,9 +341,10 @@ class Folder extends Bookmark {
callback(self, compare, resolve);
}
});

} else {
resolve();
if (typeof resolve === "function") {
resolve();
}
}
});
}
Expand Down Expand Up @@ -440,9 +440,12 @@ class Folder extends Bookmark {
}
});
} else {
resolve();
if (typeof resolve === "function") {
resolve();
}
}
}

}

/**
Expand Down Expand Up @@ -691,7 +694,9 @@ class BookmarkSorter {
if (folder.canBeSorted()) {
folder.getChildren(this.sortFolder, this.compare, resolve);
} else {
resolve();
if (typeof resolve === "function") {
resolve();
}
}
}

Expand Down

0 comments on commit 4c5e13b

Please sign in to comment.