docs: function eval_locator(locator, inDocument, opt_contextNode)
  {
      locator = parse_locator(locator);
  
      var pageBot;
      if (typeof(selenium) != 'undefined' && selenium != undefined) {
          if (typeof(editor) == 'undefined' || editor.state == 'playing') {
              safe_log('info', 'Trying [' + locator.type + ']: '
                  + locator.string);
          }
          pageBot = selenium.browserbot;
      }
      else {
          if (!UI_GLOBAL.mozillaBrowserBot) {
              // create a browser bot to evaluate the locator. Hand it the IDE
              // window as a dummy window, and cache it for future use.
              UI_GLOBAL.mozillaBrowserBot = new MozillaBrowserBot(window)
          }
          pageBot = UI_GLOBAL.mozillaBrowserBot;
      }
  
      var results = [];
  
      if (locator.type == 'xpath' || (locator.string.charAt(0) == '/' &&
          locator.type == 'implicit')) {
          results = eval_xpath(locator.string, inDocument,
              { contextNode: opt_contextNode });
      }
      else if (locator.type == 'css') {
          results = eval_css(locator.string, inDocument);
      }
      else {
          var element = pageBot
              .findElementBy(locator.type, locator.string, inDocument);
          if (element != null) {
              results.push(element);
          }
      }
  
      // Unwrap each of the elements in the result
      for (var i = 0; i < results.length; i++) {
        results[i] = core.firefox.unwrap(results[i]);
      }
      return results;
  }