mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 590812: Fix XML pretty printing. r=mrbkap a=blocker
This commit is contained in:
parent
5652bfc359
commit
a29872edef
@ -54,6 +54,7 @@
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
#include "nsBindingManager.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
@ -157,20 +158,26 @@ nsXMLPrettyPrinter::PrettyPrint(nsIDocument* aDocument,
|
||||
NS_ASSERTION(xblDoc, "xml document doesn't implement nsIDOMDocumentXBL");
|
||||
NS_ENSURE_TRUE(xblDoc, NS_ERROR_FAILURE);
|
||||
|
||||
xblDoc->LoadBindingDocument(NS_LITERAL_STRING("chrome://global/content/xml/XMLPrettyPrint.xml"));
|
||||
nsCOMPtr<nsIURI> bindingUri;
|
||||
rv = NS_NewURI(getter_AddRefs(bindingUri),
|
||||
NS_LITERAL_STRING("chrome://global/content/xml/XMLPrettyPrint.xml#prettyprint"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> sysPrincipal;
|
||||
nsContentUtils::GetSecurityManager()->
|
||||
GetSystemPrincipal(getter_AddRefs(sysPrincipal));
|
||||
aDocument->BindingManager()->LoadBindingDocument(aDocument, bindingUri,
|
||||
sysPrincipal);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> rootElem;
|
||||
sourceDocument->GetDocumentElement(getter_AddRefs(rootElem));
|
||||
NS_ENSURE_TRUE(rootElem, NS_ERROR_UNEXPECTED);
|
||||
nsCOMPtr<nsIContent> rootCont = aDocument->GetRootElement();
|
||||
NS_ENSURE_TRUE(rootCont, NS_ERROR_UNEXPECTED);
|
||||
|
||||
rv = xblDoc->AddBinding(rootElem,
|
||||
NS_LITERAL_STRING("chrome://global/content/xml/XMLPrettyPrint.xml#prettyprint"));
|
||||
rv = aDocument->BindingManager()->AddLayeredBinding(rootCont, bindingUri,
|
||||
sysPrincipal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Hand the result document to the binding
|
||||
nsCOMPtr<nsIObserver> binding;
|
||||
nsCOMPtr<nsIContent> rootCont = do_QueryInterface(rootElem);
|
||||
NS_ASSERTION(rootCont, "Element doesn't implement nsIContent");
|
||||
aDocument->BindingManager()->GetBindingImplementation(rootCont,
|
||||
NS_GET_IID(nsIObserver),
|
||||
(void**)getter_AddRefs(binding));
|
||||
|
Loading…
Reference in New Issue
Block a user