Bug 1527116 - Remove nsXBLBinding::mUsingContentXBLScope. r=bzbarsky
authorMartin Giger <martin@humanoids.be>
Wed, 06 Mar 2019 13:37:53 +0000
changeset 520503 9c7c28753aa3b7c5fd03d72eed6f6fef5c9e1859
parent 520502 398daf04b7cf386d40475ff19abcc408f838280e
child 520504 4c91f111269f3dc1873a32de2936ed119ef3c9a0
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1527116
milestone67.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 1527116 - Remove nsXBLBinding::mUsingContentXBLScope. r=bzbarsky Replaces all usages of nsXBLBinding::mUsingContentXBLScope with the assumption that it's always false and removes the property. I've also removed the related method and property on nsXBLEventHandler, since that appeared to be dead code, too. Differential Revision: https://phabricator.services.mozilla.com/D22276
dom/xbl/nsXBLBinding.cpp
dom/xbl/nsXBLBinding.h
dom/xbl/nsXBLEventHandler.cpp
dom/xbl/nsXBLEventHandler.h
--- a/dom/xbl/nsXBLBinding.cpp
+++ b/dom/xbl/nsXBLBinding.cpp
@@ -88,17 +88,16 @@ static const JSClass gPrototypeJSClass =
         JSCLASS_HAS_RESERVED_SLOTS(1),
     &gPrototypeJSClassOps};
 
 // Implementation //////////////////////////////////////////////////////////////
 
 // Constructors/Destructors
 nsXBLBinding::nsXBLBinding(nsXBLPrototypeBinding* aBinding)
     : mMarkedForDeath(false),
-      mUsingContentXBLScope(false),
       mPrototypeBinding(aBinding),
       mBoundElement(nullptr) {
   NS_ASSERTION(mPrototypeBinding, "Must have a prototype binding!");
   // Grab a ref to the document info so the prototype binding won't die
   NS_ADDREF(mPrototypeBinding->XBLDocumentInfo());
 }
 
 nsXBLBinding::~nsXBLBinding() {
@@ -204,23 +203,16 @@ void nsXBLBinding::UnbindAnonymousConten
        child = child->GetNextSibling()) {
     child->UnbindFromTree(true, aNullParent);
   }
 }
 
 void nsXBLBinding::SetBoundElement(Element* aElement) {
   mBoundElement = aElement;
   if (mNextBinding) mNextBinding->SetBoundElement(aElement);
-
-  if (!mBoundElement) {
-    return;
-  }
-
-  // mUsingContentXBLScope can go away.  See bug 1527116.
-  mUsingContentXBLScope = false;
 }
 
 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;
@@ -445,33 +437,31 @@ void nsXBLBinding::InstallEventHandlers(
                (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM)) &&
               (isChromeBinding ||
                mBoundElement->IsInNativeAnonymousSubtree())) {
             flags.mInSystemGroup = true;
           }
 
           bool hasAllowUntrustedAttr = curr->HasAllowUntrustedAttr();
           if ((hasAllowUntrustedAttr && curr->AllowUntrustedEvents()) ||
-              (!hasAllowUntrustedAttr && !isChromeDoc &&
-               !mUsingContentXBLScope)) {
+              (!hasAllowUntrustedAttr && !isChromeDoc)) {
             flags.mAllowUntrustedEvents = true;
           }
 
           manager->AddEventListenerByType(
               handler, nsDependentAtomString(eventAtom), flags);
         }
       }
 
       const nsCOMArray<nsXBLKeyEventHandler>* keyHandlers =
           mPrototypeBinding->GetKeyEventHandlers();
       int32_t i;
       for (i = 0; i < keyHandlers->Count(); ++i) {
         nsXBLKeyEventHandler* handler = keyHandlers->ObjectAt(i);
         handler->SetIsBoundToChrome(isChromeDoc);
-        handler->SetUsingContentXBLScope(mUsingContentXBLScope);
 
         nsAutoString type;
         handler->GetEventName(type);
 
         // If this is a command, add it in the system event group, otherwise
         // add it to the standard event group.
 
         // Figure out if we're using capturing or not.
--- a/dom/xbl/nsXBLBinding.h
+++ b/dom/xbl/nsXBLBinding.h
@@ -145,17 +145,16 @@ class nsXBLBinding final {
   // by this binding.
   nsAnonymousContentList* GetAnonymousNodeList();
 
   nsIURI* GetSourceDocURI();
 
   // MEMBER VARIABLES
  protected:
   bool mMarkedForDeath;
-  bool mUsingContentXBLScope;
 
   nsXBLPrototypeBinding*
       mPrototypeBinding;  // Weak, but we're holding a ref to the docinfo
   nsCOMPtr<nsIContent>
       mContent;  // Strong. Our anonymous content stays around with us.
   RefPtr<nsXBLBinding> mNextBinding;  // Strong. The derived binding owns the
                                       // base class bindings.
 
--- a/dom/xbl/nsXBLEventHandler.cpp
+++ b/dom/xbl/nsXBLEventHandler.cpp
@@ -53,18 +53,17 @@ bool nsXBLMouseEventHandler::EventMatche
   return mouse && mProtoHandler->MouseEventMatched(mouse);
 }
 
 nsXBLKeyEventHandler::nsXBLKeyEventHandler(nsAtom* aEventType, uint8_t aPhase,
                                            uint8_t aType)
     : mEventType(aEventType),
       mPhase(aPhase),
       mType(aType),
-      mIsBoundToChrome(false),
-      mUsingContentXBLScope(false) {}
+      mIsBoundToChrome(false) {}
 
 nsXBLKeyEventHandler::~nsXBLKeyEventHandler() {}
 
 NS_IMPL_ISUPPORTS(nsXBLKeyEventHandler, nsIDOMEventListener)
 
 bool nsXBLKeyEventHandler::ExecuteMatchedHandlers(
     KeyboardEvent* aKeyEvent, uint32_t aCharCode,
     const IgnoreModifierState& aIgnoreModifierState) {
@@ -72,18 +71,17 @@ bool nsXBLKeyEventHandler::ExecuteMatche
   nsCOMPtr<EventTarget> target = aKeyEvent->GetCurrentTarget();
 
   bool executed = false;
   for (uint32_t i = 0; i < mProtoHandlers.Length(); ++i) {
     nsXBLPrototypeHandler* handler = mProtoHandlers[i];
     bool hasAllowUntrustedAttr = handler->HasAllowUntrustedAttr();
     if ((event->IsTrusted() ||
          (hasAllowUntrustedAttr && handler->AllowUntrustedEvents()) ||
-         (!hasAllowUntrustedAttr && !mIsBoundToChrome &&
-          !mUsingContentXBLScope)) &&
+         (!hasAllowUntrustedAttr && !mIsBoundToChrome)) &&
         handler->KeyEventMatched(aKeyEvent, aCharCode, aIgnoreModifierState)) {
       handler->ExecuteHandler(target, aKeyEvent);
       executed = true;
     }
   }
 #ifdef XP_WIN
   // Windows native applications ignore Windows-Logo key state when checking
   // shortcut keys even if the key is pressed.  Therefore, if there is no
--- a/dom/xbl/nsXBLEventHandler.h
+++ b/dom/xbl/nsXBLEventHandler.h
@@ -72,32 +72,27 @@ class nsXBLKeyEventHandler : public nsID
   uint8_t GetPhase() const { return mPhase; }
 
   uint8_t GetType() const { return mType; }
 
   void SetIsBoundToChrome(bool aIsBoundToChrome) {
     mIsBoundToChrome = aIsBoundToChrome;
   }
 
-  void SetUsingContentXBLScope(bool aUsingContentXBLScope) {
-    mUsingContentXBLScope = aUsingContentXBLScope;
-  }
-
  private:
   nsXBLKeyEventHandler();
   virtual ~nsXBLKeyEventHandler();
 
   bool ExecuteMatchedHandlers(mozilla::dom::KeyboardEvent* aEvent,
                               uint32_t aCharCode,
                               const IgnoreModifierState& aIgnoreModifierState);
 
   nsTArray<nsXBLPrototypeHandler*> mProtoHandlers;
   RefPtr<nsAtom> mEventType;
   uint8_t mPhase;
   uint8_t mType;
   bool mIsBoundToChrome;
-  bool mUsingContentXBLScope;
 };
 
 already_AddRefed<nsXBLEventHandler> NS_NewXBLEventHandler(
     nsXBLPrototypeHandler* aHandler, nsAtom* aEventType);
 
 #endif