First part of fix for bug 306539 (Error during XSLT transformation: (null)). r/sr=sicking.

This commit is contained in:
peterv%propagandism.org 2006-12-22 17:22:18 +00:00
Родитель a757f7f50c
Коммит 95e8a90330
4 изменённых файлов: 44 добавлений и 6 удалений

Просмотреть файл

@ -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<nsIErrorService> 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<nsIErrorService> errorService =
do_GetService(NS_ERRORSERVICE_CONTRACTID);
if (errorService) {
errorService->UnregisterErrorStringBundle(NS_ERROR_MODULE_XSLT);
}
}
/* static*/
nsresult
txVariable::Convert(nsIVariant *aValue, txAExprResult** aResult)

Просмотреть файл

@ -131,6 +131,9 @@ public:
return (mFlags & DISABLE_ALL_LOADS) != 0;
}
static nsresult Init();
static void Shutdown();
private:
nsresult DoTransform();
void notifyError();

Просмотреть файл

@ -109,7 +109,6 @@
#include "nsXPathEvaluator.h"
#include "txMozillaXSLTProcessor.h"
#include "txNodeSetAdaptor.h"
#include "txXSLTProcessor.h"
#include "nsXPath1Scheme.h"
#include "nsDOMParser.h"

Просмотреть файл

@ -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();