   getUrl: (queryTerms) ->
     "http://suggestqueries.google.com/complete/search?ss_protocol=legace&client=toolbar&q=#{Utils.createSearchQuery queryTerms}"
 
-  parse: (xhr, callback) ->
-    if suggestions = xhr?.responseXML?.getElementsByTagName "suggestion"
-      suggestions =
-        for suggestion in suggestions
-          continue unless suggestion = suggestion.getAttribute "data"
-          suggestion
-      callback suggestions
-    else
-      callback []
+  # Returns a list of suggestions (strings).
+  parse: (xhr) ->
+    suggestions = xhr?.responseXML?.getElementsByTagName "suggestion"
+    return [] unless suggestions
+    for suggestion in suggestions
+      continue unless suggestion = suggestion.getAttribute "data"
+      suggestion
 
 # A dummy search engine which is guaranteed to match any search URL, but never produces completions.  This
 # allows the rest of the logic to be written knowing that there will be a search engine match.

    @requests ?= {} # Maps searchUrls to any outstanding HTTP request for that search engine.
    @cancel searchUrl

    # We cache the results of the most-recent 1000 requests (with a two-hour expiry).
    # FIXME(smblott) Currently we're caching XMLHttpRequest objects, which is wasteful of memory.  It would be
    # better to handle caching at a higher level.
    @requestCache ?= new SimpleCache 2 * 60 * 60 * 1000, 1000

    if @requestCache.has url
      callback @requestCache.get url

  # there will always be a match.  Imagining that there may be many search engines, and knowing that this is
  # called for every character entered, we cache the result.
  lookupEngine: (searchUrl) ->
    @engineCache ?= new SimpleCache 30 * 60 * 60 * 1000 # 30 hours (these are small, we can keep them longer).
    if @engineCache.has searchUrl
      @engineCache.get searchUrl
    else
