Bug 862148 - stop supporting installation of Sherlock plugins through Services.search.addEngine, r=adw.
authorFlorian Quèze <florian@queze.net>
Wed, 23 Sep 2015 12:05:36 +0200
changeset 295651 ce4065567b884b38758ce0956b9fb65f7a5facac
parent 295650 923c13d8a0cfaa830e0656830c1c86a84cfd3f66
child 295652 fe5773db84788c28b6c2bc67821bf3380f9b7a1e
push id5706
push usermconley@mozilla.com
push dateWed, 23 Sep 2015 15:33:22 +0000
reviewersadw
bugs862148
milestone44.0a1
Bug 862148 - stop supporting installation of Sherlock plugins through Services.search.addEngine, r=adw.
browser/components/search/test/browser.ini
browser/components/search/test/browser_addEngine.js
browser/components/search/test/testEngine.src
netwerk/base/nsIBrowserSearchService.idl
toolkit/components/processsingleton/MainProcessSingleton.js
toolkit/components/search/nsSearchService.js
toolkit/components/search/nsSidebar.js
toolkit/components/search/tests/xpcshell/data/engine.src
toolkit/components/search/tests/xpcshell/head_search.js
toolkit/components/search/tests/xpcshell/test_nodb_pluschanges.js
toolkit/components/search/tests/xpcshell/test_parseSubmissionURL.js
toolkit/components/search/tests/xpcshell/test_save_sorted_engines.js
toolkit/components/search/tests/xpcshell/test_serialize_file.js
toolkit/components/search/tests/xpcshell/xpcshell.ini
--- a/browser/components/search/test/browser.ini
+++ b/browser/components/search/test/browser.ini
@@ -2,17 +2,16 @@
 skip-if = buildapp == 'mulet'
 support-files =
   426329.xml
   483086-1.xml
   483086-2.xml
   head.js
   opensearch.html
   test.html
-  testEngine.src
   testEngine.xml
   testEngine_diacritics.xml
   testEngine_dupe.xml
   testEngine_mozsearch.xml
   webapi.html
 
 [browser_426329.js]
 skip-if = e10s # Bug ?????? - Test uses load event and checks event.target.
--- a/browser/components/search/test/browser_addEngine.js
+++ b/browser/components/search/test/browser_addEngine.js
@@ -74,47 +74,16 @@ var gTests = [
     },
     removed: function (engine) {
       let currentEngine = gSS.currentEngine;
       ok(currentEngine, "An engine is present.");
       isnot(currentEngine.name, this.engine.name, "Current engine reset after removal");
 
       nextTest();
     }
-  },
-  {
-    name: "sherlock install",
-    engine: {
-      name: "Test Sherlock",
-      alias: null,
-      description: "Test Description",
-      searchForm: "http://example.com/searchform",
-      type: Ci.nsISearchEngine.TYPE_SHERLOCK
-    },
-    run: function () {
-      gSS.addEngine("http://mochi.test:8888/browser/browser/components/search/test/testEngine.src",
-                    Ci.nsISearchEngine.DATA_TEXT, "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC",
-                    false);
-    },
-    added: function (engine) {
-      ok(engine, "engine was added.");
-      checkEngine(this.engine, engine);
-
-      let engineFromSS = gSS.getEngineByName(this.engine.name);
-      is(engineFromSS, engine, "engine is obtainable via getEngineByName");
-
-      gSS.removeEngine(engine);
-    },
-    removed: function (engine) {
-      let currentEngine = gSS.currentEngine;
-      ok(currentEngine, "An engine is present.");
-      isnot(currentEngine.name, this.engine.name, "Current engine reset after removal");
-
-      nextTest();
-    }
   }
 ];
 
 var gCurrentTest = null;
 function nextTest() {
   if (gTests.length) {
     gCurrentTest = gTests.shift();
     info("Running " + gCurrentTest.name);
deleted file mode 100644
--- a/browser/components/search/test/testEngine.src
+++ /dev/null
@@ -1,11 +0,0 @@
-<search 
-  name="Test Sherlock"
-  description="Test Description"
-  method="GET"
-  searchform="http://example.com/searchform"
-  action="http://example.com/action"
-  queryCharset="UTF-8"
->
-  <input name="userParam" user>
-  <input name="param" value="value">
-</search>
--- a/netwerk/base/nsIBrowserSearchService.idl
+++ b/netwerk/base/nsIBrowserSearchService.idl
@@ -291,18 +291,17 @@ interface nsIBrowserSearchService : nsIS
    * asking the user for confirmation first.  If a confirmation dialog is
    * shown, it will offer the option to begin using the newly added engine
    * right away.
    *
    * @param engineURL
    *        The URL to the search engine's description file.
    *
    * @param dataType
-   *        An integer representing the plugin file format. Must be one
-   *        of the supported search engine data types defined above.
+   *        Obsolete, the value is ignored.
    *
    * @param iconURL
    *        A URL string to an icon file to be used as the search engine's
    *        icon. This value may be overridden by an icon specified in the
    *        engine description file.
    *
    * @param confirm
    *        A boolean value indicating whether the user should be asked for
--- a/toolkit/components/processsingleton/MainProcessSingleton.js
+++ b/toolkit/components/processsingleton/MainProcessSingleton.js
@@ -20,17 +20,17 @@ MainProcessSingleton.prototype = {
 
   logConsoleMessage: function(message) {
     let logMsg = message.data;
     logMsg.wrappedJSObject = logMsg;
     Services.obs.notifyObservers(logMsg, "console-api-log-event", null);
   },
 
   // Called when a webpage calls window.external.AddSearchProvider
-  addSearchEngine: function({ target: browser, data: { pageURL, engineURL, type } }) {
+  addSearchEngine: function({ target: browser, data: { pageURL, engineURL } }) {
     pageURL = NetUtil.newURI(pageURL);
     engineURL = NetUtil.newURI(engineURL, null, pageURL);
 
     let iconURL;
     let tabbrowser = browser.getTabBrowser();
     if (browser.mIconURL && (!tabbrowser || tabbrowser.shouldLoadFavIcon(pageURL)))
       iconURL = NetUtil.newURI(browser.mIconURL);
 
@@ -56,17 +56,17 @@ MainProcessSingleton.prototype = {
       Services.ww.getNewPrompter(browser.ownerDocument.defaultView).alert(title, msg);
       return;
     }
 
     Services.search.init(function(status) {
       if (status != Cr.NS_OK)
         return;
 
-      Services.search.addEngine(engineURL.spec, type, iconURL ? iconURL.spec : null, true);
+      Services.search.addEngine(engineURL.spec, null, iconURL ? iconURL.spec : null, true);
     })
   },
 
   observe: function(subject, topic, data) {
     switch (topic) {
     case "app-startup": {
       Services.obs.addObserver(this, "xpcom-shutdown", false);
 
--- a/toolkit/components/search/nsSearchService.js
+++ b/toolkit/components/search/nsSearchService.js
@@ -94,20 +94,16 @@ const SEARCH_SERVICE_METADATA_WRITTEN  =
 
 /**
  * Sent whenever the cache is fully written to disk.
  */
 const SEARCH_SERVICE_CACHE_WRITTEN  = "write-cache-to-disk-complete";
 
 const SEARCH_TYPE_MOZSEARCH      = Ci.nsISearchEngine.TYPE_MOZSEARCH;
 const SEARCH_TYPE_OPENSEARCH     = Ci.nsISearchEngine.TYPE_OPENSEARCH;
-const SEARCH_TYPE_SHERLOCK       = Ci.nsISearchEngine.TYPE_SHERLOCK;
-
-const SEARCH_DATA_XML            = Ci.nsISearchEngine.DATA_XML;
-const SEARCH_DATA_TEXT           = Ci.nsISearchEngine.DATA_TEXT;
 
 // Delay for lazy serialization (ms)
 const LAZY_SERIALIZE_DELAY = 100;
 
 // Delay for batching invalidation of the JSON cache (ms)
 const CACHE_INVALIDATION_DELAY = 1000;
 
 // Current cache version. This should be incremented if the format of the cache
@@ -1481,25 +1477,21 @@ EngineURL.prototype = {
   }
 };
 
 /**
  * nsISearchEngine constructor.
  * @param aLocation
  *        A nsILocalFile or nsIURI object representing the location of the
  *        search engine data file.
- * @param aSourceDataType
- *        The data type of the file used to describe the engine. Must be either
- *        DATA_XML or DATA_TEXT.
  * @param aIsReadOnly
  *        Boolean indicating whether the engine should be treated as read-only.
  *        Read only engines cannot be serialized to file.
  */
-function Engine(aLocation, aSourceDataType, aIsReadOnly) {
-  this._dataType = aSourceDataType;
+function Engine(aLocation, aIsReadOnly) {
   this._readOnly = aIsReadOnly;
   this._urls = [];
 
   if (aLocation.type) {
     if (aLocation.type == "filePath")
       this._file = aLocation.value;
     else if (aLocation.type == "uri")
       this._uri = aLocation.value;
@@ -1531,18 +1523,16 @@ Engine.prototype = {
   // not-initialized-from-engineMetadataService.
   _alias: undefined,
   // A distribution-unique identifier for the engine. Either null or set
   // when loaded. See getter.
   _identifier: undefined,
   // The data describing the engine. Is either an array of bytes, for Sherlock
   // files, or an XML document element, for XML plugins.
   _data: null,
-  // The engine's data type. See data types (DATA_) defined above.
-  _dataType: null,
   // Whether or not the engine is readonly.
   _readOnly: true,
   // The engine's description
   _description: "",
   // Used to store the engine to replace, if we're an update to an existing
   // engine.
   _engineToUpdate: null,
   // The file from which the plugin was loaded.
@@ -1613,69 +1603,55 @@ Engine.prototype = {
   // The url to check for a new icon
   _iconUpdateURL: null,
   /* Deferred serialization task. */
   _lazySerializeTask: null,
   /* The extension ID if added by an extension. */
   _extensionID: null,
 
   /**
-   * Retrieves the data from the engine's file. If the engine's dataType is
-   * XML, the document element is placed in the engine's data field. For text
-   * engines, the data is just read directly from file and placed as an array
-   * of lines in the engine's data field.
+   * Retrieves the data from the engine's file.
+   * The document element is placed in the engine's data field.
    */
   _initFromFile: function SRCH_ENG_initFromFile() {
     if (!this._file || !this._file.exists())
       FAIL("File must exist before calling initFromFile!", Cr.NS_ERROR_UNEXPECTED);
 
     var fileInStream = Cc["@mozilla.org/network/file-input-stream;1"].
                        createInstance(Ci.nsIFileInputStream);
 
     fileInStream.init(this._file, MODE_RDONLY, FileUtils.PERMS_FILE, false);
 
-    if (this._dataType == SEARCH_DATA_XML) {
-      var domParser = Cc["@mozilla.org/xmlextras/domparser;1"].
-                      createInstance(Ci.nsIDOMParser);
-      var doc = domParser.parseFromStream(fileInStream, "UTF-8",
-                                          this._file.fileSize,
-                                          "text/xml");
-
-      this._data = doc.documentElement;
-    } else {
-      ERROR("Unsuppored engine _dataType in _initFromFile: \"" +
-            this._dataType + "\"",
-            Cr.NS_ERROR_UNEXPECTED);
-    }
+    var domParser = Cc["@mozilla.org/xmlextras/domparser;1"].
+                    createInstance(Ci.nsIDOMParser);
+    var doc = domParser.parseFromStream(fileInStream, "UTF-8",
+                                        this._file.fileSize,
+                                        "text/xml");
+
+    this._data = doc.documentElement;
     fileInStream.close();
 
     // Now that the data is loaded, initialize the engine object
     this._initFromData();
   },
 
   /**
-   * Retrieves the data from the engine's file asynchronously. If the engine's
-   * dataType is XML, the document element is placed in the engine's data field.
+   * Retrieves the data from the engine's file asynchronously.
+   * The document element is placed in the engine's data field.
    *
    * @returns {Promise} A promise, resolved successfully if initializing from
    * data succeeds, rejected if it fails.
    */
   _asyncInitFromFile: function SRCH_ENG__asyncInitFromFile() {
     return Task.spawn(function() {
       if (!this._file || !(yield OS.File.exists(this._file.path)))
         FAIL("File must exist before calling initFromFile!", Cr.NS_ERROR_UNEXPECTED);
 
-      if (this._dataType == SEARCH_DATA_XML) {
-        let fileURI = NetUtil.ioService.newFileURI(this._file);
-        yield this._retrieveSearchXMLData(fileURI.spec);
-      } else {
-        ERROR("Unsuppored engine _dataType in _initFromFile: \"" +
-              this._dataType + "\"",
-              Cr.NS_ERROR_UNEXPECTED);
-      }
+      let fileURI = NetUtil.ioService.newFileURI(this._file);
+      yield this._retrieveSearchXMLData(fileURI.spec);
 
       // Now that the data is loaded, initialize the engine object
       this._initFromData();
     }.bind(this));
   },
 
   /**
    * Retrieves the engine data from a URI. Initializes the engine, flushes to
@@ -1875,31 +1851,20 @@ Engine.prototype = {
     var engineToUpdate = null;
     if (aEngine._engineToUpdate) {
       engineToUpdate = aEngine._engineToUpdate.wrappedJSObject;
 
       // Make this new engine use the old engine's file.
       aEngine._file = engineToUpdate._file;
     }
 
-    switch (aEngine._dataType) {
-      case SEARCH_DATA_XML:
-        var parser = Cc["@mozilla.org/xmlextras/domparser;1"].
-                     createInstance(Ci.nsIDOMParser);
-        var doc = parser.parseFromBuffer(aBytes, aBytes.length, "text/xml");
-        aEngine._data = doc.documentElement;
-        break;
-      case SEARCH_DATA_TEXT:
-        aEngine._data = aBytes;
-        break;
-      default:
-        promptError();
-        LOG("_onLoad: Bogus engine _dataType: \"" + this._dataType + "\"");
-        return;
-    }
+    var parser = Cc["@mozilla.org/xmlextras/domparser;1"].
+                 createInstance(Ci.nsIDOMParser);
+    var doc = parser.parseFromBuffer(aBytes, aBytes.length, "text/xml");
+    aEngine._data = doc.documentElement;
 
     try {
       // Initialize the engine from the obtained data
       aEngine._initFromData();
     } catch (ex) {
       LOG("_onLoad: Failed to init engine!\n" + ex);
       // Report an error to the user
       promptError();
@@ -2129,45 +2094,34 @@ Engine.prototype = {
   /**
    * Initialize this Engine object from the collected data.
    */
   _initFromData: function SRCH_ENG_initFromData() {
     ENSURE_WARN(this._data, "Can't init an engine with no data!",
                 Cr.NS_ERROR_UNEXPECTED);
 
     // Find out what type of engine we are
-    switch (this._dataType) {
-      case SEARCH_DATA_XML:
-        if (checkNameSpace(this._data, [MOZSEARCH_LOCALNAME],
-            [MOZSEARCH_NS_10])) {
-
-          LOG("_init: Initing MozSearch plugin from " + this._location);
-
-          this._type = SEARCH_TYPE_MOZSEARCH;
-          this._parseAsMozSearch();
-
-        } else if (checkNameSpace(this._data, [OPENSEARCH_LOCALNAME],
-                                  OPENSEARCH_NAMESPACES)) {
-
-          LOG("_init: Initing OpenSearch plugin from " + this._location);
-
-          this._type = SEARCH_TYPE_OPENSEARCH;
-          this._parseAsOpenSearch();
-
-        } else
-          FAIL(this._location + " is not a valid search plugin.", Cr.NS_ERROR_FAILURE);
-
-        break;
-      case SEARCH_DATA_TEXT:
-        LOG("_init: Initing Sherlock plugin from " + this._location);
-
-        // the only text-based format we support is Sherlock
-        this._type = SEARCH_TYPE_SHERLOCK;
-        this._parseAsSherlock();
-    }
+    if (checkNameSpace(this._data, [MOZSEARCH_LOCALNAME],
+        [MOZSEARCH_NS_10])) {
+
+      LOG("_init: Initing MozSearch plugin from " + this._location);
+
+      this._type = SEARCH_TYPE_MOZSEARCH;
+      this._parseAsMozSearch();
+
+    } else if (checkNameSpace(this._data, [OPENSEARCH_LOCALNAME],
+                              OPENSEARCH_NAMESPACES)) {
+
+      LOG("_init: Initing OpenSearch plugin from " + this._location);
+
+      this._type = SEARCH_TYPE_OPENSEARCH;
+      this._parseAsOpenSearch();
+
+    } else
+      FAIL(this._location + " is not a valid search plugin.", Cr.NS_ERROR_FAILURE);
 
     // No need to keep a ref to our data (which in some cases can be a document
     // element) past this point
     this._data = null;
   },
 
   /**
    * Initialize this Engine object from a collection of metadata.
@@ -2756,18 +2710,16 @@ Engine.prototype = {
     if (this._iconUpdateURL || !aFilter)
       json._iconUpdateURL = this._iconUpdateURL;
     if (!this._hasPreferredIcon || !aFilter)
       json._hasPreferredIcon = this._hasPreferredIcon;
     if (this.type != SEARCH_TYPE_MOZSEARCH || !aFilter)
       json.type = this.type;
     if (this.queryCharset != DEFAULT_QUERY_CHARSET || !aFilter)
       json.queryCharset = this.queryCharset;
-    if (this._dataType != SEARCH_DATA_XML || !aFilter)
-      json._dataType = this._dataType;
     if (!this._readOnly || !aFilter)
       json._readOnly = this._readOnly;
     if (this._extensionID) {
       json.extensionID = this._extensionID;
     }
 
     return json;
   },
@@ -4036,41 +3988,32 @@ SearchService.prototype = {
       }
       notifyAction(aEngine, SEARCH_ENGINE_ADDED);
     }
 
     if (aEngine._hasUpdates) {
       // Schedule the engine's next update, if it isn't already.
       if (!engineMetadataService.getAttr(aEngine, "updateexpir"))
         engineUpdateService.scheduleNextUpdate(aEngine);
-
-      // We need to save the engine's _dataType, if this is the first time the
-      // engine is added to the dataStore, since ._dataType isn't persisted
-      // and will change on the next startup (since the engine will then be
-      // XML). We need this so that we know how to load any future updates from
-      // this engine.
-      if (!engineMetadataService.getAttr(aEngine, "updatedatatype"))
-        engineMetadataService.setAttr(aEngine, "updatedatatype",
-                                      aEngine._dataType);
     }
   },
 
   _loadEnginesFromCache: function SRCH_SVC__loadEnginesFromCache(aDir) {
     let engines = aDir.engines;
     LOG("_loadEnginesFromCache: Loading from cache. " + engines.length + " engines to load.");
     for (let i = 0; i < engines.length; i++) {
       let json = engines[i];
 
       try {
         let engine;
         if (json.filePath)
-          engine = new Engine({type: "filePath", value: json.filePath}, json._dataType,
+          engine = new Engine({type: "filePath", value: json.filePath},
                                json._readOnly);
         else if (json._url)
-          engine = new Engine({type: "uri", value: json._url}, json._dataType, json._readOnly);
+          engine = new Engine({type: "uri", value: json._url}, json._readOnly);
 
         engine._initWithJSON(json);
         this._addEngineToStore(engine);
       } catch (ex) {
         LOG("Failed to load " + engines[i]._name + " from cache: " + ex);
         LOG("Engine JSON: " + engines[i].toSource());
       }
     }
@@ -4098,17 +4041,17 @@ SearchService.prototype = {
 
       if (fileExtension != "xml") {
         // Not an engine
         continue;
       }
 
       var addedEngine = null;
       try {
-        addedEngine = new Engine(file, SEARCH_DATA_XML, !isWritable);
+        addedEngine = new Engine(file, !isWritable);
         addedEngine._initFromFile();
       } catch (ex) {
         LOG("_loadEnginesFromDir: Failed to load " + file.path + "!\n" + ex);
         continue;
       }
 
       this._addEngineToStore(addedEngine);
     }
@@ -4146,34 +4089,34 @@ SearchService.prototype = {
           // Not an engine
           continue;
         }
 
         let addedEngine = null;
         try {
           let file = new FileUtils.File(osfile.path);
           let isWritable = isInProfile;
-          addedEngine = new Engine(file, SEARCH_DATA_XML, !isWritable);
+          addedEngine = new Engine(file, !isWritable);
           yield checkForSyncCompletion(addedEngine._asyncInitFromFile());
         } catch (ex if ex.result != Cr.NS_ERROR_ALREADY_INITIALIZED) {
           LOG("_asyncLoadEnginesFromDir: Failed to load " + osfile.path + "!\n" + ex);
           continue;
         }
         engines.push(addedEngine);
       }
       throw new Task.Result(engines);
     }.bind(this));
   },
 
   _loadFromChromeURLs: function SRCH_SVC_loadFromChromeURLs(aURLs) {
     aURLs.forEach(function (url) {
       try {
         LOG("_loadFromChromeURLs: loading engine from chrome url: " + url);
 
-        let engine = new Engine(makeURI(url), SEARCH_DATA_XML, true);
+        let engine = new Engine(makeURI(url), true);
 
         engine._initFromURISync();
 
         this._addEngineToStore(engine);
       } catch (ex) {
         LOG("_loadFromChromeURLs: failed to load engine: " + ex);
       }
     }, this);
@@ -4188,17 +4131,17 @@ SearchService.prototype = {
    * succeeds.
    */
   _asyncLoadFromChromeURLs: function SRCH_SVC__asyncLoadFromChromeURLs(aURLs) {
     return Task.spawn(function() {
       let engines = [];
       for (let url of aURLs) {
         try {
           LOG("_asyncLoadFromChromeURLs: loading engine from chrome url: " + url);
-          let engine = new Engine(NetUtil.newURI(url), SEARCH_DATA_XML, true);
+          let engine = new Engine(NetUtil.newURI(url), true);
           yield checkForSyncCompletion(engine._asyncInitFromURI());
           engines.push(engine);
         } catch (ex if ex.result != Cr.NS_ERROR_ALREADY_INITIALIZED) {
           LOG("_asyncLoadFromChromeURLs: failed to load engine: " + ex);
         }
       }
       throw new Task.Result(engines);
     }.bind(this));
@@ -4635,29 +4578,29 @@ SearchService.prototype = {
       FAIL("Invalid name passed to addEngineWithDetails!");
     if (!aMethod)
       FAIL("Invalid method passed to addEngineWithDetails!");
     if (!aTemplate)
       FAIL("Invalid template passed to addEngineWithDetails!");
     if (this._engines[aName])
       FAIL("An engine with that name already exists!", Cr.NS_ERROR_FILE_ALREADY_EXISTS);
 
-    var engine = new Engine(getSanitizedFile(aName), SEARCH_DATA_XML, false);
+    var engine = new Engine(getSanitizedFile(aName), false);
     engine._initFromMetadata(aName, aIconURL, aAlias, aDescription,
                              aMethod, aTemplate, aExtensionID);
     this._addEngineToStore(engine);
   },
 
   addEngine: function SRCH_SVC_addEngine(aEngineURL, aDataType, aIconURL,
                                          aConfirm, aCallback) {
     LOG("addEngine: Adding \"" + aEngineURL + "\".");
     this._ensureInitialized();
     try {
       var uri = makeURI(aEngineURL);
-      var engine = new Engine(uri, aDataType, false);
+      var engine = new Engine(uri, false);
       if (aCallback) {
         engine._installCallback = function (errorCode) {
           try {
             if (errorCode == null)
               aCallback.onSuccess(engine);
             else
               aCallback.onError(errorCode);
           } catch (ex) {
@@ -5537,24 +5480,18 @@ var engineUpdateService = {
                      updateURL.getSubmission("", engine).uri :
                      makeURI(engine._updateURL);
     if (updateURI) {
       if (engine._isDefault && !updateURI.schemeIs("https")) {
         ULOG("Invalid scheme for default engine update");
         return;
       }
 
-      let dataType = engineMetadataService.getAttr(engine, "updatedatatype");
-      if (!dataType) {
-        ULOG("No loadtype to update engine!");
-        return;
-      }
-
       ULOG("updating " + engine.name + " from " + updateURI.spec);
-      testEngine = new Engine(updateURI, dataType, false);
+      testEngine = new Engine(updateURI, false);
       testEngine._engineToUpdate = engine;
       testEngine._initFromURIAndLoad();
     } else
       ULOG("invalid updateURI");
 
     if (engine._iconUpdateURL) {
       // If we're updating the engine too, use the new engine object,
       // otherwise use the existing engine object.
--- a/toolkit/components/search/nsSidebar.js
+++ b/toolkit/components/search/nsSidebar.js
@@ -33,18 +33,17 @@ nsSidebar.prototype = {
   },
 
   // This function implements window.external.AddSearchProvider().
   // The capitalization, although nonstandard here, is to match other browsers'
   // APIs and is therefore important.
   AddSearchProvider: function(engineURL) {
     this.mm.sendAsyncMessage("Search:AddEngine", {
       pageURL: this.window.document.documentURIObject.spec,
-      engineURL,
-      type: Ci.nsISearchEngine.DATA_XML
+      engineURL
     });
   },
 
   // This function exists to implement window.external.IsSearchProviderInstalled(),
   // for compatibility with other browsers.  The function has been deprecated
   // and so will not be implemented.
   IsSearchProviderInstalled: function(engineURL) {
     return 0;
deleted file mode 100644
--- a/toolkit/components/search/tests/xpcshell/data/engine.src
+++ /dev/null
@@ -1,18 +0,0 @@
-<SEARCH
-   version="1"
-   name="Sherlock test search engine"
-   description="A test search engine for testing sherlock"
-   method="GET"
-   action="http://getfirefox.com"
-   searchform="http://getfirefox.com"
->
-
-<input name="q" user>
-
-</search>
-
-<BROWSER
-   update="http://getfirefox.com"
-   updateIcon="http://getfirefox.com"
-   updatecheckdays="7"
->
--- a/toolkit/components/search/tests/xpcshell/head_search.js
+++ b/toolkit/components/search/tests/xpcshell/head_search.js
@@ -386,18 +386,16 @@ function useHttpServer() {
  *
  * The engines are added in the given order.
  *
  * @param aItems
  *        Array of objects with the following properties:
  *        {
  *          name: Engine name, used to wait for it to be loaded.
  *          xmlFileName: Name of the XML file in the "data" folder.
- *          srcFileName: Name of the SRC file in the "data" folder.
- *          iconFileName: Name of the icon associated to the SRC file.
  *          details: Array containing the parameters of addEngineWithDetails,
  *                   except for the engine name.  Alternative to xmlFileName.
  *        }
  */
 var addTestEngines = Task.async(function* (aItems) {
   if (!gDataUrl) {
     do_throw("useHttpServer must be called before addTestEngines.");
   }
@@ -421,20 +419,16 @@ var addTestEngines = Task.async(function
         } catch (ex) {
           reject(ex);
         }
       }, "browser-search-engine-modified", false);
 
       if (item.xmlFileName) {
         Services.search.addEngine(gDataUrl + item.xmlFileName,
                                   Ci.nsISearchEngine.DATA_XML, null, false);
-      } else if (item.srcFileName) {
-        Services.search.addEngine(gDataUrl + item.srcFileName,
-                                  Ci.nsISearchEngine.DATA_TEXT,
-                                  gDataUrl + item.iconFileName, false);
       } else {
         Services.search.addEngineWithDetails(item.name, ...item.details);
       }
     });
   }
 
   return engines;
 });
--- a/toolkit/components/search/tests/xpcshell/test_nodb_pluschanges.js
+++ b/toolkit/components/search/tests/xpcshell/test_nodb_pluschanges.js
@@ -26,18 +26,17 @@ function run_test() {
   useHttpServer();
 
   run_next_test();
 }
 
 add_task(function* test_nodb_pluschanges() {
   let [engine1, engine2] = yield addTestEngines([
     { name: "Test search engine", xmlFileName: "engine.xml" },
-    { name: "Sherlock test search engine", srcFileName: "engine.src",
-      iconFileName: "ico-size-16x16-png.ico" },
+    { name: "A second test engine", xmlFileName: "engine2.xml"},
   ]);
 
   let search = Services.search;
 
   search.moveEngine(engine1, 0);
   search.moveEngine(engine2, 1);
 
   // This is needed to avoid some reentrency issues in nsSearchService.
@@ -49,13 +48,13 @@ add_task(function* test_nodb_pluschanges
   search.QueryInterface(Ci.nsIObserver)
         .observe(null, "quit-application", "");
   yield promiseCommit;
   do_print("Commit complete");
 
   // Check that the entries are placed as specified correctly
   let json = getSearchMetadata();
   do_check_eq(json["[app]/test-search-engine.xml"].order, 1);
-  do_check_eq(json["[profile]/sherlock-test-search-engine.xml"].order, 2);
+  do_check_eq(json["[profile]/a-second-test-engine.xml"].order, 2);
 
   do_print("Cleaning up");
   removeMetadata();
 });
--- a/toolkit/components/search/tests/xpcshell/test_parseSubmissionURL.js
+++ b/toolkit/components/search/tests/xpcshell/test_parseSubmissionURL.js
@@ -25,18 +25,16 @@ add_task(function* test_parseSubmissionU
     { name: "Test search engine", xmlFileName: "engine.xml" },
     { name: "Test search engine (fr)", xmlFileName: "engine-fr.xml" },
     { name: "bacon_addParam", details: ["", "bacon_addParam", "Search Bacon",
                                         "GET", "http://www.bacon.test/find"] },
     { name: "idn_addParam", details: ["", "idn_addParam", "Search IDN",
                                         "GET", "http://www.xn--bcher-kva.ch/search"] },
     // The following engines cannot identify the search parameter.
     { name: "A second test engine", xmlFileName: "engine2.xml" },
-    { name: "Sherlock test search engine", srcFileName: "engine.src",
-      iconFileName: "ico-size-16x16-png.ico" },
     { name: "bacon", details: ["", "bacon", "Search Bacon", "GET",
                                "http://www.bacon.moz/search?q={searchTerms}"] },
   ]);
 
   engine3.addParam("q", "{searchTerms}", null);
   engine4.addParam("q", "{searchTerms}", null);
 
   // Test the first engine, whose URLs use UTF-8 encoding.
@@ -102,22 +100,16 @@ add_task(function* test_parseSubmissionU
   // Parsing of parameters from an engine template URL is not supported.
   do_check_eq(Services.search.parseSubmissionURL(
                               "http://www.bacon.moz/search?q=").engine, null);
   do_check_eq(Services.search.parseSubmissionURL(
                               "https://duckduckgo.com?q=test").engine, null);
   do_check_eq(Services.search.parseSubmissionURL(
                               "https://duckduckgo.com/?q=test").engine, null);
 
-  // Sherlock engines are not supported.
-  do_check_eq(Services.search.parseSubmissionURL(
-                              "http://getfirefox.com?q=test").engine, null);
-  do_check_eq(Services.search.parseSubmissionURL(
-                              "http://getfirefox.com/?q=test").engine, null);
-
   // HTTP and HTTPS schemes are interchangeable.
   url = "https://www.google.com/search?q=caff%C3%A8";
   result = Services.search.parseSubmissionURL(url);
   do_check_eq(result.engine, engine1);
   do_check_eq(result.terms, "caff\u00E8");
   do_check_true(url.slice(result.termsOffset).startsWith("caff%C3%A8"));
 
   // Decoding search terms with multiple spaces should work.
--- a/toolkit/components/search/tests/xpcshell/test_save_sorted_engines.js
+++ b/toolkit/components/search/tests/xpcshell/test_save_sorted_engines.js
@@ -23,43 +23,42 @@ function run_test() {
   useHttpServer();
 
   run_next_test();
 }
 
 add_task(function* test_save_sorted_engines() {
   let [engine1, engine2] = yield addTestEngines([
     { name: "Test search engine", xmlFileName: "engine.xml" },
-    { name: "Sherlock test search engine", srcFileName: "engine.src",
-      iconFileName: "ico-size-16x16-png.ico" },
+    { name: "A second test engine", xmlFileName: "engine2.xml"},
   ]);
 
   let search = Services.search;
 
   // Test moving the engines
   search.moveEngine(engine1, 0);
   search.moveEngine(engine2, 1);
 
   // Changes should be commited immediately
   yield promiseAfterCommit();
   do_print("Commit complete after moveEngine");
 
   // Check that the entries are placed as specified correctly
   let json = getSearchMetadata();
   do_check_eq(json["[app]/test-search-engine.xml"].order, 1);
-  do_check_eq(json["[profile]/sherlock-test-search-engine.xml"].order, 2);
+  do_check_eq(json["[profile]/a-second-test-engine.xml"].order, 2);
 
   // Test removing an engine
   search.removeEngine(engine1);
   yield promiseAfterCommit();
   do_print("Commit complete after removeEngine");
 
   // Check that the order of the remaining engine was updated correctly
   json = getSearchMetadata();
-  do_check_eq(json["[profile]/sherlock-test-search-engine.xml"].order, 1);
+  do_check_eq(json["[profile]/a-second-test-engine.xml"].order, 1);
 
   // Test adding a new engine
   search.addEngineWithDetails("foo", "", "foo", "", "GET",
                               "http://searchget/?search={searchTerms}");
   yield promiseAfterCommit();
   do_print("Commit complete after addEngineWithDetails");
 
   json = getSearchMetadata();
--- a/toolkit/components/search/tests/xpcshell/test_serialize_file.js
+++ b/toolkit/components/search/tests/xpcshell/test_serialize_file.js
@@ -15,18 +15,17 @@ function run_test() {
   useHttpServer();
 
   run_next_test();
 }
 
 add_task(function test_batchTask() {
   let [engine1, engine2] = yield addTestEngines([
     { name: "Test search engine", xmlFileName: "engine.xml" },
-    { name: "Sherlock test search engine", srcFileName: "engine.src",
-      iconFileName: "ico-size-16x16-png.ico" },
+    { name: "A second test engine", xmlFileName: "engine2.xml"},
   ]);
 
   // Test that files are written correctly.
   let engineFile1 = engine1.wrappedJSObject._file;
   let engineFile2 = engine2.wrappedJSObject._file;
   do_check_true(engineFile1.exists());
   do_check_true(engineFile2.exists());
   do_check_neq(engineFile1.fileSize, 0);
--- a/toolkit/components/search/tests/xpcshell/xpcshell.ini
+++ b/toolkit/components/search/tests/xpcshell/xpcshell.ini
@@ -1,16 +1,15 @@
 [DEFAULT]
 head = head_search.js
 tail =
 firefox-appdir = browser
 skip-if = toolkit == 'android' || toolkit == 'gonk'
 support-files =
   data/chrome.manifest
-  data/engine.src
   data/engine.xml
   data/engine2.xml
   data/engine-addon.xml
   data/engine-override.xml
   data/engine-app.xml
   data/engine-fr.xml
   data/engineMaker.sjs
   data/engine-rel-searchform.xml