From 0291f540ae98ffeab82375072eebbbd3b3f84f99 Mon Sep 17 00:00:00 2001 From: "neil%parkwaycc.co.uk" Date: Sat, 8 Mar 2008 23:42:57 +0000 Subject: [PATCH] Bug 408248 Support keyword search from third-party applications r=mcsmurf sr=jag git-svn-id: svn://10.0.0.236/trunk@247415 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/suite/browser/browser-prefs.js | 1 + mozilla/suite/browser/nsBrowserContentHandler.js | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/mozilla/suite/browser/browser-prefs.js b/mozilla/suite/browser/browser-prefs.js index 2c5fe776604..9a616f92463 100644 --- a/mozilla/suite/browser/browser-prefs.js +++ b/mozilla/suite/browser/browser-prefs.js @@ -159,6 +159,7 @@ pref("browser.translation.serviceDomain", "chrome://navigator-region/locale/regi // Smart Browsing prefs pref("browser.related.provider", "http://www-rl.netscape.com/wtgn?"); pref("browser.related.disabledForDomains", ""); +pref("keyword.enabled", true); pref("keyword.moreInfoURL", "chrome://branding/locale/brand.properties"); //Internet Search diff --git a/mozilla/suite/browser/nsBrowserContentHandler.js b/mozilla/suite/browser/nsBrowserContentHandler.js index 51438e59af1..69e056b6996 100644 --- a/mozilla/suite/browser/nsBrowserContentHandler.js +++ b/mozilla/suite/browser/nsBrowserContentHandler.js @@ -50,6 +50,7 @@ const nsIFactory = Components.interfaces.nsIFactory; const nsIFileURL = Components.interfaces.nsIFileURL; const nsIHttpProtocolHandler = Components.interfaces.nsIHttpProtocolHandler; const nsINetUtil = Components.interfaces.nsINetUtil; +const nsIIOService = Components.interfaces.nsIIOService; const nsIPrefService = Components.interfaces.nsIPrefService; const nsIPrefBranch = Components.interfaces.nsIPrefBranch; const nsIPrefLocalizedString = Components.interfaces.nsIPrefLocalizedString; @@ -80,11 +81,13 @@ function shouldLoadURI(aURI) function resolveURIInternal(aCmdLine, aArgument) { try { - var uri = aCmdLine.resolveURI(aArgument); - if (!(uri instanceof nsIFileURL) || uri.file.exists()) - return uri; + var file = aCmdLine.resolveFile(aArgument); + if (file.exists()) { + var ioService = Components.classes["@mozilla.org/network/io-service;1"] + .getService(nsIIOService); + return ioService.newFileURI(file); + } } catch (e) { - Components.utils.reportError(e); } // We have interpreted the argument as a relative file URI, but the file @@ -94,12 +97,13 @@ function resolveURIInternal(aCmdLine, aArgument) var urifixup = Components.classes["@mozilla.org/docshell/urifixup;1"] .getService(nsIURIFixup); - uri = urifixup.createFixupURI(aArgument, 0); + return urifixup.createFixupURI(aArgument, + nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP); } catch (e) { Components.utils.reportError(e); } - return uri; + return null; } function getHomePageGroup(prefs)