summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Van der Beken <peterv@propagandism.org>2022-03-09 00:23:13 +0000
committerMoonchild <moonchild@palemoon.org>2022-03-09 11:43:19 +0000
commita7f82c20768e20642557ea5677c85bbc3c5f8b47 (patch)
tree2e8ad648802371bb6f717fbfd214066e9c221014
parentcc6d347b6ccd133ed83f6a564931c27b949c7d8f (diff)
downloaduxp-RC_20220309.tar.gz
[DOM] Convert parameters upfront.RELBASE_20220310RC_20220309
-rw-r--r--dom/xslt/xslt/txMozillaXSLTProcessor.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
index 6aec6052f4..59cd09bd6a 100644
--- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
+++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
@@ -239,9 +239,10 @@ txToFragmentHandlerFactory::createHandlerWith(txOutputFormat* aFormat,
class txVariable : public txIGlobalParameter
{
public:
- explicit txVariable(nsIVariant* aValue) : mValue(aValue)
+ explicit txVariable(nsIVariant* aValue, txAExprResult* aTxValue)
+ : mValue(aValue)
{
- NS_ASSERTION(aValue, "missing value");
+ NS_ASSERTION(aValue && aTxValue, "missing value");
}
explicit txVariable(txAExprResult* aValue) : mTxValue(aValue)
{
@@ -249,12 +250,7 @@ public:
}
nsresult getValue(txAExprResult** aValue)
{
- NS_ASSERTION(mValue || mTxValue, "variablevalue is null");
-
- if (!mTxValue) {
- nsresult rv = Convert(mValue, getter_AddRefs(mTxValue));
- NS_ENSURE_SUCCESS(rv, rv);
- }
+ NS_ASSERTION(mTxValue, "variablevalue is null");
*aValue = mTxValue;
NS_ADDREF(*aValue);
@@ -271,11 +267,11 @@ public:
{
return mValue;
}
- void setValue(nsIVariant* aValue)
+ void setValue(nsIVariant* aValue, txAExprResult* aTxValue)
{
- NS_ASSERTION(aValue, "setting variablevalue to null");
+ NS_ASSERTION(aValue && aTxValue, "setting variablevalue to null");
mValue = aValue;
- mTxValue = nullptr;
+ mTxValue = aTxValue;
}
void setValue(txAExprResult* aValue)
{
@@ -284,14 +280,14 @@ public:
mTxValue = aValue;
}
+ static nsresult Convert(nsIVariant *aValue, txAExprResult** aResult);
+
friend void ImplCycleCollectionUnlink(txVariable& aVariable);
friend void ImplCycleCollectionTraverse(
nsCycleCollectionTraversalCallback& aCallback, txVariable& aVariable,
const char* aName, uint32_t aFlags);
private:
- static nsresult Convert(nsIVariant *aValue, txAExprResult** aResult);
-
nsCOMPtr<nsIVariant> mValue;
RefPtr<txAExprResult> mTxValue;
};
@@ -948,13 +944,17 @@ txMozillaXSLTProcessor::SetParameter(const nsAString & aNamespaceURI,
nsCOMPtr<nsIAtom> localName = NS_Atomize(aLocalName);
txExpandedName varName(nsId, localName);
+ RefPtr<txAExprResult> txValue;
+ rv = txVariable::Convert(value, getter_AddRefs(txValue));
+ NS_ENSURE_SUCCESS(rv, rv);
+
txVariable* var = static_cast<txVariable*>(mVariables.get(varName));
if (var) {
- var->setValue(value);
+ var->setValue(value, txValue);
return NS_OK;
}
- var = new txVariable(value);
+ var = new txVariable(value, txValue);
return mVariables.add(varName, var);
}