diff --git a/mozilla/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp b/mozilla/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp index 693bf10bc04..905ae477d48 100644 --- a/mozilla/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp +++ b/mozilla/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp @@ -65,6 +65,7 @@ #include "nsThreadUtils.h" #include "jsapi.h" #include "txExprParser.h" +#include "nsIErrorService.h" static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID); @@ -1030,7 +1031,9 @@ txMozillaXSLTProcessor::LoadStyleSheet(nsIURI* aUri, nsILoadGroup* aLoadGroup, nsCAutoString spec; aUri->GetSpec(spec); CopyUTF8toUTF16(spec, mSourceText); - reportError(rv, nsnull, nsnull); + nsresult status = NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_XSLT ? rv : + NS_ERROR_XSLT_NETWORK_ERROR; + reportError(status, nsnull, nsnull); } return rv; } @@ -1240,6 +1243,37 @@ txMozillaXSLTProcessor::ContentRemoved(nsIDocument* aDocument, mStylesheet = nsnull; } +/* static*/ +nsresult +txMozillaXSLTProcessor::Init() +{ + if (!txXSLTProcessor::init()) { + return NS_ERROR_OUT_OF_MEMORY; + } + + nsCOMPtr errorService = + do_GetService(NS_ERRORSERVICE_CONTRACTID); + if (errorService) { + errorService->RegisterErrorStringBundle(NS_ERROR_MODULE_XSLT, + XSLT_MSGS_URL); + } + + return NS_OK; +} + +/* static*/ +void +txMozillaXSLTProcessor::Shutdown() +{ + txXSLTProcessor::shutdown(); + + nsCOMPtr errorService = + do_GetService(NS_ERRORSERVICE_CONTRACTID); + if (errorService) { + errorService->UnregisterErrorStringBundle(NS_ERROR_MODULE_XSLT); + } +} + /* static*/ nsresult txVariable::Convert(nsIVariant *aValue, txAExprResult** aResult) diff --git a/mozilla/content/xslt/src/xslt/txMozillaXSLTProcessor.h b/mozilla/content/xslt/src/xslt/txMozillaXSLTProcessor.h index 7c8498f2de5..993fa80f0ee 100644 --- a/mozilla/content/xslt/src/xslt/txMozillaXSLTProcessor.h +++ b/mozilla/content/xslt/src/xslt/txMozillaXSLTProcessor.h @@ -131,6 +131,9 @@ public: return (mFlags & DISABLE_ALL_LOADS) != 0; } + static nsresult Init(); + static void Shutdown(); + private: nsresult DoTransform(); void notifyError(); diff --git a/mozilla/layout/build/nsLayoutModule.cpp b/mozilla/layout/build/nsLayoutModule.cpp index becc37a7b33..b08601455ea 100644 --- a/mozilla/layout/build/nsLayoutModule.cpp +++ b/mozilla/layout/build/nsLayoutModule.cpp @@ -109,7 +109,6 @@ #include "nsXPathEvaluator.h" #include "txMozillaXSLTProcessor.h" #include "txNodeSetAdaptor.h" -#include "txXSLTProcessor.h" #include "nsXPath1Scheme.h" #include "nsDOMParser.h" diff --git a/mozilla/layout/build/nsLayoutStatics.cpp b/mozilla/layout/build/nsLayoutStatics.cpp index 7986c7fa1d6..43a03da274c 100644 --- a/mozilla/layout/build/nsLayoutStatics.cpp +++ b/mozilla/layout/build/nsLayoutStatics.cpp @@ -76,7 +76,7 @@ #include "nsTextTransformer.h" #include "nsXBLAtoms.h" #include "nsXBLWindowKeyHandler.h" -#include "txXSLTProcessor.h" +#include "txMozillaXSLTProcessor.h" #include "nsDOMStorage.h" #ifdef MOZ_XUL @@ -175,8 +175,10 @@ nsLayoutStatics::Initialize() } nsDOMAttribute::Initialize(); - if (!txXSLTProcessor::init()) { - return NS_ERROR_OUT_OF_MEMORY; + rv = txMozillaXSLTProcessor::Init(); + if (NS_FAILED(rv)) { + NS_ERROR("Could not initialize txMozillaXSLTProcessor"); + return rv; } rv = nsDOMStorageManager::Initialize(); @@ -192,7 +194,7 @@ void nsLayoutStatics::Shutdown() { nsDOMStorageManager::Shutdown(); - txXSLTProcessor::shutdown(); + txMozillaXSLTProcessor::Shutdown(); nsDOMAttribute::Shutdown(); nsDOMEventRTTearoff::Shutdown(); nsEventListenerManager::Shutdown();