mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 17:31:47 +09:00
imported changes from mozilla:
- Bug 1754724 - Clear up some computations in expat code. r=farre, a=tritter (c084e1e9) - Bug 1754724 - Clear up some more computations in expat code. r=farre, a=tritter (1ff49f5a) - Bug 1754724 - Clear up even more computations in expat code. r=farre, a=tritter (4a180bbf) - Bug 1758062 - Convert parameters upfront. r=smaug, a=tritter (153b3922)
This commit is contained in:
parent
c403014cbe
commit
eef4fb0146
2 changed files with 200 additions and 19 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), mTxValue(aTxValue)
|
||||
{
|
||||
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