Backed out changesets 72a80fc289f2, 30258cd308b5, and c572890f16a2 (bug 910189) for robocop orange.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 18 Dec 2013 20:37:16 -0500
changeset 161206 e04fb3e318fc7d905519a50c3df26d0023c16420
parent 161205 425e560ef39a86108245172cb18c946e40128028
child 161207 cd24da528bf3f6405314fc5a7127415acdd406b2
push id25871
push usercbook@mozilla.com
push dateThu, 19 Dec 2013 09:34:02 +0000
treeherdermozilla-central@5c7fa2bfea8b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs910189
milestone29.0a1
backs out72a80fc289f2fd128132fdd799c3c36f85eeea1a
30258cd308b53567e9aa6b3c1050bfd06d61716b
c572890f16a29e29443e3e5605ccd7ec2d8f7e2a
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changesets 72a80fc289f2, 30258cd308b5, and c572890f16a2 (bug 910189) for robocop orange.
mobile/android/base/locales/en-US/android_strings.dtd
mobile/android/base/preferences/GeckoPreferenceFragment.java
mobile/android/base/preferences/GeckoPreferences.java
mobile/android/base/preferences/SearchEnginePreference.java
mobile/android/base/preferences/SearchPreferenceCategory.java
mobile/android/base/resources/menu-v11/preferences_search_menu.xml
mobile/android/base/resources/xml-v11/preferences_search.xml
mobile/android/base/resources/xml/preferences_search.xml
mobile/android/base/strings.xml.in
mobile/android/chrome/content/browser.js
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -68,19 +68,16 @@
 <!ENTITY pref_category_customize "Customize">
 <!ENTITY pref_category_search2 "Search settings">
 <!ENTITY pref_category_display "Display">
 <!ENTITY pref_category_privacy_short "Privacy">
 <!ENTITY pref_category_vendor "&vendorShortName;">
 <!ENTITY pref_category_datareporting "Data choices">
 <!ENTITY pref_category_installed_search_engines "Installed search engines">
 <!ENTITY pref_category_add_search_providers "Add more search providers">
-<!ENTITY pref_category_search_restore_defaults "Restore search engines">
-<!ENTITY pref_search_restore_defaults "Restore defaults">
-<!ENTITY pref_search_restore_defaults_summary "Restore defaults">
 <!-- Localization note (pref_search_tip) : "TIP" as in "hint", "clue" etc. Displayed as an
      advisory message on the customise search providers settings page explaining how to add new
      search providers.-->
 <!ENTITY pref_search_tip "TIP: Add any website to your list of search providers by long-pressing on its search field.">
 <!ENTITY pref_category_devtools "Developer tools">
 <!ENTITY pref_developer_remotedebugging "Remote debugging">
 <!ENTITY pref_developer_remotedebugging_docs "Learn more">
 <!ENTITY pref_remember_signons "Remember passwords">
--- a/mobile/android/base/preferences/GeckoPreferenceFragment.java
+++ b/mobile/android/base/preferences/GeckoPreferenceFragment.java
@@ -1,118 +1,62 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
  * 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/. */
 
 package org.mozilla.gecko.preferences;
 
-import java.lang.reflect.Field;
-
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.PrefsHelper;
 
-import android.app.Activity;
 import android.preference.Preference;
 import android.preference.PreferenceActivity;
 import android.preference.PreferenceCategory;
 import android.preference.PreferenceFragment;
 import android.preference.PreferenceScreen;
 import android.os.Bundle;
 import android.util.Log;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.ViewConfiguration;
 
 /* A simple implementation of PreferenceFragment for large screen devices
  * This will strip category headers (so that they aren't shown to the user twice)
  * as well as initializing Gecko prefs when a fragment is shown.
 */
 public class GeckoPreferenceFragment extends PreferenceFragment {
 
     private static final String LOGTAG = "GeckoPreferenceFragment";
     private int mPrefsRequestId = 0;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-
-        int res = getResource();
+        String resourceName = getArguments().getString("resource");
 
-        // Display a menu for Search preferences.
-        if (res == R.xml.preferences_search) {
-            setHasOptionsMenu(true);
+        int res = 0;
+        if (resourceName != null) {
+            // Fetch resource id by resource name.
+            res = getActivity().getResources().getIdentifier(resourceName,
+                                                             "xml",
+                                                             getActivity().getPackageName());
         }
 
+        if (res == 0) {
+            // The resource was invalid. Use the default resource.
+            Log.e(LOGTAG, "Failed to find resource: " + resourceName + ". Displaying default settings.");
+
+            boolean isMultiPane = ((PreferenceActivity) getActivity()).onIsMultiPane();
+            res = isMultiPane ? R.xml.preferences_customize_tablet : R.xml.preferences;
+        }
         addPreferencesFromResource(res);
 
         PreferenceScreen screen = getPreferenceScreen();
         setPreferenceScreen(screen);
         mPrefsRequestId = ((GeckoPreferences)getActivity()).setupPreferences(screen);
     }
 
-    /*
-     * Get the resource from Fragment arguments and return it.
-     *
-     * If no resource can be found, return the resource id of the default preference screen.
-     */
-    private int getResource() {
-        int resid = 0;
-
-        String resourceName = getArguments().getString("resource");
-        if (resourceName != null) {
-            // Fetch resource id by resource name.
-            resid = getActivity().getResources().getIdentifier(resourceName,
-                                                             "xml",
-                                                             getActivity().getPackageName());
-        }
-
-        if (resid == 0) {
-            // The resource was invalid. Use the default resource.
-            Log.e(LOGTAG, "Failed to find resource: " + resourceName + ". Displaying default settings.");
-
-            boolean isMultiPane = ((PreferenceActivity) getActivity()).onIsMultiPane();
-            resid = isMultiPane ? R.xml.preferences_customize_tablet : R.xml.preferences;
-        }
-
-        return resid;
-    }
-
-    @Override
-    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
-        super.onCreateOptionsMenu(menu, inflater);
-        inflater.inflate(R.menu.preferences_search_menu, menu);
-    }
-
     @Override
     public void onDestroy() {
         super.onDestroy();
         if (mPrefsRequestId > 0) {
             PrefsHelper.removeObserver(mPrefsRequestId);
         }
     }
-
-    @Override
-    public void onAttach(Activity activity) {
-        super.onAttach(activity);
-        showOverflowMenu(activity);
-    }
-
-    /*
-     * Force the overflow 3-dot menu to be displayed if it isn't already displayed.
-     *
-     * This is an ugly hack for 4.0+ Android devices that don't have a dedicated menu button
-     * because Android does not provide a public API to display the ActionBar overflow menu.
-     */
-    private void showOverflowMenu(Activity activity) {
-        try {
-            ViewConfiguration config = ViewConfiguration.get(activity);
-            Field menuOverflow = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
-            if (menuOverflow != null) {
-                menuOverflow.setAccessible(true);
-                menuOverflow.setBoolean(config, false);
-            }
-        } catch (Exception e) {
-            Log.d(LOGTAG, "Failed to force overflow menu, ignoring.");
-        }
-    }
 }
--- a/mobile/android/base/preferences/GeckoPreferences.java
+++ b/mobile/android/base/preferences/GeckoPreferences.java
@@ -72,19 +72,17 @@ public class GeckoPreferences
     private static final String NON_PREF_PREFIX = "android.not_a_preference.";
     public static final String INTENT_EXTRA_RESOURCES = "resource";
     public static String PREFS_HEALTHREPORT_UPLOAD_ENABLED = NON_PREF_PREFIX + "healthreport.uploadEnabled";
 
     private static boolean sIsCharEncodingEnabled = false;
     private boolean mInitialized = false;
     private int mPrefsRequestId = 0;
 
-    // These match keys in resources/xml*/preferences*.xml
-    private static String PREFS_SEARCH_RESTORE_DEFAULTS = NON_PREF_PREFIX + "search.restore_defaults";
-
+    // These match keys in resources/xml/preferences.xml.in.
     private static String PREFS_ANNOUNCEMENTS_ENABLED = NON_PREF_PREFIX + "privacy.announcements.enabled";
     private static String PREFS_DATA_REPORTING_PREFERENCES = NON_PREF_PREFIX + "datareporting.preferences";
     private static String PREFS_TELEMETRY_ENABLED = "datareporting.telemetry.enabled";
     private static String PREFS_CRASHREPORTER_ENABLED = "datareporting.crashreporter.submitEnabled";
     private static String PREFS_MENU_CHAR_ENCODING = "browser.menu.showCharacterEncoding";
     private static String PREFS_MP_ENABLED = "privacy.masterpassword.enabled";
     private static String PREFS_UPDATER_AUTODOWNLOAD = "app.update.autodownload";
     private static String PREFS_GEO_REPORTING = "app.geo.reportdata";
@@ -386,64 +384,39 @@ public class GeckoPreferences
                     CharSequence selectedEntry = listPref.getEntry();
                     listPref.setSummary(selectedEntry);
                     continue;
                 } else if (PREFS_SYNC.equals(key) && GeckoProfile.get(this).inGuestMode()) {
                     // Don't show sync prefs while in guest mode.
                     preferences.removePreference(pref);
                     i--;
                     continue;
-                } else if (PREFS_SEARCH_RESTORE_DEFAULTS.equals(key)) {
-                    pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
-                        @Override
-                        public boolean onPreferenceClick(Preference preference) {
-                            GeckoPreferences.this.restoreDefaultSearchEngines();
-                            return true;
-                        }
-                    });
                 }
 
                 // Some Preference UI elements are not actually preferences,
                 // but they require a key to work correctly. For example,
                 // "Clear private data" requires a key for its state to be
                 // saved when the orientation changes. It uses the
                 // "android.not_a_preference.privacy.clear" key - which doesn't
                 // exist in Gecko - to satisfy this requirement.
                 if (key != null && !key.startsWith(NON_PREF_PREFIX)) {
                     prefs.add(key);
                 }
             }
         }
     }
 
-    /**
-     * Restore default search engines in Gecko and retrigger a search engine refresh.
-     */
-    protected void restoreDefaultSearchEngines() {
-        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SearchEngines:RestoreDefaults", null));
-
-        // Send message to Gecko to get engines. SearchPreferenceCategory listens for the response.
-        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SearchEngines:GetVisible", null));
-    }
-
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {
-        int itemId = item.getItemId();
-        switch (itemId) {
+        switch (item.getItemId()) {
             case android.R.id.home:
                 finish();
                 return true;
         }
 
-        // Generated R.id.* apparently aren't constant expressions, so they can't be switched.
-        if (itemId == R.id.restore_defaults) {
-            restoreDefaultSearchEngines();
-            return true;
-       }
-
         return super.onOptionsItemSelected(item);
     }
 
     final private int DIALOG_CREATE_MASTER_PASSWORD = 0;
     final private int DIALOG_REMOVE_MASTER_PASSWORD = 1;
 
     public static void setCharEncodingState(boolean enabled) {
         sIsCharEncodingEnabled = enabled;
--- a/mobile/android/base/preferences/SearchEnginePreference.java
+++ b/mobile/android/base/preferences/SearchEnginePreference.java
@@ -35,16 +35,18 @@ public class SearchEnginePreference exte
     public static final int INDEX_SET_DEFAULT_BUTTON = 0;
     public static final int INDEX_REMOVE_BUTTON = 1;
 
     // Cache label to avoid repeated use of the resource system.
     public final String LABEL_IS_DEFAULT;
 
     // Specifies if this engine is configured as the default search engine.
     private boolean mIsDefaultEngine;
+    // Specifies if this engine is one of the ones bundled with the app, which cannot be deleted.
+    private boolean mIsImmutableEngine;
 
     // Dialog element labels.
     private String[] mDialogItems;
 
     // The popup displayed when this element is tapped.
     private AlertDialog mDialog;
 
     private final SearchPreferenceCategory mParentCategory;
@@ -114,17 +116,22 @@ public class SearchEnginePreference exte
     /**
      * Configure this Preference object from the Gecko search engine JSON object.
      * @param geckoEngineJSON The Gecko-formatted JSON object representing the search engine.
      * @throws JSONException If the JSONObject is invalid.
      */
     public void setSearchEngineFromJSON(JSONObject geckoEngineJSON) throws JSONException {
         final String engineName = geckoEngineJSON.getString("name");
         final SpannableString titleSpannable = new SpannableString(engineName);
+        mIsImmutableEngine = geckoEngineJSON.getBoolean("immutable");
 
+        if (mIsImmutableEngine) {
+            // Delete the "Remove" option from the menu.
+            mDialogItems = new String[] { getContext().getResources().getString(R.string.pref_search_set_default) };
+        }
         setTitle(titleSpannable);
 
         final String iconURI = geckoEngineJSON.getString("iconURI");
         // Keep a reference to the bitmap - we'll need it later in onBindView.
         try {
             mIconBitmap = BitmapUtils.getBitmapFromDataURI(iconURI);
         } catch (IllegalArgumentException e) {
             Log.e(LOGTAG, "IllegalArgumentException creating Bitmap. Most likely a zero-length bitmap.", e);
@@ -164,16 +171,21 @@ public class SearchEnginePreference exte
                 @Override
                 public void run() {
                     Toast.makeText(getContext(), R.string.pref_search_last_toast, Toast.LENGTH_SHORT).show();
                 }
             });
             return;
         }
 
+        // If we are both default and immutable, we have no enabled items to show on the menu - abort.
+        if (mIsDefaultEngine && mIsImmutableEngine) {
+            return;
+        }
+
         final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
         builder.setTitle(getTitle().toString());
         builder.setItems(mDialogItems, new DialogInterface.OnClickListener() {
             // Forward the various events that we care about to the container class for handling.
             @Override
             public void onClick(DialogInterface dialog, int indexClicked) {
                 hideDialog();
                 switch (indexClicked) {
--- a/mobile/android/base/preferences/SearchPreferenceCategory.java
+++ b/mobile/android/base/preferences/SearchPreferenceCategory.java
@@ -38,41 +38,37 @@ public class SearchPreferenceCategory ex
 
     @Override
     protected void onAttachedToActivity() {
         super.onAttachedToActivity();
 
         // Ensures default engine remains at top of list.
         setOrderingAsAdded(true);
 
-        // Register for SearchEngines messages and request list of search engines from Gecko.
+        // Request list of search engines from Gecko.
         GeckoAppShell.registerEventListener("SearchEngines:Data", this);
-        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SearchEngines:GetVisible", null));
-    }
-
-    @Override
-    protected void onPrepareForRemoval() {
-        GeckoAppShell.unregisterEventListener("SearchEngines:Data", this);
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SearchEngines:Get", null));
     }
 
     @Override
     public void handleMessage(String event, final JSONObject data) {
         if (event.equals("SearchEngines:Data")) {
+            // We are no longer interested in this event from Gecko, as we do not request it again with
+            // this instance.
+            GeckoAppShell.unregisterEventListener("SearchEngines:Data", this);
+
             // Parse engines array from JSON.
             JSONArray engines;
             try {
                 engines = data.getJSONArray("searchEngines");
             } catch (JSONException e) {
                 Log.e(LOGTAG, "Unable to decode search engine data from Gecko.", e);
                 return;
             }
 
-            // Clear the preferences category from this thread.
-            this.removeAll();
-
             // Create an element in this PreferenceCategory for each engine.
             for (int i = 0; i < engines.length(); i++) {
                 try {
                     JSONObject engineJSON = engines.getJSONObject(i);
                     final String engineName = engineJSON.getString("name");
 
                     SearchEnginePreference enginePreference = new SearchEnginePreference(getContext(), this);
                     enginePreference.setSearchEngineFromJSON(engineJSON);
deleted file mode 100644
--- a/mobile/android/base/resources/menu-v11/preferences_search_menu.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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/. -->
-
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <item android:id="@+id/restore_defaults"
-          android:title="@string/pref_search_restore_defaults" />
-
-</menu>
deleted file mode 100644
--- a/mobile/android/base/resources/xml-v11/preferences_search.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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/. -->
-
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
-                  xmlns:gecko="http://schemas.android.com/apk/res-auto"
-                  android:title="@string/pref_category_search"
-                  android:enabled="false">
-
-    <CheckBoxPreference android:key="browser.search.suggest.enabled"
-                        android:title="@string/pref_search_suggestions"
-                        android:defaultValue="false"
-                        android:persistent="false" />
-
-    <org.mozilla.gecko.preferences.SearchPreferenceCategory
-                        android:title="@string/pref_category_installed_search_engines"/>
-
-    <PreferenceCategory android:title="@string/pref_category_add_search_providers">
-
-        <Preference android:layout="@layout/preference_search_tip"
-                    android:enabled="false"
-                    android:selectable="false"/>
-
-    </PreferenceCategory>
-
-</PreferenceScreen>
--- a/mobile/android/base/resources/xml/preferences_search.xml
+++ b/mobile/android/base/resources/xml/preferences_search.xml
@@ -11,23 +11,16 @@
     <CheckBoxPreference android:key="browser.search.suggest.enabled"
                         android:title="@string/pref_search_suggestions"
                         android:defaultValue="false"
                         android:persistent="false" />
 
     <org.mozilla.gecko.preferences.SearchPreferenceCategory
                         android:title="@string/pref_category_installed_search_engines"/>
 
-    <PreferenceCategory android:title="@string/pref_category_search_restore_defaults">
-
-        <Preference android:key="android.not_a_preference.search.restore_defaults"
-                    android:title="@string/pref_search_restore_defaults_summary" />
-
-    </PreferenceCategory>
-
     <PreferenceCategory android:title="@string/pref_category_add_search_providers">
 
         <Preference android:layout="@layout/preference_search_tip"
                     android:enabled="false"
                     android:selectable="false"/>
 
     </PreferenceCategory>
 
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -84,21 +84,17 @@
   <string name="pref_category_customize">&pref_category_customize;</string>
   <string name="pref_category_search">&pref_category_search2;</string>
   <string name="pref_category_display">&pref_category_display;</string>
   <string name="pref_category_privacy_short">&pref_category_privacy_short;</string>
   <string name="pref_category_vendor">&pref_category_vendor;</string>
   <string name="pref_category_datareporting">&pref_category_datareporting;</string>
   <string name="pref_category_installed_search_engines">&pref_category_installed_search_engines;</string>
   <string name="pref_category_add_search_providers">&pref_category_add_search_providers;</string>
-  <string name="pref_category_search_restore_defaults">&pref_category_search_restore_defaults;</string>
-  <string name="pref_search_restore_defaults">&pref_search_restore_defaults;</string>
-  <string name="pref_search_restore_defaults_summary">&pref_search_restore_defaults_summary;</string>
   <string name="pref_search_tip">&pref_search_tip;</string>
-
   <string name="pref_category_devtools">&pref_category_devtools;</string>
   <string name="pref_developer_remotedebugging">&pref_developer_remotedebugging;</string>
   <string name="pref_developer_remotedebugging_docs">&pref_developer_remotedebugging_docs;</string>
 
   <string name="pref_header_customize">&pref_header_customize;</string>
   <string name="pref_header_display">&pref_header_display;</string>
   <string name="pref_header_privacy_short">&pref_header_privacy_short;</string>
   <string name="pref_header_vendor">&pref_header_vendor;</string>
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -6603,20 +6603,20 @@ OverscrollController.prototype = {
 
 var SearchEngines = {
   _contextMenuId: null,
   PREF_SUGGEST_ENABLED: "browser.search.suggest.enabled",
   PREF_SUGGEST_PROMPTED: "browser.search.suggest.prompted",
 
   init: function init() {
     Services.obs.addObserver(this, "SearchEngines:Add", false);
+    Services.obs.addObserver(this, "SearchEngines:Get", false);
     Services.obs.addObserver(this, "SearchEngines:GetVisible", false);
+    Services.obs.addObserver(this, "SearchEngines:SetDefault", false);
     Services.obs.addObserver(this, "SearchEngines:Remove", false);
-    Services.obs.addObserver(this, "SearchEngines:RestoreDefaults", false);
-    Services.obs.addObserver(this, "SearchEngines:SetDefault", false);
 
     let filter = {
       matches: function (aElement) {
         // Copied from body of isTargetAKeywordField function in nsContextMenu.js
         if(!(aElement instanceof HTMLInputElement))
           return false;
         let form = aElement.form;
         if (!form || aElement.type == "password")
@@ -6646,38 +6646,47 @@ var SearchEngines = {
       action: function(aElement) {
         SearchEngines.addEngine(aElement);
       }
     }
   },
 
   uninit: function uninit() {
     Services.obs.removeObserver(this, "SearchEngines:Add");
+    Services.obs.removeObserver(this, "SearchEngines:Get");
     Services.obs.removeObserver(this, "SearchEngines:GetVisible");
+    Services.obs.removeObserver(this, "SearchEngines:SetDefault");
     Services.obs.removeObserver(this, "SearchEngines:Remove");
-    Services.obs.removeObserver(this, "SearchEngines:RestoreDefaults");
-    Services.obs.removeObserver(this, "SearchEngines:SetDefault");
     if (this._contextMenuId != null)
       NativeWindow.contextmenus.remove(this._contextMenuId);
   },
 
   // Fetch list of search engines. all ? All engines : Visible engines only.
-  _handleSearchEnginesGetVisible: function _handleSearchEnginesGetVisible(rv) {
+  _handleSearchEnginesGet: function _handleSearchEnginesGet(rv, all) {
     if (!Components.isSuccessCode(rv)) {
       Cu.reportError("Could not initialize search service, bailing out.");
       return;
     }
-
-    let engineData = Services.search.getVisibleEngines({});
+    let engineData;
+    if (all) {
+      engineData = Services.search.getEngines({});
+    } else {
+      engineData = Services.search.getVisibleEngines({});
+    }
+
+    // These engines are the bundled ones - they may not be uninstalled.
+    let immutableEngines = Services.search.getDefaultEngines();
+
     let searchEngines = engineData.map(function (engine) {
       return {
         name: engine.name,
         identifier: engine.identifier,
         iconURI: (engine.iconURI ? engine.iconURI.spec : null),
-        hidden: engine.hidden
+        hidden: engine.hidden,
+        immutable: immutableEngines.indexOf(engine) != -1
       };
     });
 
     let suggestTemplate = null;
     let suggestEngine = null;
 
     // Check to see if the default engine supports search suggestions. We only need to check
     // the default engine because we only show suggestions for the default engine in the UI.
@@ -6704,49 +6713,55 @@ var SearchEngines = {
     let searchURI = Services.search.defaultEngine.getSubmission("dummy").uri;
     let callbacks = window.QueryInterface(Ci.nsIInterfaceRequestor)
                           .getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsILoadContext);
     try {
       connector.speculativeConnect(searchURI, callbacks);
     } catch (e) {}
   },
 
+  _handleSearchEnginesGetAll: function _handleSearchEnginesGetAll(rv) {
+    this._handleSearchEnginesGet(rv, true);
+  },
+  _handleSearchEnginesGetVisible: function _handleSearchEnginesGetVisible(rv) {
+    this._handleSearchEnginesGet(rv, false)
+  },
+
   // Helper method to extract the engine name from a JSON. Simplifies the observe function.
   _extractEngineFromJSON: function _extractEngineFromJSON(aData) {
     let data = JSON.parse(aData);
     return Services.search.getEngineByName(data.engine);
   },
 
   observe: function observe(aSubject, aTopic, aData) {
     let engine;
     switch(aTopic) {
       case "SearchEngines:Add":
         this.displaySearchEnginesList(aData);
         break;
       case "SearchEngines:GetVisible":
         Services.search.init(this._handleSearchEnginesGetVisible.bind(this));
         break;
+      case "SearchEngines:Get":
+        // Return a list of all engines, including "Hidden" ones.
+        Services.search.init(this._handleSearchEnginesGetAll.bind(this));
+        break;
+      case "SearchEngines:SetDefault":
+        engine = this._extractEngineFromJSON(aData);
+        // Move the new default search engine to the top of the search engine list.
+        Services.search.moveEngine(engine, 0);
+        Services.search.defaultEngine = engine;
+        break;
       case "SearchEngines:Remove":
         // Make sure the engine isn't hidden before removing it, to make sure it's
         // visible if the user later re-adds it (works around bug 341833)
         engine = this._extractEngineFromJSON(aData);
         engine.hidden = false;
         Services.search.removeEngine(engine);
         break;
-      case "SearchEngines:RestoreDefaults":
-        // Un-hides all default engines.
-        Services.search.restoreDefaultEngines();
-        break;
-      case "SearchEngines:SetDefault":
-        engine = this._extractEngineFromJSON(aData);
-        // Move the new default search engine to the top of the search engine list.
-        Services.search.moveEngine(engine, 0);
-        Services.search.defaultEngine = engine;
-        break;
-
       default:
         dump("Unexpected message type observed: " + aTopic);
         break;
     }
   },
 
   // Display context menu listing names of the search engines available to be added.
   displaySearchEnginesList: function displaySearchEnginesList(aData) {