Bug 1492475 - Part 2: Move nsIBrowserSearchService.idl to toolkit/components/search/nsISearchService.idl and update references. r=florian
authorMike de Boer <mdeboer@mozilla.com>
Tue, 16 Oct 2018 12:16:30 +0200
changeset 452864 79b2eb2367aab104669bbc75c3b42290f7de1570
parent 452863 891252fdd0b1a3e6b129025d94952ac30d922c7e
child 452865 a947d3cdf078032614edaa491ec3db1d046b55f4
push id2
push usermdeboer@mozilla.com
push dateTue, 08 Jan 2019 17:01:21 +0000
reviewersflorian
bugs1492475
milestone66.0a1
Bug 1492475 - Part 2: Move nsIBrowserSearchService.idl to toolkit/components/search/nsISearchService.idl and update references. r=florian Differential Revision: https://phabricator.services.mozilla.com/D9275
docshell/base/nsDefaultURIFixup.cpp
docshell/base/nsDocShell.cpp
dom/ipc/ContentParent.cpp
netwerk/base/moz.build
netwerk/base/nsIBrowserSearchService.idl
toolkit/components/search/moz.build
toolkit/components/search/nsISearchService.idl
toolkit/components/search/nsSearchService.js
--- a/docshell/base/nsDefaultURIFixup.cpp
+++ b/docshell/base/nsDefaultURIFixup.cpp
@@ -7,17 +7,17 @@
 #include "nsNetCID.h"
 #include "nsNetUtil.h"
 #include "nsIProtocolHandler.h"
 
 #include "nsIFile.h"
 #include <algorithm>
 
 #ifdef MOZ_TOOLKIT_SEARCH
-#include "nsIBrowserSearchService.h"
+#include "nsISearchService.h"
 #endif
 
 #include "nsIURIFixup.h"
 #include "nsIURIMutator.h"
 #include "nsDefaultURIFixup.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/ipc/IPCStreamUtils.h"
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -213,17 +213,17 @@
 #endif
 
 #if NS_PRINT_PREVIEW
 #include "nsIDocumentViewerPrint.h"
 #include "nsIWebBrowserPrint.h"
 #endif
 
 #ifdef MOZ_TOOLKIT_SEARCH
-#include "nsIBrowserSearchService.h"
+#include "nsISearchService.h"
 #endif
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::net;
 
 // Threshold value in ms for META refresh based redirects
 #define REFRESH_REDIRECT_TIMER 15000
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -256,17 +256,17 @@
 #if defined(XP_LINUX)
 #include "mozilla/SandboxInfo.h"
 #include "mozilla/SandboxBroker.h"
 #include "mozilla/SandboxBrokerPolicyFactory.h"
 #endif
 #endif
 
 #ifdef MOZ_TOOLKIT_SEARCH
-#include "nsIBrowserSearchService.h"
+#include "nsISearchService.h"
 #endif
 
 #ifdef XP_WIN
 #include "mozilla/audio/AudioNotificationSender.h"
 #include "mozilla/widget/AudioSession.h"
 #endif
 
 #ifdef ACCESSIBILITY
--- a/netwerk/base/moz.build
+++ b/netwerk/base/moz.build
@@ -125,21 +125,16 @@ XPIDL_SOURCES += [
     'nsIURI.idl',
     'nsIURIMutator.idl',
     'nsIURIWithSpecialOrigin.idl',
     'nsIURL.idl',
     'nsIURLParser.idl',
     'nsPISocketTransportService.idl',
 ]
 
-if CONFIG['MOZ_TOOLKIT_SEARCH']:
-    XPIDL_SOURCES += [
-        'nsIBrowserSearchService.idl',
-    ]
-
 XPIDL_MODULE = 'necko'
 
 EXPORTS += [
     'netCore.h',
     'nsASocketHandler.h',
     'nsAsyncRedirectVerifyHelper.h',
     'nsFileStreams.h',
     'nsInputStreamPump.h',
--- a/toolkit/components/search/moz.build
+++ b/toolkit/components/search/moz.build
@@ -1,23 +1,30 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell/xpcshell.ini']
 
+if CONFIG['MOZ_TOOLKIT_SEARCH']:
+    XPIDL_SOURCES += [
+        'nsISearchService.idl',
+    ]
+
+XPIDL_MODULE = 'toolkit_search'
+
 EXTRA_COMPONENTS += [
     'nsSearchService.js',
     'nsSearchSuggestions.js',
 ]
 
-if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']:
-    DEFINES['HAVE_SIDEBAR'] = True
+if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']:
+    DEFINES['HAVE_SIDEBAR'] = True
     EXTRA_COMPONENTS += [
     'nsSidebar.js',
     ]
 
 EXTRA_JS_MODULES += [
     'SearchSuggestionController.jsm',
 ]
 
rename from netwerk/base/nsIBrowserSearchService.idl
rename to toolkit/components/search/nsISearchService.idl
--- a/toolkit/components/search/nsSearchService.js
+++ b/toolkit/components/search/nsSearchService.js
@@ -62,29 +62,29 @@ const PERMS_FILE    = 0o644;
 const NS_APP_DISTRIBUTION_SEARCH_DIR_LIST = "SrchPluginsDistDL";
 const NS_APP_USER_PROFILE_50_DIR = "ProfD";
 
 // We load plugins from APP_SEARCH_PREFIX, where a list.json
 // file needs to exist to list available engines.
 const APP_SEARCH_PREFIX = "resource://search-plugins/";
 const EXT_SEARCH_PREFIX = "resource://search-extensions/";
 
-// See documentation in nsIBrowserSearchService.idl.
+// See documentation in nsISearchService.idl.
 const SEARCH_ENGINE_TOPIC        = "browser-search-engine-modified";
 const TOPIC_LOCALES_CHANGE       = "intl:app-locales-changed";
 const QUIT_APPLICATION_TOPIC     = "quit-application";
 
 const SEARCH_ENGINE_REMOVED      = "engine-removed";
 const SEARCH_ENGINE_ADDED        = "engine-added";
 const SEARCH_ENGINE_CHANGED      = "engine-changed";
 const SEARCH_ENGINE_LOADED       = "engine-loaded";
 const SEARCH_ENGINE_CURRENT      = "engine-current";
 const SEARCH_ENGINE_DEFAULT      = "engine-default";
 
-// The following constants are left undocumented in nsIBrowserSearchService.idl
+// The following constants are left undocumented in nsISearchService.idl
 // For the moment, they are meant for testing/debugging purposes only.
 
 /**
  * Topic used for events involving the service itself.
  */
 const SEARCH_SERVICE_TOPIC       = "browser-search-service";
 
 /**
@@ -843,17 +843,17 @@ function getMozParamPref(prefName) {
  * Notifies watchers of SEARCH_ENGINE_TOPIC about changes to an engine or to
  * the state of the search service.
  *
  * @param aEngine
  *        The nsISearchEngine object to which the change applies.
  * @param aVerb
  *        A verb describing the change.
  *
- * @see nsIBrowserSearchService.idl
+ * @see nsISearchService.idl
  */
 var gInitialized = false;
 function notifyAction(aEngine, aVerb) {
   if (gInitialized) {
     LOG("NOTIFY: Engine: \"" + aEngine.name + "\"; Verb: \"" + aVerb + "\"");
     Services.obs.notifyObservers(aEngine, SEARCH_ENGINE_TOPIC, aVerb);
   }
 }
@@ -3502,16 +3502,17 @@ SearchService.prototype = {
     let request = new XMLHttpRequest();
     request.overrideMimeType("text/plain");
     let list = await new Promise(resolve => {
       request.onload = function(aEvent) {
         resolve(aEvent.target.responseText);
       };
       request.onerror = function(aEvent) {
         LOG("_asyncFindJAREngines: failed to read " + listURL);
+        resolve();
       };
       request.open("GET", Services.io.newURI(listURL).spec, true);
       request.send();
     });
 
     this._parseListJSON(list, uris);
     return uris;
   },