mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1347369 - Avoid dynamic allocation of URLParams in OriginAttributes methods; r=baku
These show up in some profiles sometimes, and there is no reason why the variables can't simply live on the stack.
This commit is contained in:
parent
e981884dca
commit
15bd78db3c
@ -99,7 +99,7 @@ OriginAttributes::SetFirstPartyDomain(const bool aIsTopLevelDocument,
|
||||
void
|
||||
OriginAttributes::CreateSuffix(nsACString& aStr) const
|
||||
{
|
||||
UniquePtr<URLParams> params(new URLParams());
|
||||
URLParams params;
|
||||
nsAutoString value;
|
||||
|
||||
//
|
||||
@ -111,34 +111,34 @@ OriginAttributes::CreateSuffix(nsACString& aStr) const
|
||||
|
||||
if (mAppId != nsIScriptSecurityManager::NO_APP_ID) {
|
||||
value.AppendInt(mAppId);
|
||||
params->Set(NS_LITERAL_STRING("appId"), value);
|
||||
params.Set(NS_LITERAL_STRING("appId"), value);
|
||||
}
|
||||
|
||||
if (mInIsolatedMozBrowser) {
|
||||
params->Set(NS_LITERAL_STRING("inBrowser"), NS_LITERAL_STRING("1"));
|
||||
params.Set(NS_LITERAL_STRING("inBrowser"), NS_LITERAL_STRING("1"));
|
||||
}
|
||||
|
||||
if (mUserContextId != nsIScriptSecurityManager::DEFAULT_USER_CONTEXT_ID) {
|
||||
value.Truncate();
|
||||
value.AppendInt(mUserContextId);
|
||||
params->Set(NS_LITERAL_STRING("userContextId"), value);
|
||||
params.Set(NS_LITERAL_STRING("userContextId"), value);
|
||||
}
|
||||
|
||||
|
||||
if (mPrivateBrowsingId) {
|
||||
value.Truncate();
|
||||
value.AppendInt(mPrivateBrowsingId);
|
||||
params->Set(NS_LITERAL_STRING("privateBrowsingId"), value);
|
||||
params.Set(NS_LITERAL_STRING("privateBrowsingId"), value);
|
||||
}
|
||||
|
||||
if (!mFirstPartyDomain.IsEmpty()) {
|
||||
MOZ_RELEASE_ASSERT(mFirstPartyDomain.FindCharInSet(dom::quota::QuotaManager::kReplaceChars) == kNotFound);
|
||||
params->Set(NS_LITERAL_STRING("firstPartyDomain"), mFirstPartyDomain);
|
||||
params.Set(NS_LITERAL_STRING("firstPartyDomain"), mFirstPartyDomain);
|
||||
}
|
||||
|
||||
aStr.Truncate();
|
||||
|
||||
params->Serialize(value);
|
||||
params.Serialize(value);
|
||||
if (!value.IsEmpty()) {
|
||||
aStr.AppendLiteral("^");
|
||||
aStr.Append(NS_ConvertUTF16toUTF8(value));
|
||||
@ -255,11 +255,11 @@ OriginAttributes::PopulateFromSuffix(const nsACString& aStr)
|
||||
return false;
|
||||
}
|
||||
|
||||
UniquePtr<URLParams> params(new URLParams());
|
||||
params->ParseInput(Substring(aStr, 1, aStr.Length() - 1));
|
||||
URLParams params;
|
||||
params.ParseInput(Substring(aStr, 1, aStr.Length() - 1));
|
||||
|
||||
PopulateFromSuffixIterator iterator(this);
|
||||
return params->ForEach(iterator);
|
||||
return params.ForEach(iterator);
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
Reference in New Issue
Block a user