Bug 993705 - Avoid third party lookup for number-only searches. r=mfinkle

This commit is contained in:
Brian Nicholson 2014-05-22 22:10:31 -07:00
Родитель 35f022f74e
Коммит 67ef3e2f7f
1 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -1435,11 +1435,19 @@ var BrowserApp = {
case "Tab:Load": {
let data = JSON.parse(aData);
let url = data.url;
let flags;
if (/^[0-9]+$/.test(url)) {
// If the query is a number, force a search (see bug 993705; workaround for bug 693808).
url = URIFixup.keywordToURI(url).spec;
} else {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
}
// Pass LOAD_FLAGS_DISALLOW_INHERIT_OWNER to prevent any loads from
// inheriting the currently loaded document's principal.
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
if (data.userEntered) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
}
@ -1456,7 +1464,6 @@ var BrowserApp = {
desktopMode: (data.desktopMode === true)
};
let url = data.url;
if (data.engine) {
let engine = Services.search.getEngineByName(data.engine);
if (engine) {