rem: function getShortcutOrURI(aURL, aPostDataRef) {  
add: function getShortcutOrURI(aURL, aPostDataRef) { var shortcutURL = null; var keyword = aURL; var param = ""; var searchService = Cc["@mozilla.org/browser/search-service;1"]. getService(Ci.nsIBrowserSearchService);  var offset = aURL.indexOf(" "); if (offset > 0) { keyword = aURL.substr(0, offset); param = aURL.substr(offset + 1); }  var engine = searchService.getEngineByAlias(keyword); if (engine) return engine.getSubmission(param, null).uri.spec;  
context: function getShortcutOrURI(aURL, aPostDataRef){  // rjc: added support for URL shortcuts (3/30/1999)  try {    var shortcutURL = null;#ifdef MOZ_PLACES_BOOKMARKS    var shortcutURI = PlacesUtils.bookmarks.getURIForKeyword(aURL);    if (shortcutURI) {      shortcutURL = shortcutURI.spec;      // get POST data      var postData = PlacesUtils.getPostDataForURI(shortcutURI);      aPostDataRef.value = postData;    }#else    shortcutURL = BMSVC.resolveKeyword(aURL, aPostDataRef);#endif    if (!shortcutURL) {      // rjc: add support for string substitution with shortcuts (4/4/2000)      //      (see bug # 29871 for details)      var aOffset = aURL.indexOf(" ");      if (aOffset > 0) {        var cmd = aURL.substr(0, aOffset);        var text = aURL.substr(aOffset+1);#ifdef MOZ_PLACES_BOOKMARKS        shortcutURI = PlacesUtils.bookmarks.getURIForKeyword(cmd);        if (shortcutURI)          shortcutURL = shortcutURI.spec;#else        shortcutURL = BMSVC.resolveKeyword(cmd, aPostDataRef);#endif        if (shortcutURL && text) {          var encodedText = null;           var charset = "";          const re = /^(.*)\&mozcharset=([a-zA-Z][_\-a-zA-Z0-9]+)\s*$/;           var matches = shortcutURL.match(re);          if (matches) {             shortcutURL = matches[1];             charset = matches[2];          }#ifndef MOZ_PLACES_BOOKMARKS          // FIXME: Bug #317472, we don't have last charset in places yet.          else if (/%s/.test(shortcutURL) ||                    (aPostDataRef && /%s/.test(aPostDataRef.value))) {            try {              charset = BMSVC.getLastCharset(shortcutURL);            } catch (ex) {            }          }#endif          if (charset)            encodedText = escape(convertFromUnicode(charset, text));           else  // default case: charset=UTF-8            encodedText = encodeURIComponent(text);          if (aPostDataRef && aPostDataRef.value) {            // XXXben - currently we only support "application/x-www-form-urlencoded"            //          enctypes.            aPostDataRef.value = unescape(aPostDataRef.value);            if (aPostDataRef.value.match(/%[sS]/)) {              aPostDataRef.value = getPostDataStream(aPostDataRef.value,                                                     text, encodedText,                                                     "application/x-www-form-urlencoded");            }            else {              shortcutURL = null;              aPostDataRef.value = null;            }          }          else {            if (/%[sS]/.test(shortcutURL))              shortcutURL = shortcutURL.replace(/%s/g, encodedText)                                       .replace(/%S/g, text);            else               shortcutURL = null;          }        }      }    }    if (shortcutURL)      aURL = shortcutURL;  } catch (ex) {  }  return aURL;}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/8395/ca0e1f37e7a3a52ccbbc0fca39c5ec2459eb01ab/browser.js/clean/browser/base/content/browser.js