mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
[DOM] Convert parameters upfront.
This commit is contained in:
parent
e45fbf91ce
commit
7cd8d79670
1 changed files with 15 additions and 15 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue