bindableContent->SetBinding(binding);
if (!newBinding) { #ifdef DEBUG nsCAutoString spec; aURL->GetSpec(spec); nsCAutoString str(NS_LITERAL_CSTRING("Failed to locate XBL binding. XBL is now using id instead of name to reference bindings. Make sure you have switched over.  The invalid binding name is: ") + spec); NS_ERROR(str.get()); #endif return NS_OK; }  if (aAugmentFlag) { nsCOMPtr<nsIXBLBinding> baseBinding; nsCOMPtr<nsIXBLBinding> nextBinding = newBinding; do { baseBinding = nextBinding; baseBinding->GetBaseBinding(getter_AddRefs(nextBinding)); baseBinding->SetIsStyleBinding(PR_FALSE); } while (nextBinding);     bindingManager->SetBinding(aContent, newBinding); baseBinding->SetBaseBinding(binding); } else {  if (binding) {  nsCOMPtr<nsIXBLBinding> rootBinding; binding->GetRootBinding(getter_AddRefs(rootBinding)); rootBinding->SetBaseBinding(newBinding); } else {  bindingManager->SetBinding(aContent, newBinding); } }   newBinding->SetBoundElement(aContent);
nsXBLService::LoadBindings(nsIContent* aContent, const nsString& aURL) {   nsresult rv;  nsCOMPtr<nsIBindableContent> bindableContent = do_QueryInterface(aContent);  if (!bindableContent)    return NS_ERROR_FAILURE;  nsCOMPtr<nsIXBLBinding> binding;  bindableContent->GetBinding(getter_AddRefs(binding));  if (binding)    bindableContent->SetBinding(nsnull); // Flush old bindings  nsCAutoString url = aURL;  if (NS_FAILED(rv = GetBinding(url, getter_AddRefs(binding)))) {    NS_ERROR("Failed loading an XBL document for content node.");    return rv;  }  // Install the binding on the content node.  bindableContent->SetBinding(binding);  // Tell the binding to build the anonymous content.  binding->GenerateAnonymousContent(aContent);  // Tell the binding to install event handlers  binding->InstallEventHandlers(aContent);  // XXX Methods and properties. How?  return NS_OK; }