mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-21 11:40:34 -10:00
Avoid heap allocation for temporary strings
- nsCString(x).get() in LOG calls
- nsCString(Substring(...)).ToInteger()
- Append(nsPrintfCString(...))
- ToAddrPortString: replaced triple-alloc (nsCString + nsPrintfCString + assign)
- DefaultURI::Write/GetUserPass: removed unnecessary nsAutoCString temporaries
Eliminate copies
- SSLTokensCache::GetLocked: clone-then-destroy
- ObliviousHttpService::GetTRRSettings: Assign(Clone())
- LoadInfo truncated URI builder: 5-variable operator+ chain
- for (auto x : on containers of RefPtr/nsCOMPtr
- LoadInfo::CreateTruncatedPrincipal: AppendElement(x)
Eliminate redundant initialization
- DNS.cpp::InitFromString: removed {} redundant with following memset
- Dashboard::LogData ctor: mHost(host)
Idiomatic cleanup
- FuzzySecurityInfo/FuzzySocketControl: Assign(""_ns)
Differential Revision: https://phabricator.services.mozilla.com/D288105
60 lines
1.8 KiB
C++
60 lines
1.8 KiB
C++
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "mozilla/net/InterceptionInfo.h"
|
|
#include "nsContentUtils.h"
|
|
|
|
namespace mozilla::net {
|
|
|
|
NS_IMPL_ISUPPORTS(InterceptionInfo, nsIInterceptionInfo)
|
|
|
|
InterceptionInfo::InterceptionInfo(nsIPrincipal* aTriggeringPrincipal,
|
|
nsContentPolicyType aContentPolicyType,
|
|
const RedirectHistoryArray& aRedirectChain,
|
|
bool aFromThirdParty)
|
|
: mTriggeringPrincipal(aTriggeringPrincipal),
|
|
mContentPolicyType(aContentPolicyType),
|
|
mFromThirdParty(aFromThirdParty) {
|
|
SetRedirectChain(aRedirectChain);
|
|
}
|
|
|
|
nsIPrincipal* InterceptionInfo::TriggeringPrincipal() {
|
|
return mTriggeringPrincipal;
|
|
}
|
|
|
|
void InterceptionInfo::SetTriggeringPrincipal(nsIPrincipal* aPrincipal) {
|
|
mTriggeringPrincipal = aPrincipal;
|
|
}
|
|
|
|
nsContentPolicyType InterceptionInfo::ContentPolicyType() {
|
|
return mContentPolicyType;
|
|
}
|
|
|
|
nsContentPolicyType InterceptionInfo::ExternalContentPolicyType() {
|
|
return static_cast<nsContentPolicyType>(
|
|
nsContentUtils::InternalContentPolicyTypeToExternal(mContentPolicyType));
|
|
}
|
|
|
|
void InterceptionInfo::SetContentPolicyType(
|
|
const nsContentPolicyType aContentPolicyType) {
|
|
mContentPolicyType = aContentPolicyType;
|
|
}
|
|
|
|
const RedirectHistoryArray& InterceptionInfo::RedirectChain() {
|
|
return mRedirectChain;
|
|
}
|
|
|
|
void InterceptionInfo::SetRedirectChain(
|
|
const RedirectHistoryArray& aRedirectChain) {
|
|
mRedirectChain.AppendElements(aRedirectChain);
|
|
}
|
|
|
|
bool InterceptionInfo::FromThirdParty() { return mFromThirdParty; }
|
|
|
|
void InterceptionInfo::SetFromThirdParty(bool aFromThirdParty) {
|
|
mFromThirdParty = aFromThirdParty;
|
|
}
|
|
|
|
} // namespace mozilla::net
|