diff options
-rw-r--r-- | dom/xslt/xslt/txMozillaXSLTProcessor.cpp | 30 |
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); } |