[tbb-commits] [tor-browser/geckoview-96.0-11.5-1] Bug 1758062 - Convert parameters upfront. r=smaug, a=tritter
aguestuser at torproject.org
aguestuser at torproject.org
Tue Mar 8 18:43:19 UTC 2022
commit 56176c3834ed416d4bc060745e1d1a2f75beca5d
Author: Peter Van der Beken <peterv at propagandism.org>
Date: Fri Mar 4 14:00:25 2022 +0000
Bug 1758062 - Convert parameters upfront. r=smaug, a=tritter
Differential Revision: https://phabricator.services.mozilla.com/D140337
---
dom/xslt/xslt/txMozillaXSLTProcessor.cpp | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
index c50a66a40201..a982bd118118 100644
--- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
+++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
@@ -198,19 +198,15 @@ nsresult txToFragmentHandlerFactory::createHandlerWith(
class txVariable : public txIGlobalParameter {
public:
- explicit txVariable(nsIVariant* aValue) : mValue(aValue) {
- NS_ASSERTION(aValue, "missing value");
+ explicit txVariable(nsIVariant* aValue, txAExprResult* aTxValue)
+ : mValue(aValue), mTxValue(aTxValue) {
+ NS_ASSERTION(aValue && aTxValue, "missing value");
}
explicit txVariable(txAExprResult* aValue) : mTxValue(aValue) {
NS_ASSERTION(aValue, "missing value");
}
nsresult getValue(txAExprResult** aValue) override {
- 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);
@@ -223,10 +219,10 @@ class txVariable : public txIGlobalParameter {
return NS_OK;
}
nsIVariant* getValue() { return mValue; }
- void setValue(nsIVariant* aValue) {
- NS_ASSERTION(aValue, "setting variablevalue to null");
+ void setValue(nsIVariant* aValue, txAExprResult* aTxValue) {
+ NS_ASSERTION(aValue && aTxValue, "setting variablevalue to null");
mValue = aValue;
- mTxValue = nullptr;
+ mTxValue = aTxValue;
}
void setValue(txAExprResult* aValue) {
NS_ASSERTION(aValue, "setting variablevalue to null");
@@ -234,14 +230,14 @@ class txVariable : public txIGlobalParameter {
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;
};
@@ -816,13 +812,17 @@ nsresult txMozillaXSLTProcessor::SetParameter(const nsAString& aNamespaceURI,
RefPtr<nsAtom> 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);
}
More information about the tbb-commits
mailing list