Permalink
Browse files

typeahead search results presented asynchronously

  • Loading branch information...
1 parent cc06131 commit b4c892e35f6f616f75076020257c302239f660fa @mackers mackers committed Jan 20, 2012
Showing with 15 additions and 5 deletions.
  1. +7 −4 chrome/content/toolbar.js
  2. +8 −1 components/fbRemoteAutoComplete.js
View
11 chrome/content/toolbar.js
@@ -118,10 +118,13 @@ var facebook = {
while (browserEnumerator.hasMoreElements())
{
- var brow = browserEnumerator.getNext().gBrowser;
- var host = brow.currentURI.host;
- if (host == "www.facebook.com")
- brow.loadURI("http://www.facebook.com/");
+ try
+ {
+ var brow = browserEnumerator.getNext().gBrowser;
+ var host = brow.currentURI.host;
+ if (host == "www.facebook.com")
+ brow.loadURI("http://www.facebook.com/");
+ } catch (e) {}
}
break;
View
9 components/fbRemoteAutoComplete.js
@@ -645,7 +645,14 @@ FacebookRemoteAutoCompleteSearch.prototype = {
//this._lastResult = res;
debug("results found in cache = " + res.matchCount + " , will show results now");
- return listener.onSearchResult(this, res);
+ var event = {
+ notify: function(timer) {
+ listener.onSearchResult(self, res);
+ }
+ };
+
+ self.queryTimeout = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
+ self.queryTimeout.initWithCallback(event, 500, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
}
else
{

0 comments on commit b4c892e

Please sign in to comment.