зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1435430 part 1. Switch to creating XSLTProcessors via constructor, not contract. r=mystor
MozReview-Commit-ID: A20gseUzUFT
This commit is contained in:
Родитель
f1fc54c0cd
Коммит
ba9661475c
|
@ -40,6 +40,7 @@ LOCAL_INCLUDES += [
|
||||||
'/caps',
|
'/caps',
|
||||||
'/dom/base',
|
'/dom/base',
|
||||||
'/dom/html',
|
'/dom/html',
|
||||||
|
'/dom/xslt/base',
|
||||||
'/dom/xul',
|
'/dom/xul',
|
||||||
'/layout/style',
|
'/layout/style',
|
||||||
]
|
]
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
#include "mozilla/dom/HTMLTemplateElement.h"
|
#include "mozilla/dom/HTMLTemplateElement.h"
|
||||||
#include "mozilla/dom/ProcessingInstruction.h"
|
#include "mozilla/dom/ProcessingInstruction.h"
|
||||||
#include "mozilla/dom/ScriptLoader.h"
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
|
#include "mozilla/dom/txMozillaXSLTProcessor.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
@ -626,12 +627,7 @@ nsXMLContentSink::AddContentAsLeaf(nsIContent *aContent)
|
||||||
nsresult
|
nsresult
|
||||||
nsXMLContentSink::LoadXSLStyleSheet(nsIURI* aUrl)
|
nsXMLContentSink::LoadXSLStyleSheet(nsIURI* aUrl)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDocumentTransformer> processor =
|
nsCOMPtr<nsIDocumentTransformer> processor = new txMozillaXSLTProcessor();
|
||||||
do_CreateInstance("@mozilla.org/document-transformer;1?type=xslt");
|
|
||||||
if (!processor) {
|
|
||||||
// No XSLT processor available, continue normal document loading
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
processor->SetTransformObserver(this);
|
processor->SetTransformObserver(this);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsVariant.h"
|
#include "nsVariant.h"
|
||||||
#include "mozilla/dom/CustomEvent.h"
|
#include "mozilla/dom/CustomEvent.h"
|
||||||
|
#include "mozilla/dom/txMozillaXSLTProcessor.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
@ -111,10 +112,7 @@ nsXMLPrettyPrinter::PrettyPrint(nsIDocument* aDocument,
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// Transform the document
|
// Transform the document
|
||||||
nsCOMPtr<nsIXSLTProcessor> transformer =
|
RefPtr<txMozillaXSLTProcessor> transformer = new txMozillaXSLTProcessor();
|
||||||
do_CreateInstance("@mozilla.org/document-transformer;1?type=xslt", &rv);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
rv = transformer->ImportStylesheet(xslDocument);
|
rv = transformer->ImportStylesheet(xslDocument);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
|
|
@ -38,13 +38,6 @@ class GlobalObject;
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
/* bacd8ad0-552f-11d3-a9f7-000064657374 */
|
|
||||||
#define TRANSFORMIIX_XSLT_PROCESSOR_CID \
|
|
||||||
{ 0x618ee71d, 0xd7a7, 0x41a1, {0xa3, 0xfb, 0xc2, 0xbe, 0xdc, 0x6a, 0x21, 0x7e} }
|
|
||||||
|
|
||||||
#define TRANSFORMIIX_XSLT_PROCESSOR_CONTRACTID \
|
|
||||||
"@mozilla.org/document-transformer;1?type=xslt"
|
|
||||||
|
|
||||||
#define XSLT_MSGS_URL "chrome://global/locale/xslt/xslt.properties"
|
#define XSLT_MSGS_URL "chrome://global/locale/xslt/xslt.properties"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
|
|
||||||
// Transformiix stuff
|
// Transformiix stuff
|
||||||
#include "mozilla/dom/XPathEvaluator.h"
|
#include "mozilla/dom/XPathEvaluator.h"
|
||||||
#include "txMozillaXSLTProcessor.h"
|
|
||||||
#include "txNodeSetAdaptor.h"
|
#include "txNodeSetAdaptor.h"
|
||||||
|
|
||||||
#include "mozilla/dom/DOMParser.h"
|
#include "mozilla/dom/DOMParser.h"
|
||||||
|
@ -225,7 +224,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(HTMLEditor)
|
||||||
already_AddRefed<nsIPresentationService> NS_CreatePresentationService();
|
already_AddRefed<nsIPresentationService> NS_CreatePresentationService();
|
||||||
|
|
||||||
// Factory Constructor
|
// Factory Constructor
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(txMozillaXSLTProcessor)
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(XPathEvaluator)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(XPathEvaluator)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(txNodeSetAdaptor, Init)
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(txNodeSetAdaptor, Init)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMSerializer)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMSerializer)
|
||||||
|
@ -597,7 +595,6 @@ NS_DEFINE_NAMED_CID(NS_PLUGINDOCLOADERFACTORY_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_PLUGINDOCUMENT_CID);
|
NS_DEFINE_NAMED_CID(NS_PLUGINDOCUMENT_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_VIDEODOCUMENT_CID);
|
NS_DEFINE_NAMED_CID(NS_VIDEODOCUMENT_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_STYLESHEETSERVICE_CID);
|
NS_DEFINE_NAMED_CID(NS_STYLESHEETSERVICE_CID);
|
||||||
NS_DEFINE_NAMED_CID(TRANSFORMIIX_XSLT_PROCESSOR_CID);
|
|
||||||
NS_DEFINE_NAMED_CID(TRANSFORMIIX_XPATH_EVALUATOR_CID);
|
NS_DEFINE_NAMED_CID(TRANSFORMIIX_XPATH_EVALUATOR_CID);
|
||||||
NS_DEFINE_NAMED_CID(TRANSFORMIIX_NODESET_CID);
|
NS_DEFINE_NAMED_CID(TRANSFORMIIX_NODESET_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_XMLSERIALIZER_CID);
|
NS_DEFINE_NAMED_CID(NS_XMLSERIALIZER_CID);
|
||||||
|
@ -849,7 +846,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
|
||||||
{ &kNS_PLUGINDOCUMENT_CID, false, nullptr, CreatePluginDocument },
|
{ &kNS_PLUGINDOCUMENT_CID, false, nullptr, CreatePluginDocument },
|
||||||
{ &kNS_VIDEODOCUMENT_CID, false, nullptr, CreateVideoDocument },
|
{ &kNS_VIDEODOCUMENT_CID, false, nullptr, CreateVideoDocument },
|
||||||
{ &kNS_STYLESHEETSERVICE_CID, false, nullptr, nsStyleSheetServiceConstructor },
|
{ &kNS_STYLESHEETSERVICE_CID, false, nullptr, nsStyleSheetServiceConstructor },
|
||||||
{ &kTRANSFORMIIX_XSLT_PROCESSOR_CID, false, nullptr, txMozillaXSLTProcessorConstructor },
|
|
||||||
{ &kTRANSFORMIIX_XPATH_EVALUATOR_CID, false, nullptr, XPathEvaluatorConstructor },
|
{ &kTRANSFORMIIX_XPATH_EVALUATOR_CID, false, nullptr, XPathEvaluatorConstructor },
|
||||||
{ &kTRANSFORMIIX_NODESET_CID, false, nullptr, txNodeSetAdaptorConstructor },
|
{ &kTRANSFORMIIX_NODESET_CID, false, nullptr, txNodeSetAdaptorConstructor },
|
||||||
{ &kNS_XMLSERIALIZER_CID, false, nullptr, nsDOMSerializerConstructor },
|
{ &kNS_XMLSERIALIZER_CID, false, nullptr, nsDOMSerializerConstructor },
|
||||||
|
@ -968,7 +964,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
|
||||||
{ NS_WINDOWCONTROLLER_CONTRACTID, &kNS_WINDOWCONTROLLER_CID },
|
{ NS_WINDOWCONTROLLER_CONTRACTID, &kNS_WINDOWCONTROLLER_CID },
|
||||||
{ PLUGIN_DLF_CONTRACTID, &kNS_PLUGINDOCLOADERFACTORY_CID },
|
{ PLUGIN_DLF_CONTRACTID, &kNS_PLUGINDOCLOADERFACTORY_CID },
|
||||||
{ NS_STYLESHEETSERVICE_CONTRACTID, &kNS_STYLESHEETSERVICE_CID },
|
{ NS_STYLESHEETSERVICE_CONTRACTID, &kNS_STYLESHEETSERVICE_CID },
|
||||||
{ TRANSFORMIIX_XSLT_PROCESSOR_CONTRACTID, &kTRANSFORMIIX_XSLT_PROCESSOR_CID },
|
|
||||||
{ NS_XPATH_EVALUATOR_CONTRACTID, &kTRANSFORMIIX_XPATH_EVALUATOR_CID },
|
{ NS_XPATH_EVALUATOR_CONTRACTID, &kTRANSFORMIIX_XPATH_EVALUATOR_CID },
|
||||||
{ TRANSFORMIIX_NODESET_CONTRACTID, &kTRANSFORMIIX_NODESET_CID },
|
{ TRANSFORMIIX_NODESET_CONTRACTID, &kTRANSFORMIIX_NODESET_CID },
|
||||||
{ NS_XMLSERIALIZER_CONTRACTID, &kNS_XMLSERIALIZER_CID },
|
{ NS_XMLSERIALIZER_CONTRACTID, &kNS_XMLSERIALIZER_CID },
|
||||||
|
|
|
@ -1405,9 +1405,8 @@
|
||||||
|
|
||||||
this._relNotesLoading.hidden = true;
|
this._relNotesLoading.hidden = true;
|
||||||
|
|
||||||
var processor = Components.classes["@mozilla.org/document-transformer;1?type=xslt"]
|
var processor = new XSLTProcessor();
|
||||||
.createInstance(Components.interfaces.nsIXSLTProcessor);
|
processor.flags |= XSLTProcessor.DISABLE_ALL_LOADS;
|
||||||
processor.flags |= Components.interfaces.nsIXSLTProcessorPrivate.DISABLE_ALL_LOADS;
|
|
||||||
|
|
||||||
processor.importStylesheet(transformData);
|
processor.importStylesheet(transformData);
|
||||||
var fragment = processor.transformToFragment(relNotesData, document);
|
var fragment = processor.transformToFragment(relNotesData, document);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче