Bug 1450753 - Remove XUL style overlays. r=Nika
authorBrendan Dahl <brendan.dahl@gmail.com>
Wed, 06 Jun 2018 15:15:25 -0700
changeset 476054 0673137d307f3878d4cf48160cfa16efb66c25b6
parent 476053 f2ae0027dfa4c4a5b5b8d1d92ce02accff6e6e4f
child 476055 d4d9645e40cb93bf772054d8235c4570a3ba47d3
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNika
bugs1450753
milestone62.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 1450753 - Remove XUL style overlays. r=Nika Style overlays are no longer used outside of tests. MozReview-Commit-ID: 798Id5JITAm
chrome/nsChromeRegistry.h
chrome/nsChromeRegistryChrome.cpp
chrome/nsChromeRegistryChrome.h
chrome/nsChromeRegistryContent.cpp
chrome/nsChromeRegistryContent.h
chrome/test/unit/data/test_bug564667/chrome.manifest
chrome/test/unit/test_bug564667.js
dom/xul/XULDocument.cpp
dom/xul/XULDocument.h
dom/xul/nsIXULOverlayProvider.idl
dom/xul/nsXULPrototypeDocument.cpp
dom/xul/nsXULPrototypeDocument.h
xpcom/build/nsXULAppAPI.h
xpcom/components/ManifestParser.cpp
--- a/chrome/nsChromeRegistry.h
+++ b/chrome/nsChromeRegistry.h
@@ -125,18 +125,16 @@ public:
   virtual void ManifestContent(ManifestProcessingContext& cx, int lineno,
                                char *const * argv, int flags) = 0;
   virtual void ManifestLocale(ManifestProcessingContext& cx, int lineno,
                               char *const * argv, int flags) = 0;
   virtual void ManifestSkin(ManifestProcessingContext& cx, int lineno,
                             char *const * argv, int flags) = 0;
   virtual void ManifestOverlay(ManifestProcessingContext& cx, int lineno,
                                char *const * argv, int flags) = 0;
-  virtual void ManifestStyle(ManifestProcessingContext& cx, int lineno,
-                             char *const * argv, int flags) = 0;
   virtual void ManifestOverride(ManifestProcessingContext& cx, int lineno,
                                 char *const * argv, int flags) = 0;
   virtual void ManifestResource(ManifestProcessingContext& cx, int lineno,
                                 char *const * argv, int flags) = 0;
 
   // Available flags
   enum {
     // This package should use the new XPCNativeWrappers to separate
--- a/chrome/nsChromeRegistryChrome.cpp
+++ b/chrome/nsChromeRegistryChrome.cpp
@@ -303,17 +303,16 @@ nsChromeRegistryChrome::Observe(nsISuppo
   return rv;
 }
 
 NS_IMETHODIMP
 nsChromeRegistryChrome::CheckForNewChrome()
 {
   mPackagesHash.Clear();
   mOverlayHash.Clear();
-  mStyleHash.Clear();
   mOverrideTable.Clear();
 
   mDynamicRegistration = false;
 
   nsComponentManagerImpl::gComponentManager->RereadChromeManifests();
 
   mDynamicRegistration = true;
 
@@ -572,31 +571,16 @@ nsChromeRegistryChrome::OverlayListHash:
   if (!entry)
     return nullptr;
 
   return &entry->mArray;
 }
 
 #ifdef MOZ_XUL
 NS_IMETHODIMP
-nsChromeRegistryChrome::GetStyleOverlays(nsIURI *aChromeURL,
-                                         nsISimpleEnumerator **aResult)
-{
-  nsCOMPtr<nsIURI> chromeURLWithoutHash;
-  if (aChromeURL) {
-    aChromeURL->CloneIgnoringRef(getter_AddRefs(chromeURLWithoutHash));
-  }
-  const nsCOMArray<nsIURI>* parray = mStyleHash.GetArray(chromeURLWithoutHash);
-  if (!parray)
-    return NS_NewEmptyEnumerator(aResult);
-
-  return NS_NewArrayEnumerator(aResult, *parray);
-}
-
-NS_IMETHODIMP
 nsChromeRegistryChrome::GetXULOverlays(nsIURI *aChromeURL,
                                        nsISimpleEnumerator **aResult)
 {
   nsCOMPtr<nsIURI> chromeURLWithoutHash;
   if (aChromeURL) {
     aChromeURL->CloneIgnoringRef(getter_AddRefs(chromeURLWithoutHash));
   }
   const nsCOMArray<nsIURI>* parray = mOverlayHash.GetArray(chromeURLWithoutHash);
@@ -796,43 +780,16 @@ nsChromeRegistryChrome::ManifestOverlay(
 
   nsCOMPtr<nsIURI> baseuriWithoutHash;
   baseuri->CloneIgnoringRef(getter_AddRefs(baseuriWithoutHash));
 
   mOverlayHash.Add(baseuriWithoutHash, overlayuri);
 }
 
 void
-nsChromeRegistryChrome::ManifestStyle(ManifestProcessingContext& cx, int lineno,
-                                      char *const * argv, int flags)
-{
-  char* base = argv[0];
-  char* overlay = argv[1];
-
-  nsCOMPtr<nsIURI> baseuri = cx.ResolveURI(base);
-  nsCOMPtr<nsIURI> overlayuri = cx.ResolveURI(overlay);
-  if (!baseuri || !overlayuri) {
-    LogMessageWithContext(cx.GetManifestURI(), lineno, nsIScriptError::warningFlag,
-                          "During chrome registration, unable to create URI.");
-    return;
-  }
-
-  if (!CanLoadResource(overlayuri)) {
-    LogMessageWithContext(cx.GetManifestURI(), lineno, nsIScriptError::warningFlag,
-                          "Cannot register non-local URI '%s' as a style overlay.", overlay);
-    return;
-  }
-
-  nsCOMPtr<nsIURI> baseuriWithoutHash;
-  baseuri->CloneIgnoringRef(getter_AddRefs(baseuriWithoutHash));
-
-  mStyleHash.Add(baseuriWithoutHash, overlayuri);
-}
-
-void
 nsChromeRegistryChrome::ManifestOverride(ManifestProcessingContext& cx, int lineno,
                                          char *const * argv, int flags)
 {
   char* chrome = argv[0];
   char* resolved = argv[1];
 
   nsCOMPtr<nsIURI> chromeuri = cx.ResolveURI(chrome);
   nsCOMPtr<nsIURI> resolveduri = cx.ResolveURI(resolved);
--- a/chrome/nsChromeRegistryChrome.h
+++ b/chrome/nsChromeRegistryChrome.h
@@ -39,18 +39,16 @@ class nsChromeRegistryChrome : public ns
                                bool aAsBCP47,
                                nsACString& aLocale) override;
   NS_IMETHOD Observe(nsISupports *aSubject, const char *aTopic,
                      const char16_t *someData) override;
 
 #ifdef MOZ_XUL
   NS_IMETHOD GetXULOverlays(nsIURI *aURI,
                             nsISimpleEnumerator **_retval) override;
-  NS_IMETHOD GetStyleOverlays(nsIURI *aURI,
-                              nsISimpleEnumerator **_retval) override;
 #endif
 
   // If aChild is non-null then it is a new child to notify. If aChild is
   // null, then we have installed new chrome and we are resetting all of our
   // children's registered chrome.
   void SendRegisteredChrome(mozilla::dom::PContentParent* aChild);
 
  private:
@@ -142,19 +140,18 @@ class nsChromeRegistryChrome : public ns
     void Clear() { mTable.Clear(); }
     const nsCOMArray<nsIURI>* GetArray(nsIURI* aBase);
 
    private:
     nsTHashtable<OverlayListEntry> mTable;
   };
 
   // Hashes on the file to be overlaid (chrome://browser/content/browser.xul)
-  // to a list of overlays/stylesheets
+  // to a list of overlays
   OverlayListHash mOverlayHash;
-  OverlayListHash mStyleHash;
 
   bool mProfileLoaded;
   bool mDynamicRegistration;
 
   nsCString mSelectedSkin;
 
   // Hash of package names ("global") to PackageEntry objects
   nsClassHashtable<nsCStringHashKey, PackageEntry> mPackagesHash;
@@ -162,17 +159,15 @@ class nsChromeRegistryChrome : public ns
   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,
                             char *const * argv, int flags) override;
   virtual void ManifestOverlay(ManifestProcessingContext& cx, int lineno,
                                char *const * argv, int flags) override;
-  virtual void ManifestStyle(ManifestProcessingContext& cx, int lineno,
-                             char *const * argv, int flags) override;
   virtual void ManifestOverride(ManifestProcessingContext& cx, int lineno,
                                 char *const * argv, int flags) override;
   virtual void ManifestResource(ManifestProcessingContext& cx, int lineno,
                                 char *const * argv, int flags) override;
 };
 
 #endif // nsChromeRegistryChrome_h
--- a/chrome/nsChromeRegistryContent.cpp
+++ b/chrome/nsChromeRegistryContent.cpp
@@ -234,23 +234,16 @@ nsChromeRegistryContent::GetSelectedLoca
 NS_IMETHODIMP
 nsChromeRegistryContent::Observe(nsISupports* aSubject, const char* aTopic,
                                  const char16_t* aData)
 {
   CONTENT_NOT_IMPLEMENTED();
 }
 
 NS_IMETHODIMP
-nsChromeRegistryContent::GetStyleOverlays(nsIURI *aChromeURL,
-                                          nsISimpleEnumerator **aResult)
-{
-  CONTENT_NOT_IMPLEMENTED();
-}
-
-NS_IMETHODIMP
 nsChromeRegistryContent::GetXULOverlays(nsIURI *aChromeURL,
                                         nsISimpleEnumerator **aResult)
 {
   CONTENT_NOT_IMPLEMENTED();
 }
 
 void
 nsChromeRegistryContent::ManifestContent(ManifestProcessingContext& cx,
@@ -279,24 +272,16 @@ nsChromeRegistryContent::ManifestSkin(Ma
 void
 nsChromeRegistryContent::ManifestOverlay(ManifestProcessingContext& cx, int lineno,
                                          char *const * argv, int flags)
 {
   CONTENT_NOTREACHED();
 }
 
 void
-nsChromeRegistryContent::ManifestStyle(ManifestProcessingContext& cx,
-                                       int lineno,
-                                       char *const * argv, int flags)
-{
-  CONTENT_NOTREACHED();
-}
-
-void
 nsChromeRegistryContent::ManifestOverride(ManifestProcessingContext& cx,
                                           int lineno,
                                           char *const * argv, int flags)
 {
   CONTENT_NOTREACHED();
 }
 
 void
--- a/chrome/nsChromeRegistryContent.h
+++ b/chrome/nsChromeRegistryContent.h
@@ -30,18 +30,16 @@ class nsChromeRegistryContent : public n
   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;
-  NS_IMETHOD GetStyleOverlays(nsIURI *aChromeURL,
-                              nsISimpleEnumerator **aResult) override;
   NS_IMETHOD GetXULOverlays(nsIURI *aChromeURL,
                             nsISimpleEnumerator **aResult) override;
 
   void RegisterPackage(const ChromePackage& aPackage);
   void RegisterOverride(const OverrideMapping& aOverride);
   void RegisterSubstitution(const SubstitutionMapping& aResource);
 
  private:
@@ -67,17 +65,15 @@ class nsChromeRegistryContent : public n
   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,
                             char *const * argv, int flags) override;
   virtual void ManifestOverlay(ManifestProcessingContext& cx, int lineno,
                                char *const * argv, int flags) override;
-  virtual void ManifestStyle(ManifestProcessingContext& cx, int lineno,
-                             char *const * argv, int flags) override;
   virtual void ManifestOverride(ManifestProcessingContext& cx, int lineno,
                                 char *const * argv, int flags) override;
   virtual void ManifestResource(ManifestProcessingContext& cx, int lineno,
                                 char *const * argv, int flags) override;
 };
 
 #endif // nsChromeRegistryContent_h
--- a/chrome/test/unit/data/test_bug564667/chrome.manifest
+++ b/chrome/test/unit/data/test_bug564667/chrome.manifest
@@ -5,11 +5,8 @@ skin     test1 test  test/
 
 # Test Override
 content testOverride  test/
 override chrome://testOverride/content file:///test1/override
 
 
 # Load external manifest
 manifest loaded.manifest
-
-# Failure Cases
-style     chrome://test1/content/style.xul     chrome://test1/content/test1.css
--- a/chrome/test/unit/test_bug564667.js
+++ b/chrome/test/unit/test_bug564667.js
@@ -2,18 +2,17 @@
  * 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/.
  */
 
 const UNPACKAGED_ADDON = do_get_file("data/test_bug564667");
 const PACKAGED_ADDON = do_get_file("data/test_bug564667.xpi");
 
 var gCR = Cc["@mozilla.org/chrome/chrome-registry;1"].
-          getService(Ci.nsIChromeRegistry).
-          QueryInterface(Ci.nsIXULOverlayProvider);
+          getService(Ci.nsIChromeRegistry);
 
 /*
  * Checks that a mapping was added
  */
 function test_mapping(chromeURL, target) {
   var uri = Services.io.newURI(chromeURL);
 
   try {
@@ -32,30 +31,16 @@ function test_removed_mapping(chromeURL,
   try {
     gCR.convertChromeURL(uri);
     do_throw(chromeURL + " not removed");
   } catch (ex) {
     // This should throw
   }
 }
 
-/*
- * Checks if any style overlays were added after loading
- * the manifest files
- */
-function test_no_overlays(chromeURL, target) {
-  var uri = Services.io.newURI(chromeURL);
-  var overlays = gCR.getStyleOverlays(uri);
-
-  // We shouldn't be allowed to register styles
-  if (overlays.hasMoreElements()) {
-    do_throw("Style Registered: " + chromeURL);
-  }
-}
-
 function testManifest(manifestPath, baseURI) {
 
   // ------------------  Add manifest file ------------------------
   Components.manager.addBootstrappedManifestLocation(manifestPath);
 
   // Test Adding Content URL
   test_mapping("chrome://test1/content", baseURI + "test/test1.xul");
 
@@ -67,20 +52,16 @@ function testManifest(manifestPath, base
 
   // Test Adding Manifest URL
   test_mapping("chrome://test2/content", baseURI + "test/test2.xul");
   test_mapping("chrome://test2/locale", baseURI + "test/test2.dtd");
 
   // Test Adding Override
   test_mapping("chrome://testOverride/content", "file:///test1/override");
 
-  // Test Not-Adding Styles
-  test_no_overlays("chrome://test1/content/style.xul",
-                   "chrome://test1/content/test1.css", "styles");
-
   // ------------------  Remove manifest file ------------------------
   Components.manager.removeBootstrappedManifestLocation(manifestPath);
 
   // Test Removing Content URL
   test_removed_mapping("chrome://test1/content", baseURI + "test/test1.xul");
 
   // Test Removing Content URL
   test_removed_mapping("chrome://test1/locale", baseURI + "test/test1.dtd");
--- a/dom/xul/XULDocument.cpp
+++ b/dom/xul/XULDocument.cpp
@@ -467,52 +467,22 @@ XULDocument::EndLoad()
     // and we're filling the FastLoad disk cache, tell the cache we're done
     // loading it, and write the prototype. The master prototype is put into
     // the cache earlier in XULDocument::StartDocumentLoad.
     if (useXULCache && mIsWritingFastLoad && isChrome &&
         mMasterPrototype != mCurrentPrototype) {
         nsXULPrototypeCache::GetInstance()->WritePrototype(mCurrentPrototype);
     }
 
-    if (IsOverlayAllowed(uri)) {
-        nsCOMPtr<nsIXULOverlayProvider> reg =
-            mozilla::services::GetXULOverlayProviderService();
-
-        if (reg) {
-            nsCOMPtr<nsISimpleEnumerator> overlays;
-            rv = reg->GetStyleOverlays(uri, getter_AddRefs(overlays));
-            if (NS_FAILED(rv)) return;
-
-            bool moreSheets;
-            nsCOMPtr<nsISupports> next;
-            nsCOMPtr<nsIURI> sheetURI;
-
-            while (NS_SUCCEEDED(rv = overlays->HasMoreElements(&moreSheets)) &&
-                   moreSheets) {
-                overlays->GetNext(getter_AddRefs(next));
-
-                sheetURI = do_QueryInterface(next);
-                if (!sheetURI) {
-                    NS_ERROR("Chrome registry handed me a non-nsIURI object!");
-                    continue;
-                }
-
-                if (IsChromeURI(sheetURI)) {
-                    mCurrentPrototype->AddStyleSheetReference(sheetURI);
-                }
-            }
-        }
-
-        if (isChrome && useXULCache) {
-            // If it's a chrome prototype document, then notify any
-            // documents that raced to load the prototype, and awaited
-            // its load completion via proto->AwaitLoadDone().
-            rv = mCurrentPrototype->NotifyLoadDone();
-            if (NS_FAILED(rv)) return;
-        }
+    if (IsOverlayAllowed(uri) && isChrome && useXULCache) {
+        // If it's a chrome prototype document, then notify any
+        // documents that raced to load the prototype, and awaited
+        // its load completion via proto->AwaitLoadDone().
+        rv = mCurrentPrototype->NotifyLoadDone();
+        if (NS_FAILED(rv)) return;
     }
 
     OnPrototypeLoadDone(true);
     if (MOZ_LOG_TEST(gXULLog, LogLevel::Warning)) {
         nsAutoCString urlspec;
         rv = uri->GetSpec(urlspec);
         if (NS_SUCCEEDED(rv)) {
             MOZ_LOG(gXULLog, LogLevel::Warning,
@@ -521,20 +491,16 @@ XULDocument::EndLoad()
     }
 }
 
 nsresult
 XULDocument::OnPrototypeLoadDone(bool aResumeWalk)
 {
     nsresult rv;
 
-    // Add the style overlays from chrome registry, if any.
-    rv = AddPrototypeSheets();
-    if (NS_FAILED(rv)) return rv;
-
     rv = PrepareToWalk();
     NS_ASSERTION(NS_SUCCEEDED(rv), "unable to prepare for walk");
     if (NS_FAILED(rv)) return rv;
 
     if (aResumeWalk) {
         rv = ResumeWalk();
     }
     return rv;
@@ -2662,25 +2628,16 @@ nsresult
 XULDocument::DoneWalking()
 {
     MOZ_ASSERT(mPendingSheets == 0, "there are sheets to be loaded");
     MOZ_ASSERT(!mStillWalking, "walk not done");
 
     // XXXldb This is where we should really be setting the chromehidden
     // attribute.
 
-    {
-        uint32_t count = mOverlaySheets.Length();
-        for (uint32_t i = 0; i < count; ++i) {
-            AddStyleSheet(mOverlaySheets[i]);
-        }
-    }
-
-    mOverlaySheets.Clear();
-
     if (!mDocumentLoaded) {
         // Make sure we don't reenter here from StartLayout().  Note that
         // setting mDocumentLoaded to true here means that if StartLayout()
         // causes ResumeWalk() to be reentered, we'll take the other branch of
         // the |if (!mDocumentLoaded)| check above and since
         // mInitialLayoutComplete will be false will follow the else branch
         // there too.  See the big comment there for how such reentry can
         // happen.
@@ -3312,45 +3269,16 @@ XULDocument::AddAttributes(nsXULPrototyp
                                false);
         if (NS_FAILED(rv)) return rv;
     }
 
     return NS_OK;
 }
 
 
-nsresult
-XULDocument::AddPrototypeSheets()
-{
-    nsresult rv;
-
-    const nsCOMArray<nsIURI>& sheets = mCurrentPrototype->GetStyleSheetReferences();
-
-    for (int32_t i = 0; i < sheets.Count(); i++) {
-        nsCOMPtr<nsIURI> uri = sheets[i];
-
-        RefPtr<StyleSheet> incompleteSheet;
-        rv = CSSLoader()->LoadSheet(
-          uri, mCurrentPrototype->DocumentPrincipal(), this, &incompleteSheet);
-
-        // XXXldb We need to prevent bogus sheets from being held in the
-        // prototype's list, but until then, don't propagate the failure
-        // from LoadSheet (and thus exit the loop).
-        if (NS_SUCCEEDED(rv)) {
-            ++mPendingSheets;
-            if (!mOverlaySheets.AppendElement(incompleteSheet)) {
-                return NS_ERROR_OUT_OF_MEMORY;
-            }
-        }
-    }
-
-    return NS_OK;
-}
-
-
 //----------------------------------------------------------------------
 //
 // XULDocument::OverlayForwardReference
 //
 
 nsForwardReference::Result
 XULDocument::OverlayForwardReference::Resolve()
 {
--- a/dom/xul/XULDocument.h
+++ b/dom/xul/XULDocument.h
@@ -276,22 +276,16 @@ protected:
     bool                       mStillWalking;
 
     /**
      * These two values control where persistent attributes get applied.
      */
     bool                           mRestrictPersistence;
     nsTHashtable<nsStringHashKey>  mPersistenceIds;
 
-    /**
-     * An array of style sheets, that will be added (preserving order) to the
-     * document after all of them are loaded (in DoneWalking).
-     */
-    nsTArray<RefPtr<StyleSheet>> mOverlaySheets;
-
     nsCOMPtr<nsIDOMXULCommandDispatcher>     mCommandDispatcher; // [OWNER] of the focus tracker
 
     uint32_t mPendingSheets;
 
     /**
      * document lightweight theme for use with :-moz-lwtheme, :-moz-lwtheme-brighttext
      * and :-moz-lwtheme-darktext
      */
@@ -394,22 +388,16 @@ protected:
 
     /**
      * If the current transcluded script is being compiled off thread, the
      * source for that script.
      */
     char16_t* mOffThreadCompileStringBuf;
     size_t mOffThreadCompileStringLength;
 
-    /**
-     * Add the current prototype's style sheets (currently it's just
-     * style overlays from the chrome registry) to the document.
-     */
-    nsresult AddPrototypeSheets();
-
 
 protected:
     /* Declarations related to forward references.
      *
      * Forward references are declarations which are added to the temporary
      * list (mForwardReferences) during the document (or overlay) load and
      * are resolved later, when the document loading is almost complete.
      */
--- a/dom/xul/nsIXULOverlayProvider.idl
+++ b/dom/xul/nsIXULOverlayProvider.idl
@@ -18,17 +18,9 @@ interface nsIXULOverlayProvider : nsISup
 {
     /**
      * Get the XUL overlays for a particular chrome URI.
      *
      * @param aURI  The URI being loaded
      * @return      An enumerator of nsIURI for the overlays of this URI 
      */
     nsISimpleEnumerator /*nsIURI*/ getXULOverlays(in nsIURI aURI);
-
-    /**
-     * Get the style overlays for a particular chrome URI.
-     *
-     * @param aURI  The URI being loaded
-     * @return      An enumerator of nsIURI for the overlays of this URI 
-     */
-    nsISimpleEnumerator /*nsIURI*/ getStyleOverlays(in nsIURI aURI);
 };
--- a/dom/xul/nsXULPrototypeDocument.cpp
+++ b/dom/xul/nsXULPrototypeDocument.cpp
@@ -110,48 +110,31 @@ nsXULPrototypeDocument::Read(nsIObjectIn
 {
     nsCOMPtr<nsISupports> supports;
     nsresult rv = aStream->ReadObject(true, getter_AddRefs(supports));
     if (NS_FAILED(rv)) {
       return rv;
     }
     mURI = do_QueryInterface(supports);
 
-    uint32_t count, i;
-    nsCOMPtr<nsIURI> styleOverlayURI;
-
-    rv = aStream->Read32(&count);
-    if (NS_FAILED(rv)) {
-      return rv;
-    }
-
-    for (i = 0; i < count; ++i) {
-        rv = aStream->ReadObject(true, getter_AddRefs(supports));
-        if (NS_FAILED(rv)) {
-          return rv;
-        }
-        styleOverlayURI = do_QueryInterface(supports);
-        mStyleSheetReferences.AppendObject(styleOverlayURI);
-    }
-
-
     // nsIPrincipal mNodeInfoManager->mPrincipal
     rv = aStream->ReadObject(true, getter_AddRefs(supports));
     if (NS_FAILED(rv)) {
       return rv;
     }
     nsCOMPtr<nsIPrincipal> principal = do_QueryInterface(supports);
     // Better safe than sorry....
     mNodeInfoManager->SetDocumentPrincipal(principal);
 
     mRoot = new nsXULPrototypeElement();
 
     // mozilla::dom::NodeInfo table
     nsTArray<RefPtr<mozilla::dom::NodeInfo>> nodeInfos;
 
+    uint32_t count, i;
     rv = aStream->Read32(&count);
     if (NS_FAILED(rv)) {
       return rv;
     }
     nsAutoString namespaceURI, prefixStr, localName;
     bool prefixIsNull;
     RefPtr<nsAtom> prefix;
     for (i = 0; i < count; ++i) {
@@ -267,35 +250,19 @@ GetNodeInfos(nsXULPrototypeElement* aPro
 
 NS_IMETHODIMP
 nsXULPrototypeDocument::Write(nsIObjectOutputStream* aStream)
 {
     nsresult rv;
 
     rv = aStream->WriteCompoundObject(mURI, NS_GET_IID(nsIURI), true);
 
-    uint32_t count;
-
-    count = mStyleSheetReferences.Count();
-    nsresult tmp = aStream->Write32(count);
-    if (NS_FAILED(tmp)) {
-      rv = tmp;
-    }
-
-    uint32_t i;
-    for (i = 0; i < count; ++i) {
-        tmp = aStream->WriteCompoundObject(mStyleSheetReferences[i],
-                                           NS_GET_IID(nsIURI), true);
-        if (NS_FAILED(tmp)) {
-          rv = tmp;
-        }
-    }
 
     // nsIPrincipal mNodeInfoManager->mPrincipal
-    tmp = aStream->WriteObject(mNodeInfoManager->DocumentPrincipal(),
+    nsresult tmp = aStream->WriteObject(mNodeInfoManager->DocumentPrincipal(),
                                true);
     if (NS_FAILED(tmp)) {
       rv = tmp;
     }
 
 #ifdef DEBUG
     // XXX Worrisome if we're caching things without system principal.
     if (!nsContentUtils::IsSystemPrincipal(mNodeInfoManager->DocumentPrincipal())) {
@@ -312,16 +279,17 @@ nsXULPrototypeDocument::Write(nsIObjectO
       }
     }
 
     uint32_t nodeInfoCount = nodeInfos.Length();
     tmp = aStream->Write32(nodeInfoCount);
     if (NS_FAILED(tmp)) {
       rv = tmp;
     }
+    uint32_t i;
     for (i = 0; i < nodeInfoCount; ++i) {
         mozilla::dom::NodeInfo *nodeInfo = nodeInfos[i];
         NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
 
         nsAutoString namespaceURI;
         nodeInfo->GetNamespaceURI(namespaceURI);
         tmp = aStream->WriteWStringZ(namespaceURI.get());
         if (NS_FAILED(tmp)) {
@@ -346,17 +314,17 @@ nsXULPrototypeDocument::Write(nsIObjectO
         nodeInfo->GetName(localName);
         tmp = aStream->WriteWStringZ(localName.get());
         if (NS_FAILED(tmp)) {
           rv = tmp;
         }
     }
 
     // Now serialize the document contents
-    count = mProcessingInstructions.Length();
+    uint32_t count = mProcessingInstructions.Length();
     for (i = 0; i < count; ++i) {
         nsXULPrototypePI* pi = mProcessingInstructions[i];
         tmp = pi->Serialize(aStream, this, &nodeInfos);
         if (NS_FAILED(tmp)) {
           rv = tmp;
         }
     }
 
@@ -417,32 +385,16 @@ nsXULPrototypeDocument::AddProcessingIns
 }
 
 const nsTArray<RefPtr<nsXULPrototypePI> >&
 nsXULPrototypeDocument::GetProcessingInstructions() const
 {
     return mProcessingInstructions;
 }
 
-void
-nsXULPrototypeDocument::AddStyleSheetReference(nsIURI* aURI)
-{
-    MOZ_ASSERT(aURI, "null ptr");
-    if (!mStyleSheetReferences.AppendObject(aURI)) {
-        NS_WARNING("mStyleSheetReferences->AppendElement() failed."
-                   "Stylesheet overlay dropped.");
-    }
-}
-
-const nsCOMArray<nsIURI>&
-nsXULPrototypeDocument::GetStyleSheetReferences() const
-{
-    return mStyleSheetReferences;
-}
-
 nsIPrincipal*
 nsXULPrototypeDocument::DocumentPrincipal()
 {
     MOZ_ASSERT(mNodeInfoManager, "missing nodeInfoManager");
     return mNodeInfoManager->DocumentPrincipal();
 }
 
 void
--- a/dom/xul/nsXULPrototypeDocument.h
+++ b/dom/xul/nsXULPrototypeDocument.h
@@ -66,27 +66,16 @@ public:
      */
     nsresult AddProcessingInstruction(nsXULPrototypePI* aPI);
     /**
      * @note GetProcessingInstructions retains the ownership (the PI
      *       protos only get deleted when the proto document is deleted)
      */
     const nsTArray<RefPtr<nsXULPrototypePI> >& GetProcessingInstructions() const;
 
-    /**
-     * Access the array of style overlays for this document.
-     *
-     * Style overlays are stylesheets that need to be applied to the
-     * document, but are not referenced from within the document. They
-     * are currently obtained from the chrome registry via
-     * nsIXULOverlayProvider::getStyleOverlays.)
-     */
-    void AddStyleSheetReference(nsIURI* aStyleSheet);
-    const nsCOMArray<nsIURI>& GetStyleSheetReferences() const;
-
     nsIPrincipal *DocumentPrincipal();
     void SetDocumentPrincipal(nsIPrincipal *aPrincipal);
 
     /**
      * If current prototype document has not yet finished loading,
      * appends aDocument to the list of documents to notify (via
      * XULDocument::OnPrototypeLoadDone()) and sets aLoaded to false.
      * Otherwise sets aLoaded to true.
@@ -108,17 +97,16 @@ public:
     NS_DECL_CYCLE_COLLECTION_CLASS(nsXULPrototypeDocument)
 
     void TraceProtos(JSTracer* aTrc);
 
 protected:
     nsCOMPtr<nsIURI> mURI;
     RefPtr<nsXULPrototypeElement> mRoot;
     nsTArray<RefPtr<nsXULPrototypePI> > mProcessingInstructions;
-    nsCOMArray<nsIURI> mStyleSheetReferences;
 
     bool mLoaded;
     nsTArray< RefPtr<mozilla::dom::XULDocument> > mPrototypeWaiters;
 
     RefPtr<nsNodeInfoManager> mNodeInfoManager;
 
     uint32_t mCCGeneration;
     uint32_t mGCNumber;
--- a/xpcom/build/nsXULAppAPI.h
+++ b/xpcom/build/nsXULAppAPI.h
@@ -276,17 +276,17 @@ XRE_API(nsresult,
  *
  * NS_APP_LOCATION specifies a location to search for binary XPCOM
  * components as well as component/chrome manifest files.
  *
  * NS_EXTENSION_LOCATION excludes binary XPCOM components but allows other
  * manifest instructions.
  *
  * NS_SKIN_LOCATION specifies a location to search for chrome manifest files
- * which are only allowed to register only skin packages and style overlays.
+ * which are only allowed to register skin packages.
  */
 enum NSLocationType
 {
   NS_APP_LOCATION,
   NS_EXTENSION_LOCATION,
   NS_SKIN_LOCATION,
   NS_BOOTSTRAPPED_LOCATION
 };
@@ -305,17 +305,17 @@ XRE_API(nsresult,
  * @param aFiles An array of files or directories.
  * @param aFileCount the number of items in the aFiles array.
  * @note appdir/components is registered automatically.
  *
  * NS_COMPONENT_LOCATION specifies a location to search for binary XPCOM
  * components as well as component/chrome manifest files.
  *
  * NS_SKIN_LOCATION specifies a location to search for chrome manifest files
- * which are only allowed to register only skin packages and style overlays.
+ * which are only allowed to register skin packages.
  */
 XRE_API(nsresult,
         XRE_AddJarManifestLocation, (NSLocationType aType,
                                      nsIFile* aLocation))
 
 /**
  * Fire notifications to inform the toolkit about a new profile. This
  * method should be called after XRE_InitEmbedding if the embedder
--- a/xpcom/components/ManifestParser.cpp
+++ b/xpcom/components/ManifestParser.cpp
@@ -103,20 +103,16 @@ static const ManifestDirective kParsingT
     "skin",             3, false, false, true, true, false,
     nullptr, &nsChromeRegistry::ManifestSkin,
   },
   {
     "overlay",          2, false, true, true, false, false,
     nullptr, &nsChromeRegistry::ManifestOverlay,
   },
   {
-    "style",            2, false, false, true, false, false,
-    nullptr, &nsChromeRegistry::ManifestStyle,
-  },
-  {
     // NB: note that while skin manifests can use this, they are only allowed
     // to use it for chrome://../skin/ URLs
     "override",         2, false, false, true, true, false,
     nullptr, &nsChromeRegistry::ManifestOverride,
   },
   {
     "resource",         2, false, true, true, false, true,
     nullptr, &nsChromeRegistry::ManifestResource,