Bug 1470608: Remove StringBundleOverride service. r?gandalf draft
authorKris Maglione <maglione.k@gmail.com>
Sat, 23 Jun 2018 22:56:19 -0700
changeset 809963 f0930bceab29884b3a1919942f1baa8a6f94a8f5
parent 809962 43edac0df1442fa828aa40bc7bcc457760d90054
child 809966 b4a6b1d7a81380934de88f4b87391f5a9d9df797
push id113846
push usermaglione.k@gmail.com
push dateSun, 24 Jun 2018 05:57:00 +0000
reviewersgandalf
bugs1470608
milestone62.0a1
Bug 1470608: Remove StringBundleOverride service. r?gandalf MozReview-Commit-ID: GYEvzmstW54
intl/build/nsI18nModule.cpp
intl/strres/moz.build
intl/strres/nsIStringBundleOverride.idl
intl/strres/nsStringBundle.cpp
intl/strres/nsStringBundle.h
intl/strres/nsStringBundleService.h
intl/strres/nsStringBundleTextOverride.cpp
intl/strres/nsStringBundleTextOverride.h
--- a/intl/build/nsI18nModule.cpp
+++ b/intl/build/nsI18nModule.cpp
@@ -2,48 +2,43 @@
 /* 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/. */
 
 #include "mozilla/ModuleUtils.h"
 
 // string bundles (intl)
 #include "nsStringBundleService.h"
-#include "nsStringBundleTextOverride.h"
 
 // locale
 #include "nsLocaleConstructors.h"
 
 // uconv
 
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStringBundleService, Init)
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStringBundleTextOverride, Init)
 
 NS_DEFINE_NAMED_CID(MOZ_LOCALESERVICE_CID);
 NS_DEFINE_NAMED_CID(MOZ_OSPREFERENCES_CID);
 NS_DEFINE_NAMED_CID(NS_STRINGBUNDLESERVICE_CID);
-NS_DEFINE_NAMED_CID(NS_STRINGBUNDLETEXTOVERRIDE_CID);
 NS_DEFINE_NAMED_CID(NS_COLLATIONFACTORY_CID);
 NS_DEFINE_NAMED_CID(NS_COLLATION_CID);
 
 static const mozilla::Module::CIDEntry kIntlCIDs[] = {
     { &kMOZ_LOCALESERVICE_CID, false, nullptr, mozilla::intl::LocaleServiceConstructor },
     { &kMOZ_OSPREFERENCES_CID, false, nullptr, mozilla::intl::OSPreferencesConstructor },
     { &kNS_STRINGBUNDLESERVICE_CID, false, nullptr, nsStringBundleServiceConstructor },
-    { &kNS_STRINGBUNDLETEXTOVERRIDE_CID, false, nullptr, nsStringBundleTextOverrideConstructor },
     { &kNS_COLLATIONFACTORY_CID, false, nullptr, nsCollationFactoryConstructor },
     { &kNS_COLLATION_CID, false, nullptr, nsCollationConstructor },
     { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kIntlContracts[] = {
     { MOZ_LOCALESERVICE_CONTRACTID, &kMOZ_LOCALESERVICE_CID },
     { MOZ_OSPREFERENCES_CONTRACTID, &kMOZ_OSPREFERENCES_CID },
     { NS_STRINGBUNDLE_CONTRACTID, &kNS_STRINGBUNDLESERVICE_CID },
-    { NS_STRINGBUNDLETEXTOVERRIDE_CONTRACTID, &kNS_STRINGBUNDLETEXTOVERRIDE_CID },
     { NS_COLLATIONFACTORY_CONTRACTID, &kNS_COLLATIONFACTORY_CID },
     { NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID },
     { nullptr }
 };
 
 static const mozilla::Module kIntlModule = {
     mozilla::Module::kVersion,
     kIntlCIDs,
--- a/intl/strres/moz.build
+++ b/intl/strres/moz.build
@@ -3,24 +3,22 @@
 # 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/unit/xpcshell.ini']
 
 XPIDL_SOURCES += [
     'nsIStringBundle.idl',
-    'nsIStringBundleOverride.idl',
 ]
 
 XPIDL_MODULE = 'intl'
 
 UNIFIED_SOURCES += [
     'nsStringBundle.cpp',
-    'nsStringBundleTextOverride.cpp',
 ]
 
 LOCAL_INCLUDES += [
     '/xpcom/ds',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
deleted file mode 100644
--- a/intl/strres/nsIStringBundleOverride.idl
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-#include "nsISupports.idl"
-
-interface nsISimpleEnumerator;
-
-%{C++
-#include "mozilla/MemoryReporting.h"
-%}
-
-// to be implemented by an embeddor that wants to override some strings
-[scriptable, uuid(965eb278-5678-456b-82a7-20a0c86a803c)]
-interface nsIStringBundleOverride : nsISupports
-{
-  /**
-   * get the override value for a particular key in a particular
-   * string bundle
-   */
-  AString getStringFromName(in AUTF8String url,
-                            in ACString key);
-
-  /**
-   * get all override keys for a given string bundle
-   */
-  nsISimpleEnumerator enumerateKeysInBundle(in AUTF8String url);
-
-%{C++
-  virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
-%}
-};
--- a/intl/strres/nsStringBundle.cpp
+++ b/intl/strres/nsStringBundle.cpp
@@ -3,17 +3,16 @@
  * 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/. */
 
 #include "nsStringBundle.h"
 #include "nsID.h"
 #include "nsString.h"
 #include "nsIStringBundle.h"
 #include "nsStringBundleService.h"
-#include "nsStringBundleTextOverride.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIMutableArray.h"
 #include "nsArrayEnumerator.h"
 #include "nscore.h"
 #include "nsMemory.h"
 #include "nsNetUtil.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
@@ -157,18 +156,18 @@ NS_IMPL_ISUPPORTS(StringBundleProxy, nsI
  *
  * Important: The memory allocated by these string bundles will never be freed
  * before process shutdown, per the restrictions in SharedStringMap.h, so they
  * should never be used for short-lived bundles.
  */
 class SharedStringBundle final : public nsStringBundleBase
 {
 public:
-  SharedStringBundle(const char* aURLSpec, nsIStringBundleOverride* aOverrides)
-    : nsStringBundleBase(aURLSpec, aOverrides)
+  SharedStringBundle(const char* aURLSpec)
+    : nsStringBundleBase(aURLSpec)
   {}
 
   /**
    * Initialize the string bundle with a file descriptor pointing to a
    * pre-populated key-value store for this string bundle. This should only be
    * called in child processes, for bundles initially created in the parent
    * process.
    */
@@ -260,32 +259,29 @@ NS_IMPL_ISUPPORTS(StringMapEnumerator, n
 
 } // anonymous namespace
 
 NS_IMPL_ISUPPORTS(nsStringBundleBase, nsIStringBundle)
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsStringBundle, nsStringBundleBase)
 NS_IMPL_ISUPPORTS_INHERITED(SharedStringBundle, nsStringBundleBase, SharedStringBundle)
 
-nsStringBundleBase::nsStringBundleBase(const char* aURLSpec,
-                                       nsIStringBundleOverride* aOverrideStrings) :
+nsStringBundleBase::nsStringBundleBase(const char* aURLSpec) :
   mPropertiesURL(aURLSpec),
-  mOverrideStrings(aOverrideStrings),
   mReentrantMonitor("nsStringBundle.mReentrantMonitor"),
   mAttemptedLoad(false),
   mLoaded(false)
 {
 }
 
 nsStringBundleBase::~nsStringBundleBase()
 {}
 
-nsStringBundle::nsStringBundle(const char* aURLSpec,
-                               nsIStringBundleOverride* aOverrideStrings)
-  : nsStringBundleBase(aURLSpec, aOverrideStrings)
+nsStringBundle::nsStringBundle(const char* aURLSpec)
+  : nsStringBundleBase(aURLSpec)
 {}
 
 nsStringBundle::~nsStringBundle()
 {
 }
 
 NS_IMETHODIMP
 nsStringBundleBase::AsyncPreload()
@@ -298,19 +294,16 @@ nsStringBundleBase::AsyncPreload()
 
 size_t
 nsStringBundle::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
 {
   size_t n = 0;
   if (mProps) {
     n += mProps->SizeOfIncludingThis(aMallocSizeOf);
   }
-  if (mOverrideStrings) {
-    n += mOverrideStrings->SizeOfIncludingThis(aMallocSizeOf);
-  }
   return aMallocSizeOf(this) + n;
 }
 
 size_t
 nsStringBundleBase::SizeOfIncludingThisIfUnshared(MallocSizeOf aMallocSizeOf) const
 {
   if (mRefCnt == 1) {
     return SizeOfIncludingThis(aMallocSizeOf);
@@ -321,19 +314,16 @@ nsStringBundleBase::SizeOfIncludingThisI
 
 size_t
 SharedStringBundle::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
 {
   size_t n = 0;
   if (mStringMap) {
     n += aMallocSizeOf(mStringMap);
   }
-  if (mOverrideStrings) {
-    n += mOverrideStrings->SizeOfIncludingThis(aMallocSizeOf);
-  }
   return aMallocSizeOf(this) + n;
 }
 
 
 nsresult
 nsStringBundleBase::ParseProperties(nsIPersistentProperties** aProps)
 {
   // this is different than mLoaded, because we only want to attempt
@@ -481,25 +471,16 @@ nsStringBundleBase::GetStringFromAUTF8Na
 
 NS_IMETHODIMP
 nsStringBundleBase::GetStringFromName(const char* aName, nsAString& aResult)
 {
   NS_ENSURE_ARG_POINTER(aName);
 
   ReentrantMonitorAutoEnter automon(mReentrantMonitor);
 
-  // try override first
-  if (mOverrideStrings) {
-    nsresult rv;
-    rv = mOverrideStrings->GetStringFromName(mPropertiesURL,
-                                             nsDependentCString(aName),
-                                             aResult);
-    if (NS_SUCCEEDED(rv)) return rv;
-  }
-
   return GetStringImpl(nsDependentCString(aName), aResult);
 }
 
 nsresult
 nsStringBundle::GetStringImpl(const nsACString& aName, nsAString& aResult)
 {
   MOZ_TRY(LoadProperties());
 
@@ -550,87 +531,21 @@ nsStringBundleBase::FormatStringFromName
 
   nsAutoString formatStr;
   nsresult rv = GetStringFromName(aName, formatStr);
   if (NS_FAILED(rv)) return rv;
 
   return FormatString(formatStr.get(), aParams, aLength, aResult);
 }
 
-
-nsresult
-nsStringBundleBase::GetCombinedEnumeration(nsIStringBundleOverride* aOverrideStrings,
-                                           nsISimpleEnumerator** aResult)
-{
-  nsCOMPtr<nsISupports> supports;
-  nsCOMPtr<nsIPropertyElement> propElement;
-
-  nsresult rv;
-
-  nsCOMPtr<nsIMutableArray> resultArray =
-    do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // first, append the override elements
-  nsCOMPtr<nsISimpleEnumerator> overrideEnumerator;
-  rv = aOverrideStrings->EnumerateKeysInBundle(mPropertiesURL,
-                                               getter_AddRefs(overrideEnumerator));
-
-  bool hasMore;
-  rv = overrideEnumerator->HasMoreElements(&hasMore);
-  NS_ENSURE_SUCCESS(rv, rv);
-  while (hasMore) {
-
-    rv = overrideEnumerator->GetNext(getter_AddRefs(supports));
-    if (NS_SUCCEEDED(rv))
-      resultArray->AppendElement(supports);
-
-    rv = overrideEnumerator->HasMoreElements(&hasMore);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  // ok, now we have the override elements in resultArray
-  nsCOMPtr<nsISimpleEnumerator> propEnumerator;
-  rv = GetSimpleEnumerationImpl(getter_AddRefs(propEnumerator));
-  if (NS_FAILED(rv)) {
-    return NS_NewArrayEnumerator(aResult, resultArray);
-  }
-
-  do {
-    rv = propEnumerator->GetNext(getter_AddRefs(supports));
-    if (NS_SUCCEEDED(rv) &&
-        (propElement = do_QueryInterface(supports, &rv))) {
-
-      // now check if its in the override bundle
-      nsAutoCString key;
-      propElement->GetKey(key);
-
-      nsAutoString value;
-      rv = aOverrideStrings->GetStringFromName(mPropertiesURL, key, value);
-
-      // if it isn't there, then it is safe to append
-      if (NS_FAILED(rv))
-        resultArray->AppendElement(propElement);
-    }
-
-    rv = propEnumerator->HasMoreElements(&hasMore);
-    NS_ENSURE_SUCCESS(rv, rv);
-  } while (hasMore);
-
-  return resultArray->Enumerate(aResult);
-}
-
 NS_IMETHODIMP
 nsStringBundleBase::GetSimpleEnumeration(nsISimpleEnumerator** aElements)
 {
   NS_ENSURE_ARG_POINTER(aElements);
 
-  if (mOverrideStrings)
-      return GetCombinedEnumeration(mOverrideStrings, aElements);
-
   return GetSimpleEnumerationImpl(aElements);
 }
 
 nsresult
 nsStringBundle::GetSimpleEnumerationImpl(nsISimpleEnumerator** elements)
 {
   MOZ_TRY(LoadProperties());
 
@@ -912,25 +827,19 @@ nsStringBundleService::~nsStringBundleSe
 nsresult
 nsStringBundleService::Init()
 {
   nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
   if (os) {
     os->AddObserver(this, "memory-pressure", true);
     os->AddObserver(this, "profile-do-change", true);
     os->AddObserver(this, "chrome-flush-caches", true);
-    os->AddObserver(this, "xpcom-category-entry-added", true);
     os->AddObserver(this, "intl:app-locales-changed", true);
   }
 
-  // instantiate the override service, if there is any.
-  // at some point we probably want to make this a category, and
-  // support multiple overrides
-  mOverrideStrings = do_GetService(NS_STRINGBUNDLETEXTOVERRIDE_CONTRACTID);
-
   RegisterWeakMemoryReporter(this);
 
   return NS_OK;
 }
 
 size_t
 nsStringBundleService::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
 {
@@ -949,21 +858,16 @@ nsStringBundleService::Observe(nsISuppor
 {
   if (strcmp("memory-pressure", aTopic) == 0 ||
       strcmp("profile-do-change", aTopic) == 0 ||
       strcmp("chrome-flush-caches", aTopic) == 0 ||
       strcmp("intl:app-locales-changed", aTopic) == 0)
   {
     flushBundleCache();
   }
-  else if (strcmp("xpcom-category-entry-added", aTopic) == 0 &&
-           NS_LITERAL_STRING("xpcom-autoregistration").Equals(aSomeData))
-  {
-    mOverrideStrings = do_GetService(NS_STRINGBUNDLETEXTOVERRIDE_CONTRACTID);
-  }
 
   return NS_OK;
 }
 
 void
 nsStringBundleService::flushBundleCache()
 {
   // release all bundles in the cache
@@ -1015,17 +919,17 @@ nsStringBundleService::RegisterContentBu
     if (RefPtr<SharedStringBundle> shared = do_QueryObject(cacheEntry->mBundle)) {
       return;
     }
 
     proxy = do_QueryObject(cacheEntry->mBundle);
     cacheEntry->remove();
   }
 
-  auto bundle = MakeRefPtr<SharedStringBundle>(aBundleURL.get(), mOverrideStrings);
+  auto bundle = MakeRefPtr<SharedStringBundle>(aBundleURL.get());
   bundle->SetMapFile(aMapFile, aMapSize);
 
   if (proxy) {
     proxy->Retarget(bundle);
   }
 
   cacheEntry = insertIntoCache(bundle.forget(), nsCString(aBundleURL));
   mSharedBundles.insertBack(cacheEntry);
@@ -1047,17 +951,17 @@ nsStringBundleService::getStringBundle(c
     cacheEntry->remove();
 
     shared = do_QueryObject(cacheEntry->mBundle);
   } else {
     // hasn't been cached, so insert it into the hash table
     nsCOMPtr<nsIStringBundle> bundle;
     bool isContent = IsContentBundle(PromiseFlatCString(key));
     if (!isContent || !XRE_IsParentProcess()) {
-      bundle = new nsStringBundle(aURLSpec, mOverrideStrings);
+      bundle = new nsStringBundle(aURLSpec);
     }
 
     // If this is a bundle which is used by the content processes, we want to
     // load it into a shared memory region.
     //
     // If we're in the parent process, just create a new SharedStringBundle,
     // and populate it from the properties file.
     //
@@ -1065,17 +969,17 @@ nsStringBundleService::getStringBundle(c
     // the cache means that we haven't received its shared memory descriptor
     // from the parent yet. There's not much we can do about that besides
     // wait, but we need to return a bundle now. So instead of a shared memory
     // bundle, we create a temporary proxy, which points to a non-shared
     // bundle initially, and is retarged to a shared memory bundle when it
     // becomes available.
     if (isContent) {
       if (XRE_IsParentProcess()) {
-        shared = new SharedStringBundle(aURLSpec, mOverrideStrings);
+        shared = new SharedStringBundle(aURLSpec);
         bundle = shared;
       } else {
         bundle = new StringBundleProxy(bundle.forget());
       }
     }
 
     cacheEntry = insertIntoCache(bundle.forget(), key);
   }
--- a/intl/strres/nsStringBundle.h
+++ b/intl/strres/nsStringBundle.h
@@ -8,22 +8,21 @@
 
 #include "mozilla/ReentrantMonitor.h"
 #include "nsIStringBundle.h"
 #include "nsCOMPtr.h"
 #include "nsString.h"
 #include "nsCOMArray.h"
 
 class nsIPersistentProperties;
-class nsIStringBundleOverride;
 
 class nsStringBundleBase : public nsIStringBundle
 {
 public:
-    nsStringBundleBase(const char* aURLSpec, nsIStringBundleOverride*);
+    nsStringBundleBase(const char* aURLSpec);
 
     nsresult ParseProperties(nsIPersistentProperties**);
 
     NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSISTRINGBUNDLE
 
     virtual nsresult LoadProperties() = 0;
 
@@ -32,36 +31,32 @@ public:
 protected:
     virtual ~nsStringBundleBase();
 
     virtual nsresult GetStringImpl(const nsACString& aName, nsAString& aResult) = 0;
 
     virtual nsresult GetSimpleEnumerationImpl(nsISimpleEnumerator** elements) = 0;
 
     nsCString              mPropertiesURL;
-    nsCOMPtr<nsIStringBundleOverride> mOverrideStrings;
     mozilla::ReentrantMonitor    mReentrantMonitor;
     bool                         mAttemptedLoad;
     bool                         mLoaded;
 
-    nsresult GetCombinedEnumeration(nsIStringBundleOverride* aOverrideString,
-                                    nsISimpleEnumerator** aResult);
-
     size_t SizeOfIncludingThisIfUnshared(mozilla::MallocSizeOf aMallocSizeOf) const override;
 
 public:
     static nsresult FormatString(const char16_t *formatStr,
                                  const char16_t **aParams, uint32_t aLength,
                                  nsAString& aResult);
 };
 
 class nsStringBundle : public nsStringBundleBase
 {
 public:
-    nsStringBundle(const char* aURLSpec, nsIStringBundleOverride*);
+    nsStringBundle(const char* aURLSpec);
 
     NS_DECL_ISUPPORTS_INHERITED
 
     nsCOMPtr<nsIPersistentProperties> mProps;
 
     nsresult LoadProperties() override;
 
     size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
--- a/intl/strres/nsStringBundleService.h
+++ b/intl/strres/nsStringBundleService.h
@@ -9,17 +9,16 @@
 #include "nsCOMPtr.h"
 #include "nsDataHashtable.h"
 #include "nsHashKeys.h"
 #include "nsIPersistentProperties2.h"
 #include "nsIStringBundle.h"
 #include "nsIObserver.h"
 #include "nsWeakReference.h"
 #include "nsIErrorService.h"
-#include "nsIStringBundleOverride.h"
 #include "nsIMemoryReporter.h"
 
 #include "mozilla/LinkedList.h"
 
 struct bundleCacheEntry_t;
 
 class nsStringBundleService : public nsIStringBundleService,
                               public nsIObserver,
@@ -70,12 +69,11 @@ private:
   bundleCacheEntry_t *insertIntoCache(already_AddRefed<nsIStringBundle> aBundle,
                                       const nsCString &aHashKey);
 
   nsDataHashtable<nsCStringHashKey, bundleCacheEntry_t*> mBundleMap;
   mozilla::LinkedList<bundleCacheEntry_t> mBundleCache;
   mozilla::LinkedList<bundleCacheEntry_t> mSharedBundles;
 
   nsCOMPtr<nsIErrorService> mErrorService;
-  nsCOMPtr<nsIStringBundleOverride> mOverrideStrings;
 };
 
 #endif
deleted file mode 100644
--- a/intl/strres/nsStringBundleTextOverride.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* 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/. */
-
-
-#include "nsStringBundleTextOverride.h"
-#include "nsString.h"
-
-#include "nsNetUtil.h"
-#include "nsAppDirectoryServiceDefs.h"
-#include "nsContentUtils.h"
-#include "nsDirectoryServiceUtils.h"
-
-// first we need a simple class which wraps a nsIPropertyElement and
-// cuts out the leading URL from the key
-class URLPropertyElement : public nsIPropertyElement
-{
-public:
-    URLPropertyElement(nsIPropertyElement *aRealElement, uint32_t aURLLength) :
-        mRealElement(aRealElement),
-        mURLLength(aURLLength)
-    { }
-
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIPROPERTYELEMENT
-
-private:
-    nsCOMPtr<nsIPropertyElement> mRealElement;
-    uint32_t mURLLength;
-
-    virtual ~URLPropertyElement() {}
-};
-
-NS_IMPL_ISUPPORTS(URLPropertyElement, nsIPropertyElement)
-
-// we'll tweak the key on the way through, and remove the url prefix
-NS_IMETHODIMP
-URLPropertyElement::GetKey(nsACString& aKey)
-{
-    nsresult rv =  mRealElement->GetKey(aKey);
-    if (NS_FAILED(rv)) return rv;
-
-    // chop off the url
-    aKey.Cut(0, mURLLength);
-
-    return NS_OK;
-}
-
-// values are unaffected
-NS_IMETHODIMP
-URLPropertyElement::GetValue(nsAString& aValue)
-{
-    return mRealElement->GetValue(aValue);
-}
-
-// setters are kind of strange, hopefully we'll never be called
-NS_IMETHODIMP
-URLPropertyElement::SetKey(const nsACString& aKey)
-{
-    // this is just wrong - ideally you'd take the key, append it to
-    // the url, and set that as the key. However, that would require
-    // us to hold onto a copy of the string, and that's a waste,
-    // considering nobody should ever be calling this.
-    NS_ERROR("This makes no sense!");
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-URLPropertyElement::SetValue(const nsAString& aValue)
-{
-    return mRealElement->SetValue(aValue);
-}
-
-
-// this is a special enumerator which returns only the elements which
-// are prefixed with a particular url
-class nsPropertyEnumeratorByURL : public nsISimpleEnumerator
-{
-public:
-    nsPropertyEnumeratorByURL(const nsACString& aURL,
-                              nsISimpleEnumerator* aOuter) :
-        mOuter(aOuter),
-        mURL(aURL)
-    {
-        // prepare the url once so we can use its value later
-        // persistent properties uses ":" as a delimiter, so escape
-        // that character
-        mURL.ReplaceSubstring(":", "%3A");
-        // there is always a # between the url and the real key
-        mURL.Append('#');
-    }
-
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISIMPLEENUMERATOR
-
-private:
-
-    // actual enumerator of all strings from nsIProperties
-    nsCOMPtr<nsISimpleEnumerator> mOuter;
-
-    // the current element that is valid for this url
-    nsCOMPtr<nsIPropertyElement> mCurrent;
-
-    // the url in question, pre-escaped and with the # already in it
-    nsCString mURL;
-
-    virtual ~nsPropertyEnumeratorByURL() {}
-};
-
-//
-// nsStringBundleTextOverride implementation
-//
-NS_IMPL_ISUPPORTS(nsStringBundleTextOverride,
-                  nsIStringBundleOverride)
-
-nsresult
-nsStringBundleTextOverride::Init()
-{
-    nsresult rv;
-
-    // check for existence of custom-strings.txt
-
-    nsCOMPtr<nsIFile> customStringsFile;
-    rv = NS_GetSpecialDirectory(NS_APP_CHROME_DIR,
-                                getter_AddRefs(customStringsFile));
-
-    if (NS_FAILED(rv)) return rv;
-
-    // bail if not found - this will cause the service creation to
-    // bail as well, and cause this object to go away
-
-    customStringsFile->AppendNative(NS_LITERAL_CSTRING("custom-strings.txt"));
-
-    bool exists;
-    rv = customStringsFile->Exists(&exists);
-    if (NS_FAILED(rv) || !exists)
-        return NS_ERROR_FAILURE;
-
-    NS_WARNING("Using custom-strings.txt to override string bundles.");
-    // read in the custom bundle. Keys are in the form
-    // chrome://package/locale/foo.properties:keyname
-
-    nsAutoCString customStringsURLSpec;
-    rv = NS_GetURLSpecFromFile(customStringsFile, customStringsURLSpec);
-    if (NS_FAILED(rv)) return rv;
-
-    nsCOMPtr<nsIURI> uri;
-    rv = NS_NewURI(getter_AddRefs(uri), customStringsURLSpec);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr<nsIChannel> channel;
-    rv = NS_NewChannel(getter_AddRefs(channel),
-                       uri,
-                       nsContentUtils::GetSystemPrincipal(),
-                       nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
-                       nsIContentPolicy::TYPE_OTHER);
-
-    NS_ENSURE_SUCCESS(rv, rv);
-    nsCOMPtr<nsIInputStream> in;
-    rv = channel->Open2(getter_AddRefs(in));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    static NS_DEFINE_CID(kPersistentPropertiesCID, NS_IPERSISTENTPROPERTIES_CID);
-    mValues = do_CreateInstance(kPersistentPropertiesCID, &rv);
-    if (NS_FAILED(rv)) return rv;
-
-    rv = mValues->Load(in);
-
-    // turn this on to see the contents of custom-strings.txt
-#ifdef DEBUG_alecf
-    nsCOMPtr<nsISimpleEnumerator> enumerator;
-    mValues->Enumerate(getter_AddRefs(enumerator));
-    NS_ASSERTION(enumerator, "no enumerator!\n");
-
-    printf("custom-strings.txt contains:\n");
-    printf("----------------------------\n");
-
-    bool hasMore;
-    enumerator->HasMoreElements(&hasMore);
-    do {
-        nsCOMPtr<nsISupports> sup;
-        enumerator->GetNext(getter_AddRefs(sup));
-
-        nsCOMPtr<nsIPropertyElement> prop = do_QueryInterface(sup);
-
-        nsAutoCString key;
-        nsAutoString value;
-        prop->GetKey(key);
-        prop->GetValue(value);
-
-        printf("%s = '%s'\n", key.get(), NS_ConvertUTF16toUTF8(value).get());
-
-        enumerator->HasMoreElements(&hasMore);
-    } while (hasMore);
-#endif
-
-    return rv;
-}
-
-NS_IMETHODIMP
-nsStringBundleTextOverride::GetStringFromName(const nsACString& aURL,
-                                              const nsACString& key,
-                                              nsAString& aResult)
-{
-    // concatenate url#key to get the key to read
-    nsAutoCString combinedURL(aURL + NS_LITERAL_CSTRING("#") + key);
-
-    // persistent properties uses ":" as a delimiter, so escape that character
-    combinedURL.ReplaceSubstring(":", "%3A");
-
-    return mValues->GetStringProperty(combinedURL, aResult);
-}
-
-size_t
-nsStringBundleTextOverride::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
-{
-  return aMallocSizeOf(this) + (mValues ? mValues->SizeOfIncludingThis(aMallocSizeOf) : 0);
-}
-
-NS_IMETHODIMP
-nsStringBundleTextOverride::EnumerateKeysInBundle(const nsACString& aURL,
-                                                  nsISimpleEnumerator** aResult)
-{
-    // enumerate all strings, and let the enumerator know
-    nsCOMPtr<nsISimpleEnumerator> enumerator;
-    mValues->Enumerate(getter_AddRefs(enumerator));
-
-    // make the enumerator wrapper and pass it off
-    nsPropertyEnumeratorByURL* propEnum =
-        new nsPropertyEnumeratorByURL(aURL, enumerator);
-
-    if (!propEnum) return NS_ERROR_OUT_OF_MEMORY;
-
-    NS_ADDREF(*aResult = propEnum);
-
-    return NS_OK;
-}
-
-
-//
-// nsPropertyEnumeratorByURL implementation
-//
-
-
-NS_IMPL_ISUPPORTS(nsPropertyEnumeratorByURL, nsISimpleEnumerator)
-
-NS_IMETHODIMP
-nsPropertyEnumeratorByURL::GetNext(nsISupports **aResult)
-{
-    if (!mCurrent) return NS_ERROR_UNEXPECTED;
-
-    // wrap mCurrent instead of returning it
-    *aResult = new URLPropertyElement(mCurrent, mURL.Length());
-    NS_ADDREF(*aResult);
-
-    // release it so we don't return it twice
-    mCurrent = nullptr;
-
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsPropertyEnumeratorByURL::HasMoreElements(bool * aResult)
-{
-    bool hasMore;
-    mOuter->HasMoreElements(&hasMore);
-    while (hasMore) {
-
-        nsCOMPtr<nsISupports> supports;
-        mOuter->GetNext(getter_AddRefs(supports));
-
-        mCurrent = do_QueryInterface(supports);
-
-        if (mCurrent) {
-            nsAutoCString curKey;
-            mCurrent->GetKey(curKey);
-
-            if (StringBeginsWith(curKey, mURL))
-                break;
-        }
-
-        mOuter->HasMoreElements(&hasMore);
-    }
-
-    if (!hasMore)
-        mCurrent = nullptr;
-
-    *aResult = mCurrent ? true : false;
-
-    return NS_OK;
-}
deleted file mode 100644
--- a/intl/strres/nsStringBundleTextOverride.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* 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 nsStringBundleTextOverride_h__
-#define nsStringBundleTextOverride_h__
-
-#include "nsIStringBundleOverride.h"
-#include "nsCOMPtr.h"
-#include "nsIPersistentProperties2.h"
-
-// {6316C6CE-12D3-479e-8F53-E289351412B8}
-#define NS_STRINGBUNDLETEXTOVERRIDE_CID \
-  { 0x6316c6ce, 0x12d3, 0x479e, \
-  { 0x8f, 0x53, 0xe2, 0x89, 0x35, 0x14, 0x12, 0xb8 } }
-
-
-#define NS_STRINGBUNDLETEXTOVERRIDE_CONTRACTID \
-    "@mozilla.org/intl/stringbundle/text-override;1"
-
-// an implementation which does overrides from a text file
-
-class nsStringBundleTextOverride : public nsIStringBundleOverride
-{
-  public:
-    nsStringBundleTextOverride() { }
-
-    nsresult Init();
-
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISTRINGBUNDLEOVERRIDE
-
-    size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
-
-  private:
-    nsCOMPtr<nsIPersistentProperties> mValues;
-
-    virtual ~nsStringBundleTextOverride() {}
-};
-
-#endif