Bug 575581 - Default keyword search does not work for single-word keywords [r=mfinkle]
--- a/mobile/chrome/content/bindings/browser.xml
+++ b/mobile/chrome/content/bindings/browser.xml
@@ -424,17 +424,19 @@
STOP_ALL: 3,
canGoBack: false,
canGoForward: false,
goBack: function() { this._sendMessage("WebNavigation:GoBack", {}); },
goForward: function() { this._sendMessage("WebNavigation:GoForward", {}); },
gotoIndex: function(aIndex) { this._sendMessage("WebNavigation:GotoIndex", {index: aIndex}); },
loadURI: function(aURI, aLoadFlags, aReferrer, aPostData, aHeaders) {
- this._currentURI = this._browser._ios.newURI(aURI, null, null);
+ try {
+ this._currentURI = this._browser._ios.newURI(aURI, null, null);
+ } catch(e) {}
this._browser._contentTitle = "";
this._sendMessage("WebNavigation:LoadURI", {uri: aURI, flags: aLoadFlags});
},
reload: function(aReloadFlags) { this._sendMessage("WebNavigation:Reload", {flags: aReloadFlags}); },
stop: function(aStopFlags) { this._sendMessage("WebNavigation:Stop", {flags: aStopFlags}); },
get document() { Components.utils.reportError("contentDocument is not available"); return null; },
get currentURI() {
if (!this._currentURI)
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -441,22 +441,19 @@ var BrowserUI = {
else {
this._favicon.hidden = false;
this._throbber.hidden = true;
this._throbber.removeAttribute("loading");
}
},
getDisplayURI: function(browser) {
- if (!this._URIFixup)
- this._URIFixup = Cc["@mozilla.org/docshell/urifixup;1"].getService(Ci.nsIURIFixup);
-
let uri = browser.currentURI;
try {
- uri = this._URIFixup.createExposableURI(uri);
+ uri = gURIFixup.createExposableURI(uri);
} catch (ex) {}
return uri.spec;
},
/* Set the location to the current content */
updateURI: function() {
var browser = Browser.selectedBrowser;
@@ -487,31 +484,32 @@ var BrowserUI = {
Util.forceOnline();
// Give the new page lots of room
Browser.hideSidebars();
this.closeAutoComplete(true);
this._edit.value = aURI;
- let fixupFlags = Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
- let uri = gURIFixup.createFixupURI(aURI, fixupFlags);
-
// We need to keep about: pages opening in new "local" tabs. We also want to spawn
// new "remote" tabs if opening web pages from a "local" about: page.
let currentURI = getBrowser().currentURI;
- let useLocal = Util.isLocalScheme(uri.spec);
+ let useLocal = Util.isLocalScheme(aURI);
let hasLocal = Util.isLocalScheme(currentURI.spec);
if (hasLocal != useLocal) {
- Browser.addTab(uri.spec, true);
+ Browser.addTab(aURI, true);
} else {
let loadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
- getBrowser().loadURIWithFlags(uri.spec, loadFlags, null, null);
+ getBrowser().loadURIWithFlags(aURI, loadFlags, null, null);
}
+ // Delay doing the fixup so the raw URI is passed to loadURIWithFlags
+ // and the proper third-party fixup can be done
+ let fixupFlags = Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
+ let uri = gURIFixup.createFixupURI(aURI, fixupFlags);
gHistSvc.markPageAsTyped(uri);
},
showAutoComplete: function showAutoComplete() {
if (this.isAutoCompleteOpen())
return;
BrowserSearch.updateSearchButtons();