return CallQueryInterface(domDoc, aResult);
proxy->Close(); delete proxy;    *aResult = doc; NS_IF_ADDREF(*aResult);      nsCOMPtr<nsIContent> root = getter_AddRefs(doc->GetRootContent()); if (root) StripWhitespaceNodes(root);  return NS_OK;
nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoundDocument,                                   nsIURI* aDocumentURI, nsIURL* aBindingURL,                                    PRBool aForceSyncLoad, nsIDocument** aResult){  nsresult rv = NS_OK;  // Initialize our out pointer to nsnull  *aResult = nsnull;  // Now we have to synchronously load the binding file.  // Create an XML content sink and a parser.   nsCOMPtr<nsILoadGroup> loadGroup;  if (aBoundDocument)    loadGroup = aBoundDocument->GetDocumentLoadGroup();  nsINodeInfo *ni = nsnull;  if (aBoundElement)    ni = aBoundElement->GetNodeInfo();  if (ni && (ni->Equals(nsXULAtoms::scrollbar, kNameSpaceID_XUL) ||             ni->Equals(nsXULAtoms::thumb, kNameSpaceID_XUL) ||              (ni->Equals(nsHTMLAtoms::select) &&              aBoundElement->IsContentOfType(nsIContent::eHTML))) ||      IsResourceURI(aDocumentURI))    aForceSyncLoad = PR_TRUE;  if(!aForceSyncLoad) {    // Create the XML document    nsCOMPtr<nsIDocument> doc = do_CreateInstance(kXMLDocumentCID, &rv);    NS_ENSURE_SUCCESS(rv, rv);    nsCOMPtr<nsIChannel> channel;    rv = NS_NewChannel(getter_AddRefs(channel), aDocumentURI, nsnull, loadGroup);    if (NS_FAILED(rv)) return rv;    nsCOMPtr<nsIStreamListener> listener;    nsCOMPtr<nsIXMLContentSink> xblSink;    NS_NewXBLContentSink(getter_AddRefs(xblSink), doc, aDocumentURI, nsnull);    if (!xblSink)      return NS_ERROR_FAILURE;    if (NS_FAILED(rv = doc->StartDocumentLoad("loadAsInteractiveData",                                               channel,                                               loadGroup,                                               nsnull,                                               getter_AddRefs(listener),                                              PR_TRUE,                                              xblSink))) {      NS_ERROR("Failure to init XBL doc prior to load.");      return rv;    }    // We can be asynchronous    nsXBLStreamListener* xblListener = new nsXBLStreamListener(this, listener, aBoundDocument, doc);    NS_ENSURE_TRUE(xblListener,NS_ERROR_OUT_OF_MEMORY);    nsCOMPtr<nsIDOMEventReceiver> rec(do_QueryInterface(doc));    rec->AddEventListener(NS_LITERAL_STRING("load"), (nsIDOMLoadListener*)xblListener, PR_FALSE);    // Add ourselves to the list of loading docs.    nsIBindingManager *bindingManager;    if (aBoundDocument)      bindingManager = aBoundDocument->GetBindingManager();    else      bindingManager = nsnull;    if (bindingManager)      bindingManager->PutLoadingDocListener(aDocumentURI, xblListener);    // Add our request.    nsXBLBindingRequest* req = nsXBLBindingRequest::Create(mPool,                                                           aBindingURL,                                                           aBoundElement);    xblListener->AddRequest(req);    // Now kick off the async read.    channel->AsyncOpen(xblListener, nsnull);    return NS_OK;  }  // Now do a blocking synchronous parse of the file.  nsCOMPtr<nsIDOMDocument> domDoc;  nsCOMPtr<nsISyncLoadDOMService> loader =    do_GetService("@mozilla.org/content/syncload-dom-service;1", &rv);  NS_ENSURE_SUCCESS(rv, rv);  // Open channel  nsCOMPtr<nsIChannel> channel;  rv = NS_NewChannel(getter_AddRefs(channel), aDocumentURI, nsnull, loadGroup);  NS_ENSURE_SUCCESS(rv, rv);  rv = loader->LoadLocalXBLDocument(channel, getter_AddRefs(domDoc));  if (rv == NS_ERROR_FILE_NOT_FOUND) {      return NS_OK;  }  NS_ENSURE_SUCCESS(rv, rv);  return CallQueryInterface(domDoc, aResult);}