Bug 1546329 - Remove dead skins code. r=bzbarsky
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 24 Apr 2019 13:18:50 +0200
changeset 530114 7a5177cca40350267da21fdd3dd0025a172db51f
parent 530113 c08ca0ff0c98cdec6f6a70bdd9e7c610e5e39f95
child 530115 c45916f0bea2c5a258155bc3a9fbacfcbb8e30ea
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1546329
milestone68.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 1546329 - Remove dead skins code. r=bzbarsky Differential Revision: https://phabricator.services.mozilla.com//D28459
browser/base/content/test/performance/browser_windowopen.js
chrome/nsChromeRegistry.cpp
chrome/nsChromeRegistry.h
chrome/nsChromeRegistryChrome.cpp
chrome/nsChromeRegistryChrome.h
chrome/nsChromeRegistryContent.cpp
chrome/nsChromeRegistryContent.h
chrome/nsIChromeRegistry.idl
chrome/nsIToolkitChromeRegistry.idl
dom/base/Document.cpp
dom/base/Document.h
dom/xbl/nsBindingManager.cpp
dom/xbl/nsBindingManager.h
dom/xul/nsXULPrototypeCache.cpp
dom/xul/nsXULPrototypeCache.h
image/imgLoader.cpp
layout/base/PresShell.cpp
layout/style/nsLayoutStylesheetCache.cpp
toolkit/content/tests/chrome/RegisterUnregisterChrome.js
toolkit/xre/nsAppRunner.cpp
--- a/browser/base/content/test/performance/browser_windowopen.js
+++ b/browser/base/content/test/performance/browser_windowopen.js
@@ -22,17 +22,16 @@ const EXPECTED_REFLOWS = [
  * This test ensures that there are no unexpected
  * uninterruptible reflows or flickering areas when opening new windows.
  */
 add_task(async function() {
   // Flushing all caches helps to ensure that we get consistent
   // behaviour when opening a new window, even if windows have been
   // opened in previous tests.
   Services.obs.notifyObservers(null, "startupcache-invalidate");
-  Services.obs.notifyObservers(null, "chrome-flush-skin-caches");
   Services.obs.notifyObservers(null, "chrome-flush-caches");
 
   let win = window.openDialog(AppConstants.BROWSER_CHROME_URL, "_blank",
                               "chrome,all,dialog=no,remote,suppressanimation",
                               "about:home");
 
   let alreadyFocused = false;
   let inRange = (val, min, max) => min <= val && val <= max;
--- a/chrome/nsChromeRegistry.cpp
+++ b/chrome/nsChromeRegistry.cpp
@@ -36,17 +36,16 @@
 
 nsChromeRegistry* nsChromeRegistry::gChromeRegistry;
 
 // DO NOT use namespace mozilla; it'll break due to a naming conflict between
 // mozilla::TextRange and a TextRange in OSX headers.
 using mozilla::PresShell;
 using mozilla::StyleSheet;
 using mozilla::dom::Document;
-using mozilla::dom::IsChromeURI;
 using mozilla::dom::Location;
 
 ////////////////////////////////////////////////////////////////////////////////
 
 void nsChromeRegistry::LogMessage(const char* aMsg, ...) {
   nsCOMPtr<nsIConsoleService> console(
       do_GetService(NS_CONSOLESERVICE_CONTRACTID));
   if (!console) return;
@@ -268,126 +267,16 @@ nsChromeRegistry::ConvertChromeURL(nsIUR
     return NS_ERROR_FILE_NOT_FOUND;
   }
 
   return NS_NewURI(aResult, path, nullptr, baseURI);
 }
 
 ////////////////////////////////////////////////////////////////////////
 
-// theme stuff
-
-static void FlushSkinBindingsForWindow(nsPIDOMWindowOuter* aWindow) {
-  // Get the document.
-  RefPtr<Document> document = aWindow->GetDoc();
-  if (!document) return;
-
-  // Annihilate all XBL bindings.
-  document->FlushSkinBindings();
-}
-
-// XXXbsmedberg: move this to nsIWindowMediator
-NS_IMETHODIMP nsChromeRegistry::RefreshSkins() {
-  nsCOMPtr<nsIWindowMediator> windowMediator(
-      do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
-  if (!windowMediator) return NS_OK;
-
-  nsCOMPtr<nsISimpleEnumerator> windowEnumerator;
-  windowMediator->GetEnumerator(nullptr, getter_AddRefs(windowEnumerator));
-  bool more;
-  windowEnumerator->HasMoreElements(&more);
-  while (more) {
-    nsCOMPtr<nsISupports> protoWindow;
-    windowEnumerator->GetNext(getter_AddRefs(protoWindow));
-    if (protoWindow) {
-      nsCOMPtr<nsPIDOMWindowOuter> domWindow = do_QueryInterface(protoWindow);
-      if (domWindow) FlushSkinBindingsForWindow(domWindow);
-    }
-    windowEnumerator->HasMoreElements(&more);
-  }
-
-  FlushSkinCaches();
-
-  windowMediator->GetEnumerator(nullptr, getter_AddRefs(windowEnumerator));
-  windowEnumerator->HasMoreElements(&more);
-  while (more) {
-    nsCOMPtr<nsISupports> protoWindow;
-    windowEnumerator->GetNext(getter_AddRefs(protoWindow));
-    if (protoWindow) {
-      nsCOMPtr<nsPIDOMWindowOuter> domWindow = do_QueryInterface(protoWindow);
-      if (domWindow) RefreshWindow(domWindow);
-    }
-    windowEnumerator->HasMoreElements(&more);
-  }
-
-  return NS_OK;
-}
-
-void nsChromeRegistry::FlushSkinCaches() {
-  nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
-  NS_ASSERTION(obsSvc, "Couldn't get observer service.");
-
-  obsSvc->NotifyObservers(static_cast<nsIChromeRegistry*>(this),
-                          NS_CHROME_FLUSH_SKINS_TOPIC, nullptr);
-}
-
-// XXXbsmedberg: move this to windowmediator
-nsresult nsChromeRegistry::RefreshWindow(nsPIDOMWindowOuter* aWindow) {
-  // Deal with our subframes first.
-  nsDOMWindowList* frames = aWindow->GetFrames();
-  uint32_t length = frames->GetLength();
-  for (uint32_t j = 0; j < length; j++) {
-    nsCOMPtr<nsPIDOMWindowOuter> piWindow = frames->IndexedGetter(j);
-    RefreshWindow(piWindow);
-  }
-
-  // Get the document.
-  RefPtr<Document> document = aWindow->GetDoc();
-  if (!document) return NS_OK;
-
-  size_t count = document->SheetCount();
-
-  // Build an array of style sheets we need to reload.
-  nsTArray<RefPtr<StyleSheet>> oldSheets(count);
-  nsTArray<RefPtr<StyleSheet>> newSheets(count);
-
-  // Iterate over the style sheets.
-  for (size_t i = 0; i < count; i++) {
-    // Get the style sheet
-    oldSheets.AppendElement(document->SheetAt(i));
-  }
-
-  // Iterate over our old sheets and kick off a sync load of the new
-  // sheet if and only if it's a non-inline sheet with a chrome URL.
-  //
-  // FIXME(emilio): What about user sheets? Also, does this do anything useful
-  // anymore?
-  for (StyleSheet* sheet : oldSheets) {
-    MOZ_ASSERT(sheet,
-               "SheetAt shouldn't return nullptr for "
-               "in-range sheet indexes");
-    nsIURI* uri = sheet->GetSheetURI();
-
-    if (!sheet->IsInline() && IsChromeURI(uri)) {
-      // Reload the sheet.
-      // XXX what about chrome sheets that have a title or are disabled?  This
-      // only works by sheer dumb luck.
-      if (RefPtr<StyleSheet> newSheet = document->LoadChromeSheetSync(uri)) {
-        newSheets.AppendElement(newSheet);
-      }
-    } else {
-      // Just use the same sheet.
-      newSheets.AppendElement(sheet);
-    }
-  }
-
-  // Now notify the document that multiple sheets have been added and removed.
-  document->UpdateStyleSheets(oldSheets, newSheets);
-  return NS_OK;
-}
 
 void nsChromeRegistry::FlushAllCaches() {
   nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
   NS_ASSERTION(obsSvc, "Couldn't get observer service.");
 
   obsSvc->NotifyObservers((nsIChromeRegistry*)this, NS_CHROME_FLUSH_TOPIC,
                           nullptr);
 }
--- a/chrome/nsChromeRegistry.h
+++ b/chrome/nsChromeRegistry.h
@@ -37,17 +37,16 @@ class nsIURL;
 
 class nsChromeRegistry : public nsIToolkitChromeRegistry,
                          public nsIObserver,
                          public nsSupportsWeakReference {
  public:
   NS_DECL_ISUPPORTS
 
   // nsIXULChromeRegistry methods:
-  NS_IMETHOD RefreshSkins() override;
   NS_IMETHOD AllowScriptsForPackage(nsIURI* url, bool* _retval) override;
   NS_IMETHOD AllowContentToAccess(nsIURI* url, bool* _retval) override;
   NS_IMETHOD CanLoadURLRemotely(nsIURI* url, bool* _retval) override;
   NS_IMETHOD MustLoadURLRemotely(nsIURI* url, bool* _retval) override;
 
   NS_IMETHOD ConvertChromeURL(nsIURI* aChromeURI, nsIURI** aResult) override;
 
   // nsChromeRegistry methods:
--- a/chrome/nsChromeRegistryChrome.cpp
+++ b/chrome/nsChromeRegistryChrome.cpp
@@ -32,18 +32,18 @@
 #include "nsIObserverService.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "mozilla/Preferences.h"
 #include "nsIResProtocolHandler.h"
 #include "nsIScriptError.h"
 #include "nsIXULRuntime.h"
 
-#define SELECTED_SKIN_PREF "general.skins.selectedSkin"
 #define PACKAGE_OVERRIDE_BRANCH "chrome.override_package."
+#define SKIN NS_LITERAL_CSTRING("classic/1.0")
 
 using namespace mozilla;
 using mozilla::dom::ContentParent;
 using mozilla::dom::PContentParent;
 using mozilla::intl::LocaleService;
 
 // We use a "best-fit" algorithm for matching locales and themes.
 // 1) the exact selected locale/theme
@@ -89,75 +89,31 @@ nsChromeRegistryChrome::nsChromeRegistry
     : mProfileLoaded(false), mDynamicRegistration(true) {}
 
 nsChromeRegistryChrome::~nsChromeRegistryChrome() {}
 
 nsresult nsChromeRegistryChrome::Init() {
   nsresult rv = nsChromeRegistry::Init();
   if (NS_FAILED(rv)) return rv;
 
-  mSelectedSkin = NS_LITERAL_CSTRING("classic/1.0");
-
   bool safeMode = false;
   nsCOMPtr<nsIXULRuntime> xulrun(do_GetService(XULAPPINFO_SERVICE_CONTRACTID));
   if (xulrun) xulrun->GetInSafeMode(&safeMode);
 
-  nsCOMPtr<nsIPrefService> prefserv(do_GetService(NS_PREFSERVICE_CONTRACTID));
-  nsCOMPtr<nsIPrefBranch> prefs;
-
-  if (prefserv) {
-    if (safeMode) {
-      prefserv->GetDefaultBranch(nullptr, getter_AddRefs(prefs));
-    } else {
-      prefs = do_QueryInterface(prefserv);
-    }
-  }
-
-  if (!prefs) {
-    NS_WARNING("Could not get pref service!");
-  } else {
-    nsAutoCString provider;
-    rv = prefs->GetCharPref(SELECTED_SKIN_PREF, provider);
-    if (NS_SUCCEEDED(rv)) mSelectedSkin = provider;
-
-    rv = prefs->AddObserver(SELECTED_SKIN_PREF, this, true);
-  }
-
   nsCOMPtr<nsIObserverService> obsService =
       mozilla::services::GetObserverService();
   if (obsService) {
     obsService->AddObserver(this, "profile-initial-state", true);
     obsService->AddObserver(this, "intl:app-locales-changed", true);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsChromeRegistryChrome::CheckForOSAccessibility() {
-  int32_t useAccessibilityTheme =
-      LookAndFeel::GetInt(LookAndFeel::eIntID_UseAccessibilityTheme, 0);
-
-  if (useAccessibilityTheme) {
-    /* Set the skin to classic and remove pref observers */
-    if (!mSelectedSkin.EqualsLiteral("classic/1.0")) {
-      mSelectedSkin.AssignLiteral("classic/1.0");
-      RefreshSkins();
-    }
-
-    nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
-    if (prefs) {
-      prefs->RemoveObserver(SELECTED_SKIN_PREF, this);
-    }
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 nsChromeRegistryChrome::GetLocalesForPackage(
     const nsACString& aPackage, nsIUTF8StringEnumerator** aResult) {
   nsCString realpackage;
   nsresult rv = OverrideLocalePackage(aPackage, realpackage);
   if (NS_FAILED(rv)) return rv;
 
   nsTArray<nsCString>* a = new nsTArray<nsCString>;
   if (!a) return NS_ERROR_OUT_OF_MEMORY;
@@ -235,36 +191,17 @@ nsresult nsChromeRegistryChrome::Overrid
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsChromeRegistryChrome::Observe(nsISupports* aSubject, const char* aTopic,
                                 const char16_t* someData) {
   nsresult rv = NS_OK;
 
-  if (!strcmp(NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, aTopic)) {
-    nsCOMPtr<nsIPrefBranch> prefs(do_QueryInterface(aSubject));
-    NS_ASSERTION(prefs, "Bad observer call!");
-
-    NS_ConvertUTF16toUTF8 pref(someData);
-
-    if (pref.EqualsLiteral(SELECTED_SKIN_PREF)) {
-      nsAutoCString provider;
-      rv = prefs->GetCharPref(pref.get(), provider);
-      if (NS_FAILED(rv)) {
-        NS_ERROR("Couldn't get new skin pref!");
-        return rv;
-      }
-
-      mSelectedSkin = provider;
-      RefreshSkins();
-    } else {
-      NS_ERROR("Unexpected pref!");
-    }
-  } else if (!strcmp("profile-initial-state", aTopic)) {
+  if (!strcmp("profile-initial-state", aTopic)) {
     mProfileLoaded = true;
   } else if (!strcmp("intl:app-locales-changed", aTopic)) {
     if (mProfileLoaded) {
       FlushAllCaches();
     }
   } else {
     NS_ERROR("Unexpected observer topic!");
   }
@@ -303,17 +240,17 @@ void nsChromeRegistryChrome::SendRegiste
     mozilla::dom::PContentParent* aParent) {
   InfallibleTArray<ChromePackage> packages;
   InfallibleTArray<SubstitutionMapping> resources;
   InfallibleTArray<OverrideMapping> overrides;
 
   for (auto iter = mPackagesHash.Iter(); !iter.Done(); iter.Next()) {
     ChromePackage chromePackage;
     ChromePackageFromPackageEntry(iter.Key(), iter.UserData(), &chromePackage,
-                                  mSelectedSkin);
+                                  SKIN);
     packages.AppendElement(chromePackage);
   }
 
   // If we were passed a parent then a new child process has been created and
   // has requested all of the chrome so send it the resources too. Otherwise
   // resource mappings are sent by the resource protocol handler dynamically.
   if (aParent) {
     nsCOMPtr<nsIIOService> io(do_GetIOService());
@@ -397,17 +334,17 @@ nsIURI* nsChromeRegistryChrome::GetBaseU
     return nullptr;
   }
 
   if (aProvider.EqualsLiteral("locale")) {
     nsAutoCString appLocale;
     LocaleService::GetInstance()->GetAppLocaleAsLangTag(appLocale);
     return entry->locales.GetBase(appLocale, nsProviderArray::LOCALE);
   } else if (aProvider.EqualsLiteral("skin")) {
-    return entry->skins.GetBase(mSelectedSkin, nsProviderArray::ANY);
+    return entry->skins.GetBase(SKIN, nsProviderArray::ANY);
   } else if (aProvider.EqualsLiteral("content")) {
     return entry->baseURI;
   }
   return nullptr;
 }
 
 nsresult nsChromeRegistryChrome::GetFlagsFromPackage(const nsCString& aPackage,
                                                      uint32_t* aFlags) {
@@ -549,18 +486,17 @@ void nsChromeRegistryChrome::ManifestCon
 
   nsDependentCString packageName(package);
   PackageEntry* entry = mPackagesHash.LookupOrAdd(packageName);
   entry->baseURI = resolved;
   entry->flags = flags;
 
   if (mDynamicRegistration) {
     ChromePackage chromePackage;
-    ChromePackageFromPackageEntry(packageName, entry, &chromePackage,
-                                  mSelectedSkin);
+    ChromePackageFromPackageEntry(packageName, entry, &chromePackage, SKIN);
     SendManifestEntry(chromePackage);
   }
 }
 
 void nsChromeRegistryChrome::ManifestLocale(ManifestProcessingContext& cx,
                                             int lineno, char* const* argv,
                                             int flags) {
   char* package = argv[0];
@@ -586,18 +522,17 @@ void nsChromeRegistryChrome::ManifestLoc
   }
 
   nsDependentCString packageName(package);
   PackageEntry* entry = mPackagesHash.LookupOrAdd(packageName);
   entry->locales.SetBase(nsDependentCString(provider), resolved);
 
   if (mDynamicRegistration) {
     ChromePackage chromePackage;
-    ChromePackageFromPackageEntry(packageName, entry, &chromePackage,
-                                  mSelectedSkin);
+    ChromePackageFromPackageEntry(packageName, entry, &chromePackage, SKIN);
     SendManifestEntry(chromePackage);
   }
 
   // We use mainPackage as the package we track for reporting new locales being
   // registered. For most cases it will be "global", but for Fennec it will be
   // "browser".
   nsAutoCString mainPackage;
   nsresult rv =
@@ -633,18 +568,17 @@ void nsChromeRegistryChrome::ManifestSki
   }
 
   nsDependentCString packageName(package);
   PackageEntry* entry = mPackagesHash.LookupOrAdd(packageName);
   entry->skins.SetBase(nsDependentCString(provider), resolved);
 
   if (mDynamicRegistration) {
     ChromePackage chromePackage;
-    ChromePackageFromPackageEntry(packageName, entry, &chromePackage,
-                                  mSelectedSkin);
+    ChromePackageFromPackageEntry(packageName, entry, &chromePackage, SKIN);
     SendManifestEntry(chromePackage);
   }
 }
 
 void nsChromeRegistryChrome::ManifestOverride(ManifestProcessingContext& cx,
                                               int lineno, char* const* argv,
                                               int flags) {
   char* chrome = argv[0];
--- a/chrome/nsChromeRegistryChrome.h
+++ b/chrome/nsChromeRegistryChrome.h
@@ -24,17 +24,16 @@ struct ChromePackage;
 class nsChromeRegistryChrome : public nsChromeRegistry {
  public:
   nsChromeRegistryChrome();
   ~nsChromeRegistryChrome();
 
   nsresult Init() override;
 
   NS_IMETHOD CheckForNewChrome() override;
-  NS_IMETHOD CheckForOSAccessibility() override;
   NS_IMETHOD GetLocalesForPackage(const nsACString& aPackage,
                                   nsIUTF8StringEnumerator** aResult) override;
   NS_IMETHOD IsLocaleRTL(const nsACString& package, bool* aResult) override;
   NS_IMETHOD GetSelectedLocale(const nsACString& aPackage, bool aAsBCP47,
                                nsACString& aLocale) override;
   NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
                      const char16_t* someData) override;
 
@@ -99,18 +98,16 @@ class nsChromeRegistryChrome : public ns
     uint32_t flags;
     nsProviderArray locales;
     nsProviderArray skins;
   };
 
   bool mProfileLoaded;
   bool mDynamicRegistration;
 
-  nsCString mSelectedSkin;
-
   // Hash of package names ("global") to PackageEntry objects
   nsClassHashtable<nsCStringHashKey, PackageEntry> mPackagesHash;
 
   virtual void ManifestContent(ManifestProcessingContext& cx, int lineno,
                                char* const* argv, int flags) override;
   virtual void ManifestLocale(ManifestProcessingContext& cx, int lineno,
                               char* const* argv, int flags) override;
   virtual void ManifestSkin(ManifestProcessingContext& cx, int lineno,
--- a/chrome/nsChromeRegistryContent.cpp
+++ b/chrome/nsChromeRegistryContent.cpp
@@ -155,21 +155,16 @@ nsresult nsChromeRegistryContent::GetFla
 
 NS_IMETHODIMP
 nsChromeRegistryContent::GetLocalesForPackage(
     const nsACString& aPackage, nsIUTF8StringEnumerator** aResult) {
   CONTENT_NOT_IMPLEMENTED();
 }
 
 NS_IMETHODIMP
-nsChromeRegistryContent::CheckForOSAccessibility() {
-  CONTENT_NOT_IMPLEMENTED();
-}
-
-NS_IMETHODIMP
 nsChromeRegistryContent::CheckForNewChrome() { CONTENT_NOT_IMPLEMENTED(); }
 
 NS_IMETHODIMP
 nsChromeRegistryContent::IsLocaleRTL(const nsACString& aPackage,
                                      bool* aResult) {
   *aResult = GetDirectionForLocale(mLocale);
   return NS_OK;
 }
--- a/chrome/nsChromeRegistryContent.h
+++ b/chrome/nsChromeRegistryContent.h
@@ -21,17 +21,16 @@ class nsChromeRegistryContent : public n
       const InfallibleTArray<ChromePackage>& aPackages,
       const InfallibleTArray<SubstitutionMapping>& aResources,
       const InfallibleTArray<OverrideMapping>& aOverrides,
       const nsACString& aLocale, bool aReset);
 
   NS_IMETHOD GetLocalesForPackage(const nsACString& aPackage,
                                   nsIUTF8StringEnumerator** aResult) override;
   NS_IMETHOD CheckForNewChrome() override;
-  NS_IMETHOD CheckForOSAccessibility() override;
   NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
                      const char16_t* aData) override;
   NS_IMETHOD IsLocaleRTL(const nsACString& package, bool* aResult) override;
   NS_IMETHOD GetSelectedLocale(const nsACString& aPackage, bool aAsBCP47,
                                nsACString& aLocale) override;
 
   void RegisterPackage(const ChromePackage& aPackage);
   void RegisterOverride(const OverrideMapping& aOverride);
--- a/chrome/nsIChromeRegistry.idl
+++ b/chrome/nsIChromeRegistry.idl
@@ -49,19 +49,16 @@ interface nsIXULChromeRegistry : nsIChro
   // passed to ECMA402 Intl API methods without throwing a RangeError.
   ACString getSelectedLocale(in ACString packageName,
                              [optional] in boolean asBCP47);
   
   // Get whether the default writing direction of the locale is RTL
   // (or may be overridden by intl.uidirection pref)
   boolean isLocaleRTL(in ACString package);
 
-  /* Should be called when skins change. Reloads only stylesheets. */
-  void refreshSkins();
-
   /**
    * Installable skin XBL is not always granted the same privileges as other
    * chrome. This asks the chrome registry whether scripts are allowed to be
    * run for a particular chrome URI. Do not pass non-chrome URIs to this
    * method.
    */
   boolean allowScriptsForPackage(in nsIURI url);
 
@@ -94,16 +91,9 @@ interface nsIXULChromeRegistry : nsIChro
 
 /**
  * Chrome registry will notify various caches that all chrome files need
  * flushing.
  */
 #define NS_CHROME_FLUSH_TOPIC \
   "chrome-flush-caches"
 
-/**
- * Chrome registry will notify various caches that skin files need flushing.
- * If "chrome-flush-caches" is notified, this topic will *not* be notified.
- */
-#define NS_CHROME_FLUSH_SKINS_TOPIC \
-  "chrome-flush-skin-caches"
-
 %}
--- a/chrome/nsIToolkitChromeRegistry.idl
+++ b/chrome/nsIToolkitChromeRegistry.idl
@@ -7,22 +7,12 @@
 
 interface nsIURI;
 interface nsIUTF8StringEnumerator;
 
 [scriptable, uuid(8727651c-9530-45a0-b81e-0e0690c30c50)]
 interface nsIToolkitChromeRegistry : nsIXULChromeRegistry
 {
   /**
-   * If the OS has a "high-visibility" or "disabled-friendly" theme set,
-   * we want to force mozilla into the classic theme, which (for the most part
-   * obeys the system color/font settings. We cannot do this at initialization,
-   * because it depends on the toolkit (GTK2) being initialized, which is
-   * not the case in some embedding situations. Embedders have to manually
-   * call this method during the startup process.
-   */
-  void checkForOSAccessibility();
-
-  /**
    * Get a list of locales available for the specified package.
    */
   nsIUTF8StringEnumerator getLocalesForPackage(in AUTF8String aPackage);
 };
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -2404,47 +2404,53 @@ void Document::FillStyleSet() {
 }
 
 void Document::RemoveContentEditableStyleSheets() {
   MOZ_ASSERT(IsHTMLOrXHTML());
 
   auto* cache = nsLayoutStylesheetCache::Singleton();
   bool changed = false;
   if (mDesignModeSheetAdded) {
-    mStyleSet->RemoveStyleSheet(StyleOrigin::UserAgent, cache->DesignModeSheet());
+    mStyleSet->RemoveStyleSheet(StyleOrigin::UserAgent,
+                                cache->DesignModeSheet());
     mDesignModeSheetAdded = false;
     changed = true;
   }
   if (mContentEditableSheetAdded) {
-    mStyleSet->RemoveStyleSheet(StyleOrigin::UserAgent, cache->ContentEditableSheet());
+    mStyleSet->RemoveStyleSheet(StyleOrigin::UserAgent,
+                                cache->ContentEditableSheet());
     mContentEditableSheetAdded = false;
     changed = true;
   }
   if (changed) {
     MOZ_ASSERT(mStyleSetFilled);
     ApplicableStylesChanged();
   }
 }
 
 void Document::AddContentEditableStyleSheetsToStyleSet(bool aDesignMode) {
   MOZ_ASSERT(IsHTMLOrXHTML());
-  MOZ_DIAGNOSTIC_ASSERT(mStyleSetFilled, "Caller should ensure we're being rendered");
+  MOZ_DIAGNOSTIC_ASSERT(mStyleSetFilled,
+                        "Caller should ensure we're being rendered");
 
   auto* cache = nsLayoutStylesheetCache::Singleton();
   bool changed = false;
   if (!mContentEditableSheetAdded) {
-    mStyleSet->AppendStyleSheet(StyleOrigin::UserAgent, cache->ContentEditableSheet());
+    mStyleSet->AppendStyleSheet(StyleOrigin::UserAgent,
+                                cache->ContentEditableSheet());
     mContentEditableSheetAdded = true;
     changed = true;
   }
   if (mDesignModeSheetAdded != aDesignMode) {
     if (mDesignModeSheetAdded) {
-      mStyleSet->RemoveStyleSheet(StyleOrigin::UserAgent, cache->DesignModeSheet());
+      mStyleSet->RemoveStyleSheet(StyleOrigin::UserAgent,
+                                  cache->DesignModeSheet());
     } else {
-      mStyleSet->AppendStyleSheet(StyleOrigin::UserAgent, cache->DesignModeSheet());
+      mStyleSet->AppendStyleSheet(StyleOrigin::UserAgent,
+                                  cache->DesignModeSheet());
     }
     mDesignModeSheetAdded = !mDesignModeSheetAdded;
     changed = true;
   }
   if (changed) {
     ApplicableStylesChanged();
   }
 }
@@ -4338,46 +4344,16 @@ void Document::RemoveStyleSheet(StyleShe
     }
 
     NotifyStyleSheetRemoved(sheet, true);
   }
 
   sheet->ClearAssociatedDocumentOrShadowRoot();
 }
 
-void Document::UpdateStyleSheets(nsTArray<RefPtr<StyleSheet>>& aOldSheets,
-                                 nsTArray<RefPtr<StyleSheet>>& aNewSheets) {
-  // XXX Need to set the sheet on the ownernode, if any
-  MOZ_ASSERT(aOldSheets.Length() == aNewSheets.Length(),
-             "The lists must be the same length!");
-  int32_t count = aOldSheets.Length();
-
-  RefPtr<StyleSheet> oldSheet;
-  int32_t i;
-  for (i = 0; i < count; ++i) {
-    oldSheet = aOldSheets[i];
-
-    // First remove the old sheet.
-    NS_ASSERTION(oldSheet, "None of the old sheets should be null");
-    int32_t oldIndex = mStyleSheets.IndexOf(oldSheet);
-    RemoveStyleSheet(oldSheet);  // This does the right notifications
-
-    // Now put the new one in its place.  If it's null, just ignore it.
-    StyleSheet* newSheet = aNewSheets[i];
-    if (newSheet) {
-      DocumentOrShadowRoot::InsertSheetAt(oldIndex, *newSheet);
-      if (newSheet->IsApplicable()) {
-        AddStyleSheetToStyleSets(newSheet);
-      }
-
-      NotifyStyleSheetAdded(newSheet, true);
-    }
-  }
-}
-
 void Document::InsertSheetAt(size_t aIndex, StyleSheet& aSheet) {
   DocumentOrShadowRoot::InsertSheetAt(aIndex, aSheet);
 
   if (aSheet.IsApplicable()) {
     AddStyleSheetToStyleSets(&aSheet);
   }
 
   NotifyStyleSheetAdded(&aSheet, true);
@@ -6276,18 +6252,16 @@ already_AddRefed<MediaQueryList> Documen
   RefPtr<MediaQueryList> result =
       new MediaQueryList(this, aMediaQueryList, aCallerType);
 
   mDOMMediaQueryLists.insertBack(result);
 
   return result.forget();
 }
 
-void Document::FlushSkinBindings() { BindingManager()->FlushSkinBindings(); }
-
 void Document::SetMayStartLayout(bool aMayStartLayout) {
   mMayStartLayout = aMayStartLayout;
   if (MayStartLayout()) {
     // Before starting layout, check whether we're a toplevel chrome
     // window.  If we are, setup some state so that we don't have to restyle
     // the whole tree after StartLayout.
     if (nsCOMPtr<nsIXULWindow> win = GetXULWindowIfToplevelChrome()) {
       // We're the chrome document!
--- a/dom/base/Document.h
+++ b/dom/base/Document.h
@@ -1656,27 +1656,16 @@ class Document : public nsINode,
 
   StyleSheetList* StyleSheets() {
     return &DocumentOrShadowRoot::EnsureDOMStyleSheets();
   }
 
   void InsertSheetAt(size_t aIndex, StyleSheet&);
 
   /**
-   * Replace the stylesheets in aOldSheets with the stylesheets in
-   * aNewSheets. The two lists must have equal length, and the sheet
-   * at positon J in the first list will be replaced by the sheet at
-   * position J in the second list.  Some sheets in the second list
-   * may be null; if so the corresponding sheets in the first list
-   * will simply be removed.
-   */
-  void UpdateStyleSheets(nsTArray<RefPtr<StyleSheet>>& aOldSheets,
-                         nsTArray<RefPtr<StyleSheet>>& aNewSheets);
-
-  /**
    * Add a stylesheet to the document
    *
    * TODO(emilio): This is only used by parts of editor that are no longer in
    * use by m-c or c-c, so remove.
    */
   void AddStyleSheet(StyleSheet* aSheet) {
     MOZ_ASSERT(aSheet);
     InsertSheetAt(SheetCount(), *aSheet);
@@ -2410,20 +2399,16 @@ class Document : public nsINode,
    * document.
    */
   bool HaveFiredDOMTitleChange() const { return mHaveFiredTitleChange; }
 
   Element* GetAnonymousElementByAttribute(nsIContent* aElement,
                                           nsAtom* aAttrName,
                                           const nsAString& aAttrValue) const;
 
-  /**
-   * See FlushSkinBindings on nsBindingManager
-   */
-  void FlushSkinBindings();
 
   /**
    * To batch DOMSubtreeModified, document needs to be informed when
    * a mutation event might be dispatched, even if the event isn't actually
    * created because there are no listeners for it.
    *
    * @param aTarget is the target for the mutation event.
    */
--- a/dom/xbl/nsBindingManager.cpp
+++ b/dom/xbl/nsBindingManager.cpp
@@ -449,37 +449,16 @@ nsIStreamListener* nsBindingManager::Get
 }
 
 void nsBindingManager::RemoveLoadingDocListener(nsIURI* aURL) {
   if (mLoadingDocTable) {
     mLoadingDocTable->Remove(aURL);
   }
 }
 
-void nsBindingManager::FlushSkinBindings() {
-  if (!mBoundContentSet) {
-    return;
-  }
-
-  for (auto iter = mBoundContentSet->Iter(); !iter.Done(); iter.Next()) {
-    nsXBLBinding* binding = iter.Get()->GetKey()->GetXBLBinding();
-
-    if (binding->MarkedForDeath()) {
-      continue;
-    }
-
-    nsAutoCString path;
-    binding->PrototypeBinding()->DocURI()->GetPathQueryRef(path);
-
-    if (!strncmp(path.get(), "/skin", 5)) {
-      binding->MarkForDeath();
-    }
-  }
-}
-
 // Used below to protect from recurring in QI calls through XPConnect.
 struct AntiRecursionData {
   nsIContent* element;
   REFNSIID iid;
   AntiRecursionData* next;
 
   AntiRecursionData(nsIContent* aElement, REFNSIID aIID,
                     AntiRecursionData* aNext)
--- a/dom/xbl/nsBindingManager.h
+++ b/dom/xbl/nsBindingManager.h
@@ -106,18 +106,16 @@ class nsBindingManager final : public ns
   nsresult PutXBLDocumentInfo(nsXBLDocumentInfo* aDocumentInfo);
   nsXBLDocumentInfo* GetXBLDocumentInfo(nsIURI* aURI);
   void RemoveXBLDocumentInfo(nsXBLDocumentInfo* aDocumentInfo);
 
   nsresult PutLoadingDocListener(nsIURI* aURL, nsIStreamListener* aListener);
   nsIStreamListener* GetLoadingDocListener(nsIURI* aURL);
   void RemoveLoadingDocListener(nsIURI* aURL);
 
-  void FlushSkinBindings();
-
   nsresult GetBindingImplementation(nsIContent* aContent, REFNSIID aIID,
                                     void** aResult);
 
   void Traverse(nsIContent* aContent, nsCycleCollectionTraversalCallback& cb);
 
   NS_DECL_CYCLE_COLLECTION_CLASS(nsBindingManager)
 
   // Notify the binding manager when an outermost update begins and
--- a/dom/xul/nsXULPrototypeCache.cpp
+++ b/dom/xul/nsXULPrototypeCache.cpp
@@ -85,34 +85,31 @@ nsXULPrototypeCache* nsXULPrototypeCache
 
     Preferences::RegisterCallback(DisableXULCacheChangedCallback,
                                   kDisableXULCachePref);
 
     nsCOMPtr<nsIObserverService> obsSvc =
         mozilla::services::GetObserverService();
     if (obsSvc) {
       nsXULPrototypeCache* p = sInstance;
-      obsSvc->AddObserver(p, "chrome-flush-skin-caches", false);
       obsSvc->AddObserver(p, "chrome-flush-caches", false);
       obsSvc->AddObserver(p, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
       obsSvc->AddObserver(p, "startupcache-invalidate", false);
     }
   }
   return sInstance;
 }
 
 //----------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsXULPrototypeCache::Observe(nsISupports* aSubject, const char* aTopic,
                              const char16_t* aData) {
-  if (!strcmp(aTopic, "chrome-flush-skin-caches")) {
-    FlushSkinFiles();
-  } else if (!strcmp(aTopic, "chrome-flush-caches") ||
-             !strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
+  if (!strcmp(aTopic, "chrome-flush-caches") ||
+      !strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
     Flush();
   } else if (!strcmp(aTopic, "startupcache-invalidate")) {
     AbortCaching();
   } else {
     NS_WARNING("Unexpected observer topic.");
   }
   return NS_OK;
 }
@@ -206,36 +203,16 @@ nsresult nsXULPrototypeCache::PutXBLDocu
   nsIURI* uri = aDocumentInfo->DocumentURI();
   nsXBLDocumentInfo* info = mXBLDocTable.GetWeak(uri);
   if (!info) {
     mXBLDocTable.Put(uri, aDocumentInfo);
   }
   return NS_OK;
 }
 
-void nsXULPrototypeCache::FlushSkinFiles() {
-  // Flush out skin XBL files from the cache.
-  for (auto iter = mXBLDocTable.Iter(); !iter.Done(); iter.Next()) {
-    nsAutoCString str;
-    iter.Key()->GetPathQueryRef(str);
-    if (strncmp(str.get(), "/skin", 5) == 0) {
-      iter.Remove();
-    }
-  }
-
-  // Now flush out our skin stylesheets from the cache.
-  for (auto iter = mStyleSheetTable.Iter(); !iter.Done(); iter.Next()) {
-    nsAutoCString str;
-    iter.Data()->GetSheetURI()->GetPathQueryRef(str);
-    if (strncmp(str.get(), "/skin", 5) == 0) {
-      iter.Remove();
-    }
-  }
-}
-
 void nsXULPrototypeCache::FlushScripts() { mScriptTable.Clear(); }
 
 void nsXULPrototypeCache::Flush() {
   mPrototypeTable.Clear();
   mScriptTable.Clear();
   mStyleSheetTable.Clear();
   mXBLDocTable.Clear();
 }
--- a/dom/xul/nsXULPrototypeCache.h
+++ b/dom/xul/nsXULPrototypeCache.h
@@ -109,18 +109,16 @@ class nsXULPrototypeCache : public nsIOb
   friend nsresult NS_NewXULPrototypeCache(nsISupports* aOuter, REFNSIID aIID,
                                           void** aResult);
 
   nsXULPrototypeCache();
   virtual ~nsXULPrototypeCache();
 
   static nsXULPrototypeCache* sInstance;
 
-  void FlushSkinFiles();
-
   using StyleSheetTable = nsRefPtrHashtable<nsURIHashKey, mozilla::StyleSheet>;
   using XBLDocTable = nsRefPtrHashtable<nsURIHashKey, nsXBLDocumentInfo>;
 
   nsRefPtrHashtable<nsURIHashKey, nsXULPrototypeDocument>
       mPrototypeTable;  // owns the prototypes
   StyleSheetTable mStyleSheetTable;
   nsJSThingHashtable<nsURIHashKey, JSScript*> mScriptTable;
   XBLDocTable mXBLDocTable;
--- a/image/imgLoader.cpp
+++ b/image/imgLoader.cpp
@@ -1264,17 +1264,16 @@ void imgLoader::ShutdownMemoryReporter()
 
 nsresult imgLoader::InitCache() {
   nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
   if (!os) {
     return NS_ERROR_FAILURE;
   }
 
   os->AddObserver(this, "memory-pressure", false);
-  os->AddObserver(this, "chrome-flush-skin-caches", false);
   os->AddObserver(this, "chrome-flush-caches", false);
   os->AddObserver(this, "last-pb-context-exited", false);
   os->AddObserver(this, "profile-before-change", false);
   os->AddObserver(this, "xpcom-shutdown", false);
 
   mCacheTracker = MakeUnique<imgCacheExpirationTracker>();
 
   return NS_OK;
@@ -1302,18 +1301,17 @@ imgLoader::Observe(nsISupports* aSubject
   // We listen for pref change notifications...
   if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
     if (!NS_strcmp(aData, u"image.http.accept")) {
       ReadAcceptHeaderPref();
     }
 
   } else if (strcmp(aTopic, "memory-pressure") == 0) {
     MinimizeCaches();
-  } else if (strcmp(aTopic, "chrome-flush-skin-caches") == 0 ||
-             strcmp(aTopic, "chrome-flush-caches") == 0) {
+  } else if (strcmp(aTopic, "chrome-flush-caches") == 0) {
     MinimizeCaches();
     ClearChromeImageCache();
   } else if (strcmp(aTopic, "last-pb-context-exited") == 0) {
     if (mRespectPrivacy) {
       ClearImageCache();
       ClearChromeImageCache();
     }
   } else if (strcmp(aTopic, "profile-before-change") == 0) {
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -992,19 +992,16 @@ void PresShell::Init(Document* aDocument
 
   if (nsStyleSheetService* ss = nsStyleSheetService::GetInstance()) {
     ss->RegisterPresShell(this);
   }
 
   {
     nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
     if (os) {
-#ifdef MOZ_XUL
-      os->AddObserver(this, "chrome-flush-skin-caches", false);
-#endif
       os->AddObserver(this, "memory-pressure", false);
       os->AddObserver(this, NS_WIDGET_WAKE_OBSERVER_TOPIC, false);
       if (XRE_IsParentProcess() && !sProcessInteractable) {
         os->AddObserver(this, "sessionstore-one-or-no-tab-restored", false);
       }
       os->AddObserver(this, "font-info-updated", false);
     }
   }
@@ -1219,19 +1216,16 @@ void PresShell::Destroy() {
 
   if (nsStyleSheetService* ss = nsStyleSheetService::GetInstance()) {
     ss->UnregisterPresShell(this);
   }
 
   {
     nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
     if (os) {
-#ifdef MOZ_XUL
-      os->RemoveObserver(this, "chrome-flush-skin-caches");
-#endif
       os->RemoveObserver(this, "memory-pressure");
       os->RemoveObserver(this, NS_WIDGET_WAKE_OBSERVER_TOPIC);
       if (XRE_IsParentProcess()) {
         os->RemoveObserver(this, "sessionstore-one-or-no-tab-restored");
       }
       os->RemoveObserver(this, "font-info-updated");
     }
   }
@@ -9406,99 +9400,24 @@ bool PresShell::ProcessReflowCommands(bo
 
 void PresShell::WindowSizeMoveDone() {
   if (mPresContext) {
     EventStateManager::ClearGlobalActiveContent(nullptr);
     ClearMouseCapture(nullptr);
   }
 }
 
-#ifdef MOZ_XUL
-/*
- * It's better to add stuff to the |DidSetComputedStyle| method of the
- * relevant frames than adding it here.  These methods should (ideally,
- * anyway) go away.
- */
-
-// Return value says whether to walk children.
-typedef bool (*frameWalkerFn)(nsIFrame* aFrame);
-
-static bool ReResolveMenusAndTrees(nsIFrame* aFrame) {
-  // Trees have a special style cache that needs to be flushed when
-  // the theme changes.
-  nsTreeBodyFrame* treeBody = do_QueryFrame(aFrame);
-  if (treeBody) treeBody->ClearStyleAndImageCaches();
-
-  // We deliberately don't re-resolve style on a menu's popup
-  // sub-content, since doing so slows menus to a crawl.  That means we
-  // have to special-case them on a skin switch, and ensure that the
-  // popup frames just get destroyed completely.
-  nsMenuFrame* menu = do_QueryFrame(aFrame);
-  if (menu) menu->CloseMenu(true);
-  return true;
-}
-
-static bool ReframeImageBoxes(nsIFrame* aFrame) {
-  if (aFrame->IsImageBoxFrame()) {
-    aFrame->PresContext()->RestyleManager()->PostRestyleEvent(
-        aFrame->GetContent()->AsElement(), RestyleHint{0},
-        nsChangeHint_ReconstructFrame);
-    return false;  // don't walk descendants
-  }
-  return true;  // walk descendants
-}
-
-static void WalkFramesThroughPlaceholders(nsPresContext* aPresContext,
-                                          nsIFrame* aFrame,
-                                          frameWalkerFn aFunc) {
-  bool walkChildren = (*aFunc)(aFrame);
-  if (!walkChildren) return;
-
-  nsIFrame::ChildListIterator lists(aFrame);
-  for (; !lists.IsDone(); lists.Next()) {
-    nsFrameList::Enumerator childFrames(lists.CurrentList());
-    for (; !childFrames.AtEnd(); childFrames.Next()) {
-      nsIFrame* child = childFrames.get();
-      if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
-        // only do frames that are in flow, and recur through the
-        // out-of-flows of placeholders.
-        WalkFramesThroughPlaceholders(
-            aPresContext, nsPlaceholderFrame::GetRealFrameFor(child), aFunc);
-      }
-    }
-  }
-}
-#endif
-
 NS_IMETHODIMP
 PresShell::Observe(nsISupports* aSubject, const char* aTopic,
                    const char16_t* aData) {
   if (mIsDestroying) {
     NS_WARNING("our observers should have been unregistered by now");
     return NS_OK;
   }
 
-#ifdef MOZ_XUL
-  if (!nsCRT::strcmp(aTopic, "chrome-flush-skin-caches")) {
-    // Need to null-check because "chrome-flush-skin-caches" can happen
-    // at interesting times during startup.
-    if (nsIFrame* rootFrame = mFrameConstructor->GetRootFrame()) {
-      NS_ASSERTION(mViewManager, "View manager must exist");
-
-      WalkFramesThroughPlaceholders(mPresContext, rootFrame,
-                                    ReResolveMenusAndTrees);
-
-      // Because "chrome:" URL equality is messy, reframe image box
-      // frames (hack!).
-      WalkFramesThroughPlaceholders(mPresContext, rootFrame, ReframeImageBoxes);
-    }
-    return NS_OK;
-  }
-#endif
-
   if (!nsCRT::strcmp(aTopic, "memory-pressure")) {
     if (!AssumeAllFramesVisible() && mPresContext->IsRootContentDocument()) {
       DoUpdateApproximateFrameVisibility(/* aRemoveOnly = */ true);
     }
     return NS_OK;
   }
 
   if (!nsCRT::strcmp(aTopic, NS_WIDGET_WAKE_OBSERVER_TOPIC)) {
--- a/layout/style/nsLayoutStylesheetCache.cpp
+++ b/layout/style/nsLayoutStylesheetCache.cpp
@@ -107,20 +107,16 @@ NS_IMPL_ISUPPORTS(nsLayoutStylesheetCach
 nsresult nsLayoutStylesheetCache::Observe(nsISupports* aSubject,
                                           const char* aTopic,
                                           const char16_t* aData) {
   if (!strcmp(aTopic, "profile-before-change")) {
     mUserContentSheet = nullptr;
     mUserChromeSheet = nullptr;
   } else if (!strcmp(aTopic, "profile-do-change")) {
     InitFromProfile();
-  } else if (strcmp(aTopic, "chrome-flush-skin-caches") == 0 ||
-             strcmp(aTopic, "chrome-flush-caches") == 0) {
-    mScrollbarsSheet = nullptr;
-    mFormsSheet = nullptr;
   } else {
     MOZ_ASSERT_UNREACHABLE("Unexpected observer topic.");
   }
   return NS_OK;
 }
 
 #define STYLE_SHEET(identifier_, url_, shared_)                                \
   NotNull<StyleSheet*> nsLayoutStylesheetCache::identifier_##Sheet() {         \
@@ -224,18 +220,16 @@ size_t nsLayoutStylesheetCache::SizeOfIn
 
 nsLayoutStylesheetCache::nsLayoutStylesheetCache() : mUsedSharedMemory(0) {
   nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
   NS_ASSERTION(obsSvc, "No global observer service?");
 
   if (obsSvc) {
     obsSvc->AddObserver(this, "profile-before-change", false);
     obsSvc->AddObserver(this, "profile-do-change", false);
-    obsSvc->AddObserver(this, "chrome-flush-skin-caches", false);
-    obsSvc->AddObserver(this, "chrome-flush-caches", false);
   }
 
   // Load user style sheets.
   InitFromProfile();
 
   if (XRE_IsParentProcess()) {
     // We know we need xul.css for the UI, so load that now too:
     XULSheet();
--- a/toolkit/content/tests/chrome/RegisterUnregisterChrome.js
+++ b/toolkit/content/tests/chrome/RegisterUnregisterChrome.js
@@ -98,43 +98,37 @@ function createManifestTemporarily(tempD
                 0x02 | 0x08 | 0x20, 0o664, 0); // write, create, truncate
   foStream.write(manifestText, manifestText.length);
   foStream.close();
   let tempfile = copyToTemporaryFile(tempDir);
 
   Components.manager.QueryInterface(Ci.nsIComponentRegistrar).
     autoRegister(tempfile);
 
-  gChromeReg.refreshSkins();
-
   return function() {
     tempfile.fileSize = 0; // truncate the manifest
     gChromeReg.checkForNewChrome();
-    gChromeReg.refreshSkins();
     Services.prefs.clearUserPref(XUL_CACHE_PREF);
   };
 }
 
 // Register a chrome manifest temporarily and return a function which un-does
 // the registrarion when no longer needed.
 function registerManifestTemporarily(manifestURI) {
   Services.prefs.setBoolPref(XUL_CACHE_PREF, true);
 
   let file = chromeURIToFile(manifestURI);
 
   let tempfile = copyToTemporaryFile(file);
   Components.manager.QueryInterface(Ci.nsIComponentRegistrar).
     autoRegister(tempfile);
 
-  gChromeReg.refreshSkins();
-
   return function() {
     tempfile.fileSize = 0; // truncate the manifest
     gChromeReg.checkForNewChrome();
-    gChromeReg.refreshSkins();
     Services.prefs.clearUserPref(XUL_CACHE_PREF);
   };
 }
 
 function registerManifestPermanently(manifestURI) {
   var chromepath = chromeURIToFile(manifestURI);
 
   Components.manager.QueryInterface(Ci.nsIComponentRegistrar).
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -1326,22 +1326,16 @@ nsSingletonFactory::LockFactory(bool) { 
 /**
  * Set our windowcreator on the WindowWatcher service.
  */
 nsresult ScopedXPCOMStartup::SetWindowCreator(nsINativeAppSupport* native) {
   nsresult rv;
 
   NS_IF_ADDREF(gNativeAppSupport = native);
 
-  // Inform the chrome registry about OS accessibility
-  nsCOMPtr<nsIToolkitChromeRegistry> cr =
-      mozilla::services::GetToolkitChromeRegistryService();
-
-  if (cr) cr->CheckForOSAccessibility();
-
   nsCOMPtr<nsIWindowCreator> creator(components::AppStartup::Service());
   if (!creator) return NS_ERROR_UNEXPECTED;
 
   nsCOMPtr<nsIWindowWatcher> wwatch(
       do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   return wwatch->SetWindowCreator(creator);