Bug 1546046 - Remove support for XBL resources. r=TYLin
☠☠ backed out by 831918f009f6 ☠ ☠
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 22 Apr 2019 21:57:22 +0000
changeset 470418 e85cb54e594431e3b60f2e32cc6222872ba64f55
parent 470417 fc479e4e17f208520ccfa4fd29bacc1a90ba4bfa
child 470419 bd2261f7465814875436e794313a4fa525d8e69d
push id35905
push userdvarga@mozilla.com
push dateTue, 23 Apr 2019 09:53:27 +0000
treeherdermozilla-central@831918f009f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersTYLin
bugs1546046
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 1546046 - Remove support for XBL resources. r=TYLin So much unsound code going away :-) Differential Revision: https://phabricator.services.mozilla.com/D28380
dom/base/Element.cpp
dom/xbl/moz.build
dom/xbl/nsBindingManager.cpp
dom/xbl/nsBindingManager.h
dom/xbl/nsXBLBinding.cpp
dom/xbl/nsXBLBinding.h
dom/xbl/nsXBLContentSink.cpp
dom/xbl/nsXBLContentSink.h
dom/xbl/nsXBLDocumentInfo.cpp
dom/xbl/nsXBLDocumentInfo.h
dom/xbl/nsXBLPrototypeBinding.cpp
dom/xbl/nsXBLPrototypeBinding.h
dom/xbl/nsXBLPrototypeResources.cpp
dom/xbl/nsXBLPrototypeResources.h
dom/xbl/nsXBLResourceLoader.cpp
dom/xbl/nsXBLResourceLoader.h
dom/xbl/nsXBLSerialize.h
dom/xbl/nsXBLService.cpp
dom/xbl/nsXBLService.h
dom/xul/nsXULPrototypeCache.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSFrameConstructor.h
layout/inspector/InspectorUtils.cpp
layout/inspector/ServoStyleRuleMap.cpp
layout/inspector/ServoStyleRuleMap.h
layout/reftests/bugs/1375513-ref.html
layout/reftests/bugs/1375513.css
layout/reftests/bugs/1375513.html
layout/reftests/bugs/1375513.xml
layout/reftests/bugs/reftest.list
layout/reftests/xul/reftest.list
layout/reftests/xul/root-binding-style-xbl.css
layout/reftests/xul/root-binding-style.xul
layout/reftests/xul/xbl_bindings.xml
layout/style/GeckoBindings.cpp
layout/style/GeckoBindings.h
layout/style/ServoStyleSet.cpp
layout/style/ServoStyleSet.h
layout/style/test/media_queries_dynamic_xbl_binding.xml
layout/style/test/media_queries_dynamic_xbl_iframe.html
layout/style/test/media_queries_dynamic_xbl_style.css
layout/style/test/mochitest.ini
layout/style/test/test_media_queries_dynamic_xbl.html
servo/components/selectors/context.rs
servo/components/style/author_styles.rs
servo/components/style/dom.rs
servo/components/style/gecko/data.rs
servo/components/style/gecko/wrapper.rs
servo/components/style/invalidation/element/state_and_attributes.rs
servo/components/style/rule_collector.rs
servo/components/style/sharing/mod.rs
servo/components/style/stylesheet_set.rs
servo/components/style/stylist.rs
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -604,27 +604,24 @@ JSObject* Element::WrapObject(JSContext*
       return nullptr;
     }
 
     if (bindingURL) {
       nsCOMPtr<nsIURI> uri = bindingURL->GetURI();
       nsCOMPtr<nsIPrincipal> principal = bindingURL->ExtraData()->Principal();
 
       // We have a binding that must be installed.
-      bool dummy;
-
       nsXBLService* xblService = nsXBLService::GetInstance();
       if (!xblService) {
         dom::Throw(aCx, NS_ERROR_NOT_AVAILABLE);
         return nullptr;
       }
 
       RefPtr<nsXBLBinding> binding;
-      xblService->LoadBindings(this, uri, principal, getter_AddRefs(binding),
-                               &dummy);
+      xblService->LoadBindings(this, uri, principal, getter_AddRefs(binding));
 
       if (binding) {
         if (nsContentUtils::IsSafeToRunScript()) {
           binding->ExecuteAttachedHandler();
         } else {
           nsContentUtils::AddScriptRunner(
               NewRunnableMethod("nsXBLBinding::ExecuteAttachedHandler", binding,
                                 &nsXBLBinding::ExecuteAttachedHandler));
--- a/dom/xbl/moz.build
+++ b/dom/xbl/moz.build
@@ -28,18 +28,16 @@ UNIFIED_SOURCES += [
     'nsXBLDocumentInfo.cpp',
     'nsXBLEventHandler.cpp',
     'nsXBLProtoImpl.cpp',
     'nsXBLProtoImplField.cpp',
     'nsXBLProtoImplMethod.cpp',
     'nsXBLProtoImplProperty.cpp',
     'nsXBLPrototypeBinding.cpp',
     'nsXBLPrototypeHandler.cpp',
-    'nsXBLPrototypeResources.cpp',
-    'nsXBLResourceLoader.cpp',
     'nsXBLSerialize.cpp',
     'nsXBLService.cpp',
     'nsXBLWindowKeyHandler.cpp',
     'XBLChildrenElement.cpp',
 ]
 
 LOCAL_INCLUDES += [
     '/dom/base',
--- a/dom/xbl/nsBindingManager.cpp
+++ b/dom/xbl/nsBindingManager.cpp
@@ -580,50 +580,16 @@ nsresult nsBindingManager::GetBindingImp
       return rv;
     }
   }
 
   *aResult = nullptr;
   return NS_NOINTERFACE;
 }
 
-bool nsBindingManager::EnumerateBoundContentProtoBindings(
-    const BoundContentProtoBindingCallback& aCallback) const {
-  if (!mBoundContentSet) {
-    return true;
-  }
-
-  nsTHashtable<nsPtrHashKey<nsXBLPrototypeBinding>> bindings;
-  for (auto iter = mBoundContentSet->Iter(); !iter.Done(); iter.Next()) {
-    nsIContent* boundContent = iter.Get()->GetKey();
-    for (nsXBLBinding* binding = boundContent->GetXBLBinding(); binding;
-         binding = binding->GetBaseBinding()) {
-      nsXBLPrototypeBinding* proto = binding->PrototypeBinding();
-      // If we have already invoked the callback with a binding, we
-      // should have also invoked it for all its base bindings, so we
-      // don't need to continue this loop anymore.
-      if (!bindings.EnsureInserted(proto)) {
-        break;
-      }
-      if (!aCallback(proto)) {
-        return false;
-      }
-    }
-  }
-
-  return true;
-}
-
-void nsBindingManager::AppendAllSheets(nsTArray<StyleSheet*>& aArray) {
-  EnumerateBoundContentProtoBindings([&aArray](nsXBLPrototypeBinding* aProto) {
-    aProto->AppendStyleSheetsTo(aArray);
-    return true;
-  });
-}
-
 static void InsertAppendedContent(XBLChildrenElement* aPoint,
                                   nsIContent* aFirstNewContent) {
   int32_t insertionIndex;
   if (nsIContent* prevSibling = aFirstNewContent->GetPreviousSibling()) {
     // If we have a previous sibling, then it must already be in aPoint. Find
     // it and insert after it.
     insertionIndex = aPoint->IndexOfInsertedChild(prevSibling);
     MOZ_ASSERT(insertionIndex != -1);
--- a/dom/xbl/nsBindingManager.h
+++ b/dom/xbl/nsBindingManager.h
@@ -15,17 +15,16 @@
 #include "nsRefPtrHashtable.h"
 #include "nsURIHashKey.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsXBLBinding.h"
 #include "nsTArray.h"
 #include "nsThreadUtils.h"
 #include "mozilla/MediaFeatureChange.h"
 #include "mozilla/MemoryReporting.h"
-#include "mozilla/StyleSheet.h"
 #include "mozilla/EventStates.h"
 
 struct ElementDependentRuleProcessorData;
 class nsIXPConnectWrappedJS;
 class nsAtom;
 class nsIURI;
 class nsXBLDocumentInfo;
 class nsIStreamListener;
@@ -112,18 +111,16 @@ class nsBindingManager final : public ns
   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)
 
   // Notify the binding manager when an outermost update begins and
   // ends.  The end method can execute script.
   void BeginOutermostUpdate() {
     mAttachedStackSizeOnOutermost = mAttachedStack.Length();
@@ -143,24 +140,16 @@ class nsBindingManager final : public ns
   // Called when the document is going away
   void DropDocumentReference();
 
   nsIContent* FindNestedSingleInsertionPoint(nsIContent* aContainer,
                                              bool* aMulti);
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
-  // Enumerate each bound content's bindings (including its base bindings)
-  // in mBoundContentSet. Return false from the callback to stop enumeration.
-  using BoundContentProtoBindingCallback =
-      std::function<bool(nsXBLPrototypeBinding*)>;
-
-  bool EnumerateBoundContentProtoBindings(
-      const BoundContentProtoBindingCallback&) const;
-
  protected:
   nsIXPConnectWrappedJS* GetWrappedJS(nsIContent* aContent);
   nsresult SetWrappedJS(nsIContent* aContent, nsIXPConnectWrappedJS* aResult);
 
   // Called by ContentAppended and ContentInserted to handle a single child
   // insertion.  aChild must not be null.  aContainer may be null.
   // aAppend is true if this child is being appended, not inserted.
   void HandleChildInsertion(nsIContent* aContainer, nsIContent* aChild,
--- a/dom/xbl/nsXBLBinding.cpp
+++ b/dom/xbl/nsXBLBinding.cpp
@@ -205,24 +205,16 @@ void nsXBLBinding::UnbindAnonymousConten
   }
 }
 
 void nsXBLBinding::SetBoundElement(Element* aElement) {
   mBoundElement = aElement;
   if (mNextBinding) mNextBinding->SetBoundElement(aElement);
 }
 
-bool nsXBLBinding::HasStyleSheets() const {
-  // Find out if we need to re-resolve style.  We'll need to do this
-  // if we have additional stylesheets in our binding document.
-  if (mPrototypeBinding->HasStyleSheets()) return true;
-
-  return mNextBinding ? mNextBinding->HasStyleSheets() : false;
-}
-
 void nsXBLBinding::GenerateAnonymousContent() {
   NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
                "Someone forgot a script blocker");
 
   // Fetch the content element for this binding.
   Element* content = mPrototypeBinding->GetImmediateChild(nsGkAtoms::content);
 
   if (!content) {
@@ -686,34 +678,16 @@ void nsXBLBinding::ChangeDocument(Docume
     if (mContent) {
       nsXBLBinding::UnbindAnonymousContent(aOldDocument, mContent);
     }
 
     ClearInsertionPoints();
   }
 }
 
-bool nsXBLBinding::InheritsStyle() const {
-  // XXX Will have to change if we ever allow multiple bindings to contribute
-  // anonymous content. Most derived binding with anonymous content determines
-  // style inheritance for now.
-
-  // XXX What about bindings with <content> but no kids, e.g., my treecell-text
-  // binding?
-  if (mContent) return mPrototypeBinding->InheritsStyle();
-
-  if (mNextBinding) return mNextBinding->InheritsStyle();
-
-  return true;
-}
-
-const RawServoAuthorStyles* nsXBLBinding::GetServoStyles() const {
-  return mPrototypeBinding->GetServoStyles();
-}
-
 // Internal helper methods /////////////////////////////////////////////////////
 
 // Get or create a WeakMap object on a given XBL-hosting global.
 //
 // The scheme is as follows. XBL-hosting globals (either privileged content
 // Windows or XBL scopes) get two lazily-defined WeakMap properties. Each
 // WeakMap is keyed by the grand-proto - i.e. the original prototype of the
 // content before it was bound, and the prototype of the class object that we
--- a/dom/xbl/nsXBLBinding.h
+++ b/dom/xbl/nsXBLBinding.h
@@ -87,18 +87,16 @@ class nsXBLBinding final {
                             JS::Handle<jsid> aNameAsId,
                             JS::MutableHandle<JS::PropertyDescriptor> aDesc,
                             JS::Handle<JSObject*> aXBLScope);
 
  public:
   void MarkForDeath();
   bool MarkedForDeath() const { return mMarkedForDeath; }
 
-  bool HasStyleSheets() const;
-  bool InheritsStyle() const;
   bool ImplementsInterface(REFNSIID aIID) const;
 
   void GenerateAnonymousContent();
   void BindAnonymousContent(nsIContent* aAnonParent, nsIContent* aElement);
   static void UnbindAnonymousContent(mozilla::dom::Document* aDocument,
                                      nsIContent* aAnonParent,
                                      bool aNullParent = true);
   void InstallEventHandlers();
--- a/dom/xbl/nsXBLContentSink.cpp
+++ b/dom/xbl/nsXBLContentSink.cpp
@@ -250,19 +250,16 @@ nsXBLContentSink::HandleEndElement(const
         }
       } else if (mState == eXBL_InHandlers) {
         if (localName == nsGkAtoms::handlers) {
           mState = eXBL_InBinding;
           mHandler = nullptr;
         } else if (localName == nsGkAtoms::handler)
           mSecondaryState = eXBL_None;
         return NS_OK;
-      } else if (mState == eXBL_InResources) {
-        if (localName == nsGkAtoms::resources) mState = eXBL_InBinding;
-        return NS_OK;
       } else if (mState == eXBL_InImplementation) {
         if (localName == nsGkAtoms::implementation)
           mState = eXBL_InBinding;
         else if (localName == nsGkAtoms::property) {
           mSecondaryState = eXBL_None;
           mProperty = nullptr;
         } else if (localName == nsGkAtoms::method) {
           mSecondaryState = eXBL_None;
@@ -366,26 +363,16 @@ bool nsXBLContentSink::OnOpenContainer(c
     ENSURE_XBL_STATE(mState == eXBL_InBinding && mBinding);
     mState = eXBL_InHandlers;
     ret = false;
   } else if (aTagName == nsGkAtoms::handler) {
     ENSURE_XBL_STATE(mState == eXBL_InHandlers);
     mSecondaryState = eXBL_InHandler;
     ConstructHandler(aAtts, aLineNumber);
     ret = false;
-  } else if (aTagName == nsGkAtoms::resources) {
-    ENSURE_XBL_STATE(mState == eXBL_InBinding && mBinding);
-    mState = eXBL_InResources;
-    // Note that this mState will cause us to return false, so no need
-    // to set ret to false.
-  } else if (aTagName == nsGkAtoms::stylesheet ||
-             aTagName == nsGkAtoms::image) {
-    ENSURE_XBL_STATE(mState == eXBL_InResources);
-    NS_ASSERTION(mBinding, "Must have binding here");
-    ConstructResource(aAtts, aTagName);
   } else if (aTagName == nsGkAtoms::implementation) {
     ENSURE_XBL_STATE(mState == eXBL_InBinding && mBinding);
     mState = eXBL_InImplementation;
     ConstructImplementation(aAtts);
     // Note that this mState will cause us to return false, so no need
     // to set ret to false.
   } else if (aTagName == nsGkAtoms::constructor) {
     ENSURE_XBL_STATE(mState == eXBL_InImplementation &&
@@ -457,17 +444,17 @@ bool nsXBLContentSink::OnOpenContainer(c
   } else if (aTagName == nsGkAtoms::body) {
     ENSURE_XBL_STATE(mSecondaryState == eXBL_InMethod && mMethod);
     NS_ASSERTION(mState == eXBL_InImplementation, "Unexpected state");
     // stash away the line number
     mMethod->SetLineNumber(aLineNumber);
     mSecondaryState = eXBL_InBody;
   }
 
-  return ret && mState != eXBL_InResources && mState != eXBL_InImplementation;
+  return ret && mState != eXBL_InImplementation;
 }
 
 #undef ENSURE_XBL_STATE
 
 nsresult nsXBLContentSink::ConstructBinding(uint32_t aLineNumber) {
   // This is only called from HandleStartElement, so it'd better be an element.
   RefPtr<Element> binding = GetCurrentContent()->AsElement();
   binding->GetAttr(kNameSpaceID_None, nsGkAtoms::id, mCurrentBindingID);
@@ -599,26 +586,16 @@ void nsXBLContentSink::ConstructHandler(
     // We're the first handler in the chain.
     mBinding->SetPrototypeHandlers(newHandler);
   }
   // Adjust our mHandler pointer to point to the new last handler in the
   // chain.
   mHandler = newHandler;
 }
 
-void nsXBLContentSink::ConstructResource(const char16_t** aAtts,
-                                         nsAtom* aResourceType) {
-  if (!mBinding) return;
-
-  const char16_t* src = nullptr;
-  if (FindValue(aAtts, nsGkAtoms::src, &src)) {
-    mBinding->AddResource(aResourceType, nsDependentString(src));
-  }
-}
-
 void nsXBLContentSink::ConstructImplementation(const char16_t** aAtts) {
   mImplementation = nullptr;
   mImplMember = nullptr;
   mImplField = nullptr;
 
   if (!mBinding) return;
 
   const char16_t* name = nullptr;
--- a/dom/xbl/nsXBLContentSink.h
+++ b/dom/xbl/nsXBLContentSink.h
@@ -16,17 +16,16 @@
 
 /*
  * Enum that describes the primary state of the parsing process
  */
 typedef enum {
   eXBL_InDocument,       /* outside any bindings */
   eXBL_InBindings,       /* Inside a <bindings> element */
   eXBL_InBinding,        /* Inside a <binding> */
-  eXBL_InResources,      /* Inside a <resources> */
   eXBL_InImplementation, /* Inside a <implementation> */
   eXBL_InHandlers,       /* Inside a <handlers> */
   eXBL_Error /* An error has occurred.  Suspend binding construction */
 } XBLPrimaryState;
 
 /*
  * Enum that describes our substate (typically when parsing something
  * like <handlers> or <implementation>).
@@ -84,28 +83,28 @@ class nsXBLContentSink : public nsXMLCon
   bool NotifyForDocElement() override { return false; }
 
   nsresult CreateElement(const char16_t** aAtts, uint32_t aAttsCount,
                          mozilla::dom::NodeInfo* aNodeInfo,
                          uint32_t aLineNumber, uint32_t aColumnNumber,
                          nsIContent** aResult, bool* aAppendContent,
                          mozilla::dom::FromParser aFromParser) override;
 
-  nsresult AddAttributes(const char16_t** aAtts, Element* aElement) override;
+  nsresult AddAttributes(const char16_t** aAtts,
+                         mozilla::dom::Element* aElement) override;
 
 #ifdef MOZ_XUL
   nsresult AddAttributesToXULPrototype(const char16_t** aAtts,
                                        uint32_t aAttsCount,
                                        nsXULPrototypeElement* aElement);
 #endif
 
   // Our own helpers for constructing XBL prototype objects.
   nsresult ConstructBinding(uint32_t aLineNumber);
   void ConstructHandler(const char16_t** aAtts, uint32_t aLineNumber);
-  void ConstructResource(const char16_t** aAtts, nsAtom* aResourceType);
   void ConstructImplementation(const char16_t** aAtts);
   void ConstructProperty(const char16_t** aAtts, uint32_t aLineNumber);
   void ConstructMethod(const char16_t** aAtts);
   void ConstructParameter(const char16_t** aAtts);
   void ConstructField(const char16_t** aAtts, uint32_t aLineNumber);
 
   // nsXMLContentSink overrides
   nsresult FlushText(bool aReleaseTextNode = true) override;
--- a/dom/xbl/nsXBLDocumentInfo.cpp
+++ b/dom/xbl/nsXBLDocumentInfo.cpp
@@ -280,24 +280,16 @@ nsresult nsXBLDocumentInfo::WritePrototy
   return startupCache->PutBuffer(spec.get(), std::move(buf), len);
 }
 
 void nsXBLDocumentInfo::SetFirstPrototypeBinding(
     nsXBLPrototypeBinding* aBinding) {
   mFirstBinding = aBinding;
 }
 
-void nsXBLDocumentInfo::FlushSkinStylesheets() {
-  if (mBindingTable) {
-    for (auto iter = mBindingTable->Iter(); !iter.Done(); iter.Next()) {
-      iter.UserData()->FlushSkinSheets();
-    }
-  }
-}
-
 #ifdef DEBUG
 void AssertInCompilationScope() {
   AutoJSContext cx;
   MOZ_ASSERT(xpc::CompilationScope() == JS::CurrentGlobalOrNull(cx));
 }
 #endif
 
 size_t nsXBLDocumentInfo::SizeOfIncludingThis(
--- a/dom/xbl/nsXBLDocumentInfo.h
+++ b/dom/xbl/nsXBLDocumentInfo.h
@@ -35,18 +35,16 @@ class nsXBLDocumentInfo final : public n
 
   // This removes the binding without deleting it
   void RemovePrototypeBinding(const nsACString& aRef);
 
   nsresult WritePrototypeBindings();
 
   void SetFirstPrototypeBinding(nsXBLPrototypeBinding* aBinding);
 
-  void FlushSkinStylesheets();
-
   bool IsChrome() { return mIsChrome; }
 
   void MarkInCCGeneration(uint32_t aGeneration);
 
   static nsresult ReadPrototypeBindings(nsIURI* aURI,
                                         nsXBLDocumentInfo** aDocInfo,
                                         mozilla::dom::Document* aBoundDocument);
 
--- a/dom/xbl/nsXBLPrototypeBinding.cpp
+++ b/dom/xbl/nsXBLPrototypeBinding.cpp
@@ -32,23 +32,20 @@
 #include "nsGkAtoms.h"
 #include "nsXBLProtoImpl.h"
 #include "nsCRT.h"
 #include "nsContentUtils.h"
 #include "nsTextFragment.h"
 #include "nsTextNode.h"
 #include "nsIScriptError.h"
 
-#include "nsXBLResourceLoader.h"
 #include "mozilla/dom/CDATASection.h"
 #include "mozilla/dom/CharacterData.h"
 #include "mozilla/dom/Comment.h"
 #include "mozilla/dom/Element.h"
-#include "mozilla/StyleSheet.h"
-#include "mozilla/StyleSheetInlines.h"
 
 #ifdef MOZ_XUL
 #  include "nsXULElement.h"
 #endif
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
@@ -105,22 +102,20 @@ size_t nsXBLAttributeEntry::SizeOfInclud
 // =============================================================================
 
 // Implementation //////////////////////////////////////////////////////////////
 
 // Constructors/Destructors
 nsXBLPrototypeBinding::nsXBLPrototypeBinding()
     : mImplementation(nullptr),
       mBaseBinding(nullptr),
-      mInheritStyle(true),
       mCheckedBaseProto(false),
       mKeyHandlersRegistered(false),
       mBindToUntrustedContent(false),
       mSimpleScopeChain(false),
-      mResources(nullptr),
       mXBLDocInfoWeak(nullptr) {
   MOZ_COUNT_CTOR(nsXBLPrototypeBinding);
 }
 
 nsresult nsXBLPrototypeBinding::Init(const nsACString& aID,
                                      nsXBLDocumentInfo* aInfo,
                                      Element* aElement, bool aFirstBinding) {
   nsresult rv;
@@ -155,30 +150,23 @@ bool nsXBLPrototypeBinding::CompareBindi
   }
   return equal;
 }
 
 void nsXBLPrototypeBinding::Traverse(
     nsCycleCollectionTraversalCallback& cb) const {
   NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "proto mBinding");
   cb.NoteXPCOMChild(mBinding);
-  if (mResources) {
-    mResources->Traverse(cb);
-  }
   ImplCycleCollectionTraverse(cb, mInterfaceTable, "proto mInterfaceTable");
 }
 
 void nsXBLPrototypeBinding::Unlink() {
   if (mImplementation) {
     mImplementation->UnlinkJSObjects();
   }
-
-  if (mResources) {
-    mResources->Unlink();
-  }
 }
 
 void nsXBLPrototypeBinding::Trace(const TraceCallbacks& aCallbacks,
                                   void* aClosure) const {
   if (mImplementation) mImplementation->Trace(aCallbacks, aClosure);
 }
 
 void nsXBLPrototypeBinding::Initialize() {
@@ -200,55 +188,31 @@ void nsXBLPrototypeBinding::SetBaseProto
     return;
   }
 
   mBaseBinding = aBinding;
 }
 
 void nsXBLPrototypeBinding::SetBindingElement(Element* aElement) {
   mBinding = aElement;
-  if (mBinding->AttrValueIs(kNameSpaceID_None, nsGkAtoms::inheritstyle,
-                            nsGkAtoms::_false, eCaseMatters))
-    mInheritStyle = false;
 
   mBindToUntrustedContent = mBinding->AttrValueIs(
       kNameSpaceID_None, nsGkAtoms::bindToUntrustedContent, nsGkAtoms::_true,
       eCaseMatters);
 
   // TODO(emilio): Should we imply mBindToUntrustedContent -> mSimpleScopeChain?
   mSimpleScopeChain =
       mBinding->AttrValueIs(kNameSpaceID_None, nsGkAtoms::simpleScopeChain,
                             nsGkAtoms::_true, eCaseMatters);
 }
 
 bool nsXBLPrototypeBinding::GetAllowScripts() const {
   return mXBLDocInfoWeak->GetScriptAccess();
 }
 
-bool nsXBLPrototypeBinding::LoadResources(nsIContent* aBoundElement) {
-  if (mResources) {
-    return mResources->LoadResources(aBoundElement);
-  }
-
-  return true;
-}
-
-nsresult nsXBLPrototypeBinding::AddResource(nsAtom* aResourceType,
-                                            const nsAString& aSrc) {
-  EnsureResources();
-
-  mResources->AddResource(aResourceType, aSrc);
-  return NS_OK;
-}
-
-nsresult nsXBLPrototypeBinding::FlushSkinSheets() {
-  if (mResources) return mResources->FlushSkinSheets();
-  return NS_OK;
-}
-
 nsresult nsXBLPrototypeBinding::BindingAttached(nsIContent* aBoundElement) {
   if (mImplementation && mImplementation->CompiledMembers() &&
       mImplementation->mConstructor)
     return mImplementation->mConstructor->Execute(aBoundElement, *this);
   return NS_OK;
 }
 
 nsresult nsXBLPrototypeBinding::BindingDetached(nsIContent* aBoundElement) {
@@ -636,25 +600,16 @@ nsresult nsXBLPrototypeBinding::Construc
 
       token = nsCRT::strtok(newStr, ", ", &newStr);
     }
   }
 
   return NS_OK;
 }
 
-nsresult nsXBLPrototypeBinding::AddResourceListener(nsIContent* aBoundElement) {
-  if (!mResources)
-    return NS_ERROR_FAILURE;  // Makes no sense to add a listener when the
-                              // binding has no resources.
-
-  mResources->AddResourceListener(aBoundElement);
-  return NS_OK;
-}
-
 void nsXBLPrototypeBinding::CreateKeyHandlers() {
   nsXBLPrototypeHandler* curr = mPrototypeHandler;
   while (curr) {
     RefPtr<nsAtom> eventAtom = curr->GetEventName();
     if (eventAtom == nsGkAtoms::keyup || eventAtom == nsGkAtoms::keydown ||
         eventAtom == nsGkAtoms::keypress) {
       uint8_t phase = curr->GetPhase();
       uint8_t type = curr->GetType();
@@ -696,17 +651,16 @@ class XBLPrototypeSetupCleanup {
 
   nsXBLDocumentInfo* mDocInfo;
   nsAutoCString mID;
 };
 
 nsresult nsXBLPrototypeBinding::Read(nsIObjectInputStream* aStream,
                                      nsXBLDocumentInfo* aDocInfo,
                                      Document* aDocument, uint8_t aFlags) {
-  mInheritStyle = (aFlags & XBLBinding_Serialize_InheritStyle) ? true : false;
   mBindToUntrustedContent =
       (aFlags & XBLBinding_Serialize_BindToUntrustedContent) ? true : false;
   mSimpleScopeChain =
       (aFlags & XBLBinding_Serialize_SimpleScopeChain) ? true : false;
 
   // nsXBLContentSink::ConstructBinding doesn't create a binding with an empty
   // id, so we don't here either.
   nsAutoCString id;
@@ -839,38 +793,16 @@ nsresult nsXBLPrototypeBinding::Read(nsI
       NS_ENSURE_SUCCESS(rv, rv);
 
       RefPtr<nsAtom> atomPrefix = NS_Atomize(attrPrefix);
       RefPtr<nsAtom> atomName = NS_Atomize(attrName);
       mBinding->SetAttr(attrNamespace, atomName, atomPrefix, attrValue, false);
     }
   }
 
-  // Finally, read in the resources.
-  while (true) {
-    XBLBindingSerializeDetails type;
-    rv = aStream->Read8(&type);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    if (type == XBLBinding_Serialize_NoMoreItems) break;
-
-    NS_ASSERTION(
-        (type & XBLBinding_Serialize_Mask) == XBLBinding_Serialize_Stylesheet ||
-            (type & XBLBinding_Serialize_Mask) == XBLBinding_Serialize_Image,
-        "invalid resource type");
-
-    nsAutoString src;
-    rv = aStream->ReadString(src);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    AddResource(type == XBLBinding_Serialize_Stylesheet ? nsGkAtoms::stylesheet
-                                                        : nsGkAtoms::image,
-                src);
-  }
-
   if (isFirstBinding) {
     aDocInfo->SetFirstPrototypeBinding(this);
   }
 
   cleanup.Disconnect();
   return NS_OK;
 }
 
@@ -896,17 +828,17 @@ nsresult nsXBLPrototypeBinding::Write(ns
 
   // We're not directly using this AutoJSAPI here, but callees use it via
   // AutoJSContext.
   AutoJSAPI jsapi;
   if (!jsapi.Init(xpc::CompilationScope())) {
     return NS_ERROR_UNEXPECTED;
   }
 
-  uint8_t flags = mInheritStyle ? XBLBinding_Serialize_InheritStyle : 0;
+  uint8_t flags = 0;
 
   // mAlternateBindingURI is only set on the first binding.
   if (mAlternateBindingURI) {
     flags |= XBLBinding_Serialize_IsFirstBinding;
   }
 
   if (mBindToUntrustedContent) {
     flags |= XBLBinding_Serialize_BindToUntrustedContent;
@@ -1005,25 +937,16 @@ nsresult nsXBLPrototypeBinding::Write(ns
       rv = aStream->WriteWStringZ(attrName.get());
       NS_ENSURE_SUCCESS(rv, rv);
 
       rv = aStream->WriteWStringZ(attrValue.get());
       NS_ENSURE_SUCCESS(rv, rv);
     }
   }
 
-  aStream->Write8(XBLBinding_Serialize_NoMoreItems);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // Write out the resources
-  if (mResources) {
-    rv = mResources->Write(aStream);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
   // Write out an end mark at the end.
   return aStream->Write8(XBLBinding_Serialize_NoMoreItems);
 }
 
 nsresult nsXBLPrototypeBinding::ReadContentNode(nsIObjectInputStream* aStream,
                                                 Document* aDocument,
                                                 nsNodeInfoManager* aNim,
                                                 nsIContent** aContent) {
@@ -1382,67 +1305,21 @@ nsresult nsXBLPrototypeBinding::ResolveB
   if (extends.IsEmpty()) {
     return NS_OK;
   }
 
   return NS_NewURI(getter_AddRefs(mBaseBindingURI), extends,
                    doc->GetDocumentCharacterSet(), doc->GetDocBaseURI());
 }
 
-void nsXBLPrototypeBinding::EnsureResources() {
-  if (!mResources) {
-    mResources = new nsXBLPrototypeResources(this);
-  }
-}
-
-void nsXBLPrototypeBinding::AppendStyleSheet(StyleSheet* aSheet) {
-  EnsureResources();
-  mResources->AppendStyleSheet(aSheet);
-}
-
-void nsXBLPrototypeBinding::RemoveStyleSheet(StyleSheet* aSheet) {
-  if (!mResources) {
-    MOZ_ASSERT(false, "Trying to remove a sheet that does not exist.");
-    return;
-  }
-
-  mResources->RemoveStyleSheet(aSheet);
-}
-void nsXBLPrototypeBinding::InsertStyleSheetAt(size_t aIndex,
-                                               StyleSheet* aSheet) {
-  EnsureResources();
-  mResources->InsertStyleSheetAt(aIndex, aSheet);
-}
-
-StyleSheet* nsXBLPrototypeBinding::StyleSheetAt(size_t aIndex) const {
-  MOZ_ASSERT(mResources);
-  return mResources->StyleSheetAt(aIndex);
-}
-
-size_t nsXBLPrototypeBinding::SheetCount() const {
-  return mResources ? mResources->SheetCount() : 0;
-}
-
-bool nsXBLPrototypeBinding::HasStyleSheets() const {
-  return mResources && mResources->HasStyleSheets();
-}
-
-void nsXBLPrototypeBinding::AppendStyleSheetsTo(
-    nsTArray<StyleSheet*>& aResult) const {
-  if (mResources) {
-    mResources->AppendStyleSheetsTo(aResult);
-  }
-}
-
 size_t nsXBLPrototypeBinding::SizeOfIncludingThis(
     MallocSizeOf aMallocSizeOf) const {
   size_t n = aMallocSizeOf(this);
   n += mPrototypeHandler ? mPrototypeHandler->SizeOfIncludingThis(aMallocSizeOf)
                          : 0;
-  n += mResources ? mResources->SizeOfIncludingThis(aMallocSizeOf) : 0;
 
   if (mAttributeTable) {
     n += mAttributeTable->ShallowSizeOfIncludingThis(aMallocSizeOf);
     for (auto iter = mAttributeTable->Iter(); !iter.Done(); iter.Next()) {
       InnerAttributeTable* table = iter.UserData();
       n += table->ShallowSizeOfIncludingThis(aMallocSizeOf);
       for (auto iter2 = table->Iter(); !iter2.Done(); iter2.Next()) {
         n += iter2.UserData()->SizeOfIncludingThis(aMallocSizeOf);
--- a/dom/xbl/nsXBLPrototypeBinding.h
+++ b/dom/xbl/nsXBLPrototypeBinding.h
@@ -12,20 +12,18 @@
 #include "nsCOMArray.h"
 #include "nsCOMPtr.h"
 #include "nsICSSLoaderObserver.h"
 #include "nsInterfaceHashtable.h"
 #include "nsXBLDocumentInfo.h"
 #include "nsXBLProtoImpl.h"
 #include "nsXBLProtoImplMethod.h"
 #include "nsXBLPrototypeHandler.h"
-#include "nsXBLPrototypeResources.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/WeakPtr.h"
-#include "mozilla/StyleSheet.h"
 
 class nsAtom;
 class nsIContent;
 
 class nsXBLAttributeEntry;
 class nsXBLBinding;
 class nsXBLProtoImplField;
 
@@ -52,24 +50,16 @@ class nsXBLPrototypeBinding final
   // binding URIs.
   bool CompareBindingURI(nsIURI* aURI) const;
 
   bool GetAllowScripts() const;
 
   nsresult BindingAttached(nsIContent* aBoundElement);
   nsresult BindingDetached(nsIContent* aBoundElement);
 
-  // aBoundElement is passed in here because we need to get owner document
-  // and PresContext in nsXBLResourceLoader::LoadResources().
-  bool LoadResources(nsIContent* aBoundElement);
-  nsresult AddResource(nsAtom* aResourceType, const nsAString& aSrc);
-
-  bool InheritsStyle() const { return mInheritStyle; }
-  void SetInheritsStyle(bool aInheritStyle) { mInheritStyle = aInheritStyle; }
-
   nsXBLPrototypeHandler* GetPrototypeHandlers() { return mPrototypeHandler; }
   void SetPrototypeHandlers(nsXBLPrototypeHandler* aHandler) {
     mPrototypeHandler = aHandler;
   }
 
   nsXBLProtoImplAnonymousMethod* GetConstructor();
   nsresult SetConstructor(nsXBLProtoImplAnonymousMethod* aConstructor);
   nsXBLProtoImplAnonymousMethod* GetDestructor();
@@ -117,52 +107,21 @@ class nsXBLPrototypeBinding final
   nsXBLPrototypeBinding* GetBasePrototype() { return mBaseBinding; }
 
   nsXBLDocumentInfo* XBLDocumentInfo() const { return mXBLDocInfoWeak; }
   bool IsChrome() { return mXBLDocInfoWeak->IsChrome(); }
 
   void SetInitialAttributes(mozilla::dom::Element* aBoundElement,
                             nsIContent* aAnonymousContent);
 
-  void AppendStyleSheet(mozilla::StyleSheet* aSheet);
-  void RemoveStyleSheet(mozilla::StyleSheet* aSheet);
-  void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheet* aSheet);
-  mozilla::StyleSheet* StyleSheetAt(size_t aIndex) const;
-  size_t SheetCount() const;
-  bool HasStyleSheets() const;
-  void AppendStyleSheetsTo(nsTArray<mozilla::StyleSheet*>& aResult) const;
-
-  const RawServoAuthorStyles* GetServoStyles() const {
-    return mResources ? mResources->GetServoStyles() : nullptr;
-  }
-
-  void SyncServoStyles() {
-    MOZ_ASSERT(mResources);
-    mResources->SyncServoStyles();
-  }
-
-  RawServoAuthorStyles* GetServoStyles() {
-    return mResources
-               ? const_cast<RawServoAuthorStyles*>(mResources->GetServoStyles())
-               : nullptr;
-  }
-
-  mozilla::ServoStyleRuleMap* GetServoStyleRuleMap() {
-    return mResources ? mResources->GetServoStyleRuleMap() : nullptr;
-  }
-
-  nsresult FlushSkinSheets();
-
   nsAtom* GetBaseTag(int32_t* aNamespaceID);
   void SetBaseTag(int32_t aNamespaceID, nsAtom* aTag);
 
   bool ImplementsInterface(REFNSIID aIID) const;
 
-  nsresult AddResourceListener(nsIContent* aBoundElement);
-
   void Initialize();
 
   nsresult ResolveBaseBinding();
 
   const nsCOMArray<nsXBLKeyEventHandler>* GetKeyEventHandlers() {
     if (!mKeyHandlersRegistered) {
       CreateKeyHandlers();
       mKeyHandlersRegistered = true;
@@ -283,19 +242,16 @@ class nsXBLPrototypeBinding final
   void EnsureAttributeTable();
   // Ad an entry to the attribute table
   void AddToAttributeTable(int32_t aSourceNamespaceID, nsAtom* aSourceTag,
                            int32_t aDestNamespaceID, nsAtom* aDestTag,
                            mozilla::dom::Element* aContent);
   void ConstructAttributeTable(mozilla::dom::Element* aElement);
   void CreateKeyHandlers();
 
- private:
-  void EnsureResources();
-
   // MEMBER VARIABLES
  protected:
   nsCOMPtr<nsIURI> mBindingURI;
   nsCOMPtr<nsIURI> mAlternateBindingURI;  // Alternate id-less URI that is only
                                           // non-null on the first binding.
   RefPtr<mozilla::dom::Element>
       mBinding;  // Strong. We own a ref to our content element in the binding
                  // doc.
@@ -306,30 +262,25 @@ class nsXBLPrototypeBinding final
   nsCOMPtr<nsIURI> mBaseBindingURI;
 
   nsXBLProtoImpl* mImplementation;  // Our prototype implementation (includes
                                     // methods, properties, fields, the
                                     // constructor, and the destructor).
 
   // Weak.  The docinfo will own our base binding.
   mozilla::WeakPtr<nsXBLPrototypeBinding> mBaseBinding;
-  // FIXME(emilio): This is dead code now.
-  bool mInheritStyle;
   bool mCheckedBaseProto;
   bool mKeyHandlersRegistered;
   // FIXME(emilio): This is dead code now.
   bool mBindToUntrustedContent;
   // True if constructors, handlers, etc for this binding would skip the scope
   // chain for parent elements and go directly to the document.
   // FIXME(emilio): This is dead code now.
   bool mSimpleScopeChain;
 
-  nsAutoPtr<nsXBLPrototypeResources>
-      mResources;  // If we have any resources, this will be non-null.
-
   nsXBLDocumentInfo* mXBLDocInfoWeak;  // A pointer back to our doc info.  Weak,
                                        // since it owns us.
 
   // A table for attribute containers. Namespace IDs are used as
   // keys in the table. Containers are InnerAttributeTables.
   // This table is used to efficiently handle attribute changes.
   nsAutoPtr<nsClassHashtable<nsUint32HashKey, InnerAttributeTable>>
       mAttributeTable;
deleted file mode 100644
--- a/dom/xbl/nsXBLPrototypeResources.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/dom/Document.h"
-#include "nsIContent.h"
-#include "nsIPresShellInlines.h"
-#include "nsIServiceManager.h"
-#include "nsXBLResourceLoader.h"
-#include "nsXBLPrototypeResources.h"
-#include "nsXBLPrototypeBinding.h"
-#include "nsIDocumentObserver.h"
-#include "mozilla/css/Loader.h"
-#include "nsIURI.h"
-#include "nsLayoutCID.h"
-#include "mozilla/dom/URL.h"
-#include "mozilla/DebugOnly.h"
-#include "mozilla/PresShell.h"
-#include "mozilla/ServoBindings.h"
-#include "mozilla/ServoStyleRuleMap.h"
-#include "mozilla/StyleSheet.h"
-#include "mozilla/StyleSheetInlines.h"
-
-using namespace mozilla;
-using mozilla::dom::IsChromeURI;
-
-nsXBLPrototypeResources::nsXBLPrototypeResources(
-    nsXBLPrototypeBinding* aBinding) {
-  MOZ_COUNT_CTOR(nsXBLPrototypeResources);
-
-  mLoader = new nsXBLResourceLoader(aBinding, this);
-}
-
-nsXBLPrototypeResources::~nsXBLPrototypeResources() {
-  MOZ_COUNT_DTOR(nsXBLPrototypeResources);
-  if (mLoader) {
-    mLoader->mResources = nullptr;
-  }
-}
-
-void nsXBLPrototypeResources::AddResource(nsAtom* aResourceType,
-                                          const nsAString& aSrc) {
-  if (mLoader) mLoader->AddResource(aResourceType, aSrc);
-}
-
-bool nsXBLPrototypeResources::LoadResources(nsIContent* aBoundElement) {
-  if (mLoader) {
-    return mLoader->LoadResources(aBoundElement);
-  }
-
-  return true;  // All resources loaded.
-}
-
-void nsXBLPrototypeResources::AddResourceListener(nsIContent* aBoundElement) {
-  if (mLoader) mLoader->AddResourceListener(aBoundElement);
-}
-
-nsresult nsXBLPrototypeResources::FlushSkinSheets() {
-  if (mStyleSheetList.Length() == 0) return NS_OK;
-
-  nsCOMPtr<Document> doc = mLoader->mBinding->XBLDocumentInfo()->GetDocument();
-
-  // If doc is null, we're in the process of tearing things down, so just
-  // return without rebuilding anything.
-  if (!doc) {
-    return NS_OK;
-  }
-
-  // We have scoped stylesheets.  Reload any chrome stylesheets we
-  // encounter.  (If they aren't skin sheets, it doesn't matter, since
-  // they'll still be in the chrome cache.  Skip inline sheets, which
-  // skin sheets can't be, and which in any case don't have a usable
-  // URL to reload.)
-
-  nsTArray<RefPtr<StyleSheet>> oldSheets;
-
-  oldSheets.SwapElements(mStyleSheetList);
-
-  mozilla::css::Loader* cssLoader = doc->CSSLoader();
-
-  for (size_t i = 0, count = oldSheets.Length(); i < count; ++i) {
-    StyleSheet* oldSheet = oldSheets[i];
-
-    nsIURI* uri = oldSheet->GetSheetURI();
-
-    RefPtr<StyleSheet> newSheet;
-    if (!oldSheet->IsInline() && IsChromeURI(uri)) {
-      if (NS_FAILED(cssLoader->LoadSheetSync(uri, &newSheet))) continue;
-    } else {
-      newSheet = oldSheet;
-    }
-
-    mStyleSheetList.AppendElement(newSheet);
-  }
-
-  // There may be no shell during unlink.
-  if (PresShell* presShell = doc->GetPresShell()) {
-    MOZ_ASSERT(presShell->GetPresContext());
-    ComputeServoStyles(*presShell->StyleSet());
-  }
-
-  return NS_OK;
-}
-
-nsresult nsXBLPrototypeResources::Write(nsIObjectOutputStream* aStream) {
-  if (mLoader) return mLoader->Write(aStream);
-  return NS_OK;
-}
-
-void nsXBLPrototypeResources::Traverse(nsCycleCollectionTraversalCallback& cb) {
-  NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "proto mResources mLoader");
-  cb.NoteXPCOMChild(mLoader);
-
-  ImplCycleCollectionTraverse(cb, mStyleSheetList, "mStyleSheetList");
-}
-
-void nsXBLPrototypeResources::Unlink() { mStyleSheetList.Clear(); }
-
-void nsXBLPrototypeResources::ClearLoader() { mLoader = nullptr; }
-
-void nsXBLPrototypeResources::SyncServoStyles() {
-  mStyleRuleMap.reset(nullptr);
-  mServoStyles = Servo_AuthorStyles_Create().Consume();
-  for (auto& sheet : mStyleSheetList) {
-    Servo_AuthorStyles_AppendStyleSheet(mServoStyles.get(), sheet);
-  }
-}
-
-void nsXBLPrototypeResources::ComputeServoStyles(
-    const ServoStyleSet& aMasterStyleSet) {
-  SyncServoStyles();
-  Servo_AuthorStyles_Flush(mServoStyles.get(), aMasterStyleSet.RawSet());
-}
-
-ServoStyleRuleMap* nsXBLPrototypeResources::GetServoStyleRuleMap() {
-  if (!HasStyleSheets() || !mServoStyles) {
-    return nullptr;
-  }
-
-  if (!mStyleRuleMap) {
-    mStyleRuleMap = MakeUnique<ServoStyleRuleMap>();
-  }
-
-  mStyleRuleMap->EnsureTable(*this);
-  return mStyleRuleMap.get();
-}
-
-void nsXBLPrototypeResources::AppendStyleSheet(StyleSheet* aSheet) {
-  mStyleSheetList.AppendElement(aSheet);
-}
-
-void nsXBLPrototypeResources::RemoveStyleSheet(StyleSheet* aSheet) {
-  mStyleSheetList.RemoveElement(aSheet);
-}
-
-void nsXBLPrototypeResources::InsertStyleSheetAt(size_t aIndex,
-                                                 StyleSheet* aSheet) {
-  mStyleSheetList.InsertElementAt(aIndex, aSheet);
-}
-
-void nsXBLPrototypeResources::AppendStyleSheetsTo(
-    nsTArray<StyleSheet*>& aResult) const {
-  aResult.AppendElements(mStyleSheetList);
-}
-
-MOZ_DEFINE_MALLOC_SIZE_OF(ServoAuthorStylesMallocSizeOf)
-MOZ_DEFINE_MALLOC_ENCLOSING_SIZE_OF(ServoAuthorStylesMallocEnclosingSizeOf)
-
-size_t nsXBLPrototypeResources::SizeOfIncludingThis(
-    MallocSizeOf aMallocSizeOf) const {
-  size_t n = aMallocSizeOf(this);
-  n += mStyleSheetList.ShallowSizeOfExcludingThis(aMallocSizeOf);
-  for (const auto& sheet : mStyleSheetList) {
-    n += sheet->SizeOfIncludingThis(aMallocSizeOf);
-  }
-  n += mServoStyles
-           ? Servo_AuthorStyles_SizeOfIncludingThis(
-                 ServoAuthorStylesMallocSizeOf,
-                 ServoAuthorStylesMallocEnclosingSizeOf, mServoStyles.get())
-           : 0;
-  n += mStyleRuleMap ? mStyleRuleMap->SizeOfIncludingThis(aMallocSizeOf) : 0;
-
-  // Measurement of the following members may be added later if DMD finds it
-  // is worthwhile:
-  // - mLoader
-
-  return n;
-}
deleted file mode 100644
--- a/dom/xbl/nsXBLPrototypeResources.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsXBLPrototypeResources_h__
-#define nsXBLPrototypeResources_h__
-
-#include "mozilla/MemoryReporting.h"
-#include "mozilla/StyleSheet.h"
-#include "nsICSSLoaderObserver.h"
-
-class nsAtom;
-class nsIContent;
-class nsXBLPrototypeBinding;
-class nsXBLResourceLoader;
-struct RawServoAuthorStyles;
-
-namespace mozilla {
-class CSSStyleSheet;
-class ServoStyleSet;
-class ServoStyleRuleMap;
-}  // namespace mozilla
-
-// *********************************************************************/
-// The XBLPrototypeResources class
-
-class nsXBLPrototypeResources {
- public:
-  explicit nsXBLPrototypeResources(nsXBLPrototypeBinding* aBinding);
-  ~nsXBLPrototypeResources();
-
-  bool LoadResources(nsIContent* aBoundElement);
-  void AddResource(nsAtom* aResourceType, const nsAString& aSrc);
-  void AddResourceListener(nsIContent* aElement);
-  nsresult FlushSkinSheets();
-
-  nsresult Write(nsIObjectOutputStream* aStream);
-
-  void Traverse(nsCycleCollectionTraversalCallback& cb);
-  void Unlink();
-
-  void ClearLoader();
-
-  void AppendStyleSheet(mozilla::StyleSheet* aSheet);
-  void RemoveStyleSheet(mozilla::StyleSheet* aSheet);
-  void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheet* aSheet);
-
-  mozilla::StyleSheet* StyleSheetAt(size_t aIndex) const {
-    return mStyleSheetList[aIndex];
-  }
-
-  size_t SheetCount() const { return mStyleSheetList.Length(); }
-
-  bool HasStyleSheets() const { return !mStyleSheetList.IsEmpty(); }
-
-  void AppendStyleSheetsTo(nsTArray<mozilla::StyleSheet*>& aResult) const;
-
-  const RawServoAuthorStyles* GetServoStyles() const {
-    return mServoStyles.get();
-  }
-
-  void SyncServoStyles();
-
-  mozilla::ServoStyleRuleMap* GetServoStyleRuleMap();
-
-  // Updates the ServoStyleSet object that holds the result of cascading the
-  // sheets in mStyleSheetList. Equivalent to GatherRuleProcessor(), but for
-  // the Servo style backend.
-  void ComputeServoStyles(const mozilla::ServoStyleSet& aMasterStyleSet);
-
-  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
- private:
-  // A loader object. Exists only long enough to load resources, and then it
-  // dies.
-  RefPtr<nsXBLResourceLoader> mLoader;
-
-  // A list of loaded stylesheets for this binding.
-  //
-  // FIXME(emilio): Remove when the old style system is gone, defer to
-  // mServoStyles.
-  nsTArray<RefPtr<mozilla::StyleSheet>> mStyleSheetList;
-
-  // The result of cascading the XBL style sheets like mRuleProcessor, but
-  // for the Servo style backend.
-  mozilla::UniquePtr<RawServoAuthorStyles> mServoStyles;
-  mozilla::UniquePtr<mozilla::ServoStyleRuleMap> mStyleRuleMap;
-};
-
-#endif
deleted file mode 100644
--- a/dom/xbl/nsXBLResourceLoader.cpp
+++ /dev/null
@@ -1,251 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsTArray.h"
-#include "nsString.h"
-#include "mozilla/dom/Document.h"
-#include "nsIContent.h"
-#include "nsIPresShellInlines.h"
-#include "nsXBLService.h"
-#include "nsIServiceManager.h"
-#include "nsXBLResourceLoader.h"
-#include "nsXBLPrototypeResources.h"
-#include "nsIDocumentObserver.h"
-#include "imgILoader.h"
-#include "imgRequestProxy.h"
-#include "mozilla/ComputedStyle.h"
-#include "mozilla/PresShell.h"
-#include "mozilla/StyleSheet.h"
-#include "mozilla/StyleSheetInlines.h"
-#include "mozilla/css/Loader.h"
-#include "nsIURI.h"
-#include "nsNetUtil.h"
-#include "nsGkAtoms.h"
-#include "nsXBLPrototypeBinding.h"
-#include "nsContentUtils.h"
-#include "nsIScriptSecurityManager.h"
-
-using namespace mozilla;
-
-NS_IMPL_CYCLE_COLLECTION(nsXBLResourceLoader, mBoundElements)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXBLResourceLoader)
-  NS_INTERFACE_MAP_ENTRY(nsICSSLoaderObserver)
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXBLResourceLoader)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXBLResourceLoader)
-
-struct nsXBLResource {
-  nsXBLResource* mNext;
-  nsAtom* mType;
-  nsString mSrc;
-
-  nsXBLResource(nsAtom* aType, const nsAString& aSrc) {
-    MOZ_COUNT_CTOR(nsXBLResource);
-    mNext = nullptr;
-    mType = aType;
-    mSrc = aSrc;
-  }
-
-  ~nsXBLResource() {
-    MOZ_COUNT_DTOR(nsXBLResource);
-    NS_CONTENT_DELETE_LIST_MEMBER(nsXBLResource, this, mNext);
-  }
-};
-
-nsXBLResourceLoader::nsXBLResourceLoader(nsXBLPrototypeBinding* aBinding,
-                                         nsXBLPrototypeResources* aResources)
-    : mBinding(aBinding),
-      mResources(aResources),
-      mResourceList(nullptr),
-      mLastResource(nullptr),
-      mLoadingResources(false),
-      mInLoadResourcesFunc(false),
-      mPendingSheets(0),
-      mBoundDocument(nullptr) {}
-
-nsXBLResourceLoader::~nsXBLResourceLoader() { delete mResourceList; }
-
-bool nsXBLResourceLoader::LoadResources(nsIContent* aBoundElement) {
-  mInLoadResourcesFunc = true;
-
-  if (mLoadingResources) {
-    mInLoadResourcesFunc = false;
-    return mPendingSheets == 0;
-  }
-
-  mLoadingResources = true;
-
-  // Declare our loaders.
-  nsCOMPtr<Document> doc = mBinding->XBLDocumentInfo()->GetDocument();
-  mBoundDocument = aBoundElement->OwnerDoc();
-
-  mozilla::css::Loader* cssLoader = doc->CSSLoader();
-  MOZ_ASSERT(cssLoader->GetDocument(), "Loader must have document");
-
-  nsIURI* docURL = doc->GetDocumentURI();
-  nsIPrincipal* docPrincipal = doc->NodePrincipal();
-
-  nsCOMPtr<nsIURI> url;
-
-  for (nsXBLResource* curr = mResourceList; curr; curr = curr->mNext) {
-    if (curr->mSrc.IsEmpty()) continue;
-
-    if (NS_FAILED(NS_NewURI(getter_AddRefs(url), curr->mSrc,
-                            doc->GetDocumentCharacterSet(), docURL)))
-      continue;
-
-    if (curr->mType == nsGkAtoms::image) {
-      // Now kick off the image load...
-      // Passing nullptr for pretty much everything -- cause we don't care!
-      // XXX: initialDocumentURI is nullptr!
-      RefPtr<imgRequestProxy> req;
-      nsContentUtils::LoadImage(url, doc, doc, docPrincipal, 0, docURL,
-                                doc->GetReferrerPolicy(), nullptr,
-                                nsIRequest::LOAD_BACKGROUND, EmptyString(),
-                                getter_AddRefs(req));
-    } else if (curr->mType == nsGkAtoms::stylesheet) {
-      // Kick off the load of the stylesheet.
-
-      // Always load chrome synchronously
-      // XXXbz should that still do a content policy check?
-      bool chrome;
-      nsresult rv;
-      if (NS_SUCCEEDED(url->SchemeIs("chrome", &chrome)) && chrome) {
-        rv = nsContentUtils::GetSecurityManager()->CheckLoadURIWithPrincipal(
-            docPrincipal, url, nsIScriptSecurityManager::ALLOW_CHROME);
-        if (NS_SUCCEEDED(rv)) {
-          RefPtr<StyleSheet> sheet;
-          rv = cssLoader->LoadSheetSync(url, &sheet);
-          NS_ASSERTION(NS_SUCCEEDED(rv), "Load failed!!!");
-          if (NS_SUCCEEDED(rv)) {
-            rv = StyleSheetLoaded(sheet, false, NS_OK);
-            NS_ASSERTION(NS_SUCCEEDED(rv),
-                         "Processing the style sheet failed!!!");
-          }
-        }
-      } else {
-        rv = cssLoader->LoadSheet(url, false, docPrincipal, nullptr, this);
-        if (NS_SUCCEEDED(rv)) ++mPendingSheets;
-      }
-    }
-  }
-
-  mInLoadResourcesFunc = false;
-
-  // Destroy our resource list.
-  delete mResourceList;
-  mResourceList = nullptr;
-
-  return mPendingSheets == 0;
-}
-
-// nsICSSLoaderObserver
-NS_IMETHODIMP
-nsXBLResourceLoader::StyleSheetLoaded(StyleSheet* aSheet, bool aWasDeferred,
-                                      nsresult aStatus) {
-  if (!mResources) {
-    // Our resources got destroyed -- just bail out
-    return NS_OK;
-  }
-
-  mResources->AppendStyleSheet(aSheet);
-
-  if (!mInLoadResourcesFunc) mPendingSheets--;
-
-  if (mPendingSheets == 0) {
-    // All stylesheets are loaded.
-
-    // Our document might have been undisplayed after this sheet load
-    // was started, so check before building the XBL cascade data.
-    if (PresShell* presShell = mBoundDocument->GetPresShell()) {
-      mResources->ComputeServoStyles(*presShell->StyleSet());
-    }
-
-    // XXX Check for mPendingScripts when scripts also come online.
-    if (!mInLoadResourcesFunc) NotifyBoundElements();
-  }
-  return NS_OK;
-}
-
-void nsXBLResourceLoader::AddResource(nsAtom* aResourceType,
-                                      const nsAString& aSrc) {
-  nsXBLResource* res = new nsXBLResource(aResourceType, aSrc);
-  if (!mResourceList)
-    mResourceList = res;
-  else
-    mLastResource->mNext = res;
-
-  mLastResource = res;
-}
-
-void nsXBLResourceLoader::AddResourceListener(nsIContent* aBoundElement) {
-  if (aBoundElement) {
-    mBoundElements.AppendObject(aBoundElement);
-    aBoundElement->OwnerDoc()->BlockOnload();
-  }
-}
-
-void nsXBLResourceLoader::NotifyBoundElements() {
-  nsXBLService* xblService = nsXBLService::GetInstance();
-  if (!xblService) return;
-
-  nsIURI* bindingURI = mBinding->BindingURI();
-
-  uint32_t eltCount = mBoundElements.Count();
-  for (uint32_t j = 0; j < eltCount; j++) {
-    nsCOMPtr<nsIContent> content = mBoundElements.ObjectAt(j);
-    MOZ_ASSERT(content->IsElement());
-    content->OwnerDoc()->UnblockOnload(/* aFireSync = */ false);
-
-    bool ready = false;
-    xblService->BindingReady(content, bindingURI, &ready);
-
-    if (!ready) {
-      continue;
-    }
-
-    Document* doc = content->GetUncomposedDoc();
-    if (!doc) {
-      continue;
-    }
-
-    PresShell* presShell = doc->GetPresShell();
-    if (!presShell) {
-      continue;
-    }
-
-    presShell->PostRecreateFramesFor(content->AsElement());
-  }
-
-  // Clear out the whole array.
-  mBoundElements.Clear();
-
-  // Delete ourselves.
-  mResources->ClearLoader();
-}
-
-nsresult nsXBLResourceLoader::Write(nsIObjectOutputStream* aStream) {
-  nsresult rv;
-
-  for (nsXBLResource* curr = mResourceList; curr; curr = curr->mNext) {
-    if (curr->mType == nsGkAtoms::image)
-      rv = aStream->Write8(XBLBinding_Serialize_Image);
-    else if (curr->mType == nsGkAtoms::stylesheet)
-      rv = aStream->Write8(XBLBinding_Serialize_Stylesheet);
-    else
-      continue;
-
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = aStream->WriteWStringZ(curr->mSrc.get());
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  return NS_OK;
-}
deleted file mode 100644
--- a/dom/xbl/nsXBLResourceLoader.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsXBLResourceLoader_h
-#define nsXBLResourceLoader_h
-
-#include "mozilla/Attributes.h"
-#include "nsCOMPtr.h"
-#include "nsICSSLoaderObserver.h"
-#include "nsCOMArray.h"
-#include "nsCycleCollectionParticipant.h"
-
-class nsIContent;
-class nsAtom;
-class nsXBLPrototypeResources;
-class nsXBLPrototypeBinding;
-struct nsXBLResource;
-class nsIObjectOutputStream;
-
-// *********************************************************************/
-// The XBLResourceLoader class
-
-class nsXBLResourceLoader : public nsICSSLoaderObserver {
- public:
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_CLASS(nsXBLResourceLoader)
-
-  // nsICSSLoaderObserver
-  NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet, bool aWasAlternate,
-                              nsresult aStatus) override;
-
-  bool LoadResources(nsIContent* aBoundElement);
-  void AddResource(nsAtom* aResourceType, const nsAString& aSrc);
-  void AddResourceListener(nsIContent* aElement);
-
-  nsXBLResourceLoader(nsXBLPrototypeBinding* aBinding,
-                      nsXBLPrototypeResources* aResources);
-
-  void NotifyBoundElements();
-
-  nsresult Write(nsIObjectOutputStream* aStream);
-
-  // MEMBER VARIABLES
-  nsXBLPrototypeBinding* mBinding;      // A pointer back to our binding.
-  nsXBLPrototypeResources* mResources;  // A pointer back to our resources
-                                        // information.  May be null if the
-                                        // resources have already been
-                                        // destroyed.
-
-  nsXBLResource* mResourceList;  // The list of resources we need to load.
-  nsXBLResource* mLastResource;
-
-  bool mLoadingResources;
-  // We need mInLoadResourcesFunc because we do a mixture of sync and
-  // async loads.
-  bool mInLoadResourcesFunc;
-  int16_t mPendingSheets;  // The number of stylesheets that have yet to load.
-
-  // Bound elements that are waiting on the stylesheets and scripts.
-  nsCOMArray<nsIContent> mBoundElements;
-
- protected:
-  virtual ~nsXBLResourceLoader();
-
- private:
-  // The bound document is needed in StyleSheetLoaded() for servo style
-  // backend, which will be set in LoadResources().
-  dom::Document* MOZ_NON_OWNING_REF mBoundDocument;
-};
-
-#endif
--- a/dom/xbl/nsXBLSerialize.h
+++ b/dom/xbl/nsXBLSerialize.h
@@ -11,24 +11,21 @@
 #include "nsIObjectOutputStream.h"
 #include "mozilla/dom/NameSpaceConstants.h"
 #include "js/TypeDecls.h"
 
 typedef uint8_t XBLBindingSerializeDetails;
 
 // A version number to ensure we don't load cached data in a different
 // file format.
-#define XBLBinding_Serialize_Version 0x00000006
+#define XBLBinding_Serialize_Version 0x00000007
 
 // Set for the first binding in a document
 #define XBLBinding_Serialize_IsFirstBinding (1 << 0)
 
-// Set to indicate that nsXBLPrototypeBinding::mInheritStyle should be true
-#define XBLBinding_Serialize_InheritStyle (1 << 1)
-
 // Set to indicate that nsXBLPrototypeBinding::mBindToUntrustedContent should be
 // true
 #define XBLBinding_Serialize_BindToUntrustedContent (1 << 3)
 
 // Set to indicate that nsXBLPrototypeBinding::mSimpleScopeChain should be true
 #define XBLBinding_Serialize_SimpleScopeChain (1 << 4)
 
 // Appears at the end of the serialized data to indicate that no more bindings
@@ -44,18 +41,16 @@ typedef uint8_t XBLBindingSerializeDetai
 #define XBLBinding_Serialize_Field 1
 #define XBLBinding_Serialize_GetterProperty 2
 #define XBLBinding_Serialize_SetterProperty 3
 #define XBLBinding_Serialize_GetterSetterProperty 4
 #define XBLBinding_Serialize_Method 5
 #define XBLBinding_Serialize_Constructor 6
 #define XBLBinding_Serialize_Destructor 7
 #define XBLBinding_Serialize_Handler 8
-#define XBLBinding_Serialize_Image 9
-#define XBLBinding_Serialize_Stylesheet 10
 #define XBLBinding_Serialize_Attribute 0xA
 #define XBLBinding_Serialize_Mask 0x0F
 #define XBLBinding_Serialize_ReadOnly 0x80
 
 // Appears at the end of the list of insertion points to indicate that there
 // are no more.
 #define XBLBinding_Serialize_NoMoreInsertionPoints 0xFFFFFFFF
 
--- a/dom/xbl/nsXBLService.cpp
+++ b/dom/xbl/nsXBLService.cpp
@@ -394,45 +394,34 @@ class MOZ_RAII AutoEnsureSubtreeStyled {
 
  private:
   Element* mElement;
 };
 
 // RAII class to restyle the XBL bound element when it shuffles the flat tree.
 class MOZ_RAII AutoStyleElement {
  public:
-  AutoStyleElement(Element* aElement, bool* aResolveStyle)
-      : mElement(aElement),
-        mHadData(aElement->HasServoData()),
-        mResolveStyle(aResolveStyle) {
-    MOZ_ASSERT(mResolveStyle);
+  explicit AutoStyleElement(Element* aElement)
+      : mElement(aElement), mHadData(aElement->HasServoData()) {
     if (mHadData) {
       RestyleManager::ClearServoDataFromSubtree(
           mElement, RestyleManager::IncludeRoot::No);
     }
   }
 
   ~AutoStyleElement() {
     PresShell* presShell = mElement->OwnerDoc()->GetPresShell();
     if (!mHadData || !presShell || !presShell->DidInitialize()) {
       return;
     }
-
-    if (*mResolveStyle) {
-      mElement->ClearServoData();
-
-      ServoStyleSet* servoSet = presShell->StyleSet();
-      servoSet->StyleNewSubtree(mElement);
-    }
   }
 
  private:
   Element* mElement;
   bool mHadData;
-  bool* mResolveStyle;
 };
 
 static bool IsSystemOrChromeURLPrincipal(nsIPrincipal* aPrincipal) {
   if (nsContentUtils::IsSystemPrincipal(aPrincipal)) {
     return true;
   }
 
   nsCOMPtr<nsIURI> uri;
@@ -442,22 +431,20 @@ static bool IsSystemOrChromeURLPrincipal
   bool isChrome = false;
   return NS_SUCCEEDED(uri->SchemeIs("chrome", &isChrome)) && isChrome;
 }
 
 // This function loads a particular XBL file and installs all of the bindings
 // onto the element.
 nsresult nsXBLService::LoadBindings(Element* aElement, nsIURI* aURL,
                                     nsIPrincipal* aOriginPrincipal,
-                                    nsXBLBinding** aBinding,
-                                    bool* aResolveStyle) {
+                                    nsXBLBinding** aBinding) {
   MOZ_ASSERT(aOriginPrincipal, "Must have an origin principal");
 
   *aBinding = nullptr;
-  *aResolveStyle = false;
 
   AutoEnsureSubtreeStyled subtreeStyled(aElement);
 
   if (MOZ_UNLIKELY(!aURL)) {
     return NS_OK;
   }
 
 #ifdef DEBUG
@@ -491,17 +478,17 @@ nsresult nsXBLService::LoadBindings(Elem
   nsCOMPtr<Document> document = aElement->OwnerDoc();
 
   nsAutoCString urlspec;
   nsresult rv = aURL->GetSpec(urlspec);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
-  AutoStyleElement styleElement(aElement, aResolveStyle);
+  AutoStyleElement styleElement(aElement);
 
   if (binding) {
     FlushStyleBindings(aElement);
     binding = nullptr;
   }
 
   bool ready;
   RefPtr<nsXBLBinding> newBinding;
@@ -542,19 +529,16 @@ nsresult nsXBLService::LoadBindings(Elem
 
     // Tell the binding to install event handlers
     newBinding->InstallEventHandlers();
 
     // Set up our properties
     rv = newBinding->InstallImplementation();
     NS_ENSURE_SUCCESS(rv, rv);
 
-    // Figure out if we have any scoped sheets.  If so, we do a second resolve.
-    *aResolveStyle = newBinding->HasStyleSheets();
-
     newBinding.forget(aBinding);
   }
 
   return NS_OK;
 }
 
 void nsXBLService::FlushStyleBindings(Element* aElement) {
   nsCOMPtr<Document> document = aElement->OwnerDoc();
@@ -766,25 +750,16 @@ nsresult nsXBLService::GetBinding(nsICon
   }
 
   aDontExtendURIs.AppendElement(protoBinding->BindingURI());
   nsCOMPtr<nsIURI> altBindingURI = protoBinding->AlternateBindingURI();
   if (altBindingURI) {
     aDontExtendURIs.AppendElement(altBindingURI);
   }
 
-  // Our prototype binding must have all its resources loaded.
-  bool ready = protoBinding->LoadResources(aBoundElement);
-  if (!ready) {
-    // Add our bound element to the protos list of elts that should
-    // be notified when the stylesheets and scripts finish loading.
-    protoBinding->AddResourceListener(aBoundElement);
-    return NS_ERROR_FAILURE;  // The binding isn't ready yet.
-  }
-
   rv = protoBinding->ResolveBaseBinding();
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIURI> baseBindingURI;
   WeakPtr<nsXBLPrototypeBinding> baseProto = protoBinding->GetBasePrototype();
   if (baseProto) {
     baseBindingURI = baseProto->BindingURI();
   } else {
--- a/dom/xbl/nsXBLService.h
+++ b/dom/xbl/nsXBLService.h
@@ -19,16 +19,17 @@ class nsXBLBinding;
 class nsXBLDocumentInfo;
 class nsIContent;
 class nsIURI;
 class nsIPrincipal;
 
 namespace mozilla {
 namespace dom {
 class Document;
+class Element;
 class EventTarget;
 }  // namespace dom
 }  // namespace mozilla
 
 class nsXBLService final : public nsSupportsWeakReference {
   NS_DECL_ISUPPORTS
 
   static nsXBLService* gInstance;
@@ -39,18 +40,18 @@ class nsXBLService final : public nsSupp
 
   static nsXBLService* GetInstance() { return gInstance; }
 
   static bool IsChromeOrResourceURI(nsIURI* aURI);
 
   // This function loads a particular XBL file and installs all of the bindings
   // onto the element.  aOriginPrincipal must not be null here.
   nsresult LoadBindings(mozilla::dom::Element* aElement, nsIURI* aURL,
-                        nsIPrincipal* aOriginPrincipal, nsXBLBinding** aBinding,
-                        bool* aResolveStyle);
+                        nsIPrincipal* aOriginPrincipal,
+                        nsXBLBinding** aBinding);
 
   // Indicates whether or not a binding is fully loaded.
   nsresult BindingReady(nsIContent* aBoundElement, nsIURI* aURI,
                         bool* aIsReady);
 
   // This method checks the hashtable and then calls FetchBindingDocument on a
   // miss.  aOriginPrincipal or aBoundDocument may be null to bypass security
   // checks.
--- a/dom/xul/nsXULPrototypeCache.cpp
+++ b/dom/xul/nsXULPrototypeCache.cpp
@@ -224,23 +224,16 @@ void nsXULPrototypeCache::FlushSkinFiles
   // 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();
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -2247,43 +2247,37 @@ nsIFrame* nsCSSFrameConstructor::Constru
   const nsStyleDisplay* display = computedStyle->StyleDisplay();
 
   // Ensure that our XBL bindings are installed.
   //
   // FIXME(emilio): Can we remove support for bindings on the root?
   if (display->mBinding) {
     // Get the XBL loader.
     nsresult rv;
-    bool resolveStyle;
 
     nsXBLService* xblService = nsXBLService::GetInstance();
     if (!xblService) {
       return nullptr;
     }
 
     RefPtr<nsXBLBinding> binding;
     rv = xblService->LoadBindings(aDocElement, display->mBinding->GetURI(),
                                   display->mBinding->ExtraData()->Principal(),
-                                  getter_AddRefs(binding), &resolveStyle);
+                                  getter_AddRefs(binding));
     if (NS_FAILED(rv) && rv != NS_ERROR_XBL_BLOCKED) {
       // Binding will load asynchronously.
       return nullptr;
     }
 
     if (binding) {
       // For backwards compat, keep firing the root's constructor
       // after all of its kids' constructors.  So tell the binding
       // manager about it right now.
       mDocument->BindingManager()->AddToAttachedQueue(binding);
     }
-
-    if (resolveStyle) {
-      computedStyle = mPresShell->StyleSet()->ResolveServoStyle(*aDocElement);
-      display = computedStyle->StyleDisplay();
-    }
   }
 
   // --------- IF SCROLLABLE WRAP IN SCROLLFRAME --------
 
   NS_ASSERTION(!display->IsScrollableOverflow() ||
                    state.mPresContext->IsPaginated() ||
                    propagatedScrollFrom == aDocElement,
                "Scrollbars should have been propagated to the viewport");
@@ -5299,133 +5293,117 @@ nsCSSFrameConstructor::FindElementTagDat
     case kNameSpaceID_XUL:
       return FindXULTagData(aElement, aStyle);
     default:
       return nullptr;
   }
 }
 
 nsCSSFrameConstructor::XBLBindingLoadInfo::XBLBindingLoadInfo(
-    already_AddRefed<ComputedStyle>&& aStyle,
     UniquePtr<PendingBinding> aPendingBinding)
-    : mStyle(std::move(aStyle)), mPendingBinding(std::move(aPendingBinding)) {
-  MOZ_ASSERT(mStyle);
-}
-
-nsCSSFrameConstructor::XBLBindingLoadInfo::XBLBindingLoadInfo(
-    nsIContent& aContent, ComputedStyle& aStyle)
-    : mStyle(&aStyle), mPendingBinding(nullptr) {}
+    : mPendingBinding(std::move(aPendingBinding)), mSuccess(true) {}
 
 nsCSSFrameConstructor::XBLBindingLoadInfo::XBLBindingLoadInfo() = default;
 
 nsCSSFrameConstructor::XBLBindingLoadInfo
 nsCSSFrameConstructor::LoadXBLBindingIfNeeded(nsIContent& aContent,
-                                              ComputedStyle& aStyle,
+                                              const ComputedStyle& aStyle,
                                               uint32_t aFlags) {
   if (!(aFlags & ITEM_ALLOW_XBL_BASE)) {
-    return {aContent, aStyle};
+    return XBLBindingLoadInfo(nullptr);
   }
   css::URLValue* binding = aStyle.StyleDisplay()->mBinding;
   if (!binding) {
-    return {aContent, aStyle};
+    return XBLBindingLoadInfo(nullptr);
   }
 
   nsXBLService* xblService = nsXBLService::GetInstance();
   if (!xblService) {
     return {};
   }
 
   auto newPendingBinding = MakeUnique<PendingBinding>();
 
-  bool resolveStyle;
-  nsresult rv = xblService->LoadBindings(
-      aContent.AsElement(), binding->GetURI(),
-      binding->ExtraData()->Principal(),
-      getter_AddRefs(newPendingBinding->mBinding), &resolveStyle);
+  nsresult rv =
+      xblService->LoadBindings(aContent.AsElement(), binding->GetURI(),
+                               binding->ExtraData()->Principal(),
+                               getter_AddRefs(newPendingBinding->mBinding));
   if (NS_FAILED(rv)) {
     if (rv == NS_ERROR_XBL_BLOCKED) {
-      return {aContent, aStyle};
+      return XBLBindingLoadInfo(nullptr);
     }
     return {};
   }
 
-  RefPtr<ComputedStyle> style =
-      resolveStyle
-          ? mPresShell->StyleSet()->ResolveServoStyle(*aContent.AsElement())
-          : do_AddRef(&aStyle);
-
-  return {style.forget(), std::move(newPendingBinding)};
+  return XBLBindingLoadInfo(std::move(newPendingBinding));
 }
 
 void nsCSSFrameConstructor::AddFrameConstructionItemsInternal(
     nsFrameConstructorState& aState, nsIContent* aContent,
     nsContainerFrame* aParentFrame, bool aSuppressWhiteSpaceOptimizations,
     ComputedStyle* aComputedStyle, uint32_t aFlags,
     FrameConstructionItemList& aItems) {
   MOZ_ASSERT(aContent->IsText() || aContent->IsElement(),
              "Shouldn't get anything else here!");
   MOZ_ASSERT(aContent->IsInComposedDoc());
   MOZ_ASSERT(!aContent->GetPrimaryFrame() || aState.mCreatingExtraFrames ||
              aContent->NodeInfo()->NameAtom() == nsGkAtoms::area);
 
   PendingBinding* pendingBinding = nullptr;
-  RefPtr<ComputedStyle> style;
   {
     XBLBindingLoadInfo xblInfo =
         LoadXBLBindingIfNeeded(*aContent, *aComputedStyle, aFlags);
-    if (!xblInfo.mStyle) {
+    if (!xblInfo.mSuccess) {
       return;
     }
 
     if (xblInfo.mPendingBinding && xblInfo.mPendingBinding->mBinding) {
       pendingBinding = xblInfo.mPendingBinding.get();
       aState.AddPendingBinding(std::move(xblInfo.mPendingBinding));
     }
-
-    style = xblInfo.mStyle.forget();
-    aComputedStyle = style.get();
   }
 
   const bool isGeneratedContent = !!(aFlags & ITEM_IS_GENERATED_CONTENT);
-  MOZ_ASSERT(!isGeneratedContent || style->IsPseudoElement(),
+  MOZ_ASSERT(!isGeneratedContent || aComputedStyle->IsPseudoElement(),
              "Generated content should be a pseudo-element");
 
   FrameConstructionItem* item = nullptr;
   auto cleanupGeneratedContent = mozilla::MakeScopeExit([&]() {
     if (isGeneratedContent && !item) {
       MOZ_ASSERT(!IsDisplayContents(aContent),
                  "This would need to change if we support display: contents "
                  "in generated content");
       aContent->UnbindFromTree();
     }
   });
 
-  const nsStyleDisplay& display = *style->StyleDisplay();
+  const nsStyleDisplay& display = *aComputedStyle->StyleDisplay();
 
   // Pre-check for display "none" - if we find that, don't create
   // any frame at all
   if (display.mDisplay == StyleDisplay::None) {
     return;
   }
 
   if (display.mDisplay == StyleDisplay::Contents) {
     CreateGeneratedContentItem(aState, aParentFrame, *aContent->AsElement(),
-                               *style, PseudoStyleType::before, aItems);
+                               *aComputedStyle, PseudoStyleType::before,
+                               aItems);
 
     FlattenedChildIterator iter(aContent);
     InsertionPoint insertion(aParentFrame, aContent);
     for (nsIContent* child = iter.GetNextChild(); child;
          child = iter.GetNextChild()) {
       AddFrameConstructionItems(aState, child, aSuppressWhiteSpaceOptimizations,
                                 insertion, aItems);
     }
     aItems.SetParentHasNoXBLChildren(!iter.XBLInvolved());
 
     CreateGeneratedContentItem(aState, aParentFrame, *aContent->AsElement(),
-                               *style, PseudoStyleType::after, aItems);
+                               *aComputedStyle, PseudoStyleType::after, aItems);
     return;
   }
 
   nsIContent* parent = aParentFrame ? aParentFrame->GetContent() : nullptr;
   if (ShouldSuppressFrameInSelect(parent, *aContent)) {
     return;
   }
 
@@ -5435,17 +5413,17 @@ void nsCSSFrameConstructor::AddFrameCons
   // ::before and ::after); we always want to create "internal" anonymous
   // content.
   auto* details = HTMLDetailsElement::FromNodeOrNull(parent);
   if (ShouldSuppressFrameInNonOpenDetails(details, aComputedStyle, *aContent)) {
     return;
   }
 
   const FrameConstructionData* data =
-      FindDataForContent(*aContent, *style, aParentFrame, aFlags);
+      FindDataForContent(*aContent, *aComputedStyle, aParentFrame, aFlags);
   if (!data || data->mBits & FCDATA_SUPPRESS_FRAME) {
     return;
   }
 
   bool isPopup = false;
 
 #ifdef MOZ_XUL
   if ((data->mBits & FCDATA_IS_POPUP) && (!aParentFrame ||  // Parent is inline
@@ -5477,25 +5455,26 @@ void nsCSSFrameConstructor::AddFrameCons
     AddPageBreakItem(aContent, aItems);
   }
 
   if (details && details->Open()) {
     auto* summary = HTMLSummaryElement::FromNode(aContent);
     if (summary && summary->IsMainSummary()) {
       // If details is open, the main summary needs to be rendered as if it is
       // the first child, so add the item to the front of the item list.
-      item =
-          aItems.PrependItem(this, data, aContent, pendingBinding,
-                             style.forget(), aSuppressWhiteSpaceOptimizations);
+      item = aItems.PrependItem(this, data, aContent, pendingBinding,
+                                do_AddRef(aComputedStyle),
+                                aSuppressWhiteSpaceOptimizations);
     }
   }
 
   if (!item) {
     item = aItems.AppendItem(this, data, aContent, pendingBinding,
-                             style.forget(), aSuppressWhiteSpaceOptimizations);
+                             do_AddRef(aComputedStyle),
+                             aSuppressWhiteSpaceOptimizations);
   }
   item->mIsText = !aContent->IsElement();
   item->mIsGeneratedContent = isGeneratedContent;
   item->mIsAnonymousContentCreatorContent =
       aFlags & ITEM_IS_ANONYMOUSCONTENTCREATOR_CONTENT;
   if (isGeneratedContent) {
     // We need to keep this alive until the frame takes ownership.
     // This corresponds to the Release in ConstructFramesFromItem.
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -765,32 +765,26 @@ class nsCSSFrameConstructor final : publ
   static const PseudoParentData sPseudoParentData[eParentTypeCount];
 
   // The information that concerns the frame constructor after loading an XBL
   // binding.
   //
   // This is expected to just be used temporarily to aggregate the different
   // objects that LoadXBLBindingIfNeeded returns.
   struct MOZ_STACK_CLASS XBLBindingLoadInfo {
-    RefPtr<ComputedStyle> mStyle;
     mozilla::UniquePtr<PendingBinding> mPendingBinding;
-
-    // For the 'no binding loaded' case.
-    XBLBindingLoadInfo(nsIContent&, ComputedStyle&);
-
-    // For the case we actually load an XBL binding.
-    XBLBindingLoadInfo(already_AddRefed<ComputedStyle>&& aStyle,
-                       mozilla::UniquePtr<PendingBinding> aPendingBinding);
+    bool mSuccess = false;
 
     // For the error case.
     XBLBindingLoadInfo();
+    explicit XBLBindingLoadInfo(mozilla::UniquePtr<PendingBinding>);
   };
 
   // Returns null mStyle member to signal an error.
-  XBLBindingLoadInfo LoadXBLBindingIfNeeded(nsIContent&, ComputedStyle&,
+  XBLBindingLoadInfo LoadXBLBindingIfNeeded(nsIContent&, const ComputedStyle&,
                                             uint32_t aFlags);
 
   const FrameConstructionData* FindDataForContent(nsIContent&, ComputedStyle&,
                                                   nsIFrame* aParentFrame,
                                                   uint32_t aFlags);
 
   // aParentFrame might be null.  If it is, that means it was an inline frame.
   static const FrameConstructionData* FindTextData(const Text&,
--- a/layout/inspector/InspectorUtils.cpp
+++ b/layout/inspector/InspectorUtils.cpp
@@ -179,32 +179,16 @@ void InspectorUtils::GetCSSStyleRules(
 
   AutoTArray<ServoStyleRuleMap*, 1> maps;
   {
     ServoStyleSet* styleSet = presShell->StyleSet();
     ServoStyleRuleMap* map = styleSet->StyleRuleMap();
     maps.AppendElement(map);
   }
 
-  // Collect style rule maps for bindings.
-  for (nsIContent* bindingContent = &aElement; bindingContent;
-       bindingContent = bindingContent->GetBindingParent()) {
-    for (nsXBLBinding* binding = bindingContent->GetXBLBinding(); binding;
-         binding = binding->GetBaseBinding()) {
-      if (auto* map = binding->PrototypeBinding()->GetServoStyleRuleMap()) {
-        maps.AppendElement(map);
-      }
-    }
-    // Note that we intentionally don't cut off here, unlike when we
-    // do styling, because even if style rules from parent binding
-    // do not apply to the element directly in those cases, their
-    // rules may still show up in the list we get above due to the
-    // inheritance in cascading.
-  }
-
   // Now shadow DOM stuff...
   if (auto* shadow = aElement.GetShadowRoot()) {
     maps.AppendElement(&shadow->ServoStyleRuleMap());
   }
 
   for (auto* shadow = aElement.GetContainingShadow(); shadow;
        shadow = shadow->Host()->GetContainingShadow()) {
     maps.AppendElement(&shadow->ServoStyleRuleMap());
--- a/layout/inspector/ServoStyleRuleMap.cpp
+++ b/layout/inspector/ServoStyleRuleMap.cpp
@@ -11,39 +11,29 @@
 #include "mozilla/dom/CSSRuleBinding.h"
 #include "mozilla/dom/CSSStyleRule.h"
 #include "mozilla/dom/Document.h"
 #include "mozilla/dom/ShadowRoot.h"
 #include "mozilla/IntegerRange.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "nsStyleSheetService.h"
-#include "nsXBLPrototypeResources.h"
 
 using namespace mozilla::dom;
 
 namespace mozilla {
 
 void ServoStyleRuleMap::EnsureTable(ServoStyleSet& aStyleSet) {
   if (!IsEmpty()) {
     return;
   }
   aStyleSet.EnumerateStyleSheets(
       [&](StyleSheet& aSheet) { FillTableFromStyleSheet(aSheet); });
 }
 
-void ServoStyleRuleMap::EnsureTable(nsXBLPrototypeResources& aXBLResources) {
-  if (!IsEmpty() || !aXBLResources.GetServoStyles()) {
-    return;
-  }
-  for (auto index : IntegerRange(aXBLResources.SheetCount())) {
-    FillTableFromStyleSheet(*aXBLResources.StyleSheetAt(index));
-  }
-}
-
 void ServoStyleRuleMap::EnsureTable(ShadowRoot& aShadowRoot) {
   if (!IsEmpty()) {
     return;
   }
   for (auto index : IntegerRange(aShadowRoot.SheetCount())) {
     FillTableFromStyleSheet(*aShadowRoot.SheetAt(index));
   }
 }
--- a/layout/inspector/ServoStyleRuleMap.h
+++ b/layout/inspector/ServoStyleRuleMap.h
@@ -8,33 +8,31 @@
 #define mozilla_ServoStyleRuleMap_h
 
 #include "mozilla/dom/CSSStyleRule.h"
 #include "mozilla/StyleSheet.h"
 
 #include "nsDataHashtable.h"
 
 struct RawServoStyleRule;
-class nsXBLPrototypeResources;
 
 namespace mozilla {
 class ServoCSSRuleList;
 class ServoStyleSet;
 namespace css {
 class Rule;
 }  // namespace css
 namespace dom {
 class ShadowRoot;
 }
 class ServoStyleRuleMap {
  public:
   ServoStyleRuleMap() = default;
 
   void EnsureTable(ServoStyleSet&);
-  void EnsureTable(nsXBLPrototypeResources&);
   void EnsureTable(dom::ShadowRoot&);
 
   dom::CSSStyleRule* Lookup(const RawServoStyleRule* aRawRule) const {
     return mTable.Get(aRawRule);
   }
 
   void SheetAdded(StyleSheet&);
   void SheetRemoved(StyleSheet&);
deleted file mode 100644
--- a/layout/reftests/bugs/1375513-ref.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Reference for bug 1375513</title>
-    <style type="text/css">
-    input[type=range] {
-      width: 200px;
-      height: 20px;
-      margin: 0;
-      padding: 0;
-      background-color: blue;
-    }
-
-    input[type=range]::-moz-range-progress {
-      height: 10px;
-      background-color: lime;
-    }
-
-    input[type=range]::-moz-range-track,
-    input[type=range]::-moz-range-thumb {
-      visibility: hidden;
-    }
-    </style>
-  </head>
-  <body>
-    <input type="range">
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/bugs/1375513.css
+++ /dev/null
@@ -1,17 +0,0 @@
-input[type=range] {
-  width: 200px;
-  height: 20px;
-  margin: 0;
-  padding: 0;
-  background-color: blue;
-}
-
-input[type=range]::-moz-range-progress {
-  height: 10px;
-  background-color: lime;
-}
-
-input[type=range]::-moz-range-track,
-input[type=range]::-moz-range-thumb {
-  visibility: hidden;
-}
deleted file mode 100644
--- a/layout/reftests/bugs/1375513.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Test for bug 1375513</title>
-    <style type="text/css">
-    #input {
-      -moz-binding: url(1375513.xml#createInputRange);
-    }
-    </style>
-  </head>
-  <body>
-    <div id="input"></div>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/bugs/1375513.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0"?>
-<bindings xmlns="http://www.mozilla.org/xbl"
-          xmlns:html="http://www.w3.org/1999/xhtml">
-  <binding id="createInputRange">
-    <resources>
-      <stylesheet src="1375513.css"/>
-    </resources>
-    <content><html:input type="range"/></content>
-  </binding>
-</bindings>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -2049,17 +2049,16 @@ skip-if(isDebugBuild&&winWidget) == 1330
 == 1375315-6.html 1375315-6-ref.html
 == 1375315-7.html 1375315-7-ref.html
 == 1375315-8.html 1375315-8-ref.html
 == 1375315-9.html 1375315-9-ref.html
 == 1375315-10.html 1375315-10-ref.html
 == 1375315-11.html 1375315-11-ref.html
 == 1375315-12.html 1375315-12-ref.html
 == 1374062.html 1374062-ref.html
-== 1375513.html 1375513-ref.html
 == 1375674.html 1375674-ref.html
 == 1372041.html 1372041-ref.html
 == 1376092.html 1376092-ref.html
 fuzzy-if(Android,0-3,0-3) needs-focus == 1377447-1.html 1377447-1-ref.html
 needs-focus != 1377447-1.html 1377447-2.html
 == 1379041.html 1379041-ref.html
 == 1379696.html 1379696-ref.html
 == 1380224-1.html 1380224-1-ref.html
--- a/layout/reftests/xul/reftest.list
+++ b/layout/reftests/xul/reftest.list
@@ -57,18 +57,16 @@ fuzzy-if(skiaContent,0-1,0-60) fuzzy-if(
 == object-fit-scale-down-svg-002.xul object-fit-scale-down-svg-002-ref.html
 == object-fit-scale-down-svg-003.xul object-fit-scale-down-svg-003-ref.html
 == object-fit-scale-down-svg-004.xul object-fit-scale-down-svg-004-ref.html
 == object-fit-scale-down-svg-005.xul object-fit-scale-down-svg-005-ref.html
 == object-fit-scale-down-svg-006.xul object-fit-scale-down-svg-006-ref.html
 == object-position-png-001.xul object-position-png-001-ref.html
 == object-position-png-002.xul object-position-png-002-ref.html
 
-== root-binding-style.xul green-ref.xul
-
 == stack-sizing-1.xul stack-sizing-1-ref.xul
 == stack-sizing-2.xul stack-sizing-2-ref.xul
 
 # Tests for rendering SVG images in a XUL <treecell>:
 # XXXdholbert: These are marked as "random" right now, since they might not
 # render the images they trying to test in time for the reftest snapshot, per
 # bug 1218954.
 skip == treecell-image-svg-1a.xul treecell-image-svg-1-ref.xul # bug 1218954
deleted file mode 100644
--- a/layout/reftests/xul/root-binding-style-xbl.css
+++ /dev/null
@@ -1,5 +0,0 @@
-@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
-
-test {
-  background-color: green;
-}
deleted file mode 100644
--- a/layout/reftests/xul/root-binding-style.xul
+++ /dev/null
@@ -1,3 +0,0 @@
-<?xml version="1.0"?>
-<test xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" style="-moz-binding: url(xbl_bindings.xml#root_binding_style)">
-</test>
deleted file mode 100644
--- a/layout/reftests/xul/xbl_bindings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0"?>
-<bindings xmlns="http://www.mozilla.org/xbl">
-  <binding id="root_binding_style">
-    <resources>
-      <stylesheet src="root-binding-style-xbl.css"/>
-    </resources>
-  </binding>
-</bindings>
--- a/layout/style/GeckoBindings.cpp
+++ b/layout/style/GeckoBindings.cpp
@@ -1952,25 +1952,16 @@ FontSizePrefs Gecko_GetBaseSize(nsAtom* 
   return sizes;
 }
 
 const Element* Gecko_GetBindingParent(const Element* aElement) {
   nsIContent* parent = aElement->GetBindingParent();
   return parent ? parent->AsElement() : nullptr;
 }
 
-const RawServoAuthorStyles* Gecko_XBLBinding_GetRawServoStyles(
-    const nsXBLBinding* aXBLBinding) {
-  return aXBLBinding->GetServoStyles();
-}
-
-bool Gecko_XBLBinding_InheritsStyle(const nsXBLBinding* aXBLBinding) {
-  return aXBLBinding->InheritsStyle();
-}
-
 static StaticRefPtr<UACacheReporter> gUACacheReporter;
 
 namespace mozilla {
 
 void InitializeServo() {
   URLExtraData::InitDummy();
   Servo_Initialize(URLExtraData::Dummy());
 
--- a/layout/style/GeckoBindings.h
+++ b/layout/style/GeckoBindings.h
@@ -690,20 +690,16 @@ mozilla::StyleGenericFontFamily Gecko_ns
     mozilla::StyleGenericFontFamily generic_family, nsAtom* language);
 
 mozilla::FontSizePrefs Gecko_GetBaseSize(nsAtom* lang);
 
 // XBL related functions.
 const mozilla::dom::Element* Gecko_GetBindingParent(
     const mozilla::dom::Element*);
 
-const RawServoAuthorStyles* Gecko_XBLBinding_GetRawServoStyles(
-    const nsXBLBinding*);
-bool Gecko_XBLBinding_InheritsStyle(const nsXBLBinding* aXBLBinding);
-
 struct GeckoFontMetrics {
   nscoord mChSize;  // -1.0 indicates not found
   nscoord mXSize;
 };
 
 GeckoFontMetrics Gecko_GetFontMetrics(const nsPresContext*, bool is_vertical,
                                       const nsStyleFont* font,
                                       nscoord font_size,
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -30,17 +30,16 @@
 #include "nsCSSFrameConstructor.h"
 #include "nsCSSPseudoElements.h"
 #include "nsDeviceContext.h"
 #include "nsHTMLStyleSheet.h"
 #include "nsIAnonymousContentCreator.h"
 #include "mozilla/dom/DocumentInlines.h"
 #include "nsMediaFeatures.h"
 #include "nsPrintfCString.h"
-#include "nsXBLPrototypeBinding.h"
 #include "gfxUserFontSet.h"
 #include "nsBindingManager.h"
 #include "nsWindowSizes.h"
 #include "GeckoProfiler.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
@@ -136,17 +135,17 @@ void ServoStyleSet::ShellDetachedFromDoc
   // Also GC the ruletree if it got big now that the DOM no longer has
   // references to styles around anymore.
   MaybeGCRuleTree();
 }
 
 void ServoStyleSet::RecordShadowStyleChange(ShadowRoot& aShadowRoot) {
   // TODO(emilio): We could keep track of the actual shadow roots that need
   // their styles recomputed.
-  SetStylistXBLStyleSheetsDirty();
+  SetStylistShadowDOMStyleSheetsDirty();
 
   // FIXME(emilio): This should be done using stylesheet invalidation instead.
   if (nsPresContext* pc = GetPresContext()) {
     pc->RestyleManager()->PostRestyleEvent(
         aShadowRoot.Host(), RestyleHint::RestyleSubtree(), nsChangeHint(0));
   }
 }
 
@@ -161,35 +160,26 @@ void ServoStyleSet::InvalidateStyleForDo
   }
 
   Element* root = mDocument->GetRootElement();
   if (!root) {
     return;
   }
 
   // TODO(emilio): It may be nicer to just invalidate stuff in a given subtree
-  // for XBL sheets / Shadow DOM. Consider just enumerating bound content
-  // instead and run invalidation individually, passing mRawSet for the UA /
-  // User sheets.
+  // for Shadow DOM. Consider just enumerating shadow roots instead and run
+  // invalidation individually, passing mRawSet for the UA / User sheets.
   AutoTArray<const RawServoAuthorStyles*, 20> nonDocumentStyles;
 
   EnumerateShadowRoots(*mDocument, [&](ShadowRoot& aShadowRoot) {
     if (auto* authorStyles = aShadowRoot.GetServoStyles()) {
       nonDocumentStyles.AppendElement(authorStyles);
     }
   });
 
-  mDocument->BindingManager()->EnumerateBoundContentProtoBindings(
-      [&](nsXBLPrototypeBinding* aProto) {
-        if (auto* authorStyles = aProto->GetServoStyles()) {
-          nonDocumentStyles.AppendElement(authorStyles);
-        }
-        return true;
-      });
-
   Servo_InvalidateStyleForDocStateChanges(
       root, mRawSet.get(), &nonDocumentStyles, aStatesChanged.ServoValue());
 }
 
 static const MediaFeatureChangeReason kMediaFeaturesAffectingDefaultStyle =
     // Zoom changes change the meaning of em units.
     MediaFeatureChangeReason::ZoomChange |
     // A resolution change changes the app-units-per-dev-pixels ratio, which
@@ -203,41 +193,32 @@ RestyleHint ServoStyleSet::MediumFeature
   AutoTArray<RawServoAuthorStyles*, 20> nonDocumentStyles;
 
   EnumerateShadowRoots(*mDocument, [&](ShadowRoot& aShadowRoot) {
     if (auto* authorStyles = aShadowRoot.GetServoStyles()) {
       nonDocumentStyles.AppendElement(authorStyles);
     }
   });
 
-  // FIXME(emilio): This is broken for XBL. See bug 1406875.
-  mDocument->BindingManager()->EnumerateBoundContentProtoBindings(
-      [&](nsXBLPrototypeBinding* aProto) {
-        if (auto* authorStyles = aProto->GetServoStyles()) {
-          nonDocumentStyles.AppendElement(authorStyles);
-        }
-        return true;
-      });
-
   bool mayAffectDefaultStyle =
       bool(aReason & kMediaFeaturesAffectingDefaultStyle);
 
   const MediumFeaturesChangedResult result =
       Servo_StyleSet_MediumFeaturesChanged(mRawSet.get(), &nonDocumentStyles,
                                            mayAffectDefaultStyle);
 
   const bool rulesChanged =
       result.mAffectsDocumentRules || result.mAffectsNonDocumentRules;
 
   if (result.mAffectsDocumentRules) {
     SetStylistStyleSheetsDirty();
   }
 
   if (result.mAffectsNonDocumentRules) {
-    SetStylistXBLStyleSheetsDirty();
+    SetStylistShadowDOMStyleSheetsDirty();
   }
 
   if (rulesChanged) {
     // TODO(emilio): This could be more granular.
     return RestyleHint::RestyleSubtree();
   }
 
   const bool viewportChanged =
@@ -657,24 +638,21 @@ size_t ServoStyleSet::SheetCount(Origin 
 
 StyleSheet* ServoStyleSet::SheetAt(Origin aOrigin, size_t aIndex) const {
   return const_cast<StyleSheet*>(
       Servo_StyleSet_GetSheetAt(mRawSet.get(), aOrigin, aIndex));
 }
 
 void ServoStyleSet::AppendAllNonDocumentAuthorSheets(
     nsTArray<StyleSheet*>& aArray) const {
-  if (mDocument) {
-    mDocument->BindingManager()->AppendAllSheets(aArray);
-    EnumerateShadowRoots(*mDocument, [&](ShadowRoot& aShadowRoot) {
-      for (auto index : IntegerRange(aShadowRoot.SheetCount())) {
-        aArray.AppendElement(aShadowRoot.SheetAt(index));
-      }
-    });
-  }
+  EnumerateShadowRoots(*mDocument, [&](ShadowRoot& aShadowRoot) {
+    for (auto index : IntegerRange(aShadowRoot.SheetCount())) {
+      aArray.AppendElement(aShadowRoot.SheetAt(index));
+    }
+  });
 }
 
 void ServoStyleSet::AddDocStyleSheet(StyleSheet* aSheet) {
   MOZ_ASSERT(aSheet->IsApplicable());
   MOZ_ASSERT(aSheet->RawContents(),
              "Raw sheet should be in place by this point.");
 
   RefPtr<StyleSheet> strong(aSheet);
@@ -888,18 +866,18 @@ void ServoStyleSet::SetStylistStyleSheet
   //
   // We don't allow to call getComputedStyle in elements without a pres shell
   // yet, so it is fine if there's no pres context here.
   if (nsPresContext* presContext = GetPresContext()) {
     presContext->RestyleManager()->IncrementUndisplayedRestyleGeneration();
   }
 }
 
-void ServoStyleSet::SetStylistXBLStyleSheetsDirty() {
-  mStylistState |= StylistState::XBLStyleSheetsDirty;
+void ServoStyleSet::SetStylistShadowDOMStyleSheetsDirty() {
+  mStylistState |= StylistState::ShadowDOMStyleSheetsDirty;
   if (nsPresContext* presContext = GetPresContext()) {
     presContext->RestyleManager()->IncrementUndisplayedRestyleGeneration();
   }
 }
 
 static OriginFlags ToOriginFlags(StyleOrigin aOrigin) {
   switch (aOrigin) {
     case StyleOrigin::UserAgent:
@@ -999,55 +977,40 @@ already_AddRefed<RawServoAnimationValue>
     Element* aElement, RawServoDeclarationBlock* aDeclarations,
     const mozilla::ComputedStyle* aStyle) {
   return Servo_AnimationValue_Compute(aElement, aDeclarations, aStyle,
                                       mRawSet.get())
       .Consume();
 }
 
 bool ServoStyleSet::EnsureUniqueInnerOnCSSSheets() {
-  using SheetOwner =
-      Variant<ServoStyleSet*, nsXBLPrototypeBinding*, ShadowRoot*>;
+  using SheetOwner = Variant<ServoStyleSet*, ShadowRoot*>;
 
   AutoTArray<Pair<StyleSheet*, SheetOwner>, 32> queue;
   EnumerateStyleSheets([&](StyleSheet& aSheet) {
     queue.AppendElement(MakePair(&aSheet, SheetOwner{this}));
   });
 
   EnumerateShadowRoots(*mDocument, [&](ShadowRoot& aShadowRoot) {
     for (auto index : IntegerRange(aShadowRoot.SheetCount())) {
       queue.AppendElement(
           MakePair(aShadowRoot.SheetAt(index), SheetOwner{&aShadowRoot}));
     }
   });
 
-  mDocument->BindingManager()->EnumerateBoundContentProtoBindings(
-      [&](nsXBLPrototypeBinding* aProto) {
-        AutoTArray<StyleSheet*, 3> sheets;
-        aProto->AppendStyleSheetsTo(sheets);
-        for (auto* sheet : sheets) {
-          queue.AppendElement(MakePair(sheet, SheetOwner{aProto}));
-        }
-        return true;
-      });
-
   bool anyNonDocStyleChanged = false;
   while (!queue.IsEmpty()) {
     uint32_t idx = queue.Length() - 1;
     auto* sheet = queue[idx].first();
     SheetOwner owner = queue[idx].second();
     queue.RemoveElementAt(idx);
 
-    if (!sheet->HasUniqueInner()) {
-      RawServoAuthorStyles* authorStyles = nullptr;
-      if (owner.is<ShadowRoot*>()) {
-        authorStyles = owner.as<ShadowRoot*>()->GetServoStyles();
-      } else if (owner.is<nsXBLPrototypeBinding*>()) {
-        authorStyles = owner.as<nsXBLPrototypeBinding*>()->GetServoStyles();
-      }
+    if (!sheet->HasUniqueInner() && owner.is<ShadowRoot*>()) {
+      RawServoAuthorStyles* authorStyles =
+          owner.as<ShadowRoot*>()->GetServoStyles();
 
       if (authorStyles) {
         Servo_AuthorStyles_ForceDirty(authorStyles);
         mNeedsRestyleAfterEnsureUniqueInner = true;
         anyNonDocStyleChanged = true;
       }
     }
 
@@ -1065,17 +1028,17 @@ bool ServoStyleSet::EnsureUniqueInnerOnC
     AutoTArray<StyleSheet*, 3> children;
     sheet->AppendAllChildSheets(children);
     for (auto* sheet : children) {
       queue.AppendElement(MakePair(sheet, owner));
     }
   }
 
   if (anyNonDocStyleChanged) {
-    SetStylistXBLStyleSheetsDirty();
+    SetStylistShadowDOMStyleSheetsDirty();
   }
 
   if (mNeedsRestyleAfterEnsureUniqueInner) {
     // TODO(emilio): We could make this faster if needed tracking the specific
     // origins and all that, but the only caller of this doesn't seem to really
     // care about perf.
     MarkOriginsDirty(OriginFlags::All);
   }
@@ -1095,17 +1058,17 @@ void ServoStyleSet::CompatibilityModeCha
   bool anyShadow = false;
   EnumerateShadowRoots(*mDocument, [&](ShadowRoot& aShadowRoot) {
     if (auto* authorStyles = aShadowRoot.GetServoStyles()) {
       anyShadow = true;
       Servo_AuthorStyles_ForceDirty(authorStyles);
     }
   });
   if (anyShadow) {
-    SetStylistXBLStyleSheetsDirty();
+    SetStylistShadowDOMStyleSheetsDirty();
   }
 }
 
 void ServoStyleSet::ClearNonInheritingComputedStyles() {
   for (RefPtr<ComputedStyle>& ptr : mNonInheritingComputedStyles) {
     ptr = nullptr;
   }
 }
@@ -1185,41 +1148,30 @@ already_AddRefed<ComputedStyle> ServoSty
                                                aDeclarations)
       .Consume();
 }
 
 void ServoStyleSet::UpdateStylist() {
   MOZ_ASSERT(StylistNeedsUpdate());
 
   if (mStylistState & StylistState::StyleSheetsDirty) {
-    // There's no need to compute invalidations and such for an XBL styleset,
-    // since they are loaded and unloaded synchronously, and they don't have to
-    // deal with dynamic content changes.
     Element* root = mDocument->GetRootElement();
     const ServoElementSnapshotTable* snapshots = nullptr;
     if (nsPresContext* pc = GetPresContext()) {
       snapshots = &pc->RestyleManager()->Snapshots();
     }
     Servo_StyleSet_FlushStyleSheets(mRawSet.get(), root, snapshots);
   }
 
-  if (MOZ_UNLIKELY(mStylistState & StylistState::XBLStyleSheetsDirty)) {
+  if (MOZ_UNLIKELY(mStylistState & StylistState::ShadowDOMStyleSheetsDirty)) {
     EnumerateShadowRoots(*mDocument, [&](ShadowRoot& aShadowRoot) {
       if (auto* authorStyles = aShadowRoot.GetServoStyles()) {
         Servo_AuthorStyles_Flush(authorStyles, mRawSet.get());
       }
     });
-
-    mDocument->BindingManager()->EnumerateBoundContentProtoBindings(
-        [&](nsXBLPrototypeBinding* aProto) {
-          if (auto* authorStyles = aProto->GetServoStyles()) {
-            Servo_AuthorStyles_Flush(authorStyles, mRawSet.get());
-          }
-          return true;
-        });
   }
 
   mStylistState = StylistState::NotDirty;
 }
 
 void ServoStyleSet::MaybeGCRuleTree() {
   MOZ_ASSERT(NS_IsMainThread());
   Servo_MaybeGCRuleTree(mRawSet.get());
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -52,19 +52,19 @@ namespace mozilla {
 // update.
 enum class StylistState : uint8_t {
   // The stylist is not dirty, we should do nothing.
   NotDirty = 0,
 
   // The style sheets have changed, so we need to update the style data.
   StyleSheetsDirty = 1 << 0,
 
-  // Some of the style sheets of the bound elements in binding manager have
-  // changed, so we need to tell the binding manager to update style data.
-  XBLStyleSheetsDirty = 1 << 1,
+  // Some of the style sheets of the shadow trees in the document have
+  // changed.
+  ShadowDOMStyleSheetsDirty = 1 << 1,
 };
 
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(StylistState)
 
 // Bitfield type to represent Servo stylesheet origins.
 enum class OriginFlags : uint8_t {
   UserAgent = 0x01,
   User = 0x02,
@@ -475,17 +475,17 @@ class ServoStyleSet {
    */
   void MarkOriginsDirty(OriginFlags aChangedOrigins);
 
   /**
    * Note that the stylist needs a style flush due to style sheet changes.
    */
   void SetStylistStyleSheetsDirty();
 
-  void SetStylistXBLStyleSheetsDirty();
+  void SetStylistShadowDOMStyleSheetsDirty();
 
   bool StylistNeedsUpdate() const {
     return mStylistState != StylistState::NotDirty;
   }
 
   /**
    * Update the stylist as needed to ensure style data is up-to-date.
    *
deleted file mode 100644
--- a/layout/style/test/media_queries_dynamic_xbl_binding.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<bindings xmlns="http://www.mozilla.org/xbl">
-  <binding id="binding">
-    <resources>
-      <stylesheet src="media_queries_dynamic_xbl_style.css" />
-    </resources>
-    <content>
-      <html:div xmlns:html="http://www.w3.org/1999/xhtml">
-        <children/>
-      </html:div>
-    </content>
-  </binding>
-</bindings>
deleted file mode 100644
--- a/layout/style/test/media_queries_dynamic_xbl_iframe.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE HTML>
-<style type="text/css">
-body { -moz-binding: url(media_queries_dynamic_xbl_binding.xml#binding); }
-</style>
-<p id="para">Hello</p>
deleted file mode 100644
--- a/layout/style/test/media_queries_dynamic_xbl_style.css
+++ /dev/null
@@ -1,6 +0,0 @@
-@media (orientation: portrait) {
-  div { color: purple; }
-}
-@media (orientation: landscape) {
-  div { color: blue; }
-}
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -16,19 +16,16 @@ support-files =
   chrome/bug418986-2.js
   chrome/match.png
   chrome/mismatch.png
   descriptor_database.js
   !/dom/events/test/event_leak_utils.js
   empty.html
   file_computed_style_bfcache_display_none.html
   file_computed_style_bfcache_display_none2.html
-  media_queries_dynamic_xbl_binding.xml
-  media_queries_dynamic_xbl_iframe.html
-  media_queries_dynamic_xbl_style.css
   media_queries_iframe.html
   neverending_font_load.sjs
   neverending_stylesheet_load.sjs
   post-redirect-1.css
   post-redirect-2.css
   post-redirect-3.css
   property_database.js
   redirect.sjs
@@ -260,17 +257,16 @@ skip-if = toolkit == 'android'
 support-files = slow_broken_sheet.sjs slow_ok_sheet.sjs
 [test_logical_properties.html]
 [test_mask_image_CORS.html]
 [test_media_queries.html]
 # times out on verify, see bug 1461033.
 # debug-only failure; timed out #Android 4.3 aws only; bug 1030419
 skip-if = (verify || android_version == '18')
 [test_media_queries_dynamic.html]
-[test_media_queries_dynamic_xbl.html]
 [test_media_query_list.html]
 [test_media_query_serialization.html]
 [test_mq_any_hover_and_any_pointer.html]
 [test_mq_hover_and_pointer.html]
 [test_mq_prefers_reduced_motion_dynamic.html]
 run-if = (os == 'mac' || toolkit == 'android')
 [test_moz_device_pixel_ratio.html]
 [test_namespace_rule.html]
deleted file mode 100644
--- a/layout/style/test/test_media_queries_dynamic_xbl.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=156716
--->
-<head>
-  <title>Test for Bug 156716</title>
-  <script src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body onload="run()">
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=156716">Mozilla Bug 156716</a>
-<iframe id="display" src="media_queries_dynamic_xbl_iframe.html"></iframe>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for Bug 156716 **/
-
-function run() {
-  var iframe = document.getElementById("display");
-
-  var subdoc = iframe.contentDocument;
-  var subwin = iframe.contentWindow;
-  var p = subdoc.getElementById("para");
-
-  iframe.setAttribute("style", "height: 300px; width: 100px");
-  is(subwin.getComputedStyle(p).color, "rgb(128, 0, 128)",
-     "should be purple when portait");
-  iframe.setAttribute("style", "height: 100px; width: 300px");
-  is(subwin.getComputedStyle(p).color, "rgb(0, 0, 255)",
-     "should be blue when landscape");
-  SimpleTest.finish();
-}
-SimpleTest.waitForExplicitFinish();
-
-</script>
-</pre>
-</body>
-</html>
-
--- a/servo/components/selectors/context.rs
+++ b/servo/components/selectors/context.rs
@@ -274,23 +274,23 @@ where
         let result = f(self);
         self.visited_handling = original_handling_mode;
         result
     }
 
     /// Runs F with a given shadow host which is the root of the tree whose
     /// rules we're matching.
     #[inline]
-    pub fn with_shadow_host<F, E, R>(&mut self, host: Option<E>, f: F) -> R
+    pub fn with_shadow_host<F, E, R>(&mut self, host: E, f: F) -> R
     where
         E: Element,
         F: FnOnce(&mut Self) -> R,
     {
         let original_host = self.current_host.take();
-        self.current_host = host.map(|h| h.opaque());
+        self.current_host = Some(host.opaque());
         let result = f(self);
         self.current_host = original_host;
         result
     }
 
     /// Returns the current shadow host whose shadow root we're matching rules
     /// against.
     #[inline]
--- a/servo/components/style/author_styles.rs
+++ b/servo/components/style/author_styles.rs
@@ -1,53 +1,49 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
 
 //! A set of author stylesheets and their computed representation, such as the
-//! ones used for ShadowRoot and XBL.
+//! ones used for ShadowRoot.
 
 use crate::context::QuirksMode;
 use crate::dom::TElement;
 #[cfg(feature = "gecko")]
 use crate::gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
 use crate::invalidation::media_queries::ToMediaListKey;
 use crate::media_queries::Device;
 use crate::shared_lock::SharedRwLockReadGuard;
 use crate::stylesheet_set::AuthorStylesheetSet;
 use crate::stylesheets::StylesheetInDocument;
 use crate::stylist::CascadeData;
 
 /// A set of author stylesheets and their computed representation, such as the
-/// ones used for ShadowRoot and XBL.
+/// ones used for ShadowRoot.
 pub struct AuthorStyles<S>
 where
     S: StylesheetInDocument + PartialEq + 'static,
 {
     /// The sheet collection, which holds the sheet pointers, the invalidations,
     /// and all that stuff.
     pub stylesheets: AuthorStylesheetSet<S>,
     /// The actual cascade data computed from the stylesheets.
     pub data: CascadeData,
-    /// The quirks mode of the last stylesheet flush, used because XBL sucks and
-    /// we should really fix it, see bug 1406875.
-    pub quirks_mode: QuirksMode,
 }
 
 impl<S> AuthorStyles<S>
 where
     S: StylesheetInDocument + PartialEq + 'static,
 {
     /// Create an empty AuthorStyles.
     #[inline]
     pub fn new() -> Self {
         Self {
             stylesheets: AuthorStylesheetSet::new(),
             data: CascadeData::new(),
-            quirks_mode: QuirksMode::NoQuirks,
         }
     }
 
     /// Flush the pending sheet changes, updating `data` as appropriate.
     ///
     /// TODO(emilio): Need a host element and a snapshot map to do invalidation
     /// properly.
     #[inline]
@@ -59,20 +55,16 @@ where
     ) where
         E: TElement,
         S: ToMediaListKey,
     {
         let flusher = self
             .stylesheets
             .flush::<E>(/* host = */ None, /* snapshot_map = */ None);
 
-        if flusher.sheets.dirty() {
-            self.quirks_mode = quirks_mode;
-        }
-
         // Ignore OOM.
         let _ = self
             .data
             .rebuild(device, quirks_mode, flusher.sheets, guard);
     }
 }
 
 #[cfg(feature = "gecko")]
--- a/servo/components/style/dom.rs
+++ b/servo/components/style/dom.rs
@@ -756,110 +756,79 @@ pub trait TElement:
             None => return false,
         };
         return data.hint.has_animation_hint();
     }
 
     /// Returns the anonymous content for the current element's XBL binding,
     /// given if any.
     ///
-    /// This is used in Gecko for XBL and shadow DOM.
+    /// This is used in Gecko for XBL.
     fn xbl_binding_anonymous_content(&self) -> Option<Self::ConcreteNode> {
         None
     }
 
     /// The shadow root this element is a host of.
     fn shadow_root(&self) -> Option<<Self::ConcreteNode as TNode>::ConcreteShadowRoot>;
 
     /// The shadow root which roots the subtree this element is contained in.
     fn containing_shadow(&self) -> Option<<Self::ConcreteNode as TNode>::ConcreteShadowRoot>;
 
-    /// XBL hack for style sharing. :(
-    fn has_same_xbl_proto_binding_as(&self, _other: Self) -> bool {
-        true
-    }
-
     /// Return the element which we can use to look up rules in the selector
     /// maps.
     ///
     /// This is always the element itself, except in the case where we are an
     /// element-backed pseudo-element, in which case we return the originating
     /// element.
     fn rule_hash_target(&self) -> Self {
         if self.implemented_pseudo_element().is_some() {
             self.pseudo_element_originating_element()
                 .expect("Trying to collect rules for a detached pseudo-element")
         } else {
             *self
         }
     }
 
-    /// Implements Gecko's `nsBindingManager::WalkRules`.
-    ///
-    /// Returns whether to cut off the binding inheritance, that is, whether
-    /// document rules should _not_ apply.
-    fn each_xbl_cascade_data<'a, F>(&self, _: F) -> bool
-    where
-        Self: 'a,
-        F: FnMut(&'a CascadeData, QuirksMode),
-    {
-        false
-    }
-
     /// Executes the callback for each applicable style rule data which isn't
     /// the main document's data (which stores UA / author rules).
     ///
     /// The element passed to the callback is the containing shadow host for the
-    /// data if it comes from Shadow DOM, None if it comes from XBL.
+    /// data if it comes from Shadow DOM.
     ///
     /// Returns whether normal document author rules should apply.
     fn each_applicable_non_document_style_rule_data<'a, F>(&self, mut f: F) -> bool
     where
         Self: 'a,
-        F: FnMut(&'a CascadeData, QuirksMode, Option<Self>),
+        F: FnMut(&'a CascadeData, Self),
     {
         use rule_collector::containing_shadow_ignoring_svg_use;
 
-        let mut doc_rules_apply = !self.each_xbl_cascade_data(|data, quirks_mode| {
-            f(data, quirks_mode, None);
-        });
+        let mut doc_rules_apply = self.matches_user_and_author_rules();
 
         // Use the same rules to look for the containing host as we do for rule
         // collection.
         if let Some(shadow) = containing_shadow_ignoring_svg_use(*self) {
             doc_rules_apply = false;
             if let Some(data) = shadow.style_data() {
-                f(
-                    data,
-                    self.as_node().owner_doc().quirks_mode(),
-                    Some(shadow.host()),
-                );
+                f(data, shadow.host());
             }
         }
 
         if let Some(shadow) = self.shadow_root() {
             if let Some(data) = shadow.style_data() {
-                f(
-                    data,
-                    self.as_node().owner_doc().quirks_mode(),
-                    Some(shadow.host()),
-                );
+                f(data, shadow.host());
             }
         }
 
         let mut current = self.assigned_slot();
         while let Some(slot) = current {
             // Slots can only have assigned nodes when in a shadow tree.
             let shadow = slot.containing_shadow().unwrap();
             if let Some(data) = shadow.style_data() {
-                f(
-                    data,
-                    self.as_node().owner_doc().quirks_mode(),
-                    Some(shadow.host()),
-                );
+                f(data, shadow.host());
             }
             current = slot.assigned_slot();
         }
 
         doc_rules_apply
     }
 
     /// Does a rough (and cheap) check for whether or not transitions might need to be updated that
--- a/servo/components/style/gecko/data.rs
+++ b/servo/components/style/gecko/data.rs
@@ -140,21 +140,16 @@ pub struct PerDocumentStyleDataImpl {
 /// The data itself is an `AtomicRefCell`, which guarantees the proper semantics
 /// and unexpected races while trying to mutate it.
 pub struct PerDocumentStyleData(AtomicRefCell<PerDocumentStyleDataImpl>);
 
 impl PerDocumentStyleData {
     /// Create a `PerDocumentStyleData`.
     pub fn new(document: *const structs::Document) -> Self {
         let device = Device::new(document);
-
-        // FIXME(emilio, tlin): How is this supposed to work with XBL? This is
-        // right now not always honored, see bug 1405543...
-        //
-        // Should we just force XBL Stylists to be NoQuirks?
         let quirks_mode = device.document().mCompatMode;
 
         PerDocumentStyleData(AtomicRefCell::new(PerDocumentStyleDataImpl {
             stylist: Stylist::new(device, quirks_mode.into()),
         }))
     }
 
     /// Get an immutable reference to this style data.
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -167,25 +167,17 @@ impl<'lr> TShadowRoot for GeckoShadowRoo
     }
 
     #[inline]
     fn style_data<'a>(&self) -> Option<&'a CascadeData>
     where
         Self: 'a,
     {
         let author_styles = unsafe { self.0.mServoStyles.mPtr.as_ref()? };
-
         let author_styles = AuthorStyles::<GeckoStyleSheet>::from_ffi(author_styles);
-
-        debug_assert!(
-            author_styles.quirks_mode == self.as_node().owner_doc().quirks_mode() ||
-                author_styles.stylesheets.is_empty() ||
-                author_styles.stylesheets.dirty()
-        );
-
         Some(&author_styles.data)
     }
 
     #[inline]
     fn elements_with_id<'a>(&self, id: &Atom) -> Result<&'a [GeckoElement<'lr>], ()>
     where
         Self: 'a,
     {
@@ -531,48 +523,27 @@ impl<'lb> GeckoXBLBinding<'lb> {
         unsafe { self.0.mNextBinding.mRawPtr.as_ref().map(GeckoXBLBinding) }
     }
 
     #[inline]
     fn anon_content(&self) -> *const nsIContent {
         self.0.mContent.raw::<nsIContent>()
     }
 
-    #[inline]
-    fn inherits_style(&self) -> bool {
-        unsafe { bindings::Gecko_XBLBinding_InheritsStyle(self.0) }
-    }
-
     // This duplicates the logic in Gecko's
     // nsBindingManager::GetBindingWithContent.
     fn binding_with_content(&self) -> Option<Self> {
         let mut binding = *self;
         loop {
             if !binding.anon_content().is_null() {
                 return Some(binding);
             }
             binding = binding.base_binding()?;
         }
     }
-
-    fn each_xbl_cascade_data<F>(&self, f: &mut F)
-    where
-        F: FnMut(&'lb CascadeData, QuirksMode),
-    {
-        if let Some(base) = self.base_binding() {
-            base.each_xbl_cascade_data(f);
-        }
-
-        let data = unsafe { bindings::Gecko_XBLBinding_GetRawServoStyles(self.0).as_ref() };
-
-        if let Some(data) = data {
-            let data: &'lb _ = AuthorStyles::<GeckoStyleSheet>::from_ffi(data);
-            f(&data.data, data.quirks_mode)
-        }
-    }
 }
 
 /// A simple wrapper over a non-null Gecko `Element` pointer.
 #[derive(Clone, Copy)]
 pub struct GeckoElement<'le>(pub &'le RawGeckoElement);
 
 impl<'le> fmt::Debug for GeckoElement<'le> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -1245,24 +1216,16 @@ impl<'le> TElement for GeckoElement<'le>
                 ._base
                 .mContainingShadow
                 .mRawPtr
                 .as_ref()
                 .map(GeckoShadowRoot)
         }
     }
 
-    fn has_same_xbl_proto_binding_as(&self, other: Self) -> bool {
-        match (self.xbl_binding(), other.xbl_binding()) {
-            (None, None) => true,
-            (Some(a), Some(b)) => a.0.mPrototypeBinding == b.0.mPrototypeBinding,
-            _ => false,
-        }
-    }
-
     fn each_anonymous_content_child<F>(&self, mut f: F)
     where
         F: FnMut(Self),
     {
         if !self.may_have_anonymous_children() {
             return;
         }
 
@@ -1431,17 +1394,17 @@ impl<'le> TElement for GeckoElement<'le>
     #[inline]
     fn is_in_native_anonymous_subtree(&self) -> bool {
         use crate::gecko_bindings::structs::NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE;
         self.flags() & (NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE as u32) != 0
     }
 
     #[inline]
     fn matches_user_and_author_rules(&self) -> bool {
-        !self.is_in_native_anonymous_subtree()
+        !self.rule_hash_target().is_in_native_anonymous_subtree()
     }
 
     #[inline]
     fn implemented_pseudo_element(&self) -> Option<PseudoElement> {
         if !self.is_in_native_anonymous_subtree() {
             return None;
         }
 
@@ -1594,53 +1557,16 @@ impl<'le> TElement for GeckoElement<'le>
     fn has_css_animations(&self) -> bool {
         self.may_have_animations() && unsafe { Gecko_ElementHasCSSAnimations(self.0) }
     }
 
     fn has_css_transitions(&self) -> bool {
         self.may_have_animations() && unsafe { Gecko_ElementHasCSSTransitions(self.0) }
     }
 
-    fn each_xbl_cascade_data<'a, F>(&self, mut f: F) -> bool
-    where
-        'le: 'a,
-        F: FnMut(&'a CascadeData, QuirksMode),
-    {
-        // Walk the binding scope chain, starting with the binding attached to
-        // our content, up till we run out of scopes or we get cut off.
-        //
-        // If we are a NAC pseudo-element, we want to get rules from our
-        // rule_hash_target, that is, our originating element.
-        let mut current = Some(self.rule_hash_target());
-        while let Some(element) = current {
-            if let Some(binding) = element.xbl_binding() {
-                binding.each_xbl_cascade_data(&mut f);
-
-                // If we're not looking at our original element, allow the
-                // binding to cut off style inheritance.
-                if element != *self && !binding.inherits_style() {
-                    // Go no further; we're not inheriting style from
-                    // anything above here.
-                    break;
-                }
-            }
-
-            if element.is_root_of_native_anonymous_subtree() {
-                // Deliberately cut off style inheritance here.
-                break;
-            }
-
-            current = element.xbl_binding_parent();
-        }
-
-        // If current has something, this means we cut off inheritance at some
-        // point in the loop.
-        current.is_some()
-    }
-
     fn xbl_binding_anonymous_content(&self) -> Option<GeckoNode<'le>> {
         self.xbl_binding_with_content()
             .map(|b| unsafe { GeckoNode::from_content(&*b.anon_content()) })
     }
 
     fn might_need_transitions_update(
         &self,
         old_style: Option<&ComputedValues>,
--- a/servo/components/style/invalidation/element/state_and_attributes.rs
+++ b/servo/components/style/invalidation/element/state_and_attributes.rs
@@ -219,18 +219,18 @@ where
         let lookup_element = if element.implemented_pseudo_element().is_some() {
             element.pseudo_element_originating_element().unwrap()
         } else {
             element
         };
 
         let mut shadow_rule_datas = SmallVec::<[_; 3]>::new();
         let matches_document_author_rules =
-            element.each_applicable_non_document_style_rule_data(|data, quirks_mode, host| {
-                shadow_rule_datas.push((data, quirks_mode, host.map(|h| h.opaque())))
+            element.each_applicable_non_document_style_rule_data(|data, host| {
+                shadow_rule_datas.push((data, host.opaque()))
             });
 
         let invalidated_self = {
             let mut collector = Collector {
                 wrapper,
                 lookup_element,
                 state_changes,
                 element,
@@ -253,22 +253,18 @@ where
 
             for (cascade_data, origin) in self.shared_context.stylist.iter_origins() {
                 if document_origins.contains(origin.into()) {
                     collector
                         .collect_dependencies_in_invalidation_map(cascade_data.invalidation_map());
                 }
             }
 
-            for &(ref data, quirks_mode, ref host) in &shadow_rule_datas {
-                // FIXME(emilio): Replace with assert / remove when we figure
-                // out what to do with the quirks mode mismatches
-                // (that is, when bug 1406875 is properly fixed).
-                collector.matching_context.set_quirks_mode(quirks_mode);
-                collector.matching_context.current_host = host.clone();
+            for &(ref data, ref host) in &shadow_rule_datas {
+                collector.matching_context.current_host = Some(host.clone());
                 collector.collect_dependencies_in_invalidation_map(data.invalidation_map());
             }
 
             collector.invalidates_self
         };
 
         // If we generated a ton of descendant invalidations, it's probably not
         // worth to go ahead and try to process them.
--- a/servo/components/style/rule_collector.rs
+++ b/servo/components/style/rule_collector.rs
@@ -93,17 +93,17 @@ where
         smil_override: Option<ArcBorrow<'a, Locked<PropertyDeclarationBlock>>>,
         animation_rules: AnimationRules,
         rule_inclusion: RuleInclusion,
         rules: &'a mut ApplicableDeclarationList,
         context: &'a mut MatchingContext<'b, E::Impl>,
         flags_setter: &'a mut F,
     ) -> Self {
         let rule_hash_target = element.rule_hash_target();
-        let matches_user_and_author_rules = rule_hash_target.matches_user_and_author_rules();
+        let matches_user_and_author_rules = element.matches_user_and_author_rules();
 
         // Gecko definitely has pseudo-elements with style attributes, like
         // ::-moz-color-swatch.
         debug_assert!(
             cfg!(feature = "gecko") || style_attribute.is_none() || pseudo_element.is_none(),
             "Style attributes do not apply to pseudo-elements"
         );
         debug_assert!(pseudo_element.map_or(true, |p| !p.is_precomputed()));
@@ -193,17 +193,17 @@ where
         cascade_level: CascadeLevel,
     ) {
         debug_assert!(shadow_host.shadow_root().is_some());
         let element = self.element;
         let rule_hash_target = self.rule_hash_target;
         let rules = &mut self.rules;
         let flags_setter = &mut self.flags_setter;
         let shadow_cascade_order = self.shadow_cascade_order;
-        self.context.with_shadow_host(Some(shadow_host), |context| {
+        self.context.with_shadow_host(shadow_host, |context| {
             map.get_all_matching_rules(
                 element,
                 rule_hash_target,
                 rules,
                 context,
                 flags_setter,
                 cascade_level,
                 shadow_cascade_order,
@@ -298,52 +298,16 @@ where
     fn collect_document_author_rules(&mut self) {
         if !self.matches_document_author_rules {
             return;
         }
 
         self.collect_stylist_rules(Origin::Author);
     }
 
-    fn collect_xbl_rules(&mut self) {
-        let element = self.element;
-        let cut_xbl_binding_inheritance =
-            element.each_xbl_cascade_data(|cascade_data, quirks_mode| {
-                let map = match cascade_data.normal_rules(self.pseudo_element) {
-                    Some(m) => m,
-                    None => return,
-                };
-
-                // NOTE(emilio): This is needed because the XBL stylist may
-                // think it has a different quirks mode than the document.
-                let mut matching_context = MatchingContext::new(
-                    self.context.matching_mode(),
-                    self.context.bloom_filter,
-                    self.context.nth_index_cache.as_mut().map(|s| &mut **s),
-                    quirks_mode,
-                );
-                matching_context.pseudo_element_matching_fn =
-                    self.context.pseudo_element_matching_fn;
-
-                // SameTreeAuthorNormal instead of InnerShadowNormal to
-                // preserve behavior, though that's kinda fishy...
-                map.get_all_matching_rules(
-                    self.element,
-                    self.rule_hash_target,
-                    self.rules,
-                    &mut matching_context,
-                    self.flags_setter,
-                    CascadeLevel::SameTreeAuthorNormal,
-                    self.shadow_cascade_order,
-                );
-            });
-
-        self.matches_document_author_rules &= !cut_xbl_binding_inheritance;
-    }
-
     fn collect_style_attribute_and_animation_rules(&mut self) {
         if let Some(sa) = self.style_attribute {
             self.rules
                 .push(ApplicableDeclarationBlock::from_declarations(
                     sa.clone_arc(),
                     CascadeLevel::StyleAttributeNormal,
                 ));
         }
@@ -391,13 +355,12 @@ where
         // FIXME(emilio): Should the author styles enabled stuff avoid the
         // presentational hints from getting pushed? See bug 1505770.
         if self.stylist.author_styles_enabled() == AuthorStylesEnabled::No {
             return;
         }
         self.collect_host_rules();
         self.collect_slotted_rules();
         self.collect_normal_rules_from_containing_shadow_tree();
-        self.collect_xbl_rules();
         self.collect_document_author_rules();
         self.collect_style_attribute_and_animation_rules();
     }
 }
--- a/servo/components/style/sharing/mod.rs
+++ b/servo/components/style/sharing/mod.rs
@@ -722,37 +722,16 @@ impl<E: TElement> StyleSharingCache<E> {
 
         // If two elements belong to different shadow trees, different rules may
         // apply to them, from the respective trees.
         if target.element.containing_shadow() != candidate.element.containing_shadow() {
             trace!("Miss: Different containing shadow roots");
             return None;
         }
 
-        // Note that in theory we shouldn't need this XBL check. However, XBL is
-        // absolutely broken in all sorts of ways.
-        //
-        // A style change that changes which XBL binding applies to an element
-        // arrives there, with the element still having the old prototype
-        // binding attached. And thus we try to match revalidation selectors
-        // with the old XBL binding, because we can't look at the new ones of
-        // course. And that causes us to revalidate with the wrong selectors and
-        // hit assertions.
-        //
-        // Other than this, we don't need anything else like the containing XBL
-        // binding parent or what not, since two elements with different XBL
-        // bindings will necessarily end up with different style.
-        if !target
-            .element
-            .has_same_xbl_proto_binding_as(candidate.element)
-        {
-            trace!("Miss: Different proto bindings");
-            return None;
-        }
-
         // If the elements are not assigned to the same slot they could match
         // different ::slotted() rules in the slot scope.
         //
         // If two elements are assigned to different slots, even within the same
         // shadow root, they could match different rules, due to the slot being
         // assigned to yet another slot in another shadow root.
         if target.element.assigned_slot() != candidate.element.assigned_slot() {
             // TODO(emilio): We could have a look at whether the shadow roots
--- a/servo/components/style/stylesheet_set.rs
+++ b/servo/components/style/stylesheet_set.rs
@@ -541,17 +541,17 @@ where
             // We don't know what happened, assume the worse.
             self.collections
                 .borrow_mut_for_origin(&origin)
                 .set_data_validity_at_least(DataValidity::FullyInvalid);
         }
     }
 }
 
-/// The set of stylesheets effective for a given XBL binding or Shadow Root.
+/// The set of stylesheets effective for a given Shadow Root.
 #[derive(MallocSizeOf)]
 pub struct AuthorStylesheetSet<S>
 where
     S: StylesheetInDocument + PartialEq + 'static,
 {
     /// The actual style sheets.
     collection: SheetCollection<S>,
     /// The set of invalidations scheduled for this collection.
--- a/servo/components/style/stylist.rs
+++ b/servo/components/style/stylist.rs
@@ -631,17 +631,17 @@ impl Stylist {
     {
         if f(&self.cascade_data.user_agent.cascade_data) {
             return true;
         }
 
         let mut maybe = false;
 
         let doc_author_rules_apply =
-            element.each_applicable_non_document_style_rule_data(|data, _, _| {
+            element.each_applicable_non_document_style_rule_data(|data, _| {
                 maybe = maybe || f(&*data);
             });
 
         if maybe || f(&self.cascade_data.user) {
             return true;
         }
 
         doc_author_rules_apply && f(&self.cascade_data.author)
@@ -1067,22 +1067,16 @@ impl Stylist {
 
         self.device = device;
         self.media_features_change_changed_style(guards, &self.device)
     }
 
     /// Returns whether, given a media feature change, any previously-applicable
     /// style has become non-applicable, or vice-versa for each origin, using
     /// `device`.
-    ///
-    /// Passing `device` is needed because this is used for XBL in Gecko, which
-    /// can be stale in various ways, so we need to pass the device of the
-    /// document itself, which is what is kept up-to-date.
-    ///
-    /// Arguably XBL should use something more lightweight than a Stylist.
     pub fn media_features_change_changed_style(
         &self,
         guards: &StylesheetGuards,
         device: &Device,
     ) -> OriginSet {
         debug!("Stylist::media_features_change_changed_style {:?}", device);
 
         let mut origins = OriginSet::empty();
@@ -1256,21 +1250,21 @@ impl Stylist {
         // Note that, by the time we're revalidating, we're guaranteed that the
         // candidate and the entry have the same id, classes, and local name.
         // This means we're guaranteed to get the same rulehash buckets for all
         // the lookups, which means that the bitvecs are comparable. We verify
         // this in the caller by asserting that the bitvecs are same-length.
         let mut results = SmallBitVec::new();
 
         let matches_document_rules =
-            element.each_applicable_non_document_style_rule_data(|data, quirks_mode, host| {
+            element.each_applicable_non_document_style_rule_data(|data, host| {
                 matching_context.with_shadow_host(host, |matching_context| {
                     data.selectors_for_cache_revalidation.lookup(
                         element,
-                        quirks_mode,
+                        self.quirks_mode,
                         |selector_and_hashes| {
                             results.push(matches_selector(
                                 &selector_and_hashes.selector,
                                 selector_and_hashes.selector_offset,
                                 Some(&selector_and_hashes.hashes),
                                 &element,
                                 matching_context,
                                 flags_setter,