Bug 1546329 - Remove dead skins code. r=Gijs draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 23 Apr 2019 12:36:54 +0200
changeset 1963979 4a9eb44f0d1e4667dbe76172f35a6ae9fb3e5b5b
parent 1963978 3f34f624a44e1f1d542ad779f4d68a356bb82cb5
child 1963980 03a64a69bc720f7dad7883a08051096404e9db19
push id352092
push useremilio@crisal.io
push dateTue, 23 Apr 2019 10:56:39 +0000
treeherdertry@03a64a69bc72 [default view] [failures only]
reviewersGijs
bugs1546329
milestone68.0a1
Bug 1546329 - Remove dead skins code. r=Gijs 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,17 +32,16 @@
 #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."
 
 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.
@@ -89,75 +88,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 +190,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!");
   }
--- 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;
 
--- 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
@@ -6276,18 +6276,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
@@ -2410,20 +2410,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
@@ -107,18 +107,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 AppendAllSheets(nsTArray<mozilla::StyleSheet*>& aArray);
 
   void Traverse(nsIContent* aContent, nsCycleCollectionTraversalCallback& cb);
 
   NS_DECL_CYCLE_COLLECTION_CLASS(nsBindingManager)
--- 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,43 +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();
-    }
-  }
-
-  // Iterate over all the remaining XBL and make sure cached
-  // scoped skin stylesheets are flushed and refetched by the
-  // prototype bindings.
-  for (auto iter = mXBLDocTable.Iter(); !iter.Done(); iter.Next()) {
-    iter.Data()->FlushSkinStylesheets();
-  }
-}
-
 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
@@ -996,17 +996,17 @@ 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);
+      os->AddObserver(this, "chrome-flush-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);
     }
@@ -1223,17 +1223,17 @@ 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");
+      os->RemoveObserver(this, "chrome-flush-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");
     }
@@ -9458,18 +9458,19 @@ 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
+  // FIXME(emilio): Is this still needed?
+  if (!nsCRT::strcmp(aTopic, "chrome-flush-caches")) {
+    // Need to null-check because "chrome-flush-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
--- a/layout/style/nsLayoutStylesheetCache.cpp
+++ b/layout/style/nsLayoutStylesheetCache.cpp
@@ -107,18 +107,19 @@ 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) {
+  } else if (strcmp(aTopic, "chrome-flush-caches") == 0) {
+    // FIXME(emilio): Do we really need to do this? I'm pretty sure we rely on
+    // these not changing.
     mScrollbarsSheet = nullptr;
     mFormsSheet = nullptr;
   } else {
     MOZ_ASSERT_UNREACHABLE("Unexpected observer topic.");
   }
   return NS_OK;
 }
 
@@ -224,17 +225,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:
--- 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);