mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out 4 changesets (bug 1222624) to fix bug 1249572
Backed out changeset e407f668476d (bug 1222624) Backed out changeset 2a4502574495 (bug 1222624) Backed out changeset 4b6ae937a03d (bug 1222624) Backed out changeset cfa2b6acc2ba (bug 1222624)
This commit is contained in:
parent
8ef0386053
commit
9579ce7214
@ -17,6 +17,30 @@ using mozilla::LoadInfo;
|
||||
* A set of utilities for handling URIs
|
||||
**/
|
||||
|
||||
/**
|
||||
* Resolves the given href argument, using the given documentBase
|
||||
* if necessary.
|
||||
* The new resolved href will be appended to the given dest String
|
||||
**/
|
||||
void URIUtils::resolveHref(const nsAString& href, const nsAString& base,
|
||||
nsAString& dest) {
|
||||
if (base.IsEmpty()) {
|
||||
dest.Append(href);
|
||||
return;
|
||||
}
|
||||
if (href.IsEmpty()) {
|
||||
dest.Append(base);
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIURI> pURL;
|
||||
nsAutoString resultHref;
|
||||
nsresult result = NS_NewURI(getter_AddRefs(pURL), base);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
NS_MakeAbsoluteURI(resultHref, href, pURL);
|
||||
dest.Append(resultHref);
|
||||
}
|
||||
} //-- resolveHref
|
||||
|
||||
// static
|
||||
void
|
||||
URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode)
|
||||
|
@ -23,6 +23,14 @@ public:
|
||||
* Reset the given document with the document of the source node
|
||||
*/
|
||||
static void ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode);
|
||||
|
||||
/**
|
||||
* Resolves the given href argument, using the given documentBase
|
||||
* if necessary.
|
||||
* The new resolved href will be appended to the given dest String
|
||||
**/
|
||||
static void resolveHref(const nsAString& href, const nsAString& base,
|
||||
nsAString& dest);
|
||||
}; //-- URIUtils
|
||||
|
||||
/* */
|
||||
|
@ -5,16 +5,9 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(75d14f5d-293d-4872-8a26-e79268de592f)]
|
||||
[scriptable, uuid(b8d727f7-67f4-4dc1-a318-ec0c87280816)]
|
||||
interface nsIXSLTProcessorPrivate : nsISupports
|
||||
{
|
||||
/**
|
||||
* This needs to be called if the XSLTProcessor is instantiated
|
||||
* through the XPCOM registry (i.e. using do_createInstance) and the
|
||||
* stylesheet uses xsl:import/xsl:include or the document() xpath function.
|
||||
*/
|
||||
void init(in nsISupports global);
|
||||
|
||||
/**
|
||||
* Disables all loading of external documents, such as from
|
||||
* <xsl:import> and document()
|
||||
|
@ -1,4 +0,0 @@
|
||||
<?xml-stylesheet type="text/xsl" href="file_bug1222624.xsl"?>
|
||||
<root>
|
||||
<load>file_bug1222624_data2.xml</load>
|
||||
</root>
|
@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:import href="file_bug1222624_sub.xsl"/>
|
||||
<xsl:template match="/root">
|
||||
<result>
|
||||
<xsl:call-template name="external"/>
|
||||
<xsl:value-of select="document('file_bug1222624_data1.xml')"/>
|
||||
<xsl:text>!</xsl:text>
|
||||
<xsl:value-of select="document(load)"/>
|
||||
</result>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
@ -1 +0,0 @@
|
||||
<data>doc1</data>
|
@ -1 +0,0 @@
|
||||
<data>doc2</data>
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:include href="file_bug1222624_sub_sub.xsl"/>
|
||||
</xsl:stylesheet>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:template name="external">
|
||||
<external/>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
@ -16,7 +16,5 @@
|
||||
[test_bug667315.html]
|
||||
[test_bug1135764.html]
|
||||
support-files = file_bug1135764.xml file_bug1135764.xsl
|
||||
[test_bug1222624.html]
|
||||
support-files = file_bug1222624.xml file_bug1222624.xsl file_bug1222624_sub.xsl file_bug1222624_sub_sub.xsl file_bug1222624_data1.xml file_bug1222624_data2.xml
|
||||
[test_exslt_regex.html]
|
||||
[test_parameter.html]
|
||||
|
@ -1,53 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1222624
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 1222624</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1222624">Mozilla Bug 1222624</a>
|
||||
<p id="display"></p>
|
||||
<iframe id="frame"></iframe>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 1222624 **/
|
||||
|
||||
const nl = (navigator.platform == 'Win32' ||
|
||||
navigator.platform == 'Win64') ? '\r\n' : '\n';
|
||||
|
||||
const transformRes = '<?xml version="1.0" encoding="UTF-8"?>' + nl + '<result><external/>doc1!doc2</result>';
|
||||
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "file_bug1222624.xml", false);
|
||||
xhr.send();
|
||||
var xmlDoc = xhr.responseXML;
|
||||
|
||||
xhr.open("GET", "file_bug1222624.xsl", false);
|
||||
xhr.send();
|
||||
var xslDoc = xhr.responseXML;
|
||||
|
||||
var processor = new XSLTProcessor;
|
||||
processor.importStylesheet(xslDoc);
|
||||
var apiRes = new XMLSerializer().serializeToString(processor.transformToDocument(xmlDoc));
|
||||
|
||||
is(apiRes, transformRes, "API transformation correct");
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var frame = $("frame");
|
||||
frame.src = "file_bug1222624.xml";
|
||||
frame.onload = function () {
|
||||
var piRes = new XMLSerializer().serializeToString(frame.contentDocument);
|
||||
is(piRes, transformRes, "processing-instruction transformation correct");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -15,14 +15,20 @@
|
||||
#include "nsIPrincipal.h"
|
||||
|
||||
nsresult
|
||||
txParseDocumentFromURI(nsIURI* aUri,
|
||||
nsIDocument* aLoadingDocument,
|
||||
txParseDocumentFromURI(const nsAString& aHref,
|
||||
const txXPathNode& aLoader,
|
||||
nsAString& aErrMsg,
|
||||
txXPathNode** aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = nullptr;
|
||||
nsCOMPtr<nsIURI> documentURI;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(documentURI), aHref);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = aLoadingDocument->GetDocumentLoadGroup();
|
||||
nsIDocument* loaderDocument = txXPathNativeNode::getDocument(aLoader);
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = loaderDocument->GetDocumentLoadGroup();
|
||||
|
||||
// For the system principal loaderUri will be null here, which is good
|
||||
// since that means that chrome documents can load any uri.
|
||||
@ -30,24 +36,20 @@ txParseDocumentFromURI(nsIURI* aUri,
|
||||
// Raw pointer, we want the resulting txXPathNode to hold a reference to
|
||||
// the document.
|
||||
nsIDOMDocument* theDocument = nullptr;
|
||||
nsAutoSyncOperation sync(aLoadingDocument);
|
||||
nsresult rv =
|
||||
nsSyncLoadService::LoadDocument(aUri,
|
||||
nsIContentPolicy::TYPE_INTERNAL_XMLHTTPREQUEST,
|
||||
aLoadingDocument->NodePrincipal(),
|
||||
nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS,
|
||||
loadGroup,
|
||||
true,
|
||||
aLoadingDocument->GetReferrerPolicy(),
|
||||
&theDocument);
|
||||
nsAutoSyncOperation sync(loaderDocument);
|
||||
rv = nsSyncLoadService::LoadDocument(documentURI,
|
||||
nsIContentPolicy::TYPE_INTERNAL_XMLHTTPREQUEST,
|
||||
loaderDocument->NodePrincipal(),
|
||||
nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS,
|
||||
loadGroup, true,
|
||||
loaderDocument->GetReferrerPolicy(),
|
||||
&theDocument);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
aErrMsg.AppendLiteral("Document load of ");
|
||||
nsAutoCString spec;
|
||||
aUri->GetSpec(spec);
|
||||
aErrMsg.Append(NS_ConvertUTF8toUTF16(spec));
|
||||
aErrMsg.Append(aHref);
|
||||
aErrMsg.AppendLiteral(" failed.");
|
||||
return rv;
|
||||
return NS_FAILED(rv) ? rv : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*aResult = txXPathNativeNode::createXPathNode(theDocument);
|
||||
|
@ -9,8 +9,6 @@
|
||||
#include "txCore.h"
|
||||
|
||||
class txXPathNode;
|
||||
class nsIURI;
|
||||
class nsIDocument;
|
||||
|
||||
/**
|
||||
* API to load XML files into DOM datastructures.
|
||||
@ -22,9 +20,7 @@ class nsIDocument;
|
||||
* of the document aLoader.
|
||||
*/
|
||||
extern "C" nsresult
|
||||
txParseDocumentFromURI(nsIURI* aUri,
|
||||
nsIDocument* aLoadingDocument,
|
||||
nsAString& aErrMsg,
|
||||
txXPathNode** aResult);
|
||||
txParseDocumentFromURI(const nsAString& aHref, const txXPathNode& aLoader,
|
||||
nsAString& aErrMsg, txXPathNode** aResult);
|
||||
|
||||
#endif
|
||||
|
@ -563,9 +563,9 @@ txXPathNodeUtils::getXSLTId(const txXPathNode& aNode,
|
||||
|
||||
/* static */
|
||||
void
|
||||
txXPathNodeUtils::getBaseURI(const txXPathNode& aNode, nsIURI** aUri)
|
||||
txXPathNodeUtils::getBaseURI(const txXPathNode& aNode, nsAString& aURI)
|
||||
{
|
||||
*aUri = aNode.mNode->GetBaseURI().take();
|
||||
aNode.mNode->GetBaseURI(aURI);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
static nsresult getXSLTId(const txXPathNode& aNode,
|
||||
const txXPathNode& aBase, nsAString& aResult);
|
||||
static void release(txXPathNode* aNode);
|
||||
static void getBaseURI(const txXPathNode& aNode, nsIURI** aURI);
|
||||
static void getBaseURI(const txXPathNode& aNode, nsAString& aURI);
|
||||
static int comparePosition(const txXPathNode& aNode,
|
||||
const txXPathNode& aOtherNode);
|
||||
static bool localNameEquals(const txXPathNode& aNode,
|
||||
|
@ -13,33 +13,46 @@
|
||||
#include "txXSLTFunctions.h"
|
||||
#include "txExecutionState.h"
|
||||
#include "txURIUtils.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
/*
|
||||
* Creates a new DocumentFunctionCall.
|
||||
*/
|
||||
DocumentFunctionCall::DocumentFunctionCall(const nsAString& aBaseURI)
|
||||
: mBaseURI(aBaseURI)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
retrieveNode(txExecutionState* aExecutionState,
|
||||
const nsAString& aUri,
|
||||
nsIURI* aBaseUri,
|
||||
txNodeSet* aNodeSet)
|
||||
retrieveNode(txExecutionState* aExecutionState, const nsAString& aUri,
|
||||
const nsAString& aBaseUri, txNodeSet* aNodeSet)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), aUri, nullptr, aBaseUri);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return;
|
||||
nsAutoString absUrl;
|
||||
URIUtils::resolveHref(aUri, aBaseUri, absUrl);
|
||||
|
||||
int32_t hash = absUrl.RFindChar(char16_t('#'));
|
||||
uint32_t urlEnd, fragStart, fragEnd;
|
||||
if (hash == kNotFound) {
|
||||
urlEnd = absUrl.Length();
|
||||
fragStart = 0;
|
||||
fragEnd = 0;
|
||||
}
|
||||
else {
|
||||
urlEnd = hash;
|
||||
fragStart = hash + 1;
|
||||
fragEnd = absUrl.Length();
|
||||
}
|
||||
|
||||
nsAutoCString frag;
|
||||
uri->GetRef(frag);
|
||||
uri->SetRef(EmptyCString());
|
||||
nsDependentSubstring docUrl(absUrl, 0, urlEnd);
|
||||
nsDependentSubstring frag(absUrl, fragStart, fragEnd);
|
||||
|
||||
const txXPathNode* loadNode = aExecutionState->retrieveDocument(uri);
|
||||
const txXPathNode* loadNode = aExecutionState->retrieveDocument(docUrl);
|
||||
if (loadNode) {
|
||||
if (frag.IsEmpty()) {
|
||||
aNodeSet->add(*loadNode);
|
||||
}
|
||||
else {
|
||||
txXPathTreeWalker walker(*loadNode);
|
||||
if (walker.moveToElementById(NS_ConvertUTF8toUTF16(frag))) {
|
||||
if (walker.moveToElementById(frag)) {
|
||||
aNodeSet->add(walker.getCurrentPosition());
|
||||
}
|
||||
}
|
||||
@ -74,7 +87,7 @@ DocumentFunctionCall::evaluate(txIEvalContext* aContext,
|
||||
rv = mParams[0]->evaluate(aContext, getter_AddRefs(exprResult1));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
nsAutoString baseURI;
|
||||
bool baseURISet = false;
|
||||
|
||||
if (mParams.Length() == 2) {
|
||||
@ -91,8 +104,7 @@ DocumentFunctionCall::evaluate(txIEvalContext* aContext,
|
||||
baseURISet = true;
|
||||
|
||||
if (!nodeSet2->isEmpty()) {
|
||||
txXPathNodeUtils::getBaseURI(nodeSet2->get(0),
|
||||
getter_AddRefs(baseURI));
|
||||
txXPathNodeUtils::getBaseURI(nodeSet2->get(0), baseURI);
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,7 +121,7 @@ DocumentFunctionCall::evaluate(txIEvalContext* aContext,
|
||||
if (!baseURISet) {
|
||||
// if the second argument wasn't specified, use
|
||||
// the baseUri of node itself
|
||||
txXPathNodeUtils::getBaseURI(node, getter_AddRefs(baseURI));
|
||||
txXPathNodeUtils::getBaseURI(node, baseURI);
|
||||
}
|
||||
retrieveNode(es, uriStr, baseURI, nodeSet);
|
||||
}
|
||||
@ -122,8 +134,8 @@ DocumentFunctionCall::evaluate(txIEvalContext* aContext,
|
||||
// The first argument is not a NodeSet
|
||||
nsAutoString uriStr;
|
||||
exprResult1->stringValue(uriStr);
|
||||
nsIURI* base = baseURISet ? baseURI.get() : mBaseURI.get();
|
||||
retrieveNode(es, uriStr, base, nodeSet);
|
||||
const nsAString* base = baseURISet ? &baseURI : &mBaseURI;
|
||||
retrieveNode(es, uriStr, *base, nodeSet);
|
||||
|
||||
NS_ADDREF(*aResult = nodeSet);
|
||||
|
||||
|
@ -21,28 +21,27 @@ txLoadedDocumentsHash::init(txXPathNode* aSourceDocument)
|
||||
{
|
||||
mSourceDocument = aSourceDocument;
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
txXPathNodeUtils::getBaseURI(*mSourceDocument, getter_AddRefs(baseURI));
|
||||
nsAutoString baseURI;
|
||||
txXPathNodeUtils::getBaseURI(*mSourceDocument, baseURI);
|
||||
|
||||
LookupOrAdd(baseURI)->mDocument = mSourceDocument;
|
||||
PutEntry(baseURI)->mDocument = mSourceDocument;
|
||||
}
|
||||
|
||||
txLoadedDocumentsHash::~txLoadedDocumentsHash()
|
||||
{
|
||||
if (mSourceDocument) {
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
txXPathNodeUtils::getBaseURI(*mSourceDocument, getter_AddRefs(baseURI));
|
||||
nsAutoString baseURI;
|
||||
txXPathNodeUtils::getBaseURI(*mSourceDocument, baseURI);
|
||||
|
||||
txLoadedDocumentInfo* info = Get(baseURI);
|
||||
if (info) {
|
||||
delete info->mDocument.forget();
|
||||
txLoadedDocumentEntry* entry = GetEntry(baseURI);
|
||||
if (entry) {
|
||||
delete entry->mDocument.forget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
txExecutionState::txExecutionState(txStylesheet* aStylesheet,
|
||||
bool aDisableLoads,
|
||||
nsIDocument* aLoadingDocument)
|
||||
bool aDisableLoads)
|
||||
: mOutputHandler(nullptr),
|
||||
mResultHandler(nullptr),
|
||||
mStylesheet(aStylesheet),
|
||||
@ -52,7 +51,6 @@ txExecutionState::txExecutionState(txStylesheet* aStylesheet,
|
||||
mEvalContext(nullptr),
|
||||
mInitialEvalContext(nullptr),
|
||||
mGlobalParams(nullptr),
|
||||
mLoadingDocument(aLoadingDocument),
|
||||
mKeyHash(aStylesheet->getKeyMap()),
|
||||
mDisableLoads(aDisableLoads)
|
||||
{
|
||||
@ -374,48 +372,41 @@ txExecutionState::getEvalContext()
|
||||
}
|
||||
|
||||
const txXPathNode*
|
||||
txExecutionState::retrieveDocument(nsIURI* aUri)
|
||||
txExecutionState::retrieveDocument(const nsAString& aUri)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
{
|
||||
bool hasFrag;
|
||||
aUri->GetHasRef(&hasFrag);
|
||||
MOZ_ASSERT(!hasFrag, "Remove the fragment");
|
||||
}
|
||||
#endif
|
||||
NS_ASSERTION(!aUri.Contains(char16_t('#')),
|
||||
"Remove the fragment.");
|
||||
|
||||
if (mDisableLoads || !mLoadingDocument) {
|
||||
if (mDisableLoads) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (MOZ_LOG_TEST(txLog::xslt, LogLevel::Debug)) {
|
||||
nsAutoCString spec;
|
||||
aUri->GetSpec(spec);
|
||||
MOZ_LOG(txLog::xslt, LogLevel::Debug,
|
||||
("Retrieve Document %s", spec.get()));
|
||||
}
|
||||
MOZ_LOG(txLog::xslt, LogLevel::Debug,
|
||||
("Retrieve Document %s", NS_LossyConvertUTF16toASCII(aUri).get()));
|
||||
|
||||
// try to get already loaded document
|
||||
txLoadedDocumentInfo* info = mLoadedDocuments.LookupOrAdd(aUri);
|
||||
txLoadedDocumentEntry *entry = mLoadedDocuments.PutEntry(aUri);
|
||||
if (!entry) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!info->mDocument && !info->LoadingFailed()) {
|
||||
if (!entry->mDocument && !entry->LoadingFailed()) {
|
||||
// open URI
|
||||
nsAutoString errMsg;
|
||||
info->mLoadResult =
|
||||
txParseDocumentFromURI(aUri, mLoadingDocument,
|
||||
errMsg, getter_Transfers(info->mDocument));
|
||||
// XXX we should get the loader from the actual node
|
||||
// triggering the load, but this will do for the time being
|
||||
entry->mLoadResult =
|
||||
txParseDocumentFromURI(aUri, *mLoadedDocuments.mSourceDocument,
|
||||
errMsg, getter_Transfers(entry->mDocument));
|
||||
|
||||
if (info->LoadingFailed()) {
|
||||
nsAutoCString spec;
|
||||
aUri->GetSpec(spec);
|
||||
if (entry->LoadingFailed()) {
|
||||
receiveError(NS_LITERAL_STRING("Couldn't load document '") +
|
||||
NS_ConvertUTF8toUTF16(spec) +
|
||||
NS_LITERAL_STRING("': ") + errMsg,
|
||||
info->mLoadResult);
|
||||
aUri + NS_LITERAL_STRING("': ") + errMsg,
|
||||
entry->mLoadResult);
|
||||
}
|
||||
}
|
||||
|
||||
return info->mDocument;
|
||||
return entry->mDocument;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -17,19 +17,24 @@
|
||||
#include "txStylesheet.h"
|
||||
#include "txXPathTreeWalker.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsURIHashKey.h"
|
||||
|
||||
class txAOutputHandlerFactory;
|
||||
class txAXMLEventHandler;
|
||||
class txInstruction;
|
||||
|
||||
class txLoadedDocumentInfo
|
||||
class txLoadedDocumentEntry : public nsStringHashKey
|
||||
{
|
||||
public:
|
||||
explicit txLoadedDocumentInfo() : mLoadResult(NS_OK)
|
||||
explicit txLoadedDocumentEntry(KeyTypePointer aStr) : nsStringHashKey(aStr),
|
||||
mLoadResult(NS_OK)
|
||||
{
|
||||
}
|
||||
~txLoadedDocumentInfo()
|
||||
txLoadedDocumentEntry(const txLoadedDocumentEntry& aToCopy)
|
||||
: nsStringHashKey(aToCopy)
|
||||
{
|
||||
NS_ERROR("We're horked.");
|
||||
}
|
||||
~txLoadedDocumentEntry()
|
||||
{
|
||||
if (mDocument) {
|
||||
txXPathNodeUtils::release(mDocument);
|
||||
@ -47,11 +52,11 @@ public:
|
||||
nsresult mLoadResult;
|
||||
};
|
||||
|
||||
class txLoadedDocumentsHash : public nsClassHashtable<nsURIHashKey, txLoadedDocumentInfo>
|
||||
class txLoadedDocumentsHash : public nsTHashtable<txLoadedDocumentEntry>
|
||||
{
|
||||
public:
|
||||
txLoadedDocumentsHash()
|
||||
: nsClassHashtable<nsURIHashKey, txLoadedDocumentInfo>(4),
|
||||
: nsTHashtable<txLoadedDocumentEntry>(4),
|
||||
mSourceDocument(nullptr)
|
||||
{
|
||||
}
|
||||
@ -67,8 +72,7 @@ private:
|
||||
class txExecutionState : public txIMatchContext
|
||||
{
|
||||
public:
|
||||
txExecutionState(txStylesheet* aStylesheet, bool aDisableLoads,
|
||||
nsIDocument* aLoaderDocument);
|
||||
txExecutionState(txStylesheet* aStylesheet, bool aDisableLoads);
|
||||
~txExecutionState();
|
||||
nsresult init(const txXPathNode& aNode,
|
||||
txOwningExpandedNameMap<txIGlobalParameter>* aGlobalParams);
|
||||
@ -103,7 +107,7 @@ public:
|
||||
|
||||
// state-getting functions
|
||||
txIEvalContext* getEvalContext();
|
||||
const txXPathNode* retrieveDocument(nsIURI* aUri);
|
||||
const txXPathNode* retrieveDocument(const nsAString& aUri);
|
||||
nsresult getKeyNodes(const txExpandedName& aKeyName,
|
||||
const txXPathNode& aRoot,
|
||||
const nsAString& aKeyValue, bool aIndexIfNotFound,
|
||||
@ -157,7 +161,6 @@ private:
|
||||
//Document* mRTFDocument;
|
||||
txOwningExpandedNameMap<txIGlobalParameter>* mGlobalParams;
|
||||
|
||||
nsCOMPtr<nsIDocument> mLoadingDocument;
|
||||
txLoadedDocumentsHash mLoadedDocuments;
|
||||
txKeyHash mKeyHash;
|
||||
RefPtr<txResultRecycler> mRecycler;
|
||||
|
@ -257,16 +257,6 @@ txStylesheetSink::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> channelPrincipal;
|
||||
nsContentUtils::GetSecurityManager()->GetChannelResultPrincipal(
|
||||
channel, getter_AddRefs(channelPrincipal));
|
||||
mCompiler->setPrincipal(channelPrincipal);
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
nsresult rv = NS_GetFinalChannelURI(channel, getter_AddRefs(baseURI));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mCompiler->setBaseURI(baseURI);
|
||||
|
||||
// check channel's charset...
|
||||
nsAutoCString charsetVal;
|
||||
nsAutoCString charset;
|
||||
@ -385,8 +375,9 @@ public:
|
||||
TX_DECL_ACOMPILEOBSERVER
|
||||
NS_INLINE_DECL_REFCOUNTING(txCompileObserver)
|
||||
|
||||
nsresult startLoad(nsIURI* aUri, nsIPrincipal* aSourcePrincipal,
|
||||
txStylesheetCompiler* aCompiler);
|
||||
nsresult startLoad(nsIURI* aUri, txStylesheetCompiler* aCompiler,
|
||||
nsIPrincipal* aSourcePrincipal,
|
||||
ReferrerPolicy aReferrerPolicy);
|
||||
|
||||
private:
|
||||
RefPtr<txMozillaXSLTProcessor> mProcessor;
|
||||
@ -409,15 +400,30 @@ txCompileObserver::txCompileObserver(txMozillaXSLTProcessor* aProcessor,
|
||||
}
|
||||
|
||||
nsresult
|
||||
txCompileObserver::loadURI(nsIURI* aUri,
|
||||
nsIPrincipal* aReferrerPrincipal,
|
||||
txCompileObserver::loadURI(const nsAString& aUri,
|
||||
const nsAString& aReferrerUri,
|
||||
ReferrerPolicy aReferrerPolicy,
|
||||
txStylesheetCompiler* aCompiler)
|
||||
{
|
||||
if (mProcessor->IsLoadDisabled() || !mLoaderDocument) {
|
||||
if (mProcessor->IsLoadDisabled()) {
|
||||
return NS_ERROR_XSLT_LOAD_BLOCKED_ERROR;
|
||||
}
|
||||
|
||||
return startLoad(aUri, aReferrerPrincipal, aCompiler);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), aUri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> referrerUri;
|
||||
rv = NS_NewURI(getter_AddRefs(referrerUri), aReferrerUri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> referrerPrincipal;
|
||||
rv = nsContentUtils::GetSecurityManager()->
|
||||
GetSimpleCodebasePrincipal(referrerUri,
|
||||
getter_AddRefs(referrerPrincipal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return startLoad(uri, aCompiler, referrerPrincipal, aReferrerPolicy);
|
||||
}
|
||||
|
||||
void
|
||||
@ -435,11 +441,10 @@ txCompileObserver::onDoneCompiling(txStylesheetCompiler* aCompiler,
|
||||
}
|
||||
|
||||
nsresult
|
||||
txCompileObserver::startLoad(nsIURI* aUri, nsIPrincipal* aReferrerPrincipal,
|
||||
txStylesheetCompiler* aCompiler)
|
||||
txCompileObserver::startLoad(nsIURI* aUri, txStylesheetCompiler* aCompiler,
|
||||
nsIPrincipal* aReferrerPrincipal,
|
||||
ReferrerPolicy aReferrerPolicy)
|
||||
{
|
||||
MOZ_ASSERT(aReferrerPrincipal);
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = mLoaderDocument->GetDocumentLoadGroup();
|
||||
if (!loadGroup) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -468,8 +473,7 @@ txCompileObserver::startLoad(nsIURI* aUri, nsIPrincipal* aReferrerPrincipal,
|
||||
nsCOMPtr<nsIURI> referrerURI;
|
||||
aReferrerPrincipal->GetURI(getter_AddRefs(referrerURI));
|
||||
if (referrerURI) {
|
||||
httpChannel->SetReferrerWithPolicy(referrerURI,
|
||||
mLoaderDocument->GetReferrerPolicy());
|
||||
httpChannel->SetReferrerWithPolicy(referrerURI, aReferrerPolicy);
|
||||
}
|
||||
}
|
||||
|
||||
@ -477,6 +481,7 @@ txCompileObserver::startLoad(nsIURI* aUri, nsIPrincipal* aReferrerPrincipal,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
RefPtr<txStylesheetSink> sink = new txStylesheetSink(aCompiler, parser);
|
||||
NS_ENSURE_TRUE(sink, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
channel->SetNotificationCallbacks(sink);
|
||||
|
||||
@ -489,26 +494,24 @@ txCompileObserver::startLoad(nsIURI* aUri, nsIPrincipal* aReferrerPrincipal,
|
||||
|
||||
nsresult
|
||||
TX_LoadSheet(nsIURI* aUri, txMozillaXSLTProcessor* aProcessor,
|
||||
nsIDocument* aLoaderDocument)
|
||||
nsIDocument* aLoaderDocument, ReferrerPolicy aReferrerPolicy)
|
||||
{
|
||||
if (MOZ_LOG_TEST(txLog::xslt, LogLevel::Info)) {
|
||||
nsAutoCString spec;
|
||||
aUri->GetSpec(spec);
|
||||
MOZ_LOG(txLog::xslt, LogLevel::Info,
|
||||
("TX_LoadSheet: %s\n", spec.get()));
|
||||
}
|
||||
nsIPrincipal* principal = aLoaderDocument->NodePrincipal();
|
||||
|
||||
nsAutoCString spec;
|
||||
aUri->GetSpec(spec);
|
||||
MOZ_LOG(txLog::xslt, LogLevel::Info, ("TX_LoadSheet: %s\n", spec.get()));
|
||||
|
||||
RefPtr<txCompileObserver> observer =
|
||||
new txCompileObserver(aProcessor, aLoaderDocument);
|
||||
|
||||
nsAutoCString fragment;
|
||||
aUri->GetRef(fragment);
|
||||
NS_ENSURE_TRUE(observer, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
RefPtr<txStylesheetCompiler> compiler =
|
||||
new txStylesheetCompiler(NS_ConvertUTF8toUTF16(fragment), observer);
|
||||
new txStylesheetCompiler(NS_ConvertUTF8toUTF16(spec), aReferrerPolicy,
|
||||
observer);
|
||||
NS_ENSURE_TRUE(compiler, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return observer->startLoad(aUri, aLoaderDocument->NodePrincipal(),
|
||||
compiler);
|
||||
return observer->startLoad(aUri, compiler, principal, aReferrerPolicy);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -582,11 +585,7 @@ handleNode(nsINode* aNode, txStylesheetCompiler* aCompiler)
|
||||
class txSyncCompileObserver final : public txACompileObserver
|
||||
{
|
||||
public:
|
||||
explicit txSyncCompileObserver(txMozillaXSLTProcessor* aProcessor,
|
||||
nsIDocument* aLoaderDocument)
|
||||
: mProcessor(aProcessor),
|
||||
mLoaderDocument(aLoaderDocument)
|
||||
{}
|
||||
explicit txSyncCompileObserver(txMozillaXSLTProcessor* aProcessor);
|
||||
|
||||
TX_DECL_ACOMPILEOBSERVER
|
||||
NS_INLINE_DECL_REFCOUNTING(txSyncCompileObserver)
|
||||
@ -598,43 +597,60 @@ private:
|
||||
}
|
||||
|
||||
RefPtr<txMozillaXSLTProcessor> mProcessor;
|
||||
nsCOMPtr<nsIDocument> mLoaderDocument;
|
||||
};
|
||||
|
||||
txSyncCompileObserver::txSyncCompileObserver(txMozillaXSLTProcessor* aProcessor)
|
||||
: mProcessor(aProcessor)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
txSyncCompileObserver::loadURI(nsIURI* aUri,
|
||||
nsIPrincipal* aReferrerPrincipal,
|
||||
txSyncCompileObserver::loadURI(const nsAString& aUri,
|
||||
const nsAString& aReferrerUri,
|
||||
ReferrerPolicy aReferrerPolicy,
|
||||
txStylesheetCompiler* aCompiler)
|
||||
{
|
||||
MOZ_ASSERT(aReferrerPrincipal);
|
||||
|
||||
if (mProcessor->IsLoadDisabled() || !mLoaderDocument) {
|
||||
if (mProcessor->IsLoadDisabled()) {
|
||||
return NS_ERROR_XSLT_LOAD_BLOCKED_ERROR;
|
||||
}
|
||||
|
||||
nsAutoSyncOperation sync(mLoaderDocument);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), aUri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> referrerUri;
|
||||
rv = NS_NewURI(getter_AddRefs(referrerUri), aReferrerUri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> referrerPrincipal;
|
||||
rv = nsContentUtils::GetSecurityManager()->
|
||||
GetSimpleCodebasePrincipal(referrerUri,
|
||||
getter_AddRefs(referrerPrincipal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// This is probably called by js, a loadGroup for the channel doesn't
|
||||
// make sense.
|
||||
nsCOMPtr<nsINode> source;
|
||||
if (mProcessor) {
|
||||
source =
|
||||
do_QueryInterface(mProcessor->GetSourceContentModel());
|
||||
}
|
||||
nsAutoSyncOperation sync(source ? source->OwnerDoc() : nullptr);
|
||||
nsCOMPtr<nsIDOMDocument> document;
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = mLoaderDocument->GetDocumentLoadGroup();
|
||||
nsresult rv =
|
||||
nsSyncLoadService::LoadDocument(aUri,
|
||||
nsIContentPolicy::TYPE_XSLT,
|
||||
aReferrerPrincipal,
|
||||
nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS,
|
||||
loadGroup,
|
||||
false,
|
||||
mLoaderDocument->GetReferrerPolicy(),
|
||||
getter_AddRefs(document));
|
||||
rv = nsSyncLoadService::LoadDocument(uri, nsIContentPolicy::TYPE_XSLT,
|
||||
referrerPrincipal,
|
||||
nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS,
|
||||
nullptr, false,
|
||||
aReferrerPolicy,
|
||||
getter_AddRefs(document));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(document);
|
||||
nsCOMPtr<nsIURI> baseURI = doc->GetBaseURI();
|
||||
aCompiler->setBaseURI(baseURI);
|
||||
aCompiler->setPrincipal(doc->NodePrincipal());
|
||||
rv = handleNode(doc, aCompiler);
|
||||
if (NS_FAILED(rv)) {
|
||||
nsAutoCString spec;
|
||||
aUri->GetSpec(spec);
|
||||
uri->GetSpec(spec);
|
||||
aCompiler->cancel(rv, nullptr, NS_ConvertUTF8toUTF16(spec).get());
|
||||
return rv;
|
||||
}
|
||||
@ -651,20 +667,46 @@ void txSyncCompileObserver::onDoneCompiling(txStylesheetCompiler* aCompiler,
|
||||
}
|
||||
|
||||
nsresult
|
||||
TX_CompileStylesheet(nsINode* aNode,
|
||||
nsIDocument* aLoaderDocument,
|
||||
txMozillaXSLTProcessor* aProcessor,
|
||||
TX_CompileStylesheet(nsINode* aNode, txMozillaXSLTProcessor* aProcessor,
|
||||
txStylesheet** aStylesheet)
|
||||
{
|
||||
// If we move GetBaseURI to nsINode this can be simplified.
|
||||
nsCOMPtr<nsIDocument> doc = aNode->OwnerDoc();
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
if (aNode->IsNodeOfType(nsINode::eCONTENT)) {
|
||||
uri = static_cast<nsIContent*>(aNode)->GetBaseURI();
|
||||
}
|
||||
else {
|
||||
NS_ASSERTION(aNode->IsNodeOfType(nsINode::eDOCUMENT), "not a doc");
|
||||
uri = static_cast<nsIDocument*>(aNode)->GetBaseURI();
|
||||
}
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
|
||||
|
||||
nsAutoCString spec;
|
||||
uri->GetSpec(spec);
|
||||
NS_ConvertUTF8toUTF16 baseURI(spec);
|
||||
|
||||
nsIURI* docUri = doc->GetDocumentURI();
|
||||
NS_ENSURE_TRUE(docUri, NS_ERROR_FAILURE);
|
||||
|
||||
// We need to remove the ref, a URI with a ref would mean that we have an
|
||||
// embedded stylesheet.
|
||||
docUri->CloneIgnoringRef(getter_AddRefs(uri));
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
|
||||
|
||||
uri->GetSpec(spec);
|
||||
NS_ConvertUTF8toUTF16 stylesheetURI(spec);
|
||||
|
||||
RefPtr<txSyncCompileObserver> obs =
|
||||
new txSyncCompileObserver(aProcessor, aLoaderDocument);
|
||||
new txSyncCompileObserver(aProcessor);
|
||||
NS_ENSURE_TRUE(obs, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
RefPtr<txStylesheetCompiler> compiler =
|
||||
new txStylesheetCompiler(EmptyString(), obs);
|
||||
new txStylesheetCompiler(stylesheetURI, doc->GetReferrerPolicy(), obs);
|
||||
NS_ENSURE_TRUE(compiler, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI = aNode->GetBaseURI();
|
||||
compiler->setBaseURI(baseURI);
|
||||
compiler->setPrincipal(aNode->NodePrincipal());
|
||||
|
||||
nsresult rv = handleNode(aNode, compiler);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -361,13 +361,6 @@ txMozillaXSLTProcessor::txMozillaXSLTProcessor(nsISupports* aOwner)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
txMozillaXSLTProcessor::Init(nsISupports* aOwner)
|
||||
{
|
||||
mOwner = aOwner;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
txMozillaXSLTProcessor::~txMozillaXSLTProcessor()
|
||||
{
|
||||
if (mStylesheetDocument) {
|
||||
@ -611,7 +604,7 @@ txMozillaXSLTProcessor::ImportStylesheet(nsIDOMNode *aStyle)
|
||||
styleNode->IsNodeOfType(nsINode::eDOCUMENT)),
|
||||
NS_ERROR_INVALID_ARG);
|
||||
|
||||
nsresult rv = TX_CompileStylesheet(styleNode, getLoaderDoc(), this,
|
||||
nsresult rv = TX_CompileStylesheet(styleNode, this,
|
||||
getter_AddRefs(mStylesheet));
|
||||
// XXX set up exception context, bug 204658
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -666,7 +659,7 @@ txMozillaXSLTProcessor::TransformToDoc(nsIDOMDocument **aResult,
|
||||
sourceDOMDocument = do_QueryInterface(mSource);
|
||||
}
|
||||
|
||||
txExecutionState es(mStylesheet, IsLoadDisabled(), getLoaderDoc());
|
||||
txExecutionState es(mStylesheet, IsLoadDisabled());
|
||||
|
||||
// XXX Need to add error observers
|
||||
|
||||
@ -734,7 +727,7 @@ txMozillaXSLTProcessor::TransformToFragment(nsIDOMNode *aSource,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
txExecutionState es(mStylesheet, IsLoadDisabled(), getLoaderDoc());
|
||||
txExecutionState es(mStylesheet, IsLoadDisabled());
|
||||
|
||||
// XXX Need to add error observers
|
||||
|
||||
@ -1043,7 +1036,12 @@ NS_IMETHODIMP
|
||||
txMozillaXSLTProcessor::LoadStyleSheet(nsIURI* aUri,
|
||||
nsIDocument* aLoaderDocument)
|
||||
{
|
||||
nsresult rv = TX_LoadSheet(aUri, this, aLoaderDocument);
|
||||
mozilla::net::ReferrerPolicy refpol = mozilla::net::RP_Default;
|
||||
if (mStylesheetDocument) {
|
||||
refpol = mStylesheetDocument->GetReferrerPolicy();
|
||||
}
|
||||
|
||||
nsresult rv = TX_LoadSheet(aUri, this, aLoaderDocument, refpol);
|
||||
if (NS_FAILED(rv) && mObserver) {
|
||||
// This is most likely a network or security error, just
|
||||
// use the uri as context.
|
||||
@ -1200,24 +1198,6 @@ txMozillaXSLTProcessor::notifyError()
|
||||
mObserver->OnTransformDone(mTransformResult, document);
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
txMozillaXSLTProcessor::getLoaderDoc()
|
||||
{
|
||||
if (mOwner) {
|
||||
nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(mOwner);
|
||||
if (win) {
|
||||
return win->GetExtantDoc();
|
||||
}
|
||||
}
|
||||
|
||||
if (mSource) {
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(mSource);
|
||||
return node->OwnerDoc();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsresult
|
||||
txMozillaXSLTProcessor::ensureStylesheet()
|
||||
{
|
||||
@ -1232,8 +1212,7 @@ txMozillaXSLTProcessor::ensureStylesheet()
|
||||
style = mStylesheetDocument;
|
||||
}
|
||||
|
||||
return TX_CompileStylesheet(style, getLoaderDoc(), this,
|
||||
getter_AddRefs(mStylesheet));
|
||||
return TX_CompileStylesheet(style, this, getter_AddRefs(mStylesheet));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -166,8 +166,6 @@ private:
|
||||
void notifyError();
|
||||
nsresult ensureStylesheet();
|
||||
|
||||
nsIDocument* getLoaderDoc();
|
||||
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
|
||||
RefPtr<txStylesheet> mStylesheet;
|
||||
@ -187,10 +185,10 @@ private:
|
||||
};
|
||||
|
||||
extern nsresult TX_LoadSheet(nsIURI* aUri, txMozillaXSLTProcessor* aProcessor,
|
||||
nsIDocument* aLoaderDocument);
|
||||
nsIDocument* aLoaderDocument,
|
||||
mozilla::net::ReferrerPolicy aReferrerPolicy);
|
||||
|
||||
extern nsresult TX_CompileStylesheet(nsINode* aNode,
|
||||
nsIDocument* aLoaderDocument,
|
||||
txMozillaXSLTProcessor* aProcessor,
|
||||
txStylesheet** aStylesheet);
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "txNamespaceMap.h"
|
||||
#include "txURIUtils.h"
|
||||
#include "txXSLTFunctions.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -757,12 +756,10 @@ txFnStartImport(int32_t aNamespaceID,
|
||||
nsGkAtoms::href, true, &attr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = NS_NewURI(getter_AddRefs(uri), attr->mValue, nullptr,
|
||||
aState.mElementContext->mBaseURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aState.loadImportedStylesheet(uri, importPtr->mFrame);
|
||||
nsAutoString absUri;
|
||||
URIUtils::resolveHref(attr->mValue, aState.mElementContext->mBaseURI,
|
||||
absUri);
|
||||
rv = aState.loadImportedStylesheet(absUri, importPtr->mFrame);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return aState.pushHandlerTable(gTxIgnoreHandler);
|
||||
@ -790,12 +787,10 @@ txFnStartInclude(int32_t aNamespaceID,
|
||||
nsGkAtoms::href, true, &attr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = NS_NewURI(getter_AddRefs(uri), attr->mValue, nullptr,
|
||||
aState.mElementContext->mBaseURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aState.loadIncludedStylesheet(uri);
|
||||
nsAutoString absUri;
|
||||
URIUtils::resolveHref(attr->mValue, aState.mElementContext->mBaseURI,
|
||||
absUri);
|
||||
rv = aState.loadIncludedStylesheet(absUri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return aState.pushHandlerTable(gTxIgnoreHandler);
|
||||
|
@ -23,29 +23,31 @@
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using mozilla::net::ReferrerPolicy;
|
||||
|
||||
txStylesheetCompiler::txStylesheetCompiler(const nsString& aFragment,
|
||||
txStylesheetCompiler::txStylesheetCompiler(const nsAString& aStylesheetURI,
|
||||
ReferrerPolicy aReferrerPolicy,
|
||||
txACompileObserver* aObserver)
|
||||
: txStylesheetCompilerState(aObserver)
|
||||
{
|
||||
mStatus = init(aFragment, nullptr, nullptr);
|
||||
mStatus = init(aStylesheetURI, aReferrerPolicy, nullptr, nullptr);
|
||||
}
|
||||
|
||||
txStylesheetCompiler::txStylesheetCompiler(const nsString& aFragment,
|
||||
txStylesheetCompiler::txStylesheetCompiler(const nsAString& aStylesheetURI,
|
||||
txStylesheet* aStylesheet,
|
||||
txListIterator* aInsertPosition,
|
||||
ReferrerPolicy aReferrerPolicy,
|
||||
txACompileObserver* aObserver)
|
||||
: txStylesheetCompilerState(aObserver)
|
||||
{
|
||||
mStatus = init(aFragment, aStylesheet, aInsertPosition);
|
||||
mStatus = init(aStylesheetURI, aReferrerPolicy, aStylesheet,
|
||||
aInsertPosition);
|
||||
}
|
||||
|
||||
void
|
||||
txStylesheetCompiler::setBaseURI(nsIURI* aBaseURI)
|
||||
txStylesheetCompiler::setBaseURI(const nsString& aBaseURI)
|
||||
{
|
||||
NS_ASSERTION(mObjectStack.size() == 1 && !mObjectStack.peek(),
|
||||
"Execution already started");
|
||||
@ -57,16 +59,6 @@ txStylesheetCompiler::setBaseURI(nsIURI* aBaseURI)
|
||||
mElementContext->mBaseURI = aBaseURI;
|
||||
}
|
||||
|
||||
void
|
||||
txStylesheetCompiler::setPrincipal(nsIPrincipal* aPrincipal)
|
||||
{
|
||||
if (NS_FAILED(mStatus)) {
|
||||
return;
|
||||
}
|
||||
|
||||
mStylesheetPrincipal = aPrincipal;
|
||||
}
|
||||
|
||||
nsresult
|
||||
txStylesheetCompiler::startElement(int32_t aNamespaceID, nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
@ -225,11 +217,9 @@ txStylesheetCompiler::startElementInternal(int32_t aNamespaceID,
|
||||
rv = ensureNewElementContext();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = NS_NewURI(getter_AddRefs(uri), attr->mValue,
|
||||
nullptr, mElementContext->mBaseURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mElementContext->mBaseURI = uri.forget();
|
||||
nsAutoString uri;
|
||||
URIUtils::resolveHref(attr->mValue, mElementContext->mBaseURI, uri);
|
||||
mElementContext->mBaseURI = uri;
|
||||
}
|
||||
|
||||
// extension-element-prefixes
|
||||
@ -381,15 +371,9 @@ txStylesheetCompiler::characters(const nsAString& aStr)
|
||||
nsresult
|
||||
txStylesheetCompiler::doneLoading()
|
||||
{
|
||||
if (MOZ_LOG_TEST(txLog::xslt, LogLevel::Info)) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
mStylesheetPrincipal->GetURI(getter_AddRefs(uri));
|
||||
nsAutoCString spec;
|
||||
uri->GetSpec(spec);
|
||||
MOZ_LOG(txLog::xslt, LogLevel::Info,
|
||||
("Compiler::doneLoading: %s\n",
|
||||
spec.get()));
|
||||
}
|
||||
MOZ_LOG(txLog::xslt, LogLevel::Info,
|
||||
("Compiler::doneLoading: %s\n",
|
||||
NS_LossyConvertUTF16toASCII(mStylesheetURI).get()));
|
||||
if (NS_FAILED(mStatus)) {
|
||||
return mStatus;
|
||||
}
|
||||
@ -403,17 +387,11 @@ void
|
||||
txStylesheetCompiler::cancel(nsresult aError, const char16_t *aErrorText,
|
||||
const char16_t *aParam)
|
||||
{
|
||||
if (MOZ_LOG_TEST(txLog::xslt, LogLevel::Info)) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
mStylesheetPrincipal->GetURI(getter_AddRefs(uri));
|
||||
nsAutoCString spec;
|
||||
uri->GetSpec(spec);
|
||||
MOZ_LOG(txLog::xslt, LogLevel::Info,
|
||||
("Compiler::cancel: %s, module: %d, code %d\n",
|
||||
spec.get(),
|
||||
NS_ERROR_GET_MODULE(aError),
|
||||
NS_ERROR_GET_CODE(aError)));
|
||||
}
|
||||
MOZ_LOG(txLog::xslt, LogLevel::Info,
|
||||
("Compiler::cancel: %s, module: %d, code %d\n",
|
||||
NS_LossyConvertUTF16toASCII(mStylesheetURI).get(),
|
||||
NS_ERROR_GET_MODULE(aError),
|
||||
NS_ERROR_GET_CODE(aError)));
|
||||
if (NS_SUCCEEDED(mStatus)) {
|
||||
mStatus = aError;
|
||||
}
|
||||
@ -433,30 +411,20 @@ txStylesheetCompiler::getStylesheet()
|
||||
}
|
||||
|
||||
nsresult
|
||||
txStylesheetCompiler::loadURI(nsIURI* aUri,
|
||||
nsIPrincipal* aReferrerPrincipal,
|
||||
txStylesheetCompiler::loadURI(const nsAString& aUri,
|
||||
const nsAString& aReferrerUri,
|
||||
ReferrerPolicy aReferrerPolicy,
|
||||
txStylesheetCompiler* aCompiler)
|
||||
{
|
||||
nsCOMPtr<nsIURI> stylesheetURI;
|
||||
mStylesheetPrincipal->GetURI(getter_AddRefs(stylesheetURI));
|
||||
|
||||
if (MOZ_LOG_TEST(txLog::xslt, LogLevel::Info)) {
|
||||
nsAutoCString stylesheetSpec;
|
||||
stylesheetURI->GetSpec(stylesheetSpec);
|
||||
nsAutoCString uriSpec;
|
||||
aUri->GetSpec(uriSpec);
|
||||
MOZ_LOG(txLog::xslt, LogLevel::Info,
|
||||
("Compiler::loadURI forwards %s thru %s\n",
|
||||
uriSpec.get(),
|
||||
stylesheetSpec.get()));
|
||||
}
|
||||
|
||||
bool equals;
|
||||
if (NS_FAILED(stylesheetURI->Equals(aUri, &equals)) || equals) {
|
||||
MOZ_LOG(txLog::xslt, LogLevel::Info,
|
||||
("Compiler::loadURI forwards %s thru %s\n",
|
||||
NS_LossyConvertUTF16toASCII(aUri).get(),
|
||||
NS_LossyConvertUTF16toASCII(mStylesheetURI).get()));
|
||||
if (mStylesheetURI.Equals(aUri)) {
|
||||
return NS_ERROR_XSLT_LOAD_RECURSION;
|
||||
}
|
||||
return mObserver ?
|
||||
mObserver->loadURI(aUri, aReferrerPrincipal, aCompiler) :
|
||||
mObserver->loadURI(aUri, aReferrerUri, aReferrerPolicy, aCompiler) :
|
||||
NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -566,20 +534,27 @@ txStylesheetCompilerState::txStylesheetCompilerState(txACompileObserver* aObserv
|
||||
}
|
||||
|
||||
nsresult
|
||||
txStylesheetCompilerState::init(const nsString& aFragment,
|
||||
txStylesheetCompilerState::init(const nsAString& aStylesheetURI,
|
||||
ReferrerPolicy aReferrerPolicy,
|
||||
txStylesheet* aStylesheet,
|
||||
txListIterator* aInsertPosition)
|
||||
{
|
||||
NS_ASSERTION(!aStylesheet || aInsertPosition,
|
||||
"must provide insertposition if loading subsheet");
|
||||
|
||||
mStylesheetURI = aStylesheetURI;
|
||||
mReferrerPolicy = aReferrerPolicy;
|
||||
// Check for fragment identifier of an embedded stylesheet.
|
||||
if (!aFragment.IsEmpty()) {
|
||||
// This is really an embedded stylesheet, not just a
|
||||
// "url#". We may want to unescape the fragment.
|
||||
mTarget = aFragment;
|
||||
mEmbedStatus = eNeedEmbed;
|
||||
mHandlerTable = gTxEmbedHandler;
|
||||
int32_t fragment = aStylesheetURI.FindChar('#') + 1;
|
||||
if (fragment > 0) {
|
||||
int32_t fragmentLength = aStylesheetURI.Length() - fragment;
|
||||
if (fragmentLength > 0) {
|
||||
// This is really an embedded stylesheet, not just a
|
||||
// "url#". We may want to unescape the fragment.
|
||||
mTarget = Substring(aStylesheetURI, (uint32_t)fragment,
|
||||
fragmentLength);
|
||||
mEmbedStatus = eNeedEmbed;
|
||||
mHandlerTable = gTxEmbedHandler;
|
||||
}
|
||||
}
|
||||
nsresult rv = NS_OK;
|
||||
if (aStylesheet) {
|
||||
@ -598,7 +573,8 @@ txStylesheetCompilerState::init(const nsString& aFragment,
|
||||
mIsTopCompiler = true;
|
||||
}
|
||||
|
||||
mElementContext = new txElementContext();
|
||||
mElementContext = new txElementContext(aStylesheetURI);
|
||||
NS_ENSURE_TRUE(mElementContext->mMappings, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// Push the "old" txElementContext
|
||||
rv = pushObject(0);
|
||||
@ -761,25 +737,18 @@ txStylesheetCompilerState::addInstruction(nsAutoPtr<txInstruction>&& aInstructio
|
||||
}
|
||||
|
||||
nsresult
|
||||
txStylesheetCompilerState::loadIncludedStylesheet(nsIURI* aURI)
|
||||
txStylesheetCompilerState::loadIncludedStylesheet(const nsAString& aURI)
|
||||
{
|
||||
if (MOZ_LOG_TEST(txLog::xslt, LogLevel::Info)) {
|
||||
nsAutoCString spec;
|
||||
aURI->GetSpec(spec);
|
||||
MOZ_LOG(txLog::xslt, LogLevel::Info,
|
||||
("CompilerState::loadIncludedStylesheet: %s\n",
|
||||
spec.get()));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> stylesheetURI;
|
||||
mStylesheetPrincipal->GetURI(getter_AddRefs(stylesheetURI));
|
||||
bool equals;
|
||||
if (NS_FAILED(stylesheetURI->Equals(aURI, &equals)) || equals) {
|
||||
MOZ_LOG(txLog::xslt, LogLevel::Info,
|
||||
("CompilerState::loadIncludedStylesheet: %s\n",
|
||||
NS_LossyConvertUTF16toASCII(aURI).get()));
|
||||
if (mStylesheetURI.Equals(aURI)) {
|
||||
return NS_ERROR_XSLT_LOAD_RECURSION;
|
||||
}
|
||||
NS_ENSURE_TRUE(mObserver, NS_ERROR_NOT_IMPLEMENTED);
|
||||
|
||||
nsAutoPtr<txToplevelItem> item(new txDummyItem);
|
||||
NS_ENSURE_TRUE(item, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsresult rv = mToplevelIterator.addBefore(item);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -791,21 +760,19 @@ txStylesheetCompilerState::loadIncludedStylesheet(nsIURI* aURI)
|
||||
|
||||
txACompileObserver* observer = static_cast<txStylesheetCompiler*>(this);
|
||||
|
||||
nsAutoCString fragment;
|
||||
aURI->GetRef(fragment);
|
||||
|
||||
RefPtr<txStylesheetCompiler> compiler =
|
||||
new txStylesheetCompiler(NS_ConvertUTF8toUTF16(fragment),
|
||||
mStylesheet,
|
||||
&mToplevelIterator,
|
||||
observer);
|
||||
new txStylesheetCompiler(aURI, mStylesheet, &mToplevelIterator,
|
||||
mReferrerPolicy, observer);
|
||||
NS_ENSURE_TRUE(compiler, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// step forward before calling the observer in case of syncronous loading
|
||||
mToplevelIterator.next();
|
||||
|
||||
mChildCompilerList.AppendElement(compiler);
|
||||
if (mChildCompilerList.AppendElement(compiler) == nullptr) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
rv = mObserver->loadURI(aURI, mStylesheetPrincipal, compiler);
|
||||
rv = mObserver->loadURI(aURI, mStylesheetURI, mReferrerPolicy, compiler);
|
||||
if (NS_FAILED(rv)) {
|
||||
mChildCompilerList.RemoveElement(compiler);
|
||||
}
|
||||
@ -814,21 +781,13 @@ txStylesheetCompilerState::loadIncludedStylesheet(nsIURI* aURI)
|
||||
}
|
||||
|
||||
nsresult
|
||||
txStylesheetCompilerState::loadImportedStylesheet(nsIURI* aURI,
|
||||
txStylesheetCompilerState::loadImportedStylesheet(const nsAString& aURI,
|
||||
txStylesheet::ImportFrame* aFrame)
|
||||
{
|
||||
if (MOZ_LOG_TEST(txLog::xslt, LogLevel::Info)) {
|
||||
nsAutoCString spec;
|
||||
aURI->GetSpec(spec);
|
||||
MOZ_LOG(txLog::xslt, LogLevel::Info,
|
||||
("CompilerState::loadImportedStylesheet: %s\n",
|
||||
spec.get()));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> stylesheetURI;
|
||||
mStylesheetPrincipal->GetURI(getter_AddRefs(stylesheetURI));
|
||||
bool equals;
|
||||
if (NS_FAILED(stylesheetURI->Equals(aURI, &equals)) || equals) {
|
||||
MOZ_LOG(txLog::xslt, LogLevel::Info,
|
||||
("CompilerState::loadImportedStylesheet: %s\n",
|
||||
NS_LossyConvertUTF16toASCII(aURI).get()));
|
||||
if (mStylesheetURI.Equals(aURI)) {
|
||||
return NS_ERROR_XSLT_LOAD_RECURSION;
|
||||
}
|
||||
NS_ENSURE_TRUE(mObserver, NS_ERROR_NOT_IMPLEMENTED);
|
||||
@ -838,18 +797,17 @@ txStylesheetCompilerState::loadImportedStylesheet(nsIURI* aURI,
|
||||
|
||||
txACompileObserver* observer = static_cast<txStylesheetCompiler*>(this);
|
||||
|
||||
nsAutoCString fragment;
|
||||
aURI->GetRef(fragment);
|
||||
|
||||
RefPtr<txStylesheetCompiler> compiler =
|
||||
new txStylesheetCompiler(NS_ConvertUTF8toUTF16(fragment),
|
||||
mStylesheet,
|
||||
&iter,
|
||||
new txStylesheetCompiler(aURI, mStylesheet, &iter, mReferrerPolicy,
|
||||
observer);
|
||||
NS_ENSURE_TRUE(compiler, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
mChildCompilerList.AppendElement(compiler);
|
||||
if (mChildCompilerList.AppendElement(compiler) == nullptr) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsresult rv = mObserver->loadURI(aURI, mStylesheetPrincipal, compiler);
|
||||
nsresult rv = mObserver->loadURI(aURI, mStylesheetURI, mReferrerPolicy,
|
||||
compiler);
|
||||
if (NS_FAILED(rv)) {
|
||||
mChildCompilerList.RemoveElement(compiler);
|
||||
}
|
||||
@ -1110,7 +1068,9 @@ extern bool
|
||||
TX_XSLTFunctionAvailable(nsIAtom* aName, int32_t aNameSpaceID)
|
||||
{
|
||||
RefPtr<txStylesheetCompiler> compiler =
|
||||
new txStylesheetCompiler(EmptyString(), nullptr);
|
||||
new txStylesheetCompiler(EmptyString(),
|
||||
mozilla::net::RP_Default, nullptr);
|
||||
NS_ENSURE_TRUE(compiler, false);
|
||||
|
||||
nsAutoPtr<FunctionCall> fnCall;
|
||||
|
||||
@ -1154,9 +1114,10 @@ txStylesheetCompilerState::shutdown()
|
||||
sXPCOMFunctionMappings = nullptr;
|
||||
}
|
||||
|
||||
txElementContext::txElementContext()
|
||||
txElementContext::txElementContext(const nsAString& aBaseURI)
|
||||
: mPreserveWhitespace(false),
|
||||
mForwardsCompatibleParsing(true),
|
||||
mBaseURI(aBaseURI),
|
||||
mMappings(new txNamespaceMap),
|
||||
mDepth(0)
|
||||
{
|
||||
|
@ -32,12 +32,12 @@ class txInScopeVariable;
|
||||
class txElementContext : public txObject
|
||||
{
|
||||
public:
|
||||
explicit txElementContext();
|
||||
explicit txElementContext(const nsAString& aBaseURI);
|
||||
txElementContext(const txElementContext& aOther);
|
||||
|
||||
bool mPreserveWhitespace;
|
||||
bool mForwardsCompatibleParsing;
|
||||
nsCOMPtr<nsIURI> mBaseURI;
|
||||
nsString mBaseURI;
|
||||
RefPtr<txNamespaceMap> mMappings;
|
||||
nsTArray<int32_t> mInstructionNamespaces;
|
||||
int32_t mDepth;
|
||||
@ -49,8 +49,9 @@ public:
|
||||
NS_IMETHOD_(MozExternalRefCountType) AddRef() = 0;
|
||||
NS_IMETHOD_(MozExternalRefCountType) Release() = 0;
|
||||
|
||||
virtual nsresult loadURI(nsIURI* aUri,
|
||||
nsIPrincipal* aReferrerPrincipal,
|
||||
virtual nsresult loadURI(const nsAString& aUri,
|
||||
const nsAString& aReferrerUri,
|
||||
mozilla::net::ReferrerPolicy aReferrerPolicy,
|
||||
txStylesheetCompiler* aCompiler) = 0;
|
||||
virtual void onDoneCompiling(txStylesheetCompiler* aCompiler,
|
||||
nsresult aResult,
|
||||
@ -59,8 +60,8 @@ public:
|
||||
};
|
||||
|
||||
#define TX_DECL_ACOMPILEOBSERVER \
|
||||
nsresult loadURI(nsIURI* aUri, \
|
||||
nsIPrincipal* aReferrerPrincipal, \
|
||||
nsresult loadURI(const nsAString& aUri, const nsAString& aReferrerUri, \
|
||||
mozilla::net::ReferrerPolicy aReferrerPolicy, \
|
||||
txStylesheetCompiler* aCompiler); \
|
||||
void onDoneCompiling(txStylesheetCompiler* aCompiler, nsresult aResult, \
|
||||
const char16_t *aErrorText = nullptr, \
|
||||
@ -72,8 +73,9 @@ public:
|
||||
explicit txStylesheetCompilerState(txACompileObserver* aObserver);
|
||||
~txStylesheetCompilerState();
|
||||
|
||||
nsresult init(const nsString& aFragment, txStylesheet* aStylesheet,
|
||||
txListIterator* aInsertPosition);
|
||||
nsresult init(const nsAString& aStylesheetURI,
|
||||
mozilla::net::ReferrerPolicy aReferrerPolicy,
|
||||
txStylesheet* aStylesheet, txListIterator* aInsertPosition);
|
||||
|
||||
// Embedded stylesheets state
|
||||
bool handleEmbeddedSheet()
|
||||
@ -114,8 +116,8 @@ public:
|
||||
nsresult openInstructionContainer(txInstructionContainer* aContainer);
|
||||
void closeInstructionContainer();
|
||||
nsresult addInstruction(nsAutoPtr<txInstruction>&& aInstruction);
|
||||
nsresult loadIncludedStylesheet(nsIURI* aURI);
|
||||
nsresult loadImportedStylesheet(nsIURI* aURI,
|
||||
nsresult loadIncludedStylesheet(const nsAString& aURI);
|
||||
nsresult loadImportedStylesheet(const nsAString& aURI,
|
||||
txStylesheet::ImportFrame* aFrame);
|
||||
|
||||
// misc
|
||||
@ -164,7 +166,6 @@ public:
|
||||
uint16_t mDisAllowed;
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIPrincipal> mStylesheetPrincipal;
|
||||
RefPtr<txACompileObserver> mObserver;
|
||||
nsTArray<txInScopeVariable*> mInScopeVariables;
|
||||
nsTArray<txStylesheetCompiler*> mChildCompilerList;
|
||||
@ -177,6 +178,7 @@ protected:
|
||||
eInEmbed,
|
||||
eHasEmbed
|
||||
} mEmbedStatus;
|
||||
nsString mStylesheetURI;
|
||||
bool mIsTopCompiler;
|
||||
bool mDoneWithThisStylesheet;
|
||||
txStack mObjectStack;
|
||||
@ -187,6 +189,7 @@ private:
|
||||
txInstruction** mNextInstrPtr;
|
||||
txListIterator mToplevelIterator;
|
||||
nsTArray<txInstruction**> mGotoTargetPointers;
|
||||
mozilla::net::ReferrerPolicy mReferrerPolicy;
|
||||
};
|
||||
|
||||
struct txStylesheetAttr
|
||||
@ -204,15 +207,16 @@ public:
|
||||
friend class txStylesheetCompilerState;
|
||||
friend bool TX_XSLTFunctionAvailable(nsIAtom* aName,
|
||||
int32_t aNameSpaceID);
|
||||
txStylesheetCompiler(const nsString& aFragment,
|
||||
txStylesheetCompiler(const nsAString& aStylesheetURI,
|
||||
mozilla::net::ReferrerPolicy aReferrerPolicy,
|
||||
txACompileObserver* aObserver);
|
||||
txStylesheetCompiler(const nsString& aFragment,
|
||||
txStylesheetCompiler(const nsAString& aStylesheetURI,
|
||||
txStylesheet* aStylesheet,
|
||||
txListIterator* aInsertPosition,
|
||||
mozilla::net::ReferrerPolicy aReferrerPolicy,
|
||||
txACompileObserver* aObserver);
|
||||
|
||||
void setBaseURI(nsIURI* aBaseURI);
|
||||
void setPrincipal(nsIPrincipal* aPrincipal);
|
||||
void setBaseURI(const nsString& aBaseURI);
|
||||
|
||||
nsresult startElement(int32_t aNamespaceID, nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix, txStylesheetAttr* aAttributes,
|
||||
|
@ -23,14 +23,12 @@ public:
|
||||
/**
|
||||
* Creates a new document() function call
|
||||
**/
|
||||
explicit DocumentFunctionCall(nsIURI* aBaseURI)
|
||||
: mBaseURI(aBaseURI)
|
||||
{}
|
||||
explicit DocumentFunctionCall(const nsAString& aBaseURI);
|
||||
|
||||
TX_DECL_FUNCTION
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIURI> mBaseURI;
|
||||
nsString mBaseURI;
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user