Bug 703377: remove now-unused pref override functionality, r=dolske
authorGavin Sharp <gavin@gavinsharp.com>
Thu, 17 Nov 2011 13:41:04 -0800
changeset 139895 a99ad1b3fc241c4a47ef1fbb03ac8692c434a784
parent 139894 ba33b931fe9418006b4283181f15b6ac1a245585
child 139896 a1f7c708cf4266e217e72d11468706971756fcf7
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske
bugs703377
milestone23.0a1
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
Bug 703377: remove now-unused pref override functionality, r=dolske
browser/components/dirprovider/DirectoryProvider.cpp
browser/components/dirprovider/nsBrowserDirectoryServiceDefs.h
browser/components/dirprovider/tests/unit/test_keys.js
browser/components/nsBrowserContentHandler.js
browser/locales/Makefile.in
--- a/browser/components/dirprovider/DirectoryProvider.cpp
+++ b/browser/components/dirprovider/DirectoryProvider.cpp
@@ -7,17 +7,16 @@
 
 #include "nsIFile.h"
 #include "nsISimpleEnumerator.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 
 #include "nsArrayEnumerator.h"
 #include "nsEnumeratorUtils.h"
-#include "nsBrowserDirectoryServiceDefs.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsCategoryManagerUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsCOMArray.h"
 #include "nsDirectoryServiceUtils.h"
 #include "mozilla/ModuleUtils.h"
 #include "nsServiceManagerUtils.h"
@@ -53,25 +52,16 @@ DirectoryProvider::GetFile(const char *a
     if (prefs) {
       nsCString path;
       rv = prefs->GetCharPref("browser.bookmarks.file", getter_Copies(path));
       if (NS_SUCCEEDED(rv)) {
         NS_NewNativeLocalFile(path, true, getter_AddRefs(file));
       }
     }
   }
-  else if (!strcmp(aKey, NS_APP_EXISTING_PREF_OVERRIDE)) {
-    rv = NS_GetSpecialDirectory(NS_APP_DEFAULTS_50_DIR,
-                                getter_AddRefs(file));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    file->AppendNative(NS_LITERAL_CSTRING("existing-profile-defaults.js"));
-    file.swap(*aResult);
-    return NS_OK;
-  }
   else {
     return NS_ERROR_FAILURE;
   }
 
   nsDependentCString leafstr(leafName);
 
   nsCOMPtr<nsIFile> parentDir;
   if (file) {
deleted file mode 100644
--- a/browser/components/dirprovider/nsBrowserDirectoryServiceDefs.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* 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/. */
-
-#ifndef nsBrowserDirectoryServiceDefs_h___
-#define nsBrowserDirectoryServiceDefs_h___
-
-//=============================================================================
-//
-// Defines property names for directories available from the browser-specific
-// nsBrowserDirectoryProvider.
-//
-// System and XPCOM properties are defined in nsDirectoryServiceDefs.h.
-// General application properties are defined in nsAppDirectoryServiceDefs.h.
-//
-//=============================================================================
-
-// ----------------------------------------------------------------------------
-// Files and directories that exist on a per-browser basis.
-// ----------------------------------------------------------------------------
-
-#define NS_APP_EXISTING_PREF_OVERRIDE           "ExistingPrefOverride"
-
-#endif
--- a/browser/components/dirprovider/tests/unit/test_keys.js
+++ b/browser/components/dirprovider/tests/unit/test_keys.js
@@ -5,26 +5,17 @@
 function test_bookmarkhtml() {
   let bmarks = gProfD.clone();
   bmarks.append("bookmarks.html");
 
   let tbmarks = gDirSvc.get("BMarks", Ci.nsIFile);
   do_check_true(bmarks.equals(tbmarks));
 }
 
-function test_prefoverride() {
-  let dir = gDirSvc.get("DefRt", Ci.nsIFile);
-  dir.append("existing-profile-defaults.js");
-
-  let tdir = gDirSvc.get("ExistingPrefOverride", Ci.nsIFile);
-  do_check_true(dir.equals(tdir));
-}
-
 function run_test() {
-  [test_bookmarkhtml,
-   test_prefoverride
+  [test_bookmarkhtml
   ].forEach(function(f) {
     do_test_pending();
     print("Running test: " + f.name);
     f();
     do_test_finished();
   });
 }
--- a/browser/components/nsBrowserContentHandler.js
+++ b/browser/components/nsBrowserContentHandler.js
@@ -167,50 +167,16 @@ function getPostUpdateOverridePage(defau
   // The existence of silent or the non-existence of showURL in the actions both
   // mean that an override page should not be displayed.
   if (actions.indexOf("silent") != -1 || actions.indexOf("showURL") == -1)
     return "";
 
   return update.getProperty("openURL") || defaultOverridePage;
 }
 
-// Copies a pref override file into the user's profile pref-override folder,
-// and then tells the pref service to reload its default prefs.
-function copyPrefOverride() {
-  try {
-    var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"]
-                                .getService(Components.interfaces.nsIProperties);
-    const NS_APP_EXISTING_PREF_OVERRIDE = "ExistingPrefOverride";
-    var prefOverride = fileLocator.get(NS_APP_EXISTING_PREF_OVERRIDE,
-                                       Components.interfaces.nsIFile);
-    if (!prefOverride.exists())
-      return; // nothing to do
-
-    const NS_APP_PREFS_OVERRIDE_DIR     = "PrefDOverride";
-    var prefOverridesDir = fileLocator.get(NS_APP_PREFS_OVERRIDE_DIR,
-                                           Components.interfaces.nsIFile);
-
-    // Check for any existing pref overrides, and remove them if present
-    var existingPrefOverridesFile = prefOverridesDir.clone();
-    existingPrefOverridesFile.append(prefOverride.leafName);
-    if (existingPrefOverridesFile.exists())
-      existingPrefOverridesFile.remove(false);
-
-    prefOverride.copyTo(prefOverridesDir, null);
-
-    // Now that we've installed the new-profile pref override file,
-    // re-read the default prefs.
-    var prefSvcObs = Components.classes["@mozilla.org/preferences-service;1"]
-                               .getService(Components.interfaces.nsIObserver);
-    prefSvcObs.observe(null, "reload-default-prefs", null);
-  } catch (ex) {
-    Components.utils.reportError(ex);
-  }
-}
-
 // Flag used to indicate that the arguments to openWindow can be passed directly.
 const NO_EXTERNAL_URIS = 1;
 
 function openWindow(parent, url, target, features, args, noExternalArgs) {
   var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
                          .getService(nsIWindowWatcher);
 
   if (noExternalArgs == NO_EXTERNAL_URIS) {
@@ -595,19 +561,16 @@ nsBrowserContentHandler.prototype = {
       let override = needHomepageOverride(prefb);
       if (override != OVERRIDE_NONE) {
         switch (override) {
           case OVERRIDE_NEW_PROFILE:
             // New profile.
             overridePage = Services.urlFormatter.formatURLPref("startup.homepage_welcome_url");
             break;
           case OVERRIDE_NEW_MSTONE:
-            // Existing profile, new milestone build.
-            copyPrefOverride();
-
             // Check whether we have a session to restore. If we do, we assume
             // that this is an "update" session.
             var ss = Components.classes["@mozilla.org/browser/sessionstartup;1"]
                                .getService(Components.interfaces.nsISessionStartup);
             haveUpdateSession = ss.doRestore();
             overridePage = Services.urlFormatter.formatURLPref("startup.homepage_override_url");
             if (prefb.prefHasUserValue("app.update.postupdate"))
               overridePage = getPostUpdateOverridePage(overridePage);
--- a/browser/locales/Makefile.in
+++ b/browser/locales/Makefile.in
@@ -94,27 +94,16 @@ include $(topsrcdir)/config/rules.mk
 
 include $(topsrcdir)/toolkit/locales/l10n.mk
 
 $(STAGEDIST): $(DIST)/branding
 
 $(DIST)/branding:
 	$(NSINSTALL) -D $@
 
-libs::
-	@if test -f "$(LOCALE_SRCDIR)/existing-profile-defaults.js"; then \
-	  $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
-	    $(LOCALE_SRCDIR)/existing-profile-defaults.js > $(FINAL_TARGET)/defaults/existing-profile-defaults.js; \
-	fi
-install::
-	@if test -f "$(LOCALE_SRCDIR)/existing-profile-defaults.js"; then \
-	  $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
-	    $(LOCALE_SRCDIR)/existing-profile-defaults.js > $(DESTDIR)$(mozappdir)/defaults/existing-profile-defaults.js; \
-	fi
-
 PROFILE_FILES = \
 	localstore.rdf \
 	mimeTypes.rdf \
 	$(NULL)
 
 PROFILE_CHROME = userChrome-example.css userContent-example.css
 
 NO_JA_JP_MAC_AB_CD := $(if $(filter ja-JP-mac, $(AB_CD)),ja,$(AB_CD))