Bug 983899, part 1 - Delete some trailing whitespace in XBL. r=mrbkap
authorAndrew McCreight <continuation@gmail.com>
Tue, 18 Mar 2014 14:25:39 -0700
changeset 193746 4ca8ffe34a7cb9f0fcc14cb161ec3ffbae009348
parent 193745 10eec48bfa3c1b386a574fe2d5a1d7c82a51abde
child 193747 4d5bb6fc92958b09dde38fed99373f0eda152299
push id486
push userasasaki@mozilla.com
push dateMon, 14 Jul 2014 18:39:42 +0000
treeherdermozilla-release@d33428174ff1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs983899
milestone31.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 983899, part 1 - Delete some trailing whitespace in XBL. r=mrbkap
dom/xbl/nsXBLBinding.cpp
dom/xbl/nsXBLService.cpp
dom/xbl/nsXBLService.h
--- a/dom/xbl/nsXBLBinding.cpp
+++ b/dom/xbl/nsXBLBinding.cpp
@@ -70,17 +70,17 @@ using namespace mozilla::dom;
 // The JS class for XBLBinding
 //
 static void
 XBLFinalize(JSFreeOp *fop, JSObject *obj)
 {
   nsXBLDocumentInfo* docInfo =
     static_cast<nsXBLDocumentInfo*>(::JS_GetPrivate(obj));
   nsContentUtils::DeferredFinalize(docInfo);
-  
+
   nsXBLJSClass* c = nsXBLJSClass::fromJSClass(::JS_GetClass(obj));
   c->Drop();
 }
 
 static bool
 XBLEnumerate(JSContext *cx, JS::Handle<JSObject*> obj)
 {
   nsXBLPrototypeBinding* protoBinding =
@@ -260,17 +260,17 @@ nsXBLBinding::InstallAnonymousContent(ns
     }
     nsresult rv =
       child->BindToTree(doc, aElement, mBoundElement, allowScripts);
     if (NS_FAILED(rv)) {
       // Oh, well... Just give up.
       // XXXbz This really shouldn't be a void method!
       child->UnbindFromTree();
       return;
-    }        
+    }
 
     child->SetFlags(NODE_IS_ANONYMOUS_ROOT);
 
 #ifdef MOZ_XUL
     // To make XUL templates work (and other goodies that happen when
     // an element is added to a XUL document), we need to notify the
     // XUL document using its special API.
     nsCOMPtr<nsIXULDocument> xuldoc(do_QueryInterface(doc));
@@ -355,17 +355,17 @@ nsXBLBinding::GenerateAnonymousContent()
 
   if (!content) {
     // We have no anonymous content.
     if (mNextBinding)
       mNextBinding->GenerateAnonymousContent();
 
     return;
   }
-     
+
   // Find out if we're really building kids or if we're just
   // using the attribute-setting shorthand hack.
   uint32_t contentCount = content->GetChildCount();
 
   // Plan to build the content by default.
   bool hasContent = (contentCount > 0);
   if (hasContent) {
     nsIDocument* doc = mBoundElement->OwnerDoc();
@@ -473,31 +473,31 @@ nsXBLBinding::GenerateAnonymousContent()
 XBLChildrenElement*
 nsXBLBinding::FindInsertionPointFor(nsIContent* aChild)
 {
   // XXX We should get rid of this function as it causes us to traverse the
   // binding chain multiple times
   if (mContent) {
     return FindInsertionPointForInternal(aChild);
   }
-  
+
   return mNextBinding ? mNextBinding->FindInsertionPointFor(aChild)
                       : nullptr;
 }
 
 XBLChildrenElement*
 nsXBLBinding::FindInsertionPointForInternal(nsIContent* aChild)
 {
   for (uint32_t i = 0; i < mInsertionPoints.Length(); ++i) {
     XBLChildrenElement* point = mInsertionPoints[i];
     if (point->Includes(aChild)) {
       return point;
     }
   }
-  
+
   return mDefaultInsertionPoint;
 }
 
 void
 nsXBLBinding::ClearInsertionPoints()
 {
   if (mDefaultInsertionPoint) {
     mDefaultInsertionPoint->ClearInsertedChildren();
@@ -579,17 +579,17 @@ nsXBLBinding::InstallEventHandlers()
       for (i = 0; i < keyHandlers->Count(); ++i) {
         nsXBLKeyEventHandler* handler = keyHandlers->ObjectAt(i);
         handler->SetIsBoundToChrome(isChromeDoc);
         handler->SetUsingXBLScope(mUsingXBLScope);
 
         nsAutoString type;
         handler->GetEventName(type);
 
-        // If this is a command, add it in the system event group, otherwise 
+        // 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.
         EventListenerFlags flags;
         flags.mCapture = (handler->GetPhase() == NS_PHASE_CAPTURING);
 
         if ((handler->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND |
                                    NS_HANDLER_TYPE_SYSTEM)) &&
@@ -679,25 +679,25 @@ nsXBLBinding::UnhookEventHandlers()
 {
   nsXBLPrototypeHandler* handlerChain = mPrototypeBinding->GetPrototypeHandlers();
 
   if (handlerChain) {
     EventListenerManager* manager = mBoundElement->GetExistingListenerManager();
     if (!manager) {
       return;
     }
-                                      
+
     bool isChromeBinding = mPrototypeBinding->IsChrome();
     nsXBLPrototypeHandler* curr;
     for (curr = handlerChain; curr; curr = curr->GetNextHandler()) {
       nsXBLEventHandler* handler = curr->GetCachedEventHandler();
       if (!handler) {
         continue;
       }
-      
+
       nsCOMPtr<nsIAtom> eventAtom = curr->GetEventName();
       if (!eventAtom ||
           eventAtom == nsGkAtoms::keyup ||
           eventAtom == nsGkAtoms::keydown ||
           eventAtom == nsGkAtoms::keypress)
         continue;
 
       // Figure out if we're using capturing or not.
@@ -726,17 +726,17 @@ nsXBLBinding::UnhookEventHandlers()
 
       nsAutoString type;
       handler->GetEventName(type);
 
       // Figure out if we're using capturing or not.
       EventListenerFlags flags;
       flags.mCapture = (handler->GetPhase() == NS_PHASE_CAPTURING);
 
-      // If this is a command, remove it from the system event group, otherwise 
+      // If this is a command, remove it from the system event group, otherwise
       // remove it from the standard event group.
 
       if ((handler->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM)) &&
           (isChromeBinding || mBoundElement->IsInNativeAnonymousSubtree())) {
         flags.mInSystemGroup = true;
       }
 
       manager->RemoveEventListenerByType(handler, type, flags);
@@ -900,17 +900,17 @@ 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;
 }
 
 void
 nsXBLBinding::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, void* aData)
@@ -1029,17 +1029,17 @@ nsXBLBinding::DoInitJSClass(JSContext *c
     }
 
     // The prototype holds a strong reference to its class struct.
     c->Hold();
 
     // Make a new object prototyped by parent_proto and parented by global.
     proto = ::JS_InitClass(cx,                  // context
                            global,              // global object
-                           parent_proto,        // parent proto 
+                           parent_proto,        // parent proto
                            c,                   // JSClass
                            nullptr,              // JSNative ctor
                            0,                   // ctor args
                            nullptr,              // proto props
                            nullptr,              // proto funcs
                            nullptr,              // ctor props (static)
                            nullptr);             // ctor funcs (static)
     if (!proto) {
--- a/dom/xbl/nsXBLService.cpp
+++ b/dom/xbl/nsXBLService.cpp
@@ -149,17 +149,17 @@ public:
 
   nsXBLBindingRequest(nsIURI* aURI, nsIContent* aBoundElement)
     : mBindingURI(aURI),
       mBoundElement(aBoundElement)
   {
   }
 };
 
-// nsXBLStreamListener, a helper class used for 
+// nsXBLStreamListener, a helper class used for
 // asynchronous parsing of URLs
 /* Header file */
 class nsXBLStreamListener MOZ_FINAL : public nsIStreamListener,
                                       public nsIDOMEventListener
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSISTREAMLISTENER
@@ -172,17 +172,17 @@ public:
   ~nsXBLStreamListener();
 
   void AddRequest(nsXBLBindingRequest* aRequest) { mBindingRequests.AppendElement(aRequest); }
   bool HasRequest(nsIURI* aURI, nsIContent* aBoundElement);
 
 private:
   nsCOMPtr<nsIStreamListener> mInner;
   nsAutoTArray<nsXBLBindingRequest*, 8> mBindingRequests;
-  
+
   nsCOMPtr<nsIWeakReference> mBoundDocument;
   nsCOMPtr<nsIXMLContentSink> mSink; // Only set until OnStartRequest
   nsCOMPtr<nsIDocument> mBindingDocument; // Only set until OnStartRequest
 };
 
 /* Implementation file */
 NS_IMPL_ISUPPORTS3(nsXBLStreamListener,
                    nsIStreamListener,
@@ -242,17 +242,17 @@ nsXBLStreamListener::OnStartRequest(nsIR
 
   // Make sure to add ourselves as a listener after StartDocumentLoad,
   // since that resets the event listners on the document.
   doc->AddEventListener(NS_LITERAL_STRING("load"), this, false);
 
   return mInner->OnStartRequest(request, aCtxt);
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsXBLStreamListener::OnStopRequest(nsIRequest* request, nsISupports* aCtxt, nsresult aStatus)
 {
   nsresult rv = NS_OK;
   if (mInner) {
      rv = mInner->OnStopRequest(request, aCtxt, aStatus);
   }
 
   // Don't hold onto the inner listener; holding onto it can create a cycle
@@ -296,17 +296,17 @@ nsXBLStreamListener::HandleEvent(nsIDOME
   nsCOMPtr<nsIDocument> doc(do_QueryReferent(mBoundDocument));
   if (!doc) {
     NS_WARNING("XBL load did not complete until after document went away! Modal dialog bug?\n");
   }
   else {
     // We have to do a flush prior to notification of the document load.
     // This has to happen since the HTML content sink can be holding on
     // to notifications related to our children (e.g., if you bind to the
-    // <body> tag) that result in duplication of content.  
+    // <body> tag) that result in duplication of content.
     // We need to get the sink's notifications flushed and then make the binding
     // ready.
     if (count > 0) {
       nsXBLBindingRequest* req = mBindingRequests.ElementAt(0);
       nsIDocument* document = req->mBoundElement->GetCurrentDoc();
       if (document)
         document->FlushPendingNotifications(Flush_ContentAndNotify);
     }
@@ -342,17 +342,17 @@ nsXBLStreamListener::HandleEvent(nsIDOME
     // If the doc is a chrome URI, then we put it into the XUL cache.
 #ifdef MOZ_XUL
     if (nsXBLService::IsChromeOrResourceURI(documentURI)) {
       nsXULPrototypeCache* cache = nsXULPrototypeCache::GetInstance();
       if (cache && cache->IsEnabled())
         cache->PutXBLDocumentInfo(info);
     }
 #endif
-  
+
     bindingManager->PutXBLDocumentInfo(info);
 
     // Notify all pending requests that their bindings are
     // ready and can be installed.
     for (i = 0; i < count; i++) {
       nsXBLBindingRequest* req = mBindingRequests.ElementAt(i);
       req->DocumentLoaded(bindingDocument);
     }
@@ -418,32 +418,32 @@ nsXBLService::~nsXBLService(void)
 }
 
 // static
 bool
 nsXBLService::IsChromeOrResourceURI(nsIURI* aURI)
 {
   bool isChrome = false;
   bool isResource = false;
-  if (NS_SUCCEEDED(aURI->SchemeIs("chrome", &isChrome)) && 
+  if (NS_SUCCEEDED(aURI->SchemeIs("chrome", &isChrome)) &&
       NS_SUCCEEDED(aURI->SchemeIs("resource", &isResource)))
       return (isChrome || isResource);
   return false;
 }
 
 
 // This function loads a particular XBL file and installs all of the bindings
 // onto the element.
 nsresult
 nsXBLService::LoadBindings(nsIContent* aContent, nsIURI* aURL,
                            nsIPrincipal* aOriginPrincipal,
-                           nsXBLBinding** aBinding, bool* aResolveStyle) 
+                           nsXBLBinding** aBinding, bool* aResolveStyle)
 {
   NS_PRECONDITION(aOriginPrincipal, "Must have an origin principal");
-  
+
   *aBinding = nullptr;
   *aResolveStyle = false;
 
   nsresult rv;
 
   nsCOMPtr<nsIDocument> document = aContent->OwnerDoc();
 
   nsAutoCString urlspec;
@@ -513,36 +513,36 @@ nsXBLService::LoadBindings(nsIContent* a
     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.swap(*aBinding);
   }
 
-  return NS_OK; 
+  return NS_OK;
 }
 
 nsresult
 nsXBLService::FlushStyleBindings(nsIContent* aContent)
 {
   nsCOMPtr<nsIDocument> document = aContent->OwnerDoc();
 
   nsXBLBinding *binding = aContent->GetXBLBinding();
   if (binding) {
     // Clear out the script references.
     binding->ChangeDocument(document, nullptr);
 
     aContent->SetXBLBinding(nullptr); // Flush old style bindings
   }
-   
+
   return NS_OK;
 }
 
 //
 // AttachGlobalKeyHandler
 //
 // Creates a new key handler and prepares to listen to key events on the given
 // event receiver (either a document or an content node). If the receiver is content,
@@ -654,61 +654,61 @@ nsXBLService::FlushMemory()
   }
   return NS_OK;
 }
 
 // Internal helper methods ////////////////////////////////////////////////////////////////
 
 nsresult
 nsXBLService::BindingReady(nsIContent* aBoundElement,
-                           nsIURI* aURI, 
+                           nsIURI* aURI,
                            bool* aIsReady)
 {
   // Don't do a security check here; we know this binding is set to go.
   return GetBinding(aBoundElement, aURI, true, nullptr, aIsReady, nullptr);
 }
 
 nsresult
-nsXBLService::GetBinding(nsIContent* aBoundElement, nsIURI* aURI, 
+nsXBLService::GetBinding(nsIContent* aBoundElement, nsIURI* aURI,
                          bool aPeekOnly, nsIPrincipal* aOriginPrincipal,
                          bool* aIsReady, nsXBLBinding** aResult)
 {
   // More than 6 binding URIs are rare, see bug 55070 comment 18.
   nsAutoTArray<nsIURI*, 6> uris;
   return GetBinding(aBoundElement, aURI, aPeekOnly, aOriginPrincipal, aIsReady,
                     aResult, uris);
 }
 
 nsresult
-nsXBLService::GetBinding(nsIContent* aBoundElement, nsIURI* aURI, 
+nsXBLService::GetBinding(nsIContent* aBoundElement, nsIURI* aURI,
                          bool aPeekOnly, nsIPrincipal* aOriginPrincipal,
                          bool* aIsReady, nsXBLBinding** aResult,
                          nsTArray<nsIURI*>& aDontExtendURIs)
 {
   NS_ASSERTION(aPeekOnly || aResult,
                "Must have non-null out param if not just peeking to see "
                "whether the binding is ready");
-  
+
   if (aResult)
     *aResult = nullptr;
 
   if (!aURI)
     return NS_ERROR_FAILURE;
 
   nsAutoCString ref;
   aURI->GetRef(ref);
 
   nsCOMPtr<nsIDocument> boundDocument = aBoundElement->OwnerDoc();
 
   nsRefPtr<nsXBLDocumentInfo> docInfo;
   nsresult rv = LoadBindingDocumentInfo(aBoundElement, boundDocument, aURI,
                                         aOriginPrincipal,
                                         false, getter_AddRefs(docInfo));
   NS_ENSURE_SUCCESS(rv, rv);
-  
+
   if (!docInfo)
     return NS_ERROR_FAILURE;
 
   nsXBLPrototypeBinding* protoBinding = docInfo->GetPrototypeBinding(ref);
 
   if (!protoBinding) {
 #ifdef DEBUG
     nsAutoCString uriSpec;
@@ -816,41 +816,41 @@ static bool SchemeIs(nsIURI* aURI, const
 }
 
 static bool
 IsSystemOrChromeURLPrincipal(nsIPrincipal* aPrincipal)
 {
   if (nsContentUtils::IsSystemPrincipal(aPrincipal)) {
     return true;
   }
-  
+
   nsCOMPtr<nsIURI> uri;
   aPrincipal->GetURI(getter_AddRefs(uri));
   NS_ENSURE_TRUE(uri, false);
-  
+
   bool isChrome = false;
   return NS_SUCCEEDED(uri->SchemeIs("chrome", &isChrome)) && isChrome;
 }
 
 nsresult
 nsXBLService::LoadBindingDocumentInfo(nsIContent* aBoundElement,
                                       nsIDocument* aBoundDocument,
                                       nsIURI* aBindingURI,
                                       nsIPrincipal* aOriginPrincipal,
                                       bool aForceSyncLoad,
                                       nsXBLDocumentInfo** aResult)
 {
   NS_PRECONDITION(aBindingURI, "Must have a binding URI");
   NS_PRECONDITION(!aOriginPrincipal || aBoundDocument,
                   "If we're doing a security check, we better have a document!");
-  
+
   nsresult rv;
   if (aOriginPrincipal) {
     // Security check - Enforce same-origin policy, except to chrome.
-    // We have to be careful to not pass aContent as the context here. 
+    // We have to be careful to not pass aContent as the context here.
     // Otherwise, if there is a JS-implemented content policy, we will attempt
     // to wrap the content node, which will try to load XBL bindings for it, if
     // any. Since we're not done loading this binding yet, that will reenter
     // this method and we'll end up creating a binding and then immediately
     // clobbering it in our table.  That makes things very confused, leading to
     // misbehavior and crashes.
     rv = nsContentUtils::
       CheckSecurityBeforeLoad(aBindingURI, aOriginPrincipal,
@@ -881,23 +881,23 @@ nsXBLService::LoadBindingDocumentInfo(ns
 
   nsCOMPtr<nsIURI> documentURI;
   rv = aBindingURI->CloneIgnoringRef(getter_AddRefs(documentURI));
   NS_ENSURE_SUCCESS(rv, rv);
 
 #ifdef MOZ_XUL
   // We've got a file.  Check our XBL document cache.
   nsXULPrototypeCache* cache = nsXULPrototypeCache::GetInstance();
-  bool useXULCache = cache && cache->IsEnabled(); 
+  bool useXULCache = cache && cache->IsEnabled();
 
   if (useXULCache) {
-    // The first line of defense is the chrome cache.  
+    // The first line of defense is the chrome cache.
     // This cache crosses the entire product, so that any XBL bindings that are
     // part of chrome will be reused across all XUL documents.
-    info = cache->GetXBLDocumentInfo(documentURI); 
+    info = cache->GetXBLDocumentInfo(documentURI);
   }
 #endif
 
   if (!info) {
     // The second line of defense is the binding manager's document table.
     nsBindingManager *bindingManager = nullptr;
 
     if (aBoundDocument) {
@@ -952,17 +952,17 @@ nsXBLService::LoadBindingDocumentInfo(ns
         }
       }
     }
 #endif
 
     if (!info) {
       // Finally, if all lines of defense fail, we go and fetch the binding
       // document.
-      
+
       // Always load chrome synchronously
       bool chrome;
       if (NS_SUCCEEDED(documentURI->SchemeIs("chrome", &chrome)) && chrome)
         aForceSyncLoad = true;
 
       nsCOMPtr<nsIDocument> document;
       FetchBindingDocument(aBoundElement, aBoundDocument, documentURI,
                            aBindingURI, aForceSyncLoad, getter_AddRefs(document));
@@ -980,41 +980,41 @@ nsXBLService::LoadBindingDocumentInfo(ns
 #ifdef MOZ_XUL
         if (useStartupCache) {
           cache->PutXBLDocumentInfo(info);
 
           // now write the bindings into the startup cache
           info->WritePrototypeBindings();
         }
 #endif
-        
+
         if (bindingManager) {
           // Also put it in our binding manager's document table.
           bindingManager->PutXBLDocumentInfo(info);
         }
       }
     }
   }
 
   info.forget(aResult);
 
   return NS_OK;
 }
 
 nsresult
 nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoundDocument,
-                                   nsIURI* aDocumentURI, nsIURI* aBindingURI, 
+                                   nsIURI* aDocumentURI, nsIURI* aBindingURI,
                                    bool aForceSyncLoad, nsIDocument** aResult)
 {
   nsresult rv = NS_OK;
   // Initialize our out pointer to nullptr
   *aResult = nullptr;
 
   // Now we have to synchronously load the binding file.
-  // Create an XML content sink and a parser. 
+  // Create an XML content sink and a parser.
   nsCOMPtr<nsILoadGroup> loadGroup;
   if (aBoundDocument)
     loadGroup = aBoundDocument->GetDocumentLoadGroup();
 
   // We really shouldn't have to force a sync load for anything here... could
   // we get away with not doing that?  Not sure.
   if (IsChromeOrResourceURI(aDocumentURI))
     aForceSyncLoad = true;
@@ -1087,9 +1087,8 @@ nsXBLService::FetchBindingDocument(nsICo
 
   rv = nsSyncLoadService::PushSyncStreamToListener(in, listener, channel);
   NS_ENSURE_SUCCESS(rv, rv);
 
   doc.swap(*aResult);
 
   return NS_OK;
 }
-
--- a/dom/xbl/nsXBLService.h
+++ b/dom/xbl/nsXBLService.h
@@ -79,20 +79,20 @@ private:
   virtual ~nsXBLService();
 
 protected:
   // This function clears out the bindings on a given content node.
   nsresult FlushStyleBindings(nsIContent* aContent);
 
   // Release any memory that we can
   nsresult FlushMemory();
-  
+
   // This method synchronously loads and parses an XBL file.
   nsresult FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoundDocument,
-                                nsIURI* aDocumentURI, nsIURI* aBindingURI, 
+                                nsIURI* aDocumentURI, nsIURI* aBindingURI,
                                 bool aForceSyncLoad, nsIDocument** aResult);
 
   /**
    * This method calls the one below with an empty |aDontExtendURIs| array.
    */
   nsresult GetBinding(nsIContent* aBoundElement, nsIURI* aURI,
                       bool aPeekFlag, nsIPrincipal* aOriginPrincipal,
                       bool* aIsReady, nsXBLBinding** aResult);