Bug 444735, move search service to toolkit, r=gavin
authorNeil Deakin <neil@mozilla.com>
Sat, 13 Sep 2008 17:01:14 -0400
changeset 19220 b6c3d94c2f66c323648d5332ef7d7d53e147eedb
parent 19219 365280a5b5481327ea9bf42e0e2d54627ace2cf0
child 19221 766c9fb5942c96f10b2bb982a713b96844186219
push id2030
push userneil@mozilla.com
push dateSat, 13 Sep 2008 21:01:59 +0000
treeherderautoland@b6c3d94c2f66 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs444735
milestone1.9.1b1pre
Bug 444735, move search service to toolkit, r=gavin
browser/components/search/Makefile.in
browser/components/search/nsIBrowserSearchService.idl
browser/components/search/nsSearchService.js
browser/components/search/nsSearchSuggestions.js
browser/components/sidebar/src/nsSidebar.js
browser/installer/unix/packages-static
browser/installer/windows/packages-static
browser/locales/en-US/chrome/browser/search.properties
toolkit/components/Makefile.in
toolkit/components/search/Makefile.in
toolkit/components/search/nsIBrowserSearchService.idl
toolkit/components/search/nsSearchService.js
toolkit/components/search/nsSearchSuggestions.js
toolkit/locales/en-US/chrome/search/search.properties
toolkit/locales/jar.mn
--- a/browser/components/search/Makefile.in
+++ b/browser/components/search/Makefile.in
@@ -42,23 +42,9 @@ srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 ifdef ENABLE_TESTS
 DIRS = test
 endif
 
-MODULE = browsersearch
-XPIDL_MODULE = browsersearch
-
-XPIDLSRCS = nsIBrowserSearchService.idl
-
-EXTRA_PP_COMPONENTS = nsSearchService.js \
-	nsSearchSuggestions.js
-
-ifneq (,$(BUILD_OFFICIAL)$(MOZILLA_OFFICIAL))
-DEFINES += -DOFFICIAL_BUILD=1
-endif
-
-DEFINES += -DMOZ_DISTRIBUTION_ID=$(MOZ_DISTRIBUTION_ID)
-
 include $(topsrcdir)/config/rules.mk
--- a/browser/components/sidebar/src/nsSidebar.js
+++ b/browser/components/sidebar/src/nsSidebar.js
@@ -147,17 +147,17 @@ function (engineURL, iconURL)
         ! /^(https?|ftp):\/\/.+\.(gif|jpg|jpeg|png|ico)$/i.test(iconURL))
       throw "Unsupported search icon URL.";
   }
   catch(ex)
   {
     debug(ex);
     Components.utils.reportError("Invalid argument passed to window.sidebar.addSearchEngine: " + ex);
     
-    var searchBundle = srGetStrBundle("chrome://browser/locale/search.properties");
+    var searchBundle = srGetStrBundle("chrome://global/locale/search/search.properties");
     var brandBundle = srGetStrBundle("chrome://branding/locale/brand.properties");
     var brandName = brandBundle.GetStringFromName("brandShortName");
     var title = searchBundle.GetStringFromName("error_invalid_engine_title");
     var msg = searchBundle.formatStringFromName("error_invalid_engine_msg",
                                                 [brandName], 1);
     var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].
              getService(Components.interfaces.nsIWindowWatcher);
     ww.getNewPrompter(null).alert(title, msg);
--- a/browser/installer/unix/packages-static
+++ b/browser/installer/unix/packages-static
@@ -61,17 +61,16 @@ bin/blocklist.xml
 bin/components/alerts.xpt
 bin/components/accessibility.xpt
 bin/components/appshell.xpt
 bin/components/appstartup.xpt
 bin/components/autocomplete.xpt
 bin/components/autoconfig.xpt
 bin/components/browsercompsbase.xpt
 bin/components/browserplaces.xpt
-bin/components/browsersearch.xpt
 bin/components/browser-feeds.xpt
 bin/components/caps.xpt
 bin/components/chardet.xpt
 bin/components/chrome.xpt
 bin/components/commandhandler.xpt
 bin/components/commandlines.xpt
 bin/components/composer.xpt
 bin/components/content_base.xpt
@@ -162,16 +161,17 @@ bin/components/toolkitremote.xpt
 bin/components/rdf.xpt
 bin/components/satchel.xpt
 bin/components/saxparser.xpt
 bin/components/shistory.xpt
 bin/components/spellchecker.xpt
 bin/components/storage.xpt
 bin/components/profile.xpt
 bin/components/toolkitprofile.xpt
+bin/components/toolkitsearch.xpt
 bin/components/txtsvc.xpt
 bin/components/txmgr.xpt
 bin/components/uconv.xpt
 bin/components/unicharutil.xpt
 bin/components/uriloader.xpt
 bin/components/webBrowser_core.xpt
 bin/components/webbrowserpersist.xpt
 bin/components/webshell_idls.xpt
--- a/browser/installer/windows/packages-static
+++ b/browser/installer/windows/packages-static
@@ -68,17 +68,16 @@ bin\AccessibleMarshal.dll
 bin\components\accessibility.xpt
 bin\components\accessibility-msaa.xpt
 bin\components\appshell.xpt
 bin\components\appstartup.xpt
 bin\components\autocomplete.xpt
 bin\components\autoconfig.xpt
 bin\components\browsercompsbase.xpt
 bin\components\browserplaces.xpt
-bin\components\browsersearch.xpt
 bin\components\browser-feeds.xpt
 bin\components\caps.xpt
 bin\components\chardet.xpt
 bin\components\chrome.xpt
 bin\components\commandhandler.xpt
 bin\components\commandlines.xpt
 bin\components\composer.xpt
 bin\components\content_base.xpt
@@ -166,16 +165,17 @@ bin\components\prefetch.xpt
 bin\components\profile.xpt
 bin\components\proxyObject.xpt
 bin\components\rdf.xpt
 bin\components\satchel.xpt
 bin\components\saxparser.xpt
 bin\components\shistory.xpt
 bin\components\storage.xpt
 bin\components\toolkitprofile.xpt
+bin\components\toolkitsearch.xpt
 bin\components\txtsvc.xpt
 bin\components\txmgr.xpt
 #ifdef MOZ_USE_NATIVE_UCONV
 bin\components\ucnative.xpt
 #endif
 bin\components\uconv.xpt
 bin\components\unicharutil.xpt
 bin\components\uriloader.xpt
--- a/browser/locales/en-US/chrome/browser/search.properties
+++ b/browser/locales/en-US/chrome/browser/search.properties
@@ -1,25 +1,10 @@
 searchtip=Search using %S
 
 cmd_clearHistory=Clear Search History
 cmd_clearHistory_accesskey=C
 
 cmd_showSuggestions=Show Suggestions
 cmd_showSuggestions_accesskey=S
 
-addEngineConfirmTitle=Add Search Engine
-addEngineConfirmation=Add "%S" to the list of engines available in the search bar?\n\nFrom: %S
-addEngineUseNowText=Start &using it right away
-addEngineAddButtonLabel=Add
-
-error_loading_engine_title=Download Error
-# LOCALIZATION NOTE (error_loading_engine_msg2): %1$S = brandShortName, %2$S = location
-error_loading_engine_msg2=%S could not download the search plugin from:\n%S
-error_duplicate_engine_msg=%S could not install the search plugin from "%S" because an engine with the same name already exists.
-
-error_invalid_engine_title=Install Error
-# LOCALIZATION NOTE (error_invalid_engine_msg): %S = brandShortName
-error_invalid_engine_msg=This search engine isn't supported by %S and can't be installed.
-
 cmd_addFoundEngine=Add "%S"
 
-suggestion_label=Suggestions
--- a/toolkit/components/Makefile.in
+++ b/toolkit/components/Makefile.in
@@ -84,16 +84,22 @@ endif
 ifdef NS_PRINTING
 DIRS +=	printing
 endif
 
 ifdef MOZ_VIEW_SOURCE
 DIRS +=	viewsource
 endif
 
+ifndef MOZ_SUITE
+ifndef MOZ_THUNDERBIRD
+DIRS +=	search
+endif
+endif
+
 ifdef MOZ_THUNDERBIRD
 DIRS += autocomplete/public
 else
 DIRS +=	\
 	cookie \
 	$(NULL)
 
 ifdef MOZ_XUL
new file mode 100644
--- /dev/null
+++ b/toolkit/components/search/Makefile.in
@@ -0,0 +1,60 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is the Browser Search Service.
+#
+# The Initial Developer of the Original Code is
+# Google Inc.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Ben Goodger <beng@google.com> (Original author)
+#   Gavin Sharp <gavin@gavinsharp.com>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK ***** */
+
+DEPTH     = ../../..
+topsrcdir = @top_srcdir@
+srcdir    = @srcdir@
+VPATH     = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = toolkitsearch
+XPIDL_MODULE = toolkitsearch
+
+XPIDLSRCS = nsIBrowserSearchService.idl
+
+EXTRA_PP_COMPONENTS = nsSearchService.js \
+	nsSearchSuggestions.js
+
+ifneq (,$(BUILD_OFFICIAL)$(MOZILLA_OFFICIAL))
+DEFINES += -DOFFICIAL_BUILD=1
+endif
+
+DEFINES += -DMOZ_DISTRIBUTION_ID=$(MOZ_DISTRIBUTION_ID)
+
+include $(topsrcdir)/config/rules.mk
rename from browser/components/search/nsIBrowserSearchService.idl
rename to toolkit/components/search/nsIBrowserSearchService.idl
rename from browser/components/search/nsSearchService.js
rename to toolkit/components/search/nsSearchService.js
--- a/browser/components/search/nsSearchService.js
+++ b/toolkit/components/search/nsSearchService.js
@@ -97,17 +97,17 @@ const NEW_LINES = /(\r\n|\r|\n)/;
 // Set an arbitrary cap on the maximum icon size. Without this, large icons can
 // cause big delays when loading them at startup.
 const MAX_ICON_SIZE   = 10000;
 
 // Default charset to use for sending search parameters. ISO-8859-1 is used to
 // match previous nsInternetSearchService behavior.
 const DEFAULT_QUERY_CHARSET = "ISO-8859-1";
 
-const SEARCH_BUNDLE = "chrome://browser/locale/search.properties";
+const SEARCH_BUNDLE = "chrome://global/locale/search/search.properties";
 const BRAND_BUNDLE = "chrome://branding/locale/brand.properties";
 
 const OPENSEARCH_NS_10  = "http://a9.com/-/spec/opensearch/1.0/";
 const OPENSEARCH_NS_11  = "http://a9.com/-/spec/opensearch/1.1/";
 
 // Although the specification at http://opensearch.a9.com/spec/1.1/description/
 // gives the namespace names defined above, many existing OpenSearch engines
 // are using the following versions.  We therefore allow either.
rename from browser/components/search/nsSearchSuggestions.js
rename to toolkit/components/search/nsSearchSuggestions.js
--- a/browser/components/search/nsSearchSuggestions.js
+++ b/toolkit/components/search/nsSearchSuggestions.js
@@ -37,17 +37,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 const SEARCH_RESPONSE_SUGGESTION_JSON = "application/x-suggestions+json";
 
 const BROWSER_SUGGEST_PREF = "browser.search.suggest.enabled";
 const XPCOM_SHUTDOWN_TOPIC              = "xpcom-shutdown";
 const NS_PREFBRANCH_PREFCHANGE_TOPIC_ID = "nsPref:changed";
-const SEARCH_BUNDLE = "chrome://browser/locale/search.properties";
+const SEARCH_BUNDLE = "chrome://global/locale/search/search.properties";
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cu = Components.utils;
 
 const HTTP_OK                    = 200;
 const HTTP_INTERNAL_SERVER_ERROR = 500;
new file mode 100644
--- /dev/null
+++ b/toolkit/locales/en-US/chrome/search/search.properties
@@ -0,0 +1,16 @@
+addEngineConfirmTitle=Add Search Engine
+addEngineConfirmation=Add "%S" to the list of engines available in the search bar?\n\nFrom: %S
+addEngineUseNowText=Start &using it right away
+addEngineAddButtonLabel=Add
+
+error_loading_engine_title=Download Error
+# LOCALIZATION NOTE (error_loading_engine_msg2): %1$S = brandShortName, %2$S = location
+error_loading_engine_msg2=%S could not download the search plugin from:\n%S
+error_duplicate_engine_msg=%S could not install the search plugin from "%S" because an engine with the same name already exists.
+
+error_invalid_engine_title=Install Error
+# LOCALIZATION NOTE (error_invalid_engine_msg): %S = brandShortName
+error_invalid_engine_msg=This search engine isn't supported by %S and can't be installed.
+
+suggestion_label=Suggestions
+
--- a/toolkit/locales/jar.mn
+++ b/toolkit/locales/jar.mn
@@ -111,8 +111,9 @@
 % locale help @AB_CD@ %locale/@AB_CD@/help/
   locale/@AB_CD@/help/help.properties                     (%chrome/mozapps/help/help.properties)
   locale/@AB_CD@/help/help.dtd                            (%chrome/mozapps/help/help.dtd)
   locale/@AB_CD@/help/help-toc.rdf                        (%chrome/mozapps/help/help-toc.rdf)
   locale/@AB_CD@/help/welcome.xhtml                       (%chrome/mozapps/help/welcome.xhtml)
 #endif
 % locale places @AB_CD@ %locale/@AB_CD@/places/
   locale/@AB_CD@/places/places.properties                 (%chrome/places/places.properties)
+  locale/@AB_CD@/global/search/search.properties          (%chrome/search/search.properties)