diff options
| author | Niklas Baumstark | 2012-01-21 15:44:13 +0100 |
|---|---|---|
| committer | Niklas Baumstark | 2012-04-10 23:54:36 +0200 |
| commit | 3520212b6ef4945b96fc061ecfe7c198195e1ee4 (patch) | |
| tree | c80065d33866208cf93f1c0306b212c13c9ec6c2 | |
| parent | 0bcad9357ad0a774ce2190f1e990dcdd17762c2a (diff) | |
| download | vimium-3520212b6ef4945b96fc061ecfe7c198195e1ee4.tar.bz2 | |
move some logic from background to content page
| -rw-r--r-- | background_page.html | 17 | ||||
| -rw-r--r-- | lib/completion.js | 2 |
2 files changed, 4 insertions, 15 deletions
diff --git a/background_page.html b/background_page.html index bca446a6..97017fad 100644 --- a/background_page.html +++ b/background_page.html @@ -291,8 +291,6 @@ chrome.bookmarks.getTree(function(bookmarks) { var results = []; traverseTree(bookmarks, function(bookmark) { - if (typeof bookmark.url === "undefined") - return; results.push(bookmark); }); port.postMessage({bookmarks:results}); @@ -302,19 +300,8 @@ function getHistory(args, port) { chrome.history.search({ text: '', maxResults: args.maxResults || 1000 }, - function(history) { - // sort by visit cound descending - history.sort(function(a, b) { - // visitCount may be undefined - var visitCountForA = a.visitCount || 0; - var visitCountForB = a.visitCount || 0; - return visitCountForB - visitCountForA; - }); - var results = []; - for (var i = 0; i < history.length; ++i) { - results.push(history[i]); - } - port.postMessage({history:results}); + function(history) { + port.postMessage({history:history}); }); }; diff --git a/lib/completion.js b/lib/completion.js index d0c798c8..1eb87d51 100644 --- a/lib/completion.js +++ b/lib/completion.js @@ -356,6 +356,8 @@ var completion = (function() { for (var i = 0; i < msg.bookmarks.length; ++i) { var bookmark = msg.bookmarks[i]; + if (bookmark.url === undefined) + continue; var title = ''; if (bookmark.title.length > 0) |
