title: Using find bar routines programmatically causes find bar to appear
body: <p><strong>Update</strong>: It appears that the fix for <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=967982" rel="nofollow">bug 967982</a> is what's causing this. It would still be great to know either (a) how to work around this or (b) if there's an alternative way to find text in a given page.</p>
  
  <p>One of my Firefox extensions programmatically uses the browser's find bar to locate text on a web page. In recent versions of Firefox, executing my add-ons code causes the find bar to appear when a search term is <em>not</em> found, something it didn't do previously. My routine looks like this:</p>
  
  <pre><code>// Reuse the find bar mechanisms in Firefox (we get a bunch of stuff for free that way)
  FindInPage: function(term, e) {
      var findBar = document.defaultView.gFindBar;
      var shiftKey = e.shiftKey;
      var findObj;
      var cachedFindTerm;
  
      if ("_find" in findBar) {
          findObj = {
              find: function(t) {
                  findBar._find(findBar._findField.value = t);
              },
              findNext: function() {
                   findBar._findAgain(false);
              },
              findPrevious: function() {
                   findBar._findAgain(true);
              }
          };
  
          cachedFindTerm = gFindBar._findField.value;
      } else {
          findObj = findBar;
          cachedFindTerm = getBrowser().findString;
      }
  
      if (cachedFindTerm == term) {
          if(shiftKey)
              findObj.findPrevious();
          else
              findObj.findNext();
      } else {
          findObj.find(term);
          if(shiftKey)
              findObj.findPrevious();
      }
  },
  </code></pre>
  
  <p>Is there some way I can prevent the find bar from appearing when this block gets executed? I'm aware that using private functions like this is not a best practice, but is there a better way to find a given word in a web page? Some sort of search API available to add-on authors that I'm not aware of?</p>