Bug 1650163 - Part 1: Switch native remoteType values to nsCString, r=farre

Differential Revision: https://phabricator.services.mozilla.com/D82104
This commit is contained in:
Nika Layzell 2020-07-06 20:30:58 +00:00
Родитель 82eef07986
Коммит df351180c3
73 изменённых файлов: 307 добавлений и 355 удалений

Просмотреть файл

@ -156,7 +156,7 @@ AboutRedirector::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
// startup cache.
if (XRE_IsContentProcess() && path.EqualsLiteral("home")) {
auto& remoteType = dom::ContentChild::GetSingleton()->GetRemoteType();
if (remoteType.EqualsLiteral(PRIVILEGEDABOUT_REMOTE_TYPE)) {
if (remoteType == PRIVILEGEDABOUT_REMOTE_TYPE) {
nsCOMPtr<nsIAboutNewTabService> aboutNewTabService =
do_GetService("@mozilla.org/browser/aboutnewtab-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -938,7 +938,7 @@ nsresult nsScriptSecurityManager::CheckLoadURIFlags(
}
auto& remoteType = dom::ContentChild::GetSingleton()->GetRemoteType();
if (remoteType.EqualsLiteral(PRIVILEGEDABOUT_REMOTE_TYPE)) {
if (remoteType == PRIVILEGEDABOUT_REMOTE_TYPE) {
return NS_OK;
}
}

Просмотреть файл

@ -1047,9 +1047,8 @@ bool BrowsingContext::CrossOriginIsolated() {
nsILoadInfo::
OPENER_POLICY_SAME_ORIGIN_EMBEDDER_POLICY_REQUIRE_CORP &&
XRE_IsContentProcess() &&
StringBeginsWith(
ContentChild::GetSingleton()->GetRemoteType(),
NS_LITERAL_STRING_FROM_CSTRING(WITH_COOP_COEP_REMOTE_TYPE_PREFIX));
StringBeginsWith(ContentChild::GetSingleton()->GetRemoteType(),
WITH_COOP_COEP_REMOTE_TYPE_PREFIX);
}
BrowsingContext::~BrowsingContext() {

Просмотреть файл

@ -94,11 +94,11 @@ ContentParent* CanonicalBrowsingContext::GetContentParent() const {
return cpm->GetContentProcessById(ContentParentId(mProcessId));
}
void CanonicalBrowsingContext::GetCurrentRemoteType(nsAString& aRemoteType,
void CanonicalBrowsingContext::GetCurrentRemoteType(nsACString& aRemoteType,
ErrorResult& aRv) const {
// If we're in the parent process, dump out the void string.
if (mProcessId == 0) {
aRemoteType.Assign(VoidString());
aRemoteType.Assign(VoidCString());
return;
}
@ -822,7 +822,7 @@ CanonicalBrowsingContext::PendingRemotenessChange::~PendingRemotenessChange() {
}
RefPtr<CanonicalBrowsingContext::RemotenessPromise>
CanonicalBrowsingContext::ChangeRemoteness(const nsAString& aRemoteType,
CanonicalBrowsingContext::ChangeRemoteness(const nsACString& aRemoteType,
uint64_t aPendingSwitchId,
bool aReplaceBrowsingContext,
uint64_t aSpecificGroupId) {

Просмотреть файл

@ -59,7 +59,7 @@ class CanonicalBrowsingContext final : public BrowsingContext {
uint64_t EmbedderProcessId() const { return mEmbedderProcessId; }
ContentParent* GetContentParent() const;
void GetCurrentRemoteType(nsAString& aRemoteType, ErrorResult& aRv) const;
void GetCurrentRemoteType(nsACString& aRemoteType, ErrorResult& aRv) const;
void SetOwnerProcessId(uint64_t aProcessId);
@ -150,10 +150,10 @@ class CanonicalBrowsingContext final : public BrowsingContext {
// Internal method to change which process a BrowsingContext is being loaded
// in. The returned promise will resolve when the process switch is completed.
//
// A VoidString() aRemoteType argument will perform a process switch into the
// A VoidCString() aRemoteType argument will perform a process switch into the
// parent process, and the method will resolve with a null BrowserParent.
using RemotenessPromise = MozPromise<RefPtr<BrowserParent>, nsresult, false>;
RefPtr<RemotenessPromise> ChangeRemoteness(const nsAString& aRemoteType,
RefPtr<RemotenessPromise> ChangeRemoteness(const nsACString& aRemoteType,
uint64_t aPendingSwitchId,
bool aReplaceBrowsingContext,
uint64_t aSpecificGroupId);

Просмотреть файл

@ -795,7 +795,7 @@ already_AddRefed<Promise> ChromeUtils::RequestProcInfo(GlobalObject& aGlobal,
global->EventTargetFor(TaskCategory::Performance);
// Getting the parent proc info
mozilla::GetProcInfo(parentPid, 0, mozilla::ProcType::Browser, u""_ns)
mozilla::GetProcInfo(parentPid, 0, mozilla::ProcType::Browser, ""_ns)
->Then(
target, __func__,
[target, domPromise, parentPid](ProcInfo aParentInfo) {
@ -809,7 +809,7 @@ already_AddRefed<Promise> ChromeUtils::RequestProcInfo(GlobalObject& aGlobal,
if (!aGeckoProcess->GetChildProcessHandle()) {
return;
}
nsAutoString origin;
nsAutoCString origin;
base::ProcessId childPid =
base::GetProcId(aGeckoProcess->GetChildProcessHandle());
int32_t childId = 0;
@ -832,50 +832,42 @@ already_AddRefed<Promise> ChromeUtils::RequestProcInfo(GlobalObject& aGlobal,
// Converting the remoteType into a ProcType.
// Ideally, the remoteType should be strongly typed
// upstream, this would make the conversion less brittle.
nsAutoString remoteType(contentParent->GetRemoteType());
nsAutoCString remoteType(contentParent->GetRemoteType());
if (StringBeginsWith(remoteType,
NS_LITERAL_STRING_FROM_CSTRING(
FISSION_WEB_REMOTE_TYPE))) {
FISSION_WEB_REMOTE_TYPE)) {
// WARNING: Do not change the order, as
// `DEFAULT_REMOTE_TYPE` is a prefix of
// `FISSION_WEB_REMOTE_TYPE`.
type = mozilla::ProcType::WebIsolated;
} else if (StringBeginsWith(
remoteType, NS_LITERAL_STRING_FROM_CSTRING(
DEFAULT_REMOTE_TYPE))) {
} else if (StringBeginsWith(remoteType,
DEFAULT_REMOTE_TYPE)) {
type = mozilla::ProcType::Web;
} else if (remoteType.EqualsLiteral(FILE_REMOTE_TYPE)) {
} else if (remoteType == FILE_REMOTE_TYPE) {
type = mozilla::ProcType::File;
} else if (remoteType.EqualsLiteral(
EXTENSION_REMOTE_TYPE)) {
} else if (remoteType == EXTENSION_REMOTE_TYPE) {
type = mozilla::ProcType::Extension;
} else if (remoteType.EqualsLiteral(
PRIVILEGEDABOUT_REMOTE_TYPE)) {
} else if (remoteType == PRIVILEGEDABOUT_REMOTE_TYPE) {
type = mozilla::ProcType::PrivilegedAbout;
} else if (remoteType.EqualsLiteral(
PRIVILEGEDMOZILLA_REMOTE_TYPE)) {
} else if (remoteType == PRIVILEGEDMOZILLA_REMOTE_TYPE) {
type = mozilla::ProcType::PrivilegedMozilla;
} else if (StringBeginsWith(
remoteType,
NS_LITERAL_STRING_FROM_CSTRING(
WITH_COOP_COEP_REMOTE_TYPE_PREFIX))) {
WITH_COOP_COEP_REMOTE_TYPE_PREFIX)) {
type = mozilla::ProcType::WebCOOPCOEP;
} else if (remoteType.EqualsLiteral(
LARGE_ALLOCATION_REMOTE_TYPE)) {
} else if (remoteType == LARGE_ALLOCATION_REMOTE_TYPE) {
type = mozilla::ProcType::WebLargeAllocation;
} else if (remoteType.EqualsLiteral(
PREALLOC_REMOTE_TYPE)) {
} else if (remoteType == PREALLOC_REMOTE_TYPE) {
type = mozilla::ProcType::Preallocated;
} else {
MOZ_CRASH("Unknown remoteType");
}
// By convention, everything after '=' is the origin.
nsAString::const_iterator cursor;
nsAString::const_iterator end;
nsACString::const_iterator cursor;
nsACString::const_iterator end;
remoteType.BeginReading(cursor);
remoteType.EndReading(end);
if (FindCharInReadable(u'=', cursor, end)) {
if (FindCharInReadable('=', cursor, end)) {
origin = Substring(++cursor, end);
}
childId = contentParent->ChildID();

Просмотреть файл

@ -75,7 +75,7 @@ class MessageManagerGlobal {
return mMessageManager->GetProcessMessageManager(aError);
}
void GetRemoteType(nsAString& aRemoteType, mozilla::ErrorResult& aError) {
void GetRemoteType(nsACString& aRemoteType, mozilla::ErrorResult& aError) {
if (!mMessageManager) {
aError.Throw(NS_ERROR_NOT_INITIALIZED);
return;

Просмотреть файл

@ -169,7 +169,7 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, BrowsingContext* aBrowsingContext,
mDetachedSubdocFrame(nullptr),
mPendingSwitchID(0),
mChildID(0),
mRemoteType(VoidString()),
mRemoteType(VoidCString()),
mDepthTooGreat(false),
mIsTopLevelContent(false),
mDestroyCalled(false),
@ -351,17 +351,20 @@ static bool InitialLoadIsRemote(Element* aOwner) {
}
static void GetInitialRemoteTypeAndProcess(Element* aOwner,
nsAString& aRemoteType,
nsACString& aRemoteType,
uint64_t* aChildID) {
MOZ_ASSERT(XRE_IsParentProcess());
*aChildID = 0;
// Check if there is an explicit `remoteType` attribute which we should use.
nsAutoString remoteType;
bool hasRemoteType =
aOwner->GetAttr(kNameSpaceID_None, nsGkAtoms::RemoteType, aRemoteType);
if (!hasRemoteType || aRemoteType.IsEmpty()) {
aOwner->GetAttr(kNameSpaceID_None, nsGkAtoms::RemoteType, remoteType);
if (!hasRemoteType || remoteType.IsEmpty()) {
hasRemoteType = false;
aRemoteType.AssignLiteral(DEFAULT_REMOTE_TYPE);
aRemoteType = DEFAULT_REMOTE_TYPE;
} else {
aRemoteType = NS_ConvertUTF16toUTF8(remoteType);
}
// Check if `sameProcessAsFrameLoader` was used to override the process.
@ -528,7 +531,7 @@ void nsFrameLoader::LoadFrame(bool aOriginalSrc) {
}
}
void nsFrameLoader::ConfigRemoteProcess(const nsAString& aRemoteType,
void nsFrameLoader::ConfigRemoteProcess(const nsACString& aRemoteType,
ContentParent* aContentParent) {
MOZ_DIAGNOSTIC_ASSERT(IsRemoteFrame(), "Must be a remote frame");
MOZ_DIAGNOSTIC_ASSERT(!mRemoteBrowser, "Must not have a browser yet");

Просмотреть файл

@ -398,7 +398,7 @@ class nsFrameLoader final : public nsStubMutationObserver,
// `TryRemoteBrowser`, and a script blocker must be on the stack.
//
// |aContentParent|, if set, must have the remote type |aRemoteType|.
void ConfigRemoteProcess(const nsAString& aRemoteType,
void ConfigRemoteProcess(const nsACString& aRemoteType,
mozilla::dom::ContentParent* aContentParent);
void MaybeNotifyCrashed(mozilla::dom::BrowsingContext* aBrowsingContext,
@ -515,7 +515,7 @@ class nsFrameLoader final : public nsStubMutationObserver,
RefPtr<mozilla::dom::TabListener> mSessionStoreListener;
nsString mRemoteType;
nsCString mRemoteType;
bool mDepthTooGreat : 1;
bool mIsTopLevelContent : 1;

Просмотреть файл

@ -152,7 +152,7 @@ NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsFrameMessageManager)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFrameMessageManager)
void MessageManagerCallback::DoGetRemoteType(nsAString& aRemoteType,
void MessageManagerCallback::DoGetRemoteType(nsACString& aRemoteType,
ErrorResult& aError) const {
aRemoteType.Truncate();
mozilla::dom::ProcessMessageManager* parent = GetProcessMessageManager();
@ -917,7 +917,7 @@ nsFrameMessageManager::GetProcessMessageManager(ErrorResult& aError) {
return pmm.forget();
}
void nsFrameMessageManager::GetRemoteType(nsAString& aRemoteType,
void nsFrameMessageManager::GetRemoteType(nsACString& aRemoteType,
ErrorResult& aError) const {
aRemoteType.Truncate();
if (mCallback) {

Просмотреть файл

@ -99,7 +99,7 @@ class MessageManagerCallback {
return nullptr;
}
virtual void DoGetRemoteType(nsAString& aRemoteType,
virtual void DoGetRemoteType(nsACString& aRemoteType,
ErrorResult& aError) const;
protected:
@ -178,7 +178,7 @@ class nsFrameMessageManager : public nsIMessageSender {
}
already_AddRefed<mozilla::dom::ProcessMessageManager>
GetProcessMessageManager(mozilla::ErrorResult& aError);
void GetRemoteType(nsAString& aRemoteType,
void GetRemoteType(nsACString& aRemoteType,
mozilla::ErrorResult& aError) const;
// SyncMessageSender

Просмотреть файл

@ -136,7 +136,7 @@ interface CanonicalBrowsingContext : BrowsingContext {
// synchronously create WindowGlobalParent. It can throw if somehow the
// content process has died.
[Throws]
readonly attribute DOMString? currentRemoteType;
readonly attribute UTF8String? currentRemoteType;
readonly attribute WindowGlobalParent? embedderWindowGlobal;

Просмотреть файл

@ -555,7 +555,7 @@ dictionary ChildProcInfoDictionary {
sequence<ThreadInfoDictionary> threads = [];
// Firefox info
unsigned long long ChildID = 0;
DOMString origin = "";
UTF8String origin = "";
WebIDLProcType type = "web";
};

Просмотреть файл

@ -46,7 +46,7 @@ dictionary ProcessActorOptions {
* can prefix match remote type either `web` or `webIsolated`. If not passed,
* all content processes are allowed to instantiate the actor.
*/
sequence<DOMString> remoteTypes;
sequence<UTF8String> remoteTypes;
/** This fields are used for configuring individual sides of the actor. */
ProcessActorSidedOptions parent;

Просмотреть файл

@ -97,7 +97,7 @@ dictionary WindowActorOptions {
* can prefix match remote type either `web` or `webIsolated`. If not passed,
* all content processes are allowed to instantiate the actor.
*/
sequence<DOMString> remoteTypes;
sequence<UTF8String> remoteTypes;
/**
* An array of MessageManagerGroup values which restrict which type

Просмотреть файл

@ -322,7 +322,7 @@ interface mixin MessageSenderMixin {
* Otherwise, it is empty.
*/
[Throws]
readonly attribute DOMString remoteType;
readonly attribute UTF8String remoteType;
};
[ChromeOnly, Exposed=Window]

Просмотреть файл

@ -45,7 +45,7 @@ interface nsIContentProcessProvider : nsISupports
* nsIContentProcessProvider.NEW_PROCESS to ask the caller to create a new
* content process.
*/
int32_t provideProcess(in AString aType,
int32_t provideProcess(in AUTF8String aType,
in Array<nsIContentProcessInfo> aAliveProcesses,
in uint32_t aMaxCount);
};

Просмотреть файл

@ -1652,7 +1652,7 @@ mozilla::ipc::IPCResult ContentChild::RecvSetProcessSandbox(
// Use the prefix to avoid URIs from Fission isolated processes.
auto remoteTypePrefix = RemoteTypePrefix(GetRemoteType());
CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::RemoteType,
NS_ConvertUTF16toUTF8(remoteTypePrefix));
remoteTypePrefix);
#endif /* MOZ_SANDBOX */
return IPC_OK();
@ -2550,38 +2550,36 @@ mozilla::ipc::IPCResult ContentChild::RecvAppInfo(
}
mozilla::ipc::IPCResult ContentChild::RecvRemoteType(
const nsString& aRemoteType) {
if (!DOMStringIsNull(mRemoteType)) {
const nsCString& aRemoteType) {
if (!mRemoteType.IsVoid()) {
// Preallocated processes are type PREALLOC_REMOTE_TYPE; they can become
// anything except a File: process.
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("Changing remoteType of process %d from %s to %s", getpid(),
NS_ConvertUTF16toUTF8(mRemoteType).get(),
NS_ConvertUTF16toUTF8(aRemoteType).get()));
mRemoteType.get(), aRemoteType.get()));
// prealloc->anything (but file) or web->web allowed
MOZ_RELEASE_ASSERT(!aRemoteType.EqualsLiteral(FILE_REMOTE_TYPE) &&
(mRemoteType.EqualsLiteral(PREALLOC_REMOTE_TYPE) ||
(mRemoteType.EqualsLiteral(DEFAULT_REMOTE_TYPE) &&
aRemoteType.EqualsLiteral(DEFAULT_REMOTE_TYPE))));
MOZ_RELEASE_ASSERT(aRemoteType != FILE_REMOTE_TYPE &&
(mRemoteType == PREALLOC_REMOTE_TYPE ||
(mRemoteType == DEFAULT_REMOTE_TYPE &&
aRemoteType == DEFAULT_REMOTE_TYPE)));
} else {
// Initial setting of remote type. Either to 'prealloc' or the actual
// final type (if we didn't use a preallocated process)
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("Setting remoteType of process %d to %s", getpid(),
NS_ConvertUTF16toUTF8(aRemoteType).get()));
aRemoteType.get()));
}
// Update the process name so about:memory's process names are more obvious.
if (aRemoteType.EqualsLiteral(FILE_REMOTE_TYPE)) {
if (aRemoteType == FILE_REMOTE_TYPE) {
SetProcessName(u"file:// Content"_ns);
} else if (aRemoteType.EqualsLiteral(EXTENSION_REMOTE_TYPE)) {
} else if (aRemoteType == EXTENSION_REMOTE_TYPE) {
SetProcessName(u"WebExtensions"_ns);
} else if (aRemoteType.EqualsLiteral(PRIVILEGEDABOUT_REMOTE_TYPE)) {
} else if (aRemoteType == PRIVILEGEDABOUT_REMOTE_TYPE) {
SetProcessName(u"Privileged Content"_ns);
} else if (aRemoteType.EqualsLiteral(LARGE_ALLOCATION_REMOTE_TYPE)) {
} else if (aRemoteType == LARGE_ALLOCATION_REMOTE_TYPE) {
SetProcessName(u"Large Allocation Web Content"_ns);
} else if (RemoteTypePrefix(aRemoteType)
.EqualsLiteral(FISSION_WEB_REMOTE_TYPE)) {
} else if (RemoteTypePrefix(aRemoteType) == FISSION_WEB_REMOTE_TYPE) {
SetProcessName(u"Isolated Web Content"_ns);
}
// else "prealloc", "web" or "webCOOP+COEP" type -> "Web Content" already set
@ -2593,7 +2591,7 @@ mozilla::ipc::IPCResult ContentChild::RecvRemoteType(
// Call RemoteTypePrefix() on the result to remove URIs if you want to use this
// for telemetry.
const nsAString& ContentChild::GetRemoteType() const { return mRemoteType; }
const nsACString& ContentChild::GetRemoteType() const { return mRemoteType; }
mozilla::ipc::IPCResult ContentChild::RecvInitServiceWorkers(
const ServiceWorkerConfiguration& aConfig) {

Просмотреть файл

@ -383,11 +383,11 @@ class ContentChild final : public PContentChild,
const nsCString& UAName, const nsCString& ID, const nsCString& vendor,
const nsCString& sourceURL, const nsCString& updateURL);
mozilla::ipc::IPCResult RecvRemoteType(const nsString& aRemoteType);
mozilla::ipc::IPCResult RecvRemoteType(const nsCString& aRemoteType);
// Call RemoteTypePrefix() on the result to remove URIs if you want to use
// this for telemetry.
const nsAString& GetRemoteType() const override;
const nsACString& GetRemoteType() const override;
mozilla::ipc::IPCResult RecvInitServiceWorkers(
const ServiceWorkerConfiguration& aConfig);
@ -856,7 +856,7 @@ class ContentChild final : public PContentChild,
AppInfo mAppInfo;
bool mIsForBrowser;
nsString mRemoteType = VoidString();
nsCString mRemoteType = VoidCString();
bool mIsAlive;
nsString mProcessName;

Просмотреть файл

@ -490,7 +490,7 @@ ContentParentsMemoryReporter::CollectReports(
// processes that are in the Preallocator cache (which would be type
// 'prealloc'), and recycled processes ('web' and in the future
// eTLD+1-locked) processes).
nsClassHashtable<nsStringHashKey, nsTArray<ContentParent*>>*
nsClassHashtable<nsCStringHashKey, nsTArray<ContentParent*>>*
ContentParent::sBrowserContentParents;
namespace {
@ -568,13 +568,13 @@ ScriptableCPInfo::GetMessageManager(nsISupports** aMessenger) {
return NS_OK;
}
ProcessID GetTelemetryProcessID(const nsAString& remoteType) {
ProcessID GetTelemetryProcessID(const nsACString& remoteType) {
// OOP WebExtensions run in a content process.
// For Telemetry though we want to break out collected data from the
// WebExtensions process into a separate bucket, to make sure we can analyze
// it separately and avoid skewing normal content process metrics.
return remoteType.EqualsLiteral(EXTENSION_REMOTE_TYPE) ? ProcessID::Extension
: ProcessID::Content;
return remoteType == EXTENSION_REMOTE_TYPE ? ProcessID::Extension
: ProcessID::Content;
}
} // anonymous namespace
@ -636,11 +636,10 @@ static const char* sObserverTopics[] = {
// ContentParent then takes this process back within GetNewOrUsedBrowserProcess.
/*static*/ RefPtr<ContentParent::LaunchPromise>
ContentParent::PreallocateProcess() {
RefPtr<ContentParent> process =
new ContentParent(NS_LITERAL_STRING_FROM_CSTRING(PREALLOC_REMOTE_TYPE));
RefPtr<ContentParent> process = new ContentParent(PREALLOC_REMOTE_TYPE);
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("Preallocating process of type " PREALLOC_REMOTE_TYPE));
("Preallocating process of type prealloc"));
return process->LaunchSubprocessAsync(PROCESS_PRIORITY_PREALLOC);
}
@ -686,7 +685,7 @@ void ContentParent::ShutDown() {
}
/*static*/
uint32_t ContentParent::GetPoolSize(const nsAString& aContentProcessType) {
uint32_t ContentParent::GetPoolSize(const nsACString& aContentProcessType) {
if (!sBrowserContentParents) {
return 0;
}
@ -698,17 +697,17 @@ uint32_t ContentParent::GetPoolSize(const nsAString& aContentProcessType) {
}
/*static*/ nsTArray<ContentParent*>& ContentParent::GetOrCreatePool(
const nsAString& aContentProcessType) {
const nsACString& aContentProcessType) {
if (!sBrowserContentParents) {
sBrowserContentParents =
new nsClassHashtable<nsStringHashKey, nsTArray<ContentParent*>>;
new nsClassHashtable<nsCStringHashKey, nsTArray<ContentParent*>>;
}
return *sBrowserContentParents->LookupOrAdd(aContentProcessType);
}
const nsDependentSubstring RemoteTypePrefix(
const nsAString& aContentProcessType) {
const nsDependentCSubstring RemoteTypePrefix(
const nsACString& aContentProcessType) {
// The suffix after a `=` in a remoteType is dynamic, and used to control the
// process pool to use.
int32_t equalIdx = aContentProcessType.FindChar(L'=');
@ -718,28 +717,26 @@ const nsDependentSubstring RemoteTypePrefix(
return StringHead(aContentProcessType, equalIdx);
}
bool IsWebRemoteType(const nsAString& aContentProcessType) {
bool IsWebRemoteType(const nsACString& aContentProcessType) {
// Note: matches webIsolated as well as web (and webLargeAllocation, and
// webCOOP+COEP)
return StringBeginsWith(aContentProcessType,
NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE));
return StringBeginsWith(aContentProcessType, DEFAULT_REMOTE_TYPE);
}
bool IsWebCoopCoepRemoteType(const nsAString& aContentProcessType) {
return StringBeginsWith(
aContentProcessType,
NS_LITERAL_STRING_FROM_CSTRING(WITH_COOP_COEP_REMOTE_TYPE_PREFIX));
bool IsWebCoopCoepRemoteType(const nsACString& aContentProcessType) {
return StringBeginsWith(aContentProcessType,
WITH_COOP_COEP_REMOTE_TYPE_PREFIX);
}
/*static*/
uint32_t ContentParent::GetMaxProcessCount(
const nsAString& aContentProcessType) {
const nsACString& aContentProcessType) {
// Max process count is based only on the prefix.
const nsDependentSubstring processTypePrefix =
const nsDependentCSubstring processTypePrefix =
RemoteTypePrefix(aContentProcessType);
// Check for the default remote type of "web", as it uses different prefs.
if (processTypePrefix.EqualsLiteral(DEFAULT_REMOTE_TYPE)) {
if (processTypePrefix == DEFAULT_REMOTE_TYPE) {
return GetMaxWebProcessCount();
}
@ -747,7 +744,7 @@ uint32_t ContentParent::GetMaxProcessCount(
// used as a fallback, as it is intended to control the number of "web"
// content processes, checked in `mozilla::GetMaxWebProcessCount()`.
nsAutoCString processCountPref("dom.ipc.processCount.");
AppendUTF16toUTF8(processTypePrefix, processCountPref);
processCountPref.Append(processTypePrefix);
int32_t maxContentParents = Preferences::GetInt(processCountPref.get(), 1);
if (maxContentParents < 1) {
@ -759,7 +756,7 @@ uint32_t ContentParent::GetMaxProcessCount(
/*static*/
bool ContentParent::IsMaxProcessCountReached(
const nsAString& aContentProcessType) {
const nsACString& aContentProcessType) {
return GetPoolSize(aContentProcessType) >=
GetMaxProcessCount(aContentProcessType);
}
@ -779,10 +776,9 @@ void ContentParent::ReleaseCachedProcesses() {
nsTArray<ContentParent*>* contentParents = iter.Data().get();
num += contentParents->Length();
for (auto* cp : *contentParents) {
MOZ_LOG(
ContentParent::GetLog(), LogLevel::Debug,
("%s: %zu processes", NS_ConvertUTF16toUTF8(cp->mRemoteType).get(),
contentParents->Length()));
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("%s: %zu processes", cp->mRemoteType.get(),
contentParents->Length()));
break;
}
}
@ -798,13 +794,12 @@ void ContentParent::ReleaseCachedProcesses() {
for (auto* cp : *contentParents) {
if (cp->ManagedPBrowserParent().Count() == 0 &&
!cp->HasActiveWorkerOrJSPlugin() &&
cp->mRemoteType.EqualsLiteral(DEFAULT_REMOTE_TYPE)) {
cp->mRemoteType == DEFAULT_REMOTE_TYPE) {
toRelease.AppendElement(cp);
} else {
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
(" Skipping %p (%s), count %d, HasActiveWorkerOrJSPlugin %d",
cp, NS_ConvertUTF16toUTF8(cp->mRemoteType).get(),
cp->ManagedPBrowserParent().Count(),
cp, cp->mRemoteType.get(), cp->ManagedPBrowserParent().Count(),
cp->HasActiveWorkerOrJSPlugin()));
}
}
@ -812,8 +807,7 @@ void ContentParent::ReleaseCachedProcesses() {
for (auto* cp : toRelease) {
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
(" Shutdown %p (%s)", cp,
NS_ConvertUTF16toUTF8(cp->mRemoteType).get()));
(" Shutdown %p (%s)", cp, cp->mRemoteType.get()));
PreallocatedProcessManager::Erase(cp);
// Start a soft shutdown.
cp->ShutDownProcess(SEND_SHUTDOWN_MESSAGE);
@ -861,7 +855,7 @@ already_AddRefed<ContentParent> ContentParent::MinTabSelect(
/*static*/
already_AddRefed<ContentParent> ContentParent::GetUsedBrowserProcess(
const nsAString& aRemoteType, nsTArray<ContentParent*>& aContentParents,
const nsACString& aRemoteType, nsTArray<ContentParent*>& aContentParents,
uint32_t aMaxContentParents, bool aPreferUsed) {
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
AutoRestore ar(sInProcessSelector);
@ -900,7 +894,7 @@ already_AddRefed<ContentParent> ContentParent::GetUsedBrowserProcess(
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("GetUsedProcess: Reused process %p (%u) for %s", retval.get(),
(unsigned int)retval->ChildID(),
NS_ConvertUTF16toUTF8(aRemoteType).get()));
PromiseFlatCString(aRemoteType).get()));
retval->AssertAlive();
return retval.forget();
}
@ -913,7 +907,7 @@ already_AddRefed<ContentParent> ContentParent::GetUsedBrowserProcess(
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("GetUsedProcess: Reused random process %p (%d) for %s",
random.get(), (unsigned int)random->ChildID(),
NS_ConvertUTF16toUTF8(aRemoteType).get()));
PromiseFlatCString(aRemoteType).get()));
random->AssertAlive();
return random.forget();
}
@ -925,8 +919,8 @@ already_AddRefed<ContentParent> ContentParent::GetUsedBrowserProcess(
// try to reuse a process that is being shut down.
RefPtr<ContentParent> p;
bool preallocated = false;
if (!aRemoteType.EqualsLiteral(FILE_REMOTE_TYPE) &&
!aRemoteType.EqualsLiteral(EXTENSION_REMOTE_TYPE) && // Bug 1638119
if (aRemoteType != FILE_REMOTE_TYPE &&
aRemoteType != EXTENSION_REMOTE_TYPE && // Bug 1638119
(p = PreallocatedProcessManager::Take(aRemoteType)) &&
!p->mShutdownPending) {
p->AssertAlive();
@ -934,7 +928,7 @@ already_AddRefed<ContentParent> ContentParent::GetUsedBrowserProcess(
// p may be a preallocated process, or (if not PREALLOC_REMOTE_TYPE)
// a perviously-used process that's being recycled. Currently this is
// only done for short-duration web (DEFAULT_REMOTE_TYPE) processes
preallocated = p->mRemoteType.EqualsLiteral(PREALLOC_REMOTE_TYPE);
preallocated = p->mRemoteType == PREALLOC_REMOTE_TYPE;
// For pre-allocated process we have not set the opener yet.
#ifdef MOZ_GECKO_PROFILER
if (profiler_thread_is_being_profiled()) {
@ -949,7 +943,7 @@ already_AddRefed<ContentParent> ContentParent::GetUsedBrowserProcess(
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("Adopted %s process %p for type %s",
preallocated ? "preallocated" : "reused web", p.get(),
NS_ConvertUTF16toUTF8(aRemoteType).get()));
PromiseFlatCString(aRemoteType).get()));
p->mActivateTS = TimeStamp::Now();
p->AddToPool(aContentParents);
if (preallocated) {
@ -969,8 +963,8 @@ already_AddRefed<ContentParent> ContentParent::GetUsedBrowserProcess(
}
} else {
// we only allow "web" to "web" for security reasons
MOZ_RELEASE_ASSERT(p->mRemoteType.EqualsLiteral(DEFAULT_REMOTE_TYPE) &&
aRemoteType.EqualsLiteral(DEFAULT_REMOTE_TYPE));
MOZ_RELEASE_ASSERT(p->mRemoteType == DEFAULT_REMOTE_TYPE &&
aRemoteType == DEFAULT_REMOTE_TYPE);
}
return p.forget();
}
@ -980,25 +974,22 @@ already_AddRefed<ContentParent> ContentParent::GetUsedBrowserProcess(
/*static*/
already_AddRefed<ContentParent>
ContentParent::GetNewOrUsedLaunchingBrowserProcess(Element* aFrameElement,
const nsAString& aRemoteType,
ProcessPriority aPriority,
bool aPreferUsed) {
ContentParent::GetNewOrUsedLaunchingBrowserProcess(
Element* aFrameElement, const nsACString& aRemoteType,
ProcessPriority aPriority, bool aPreferUsed) {
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("GetNewOrUsedProcess for type %s",
NS_ConvertUTF16toUTF8(aRemoteType).get()));
PromiseFlatCString(aRemoteType).get()));
nsTArray<ContentParent*>& contentParents = GetOrCreatePool(aRemoteType);
uint32_t maxContentParents = GetMaxProcessCount(aRemoteType);
if (aRemoteType.EqualsLiteral(
LARGE_ALLOCATION_REMOTE_TYPE) // We never want to re-use
// Large-Allocation processes.
&& contentParents.Length() >= maxContentParents) {
// We never want to re-use Large-Allocation processes.
if (aRemoteType == LARGE_ALLOCATION_REMOTE_TYPE &&
contentParents.Length() >= maxContentParents) {
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("GetNewOrUsedProcess: returning Large Used process"));
return GetNewOrUsedLaunchingBrowserProcess(
aFrameElement, NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE),
aPriority,
/*aPreferUsed =*/false);
return GetNewOrUsedLaunchingBrowserProcess(aFrameElement,
DEFAULT_REMOTE_TYPE, aPriority,
/*aPreferUsed =*/false);
}
// Let's try and reuse an existing process.
@ -1019,7 +1010,7 @@ ContentParent::GetNewOrUsedLaunchingBrowserProcess(Element* aFrameElement,
// The life cycle will be set to `LifecycleState::LAUNCHING`.
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("Launching new process immediately for type %s",
NS_ConvertUTF16toUTF8(aRemoteType).get()));
PromiseFlatCString(aRemoteType).get()));
contentParent = new ContentParent(aRemoteType);
if (!contentParent->BeginSubprocessLaunch(aPriority)) {
@ -1046,7 +1037,7 @@ ContentParent::GetNewOrUsedLaunchingBrowserProcess(Element* aFrameElement,
/*static*/
RefPtr<ContentParent::LaunchPromise>
ContentParent::GetNewOrUsedBrowserProcessAsync(Element* aFrameElement,
const nsAString& aRemoteType,
const nsACString& aRemoteType,
ProcessPriority aPriority,
bool aPreferUsed) {
// Obtain a `ContentParent` launched asynchronously.
@ -1061,7 +1052,7 @@ ContentParent::GetNewOrUsedBrowserProcessAsync(Element* aFrameElement,
/*static*/
already_AddRefed<ContentParent> ContentParent::GetNewOrUsedBrowserProcess(
Element* aFrameElement, const nsAString& aRemoteType,
Element* aFrameElement, const nsACString& aRemoteType,
ProcessPriority aPriority, bool aPreferUsed) {
RefPtr<ContentParent> contentParent = GetNewOrUsedLaunchingBrowserProcess(
aFrameElement, aRemoteType, aPriority, aPreferUsed);
@ -1310,7 +1301,7 @@ mozilla::ipc::IPCResult ContentParent::RecvLaunchRDDProcess(
/*static*/
already_AddRefed<RemoteBrowser> ContentParent::CreateBrowser(
const TabContext& aContext, Element* aFrameElement,
const nsAString& aRemoteType, BrowsingContext* aBrowsingContext,
const nsACString& aRemoteType, BrowsingContext* aBrowsingContext,
ContentParent* aOpenerContentParent) {
AUTO_PROFILER_LABEL("ContentParent::CreateBrowser", OTHER);
@ -1318,9 +1309,9 @@ already_AddRefed<RemoteBrowser> ContentParent::CreateBrowser(
return nullptr;
}
nsAutoString remoteType(aRemoteType);
nsAutoCString remoteType(aRemoteType);
if (remoteType.IsEmpty()) {
remoteType.AssignLiteral(DEFAULT_REMOTE_TYPE);
remoteType = DEFAULT_REMOTE_TYPE;
}
ProcessPriority initialPriority = GetInitialProcessPriority(aFrameElement);
@ -1478,7 +1469,7 @@ void ContentParent::BroadcastFontListChanged() {
}
}
const nsAString& ContentParent::GetRemoteType() const { return mRemoteType; }
const nsACString& ContentParent::GetRemoteType() const { return mRemoteType; }
void ContentParent::Init() {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
@ -1938,7 +1929,7 @@ void ContentParent::ActorDealloc() { mSelfRef = nullptr; }
bool ContentParent::TryToRecycle() {
// We can only do this if we have a separate cache for recycled
// 'web' processes, and handle them differently than webIsolated ones
if (!mRemoteType.EqualsLiteral(DEFAULT_REMOTE_TYPE)) {
if (mRemoteType != DEFAULT_REMOTE_TYPE) {
return false;
}
// This life time check should be replaced by a memory health check (memory
@ -2024,13 +2015,12 @@ bool ContentParent::ShouldKeepProcessAlive() {
nsAutoCString keepAlivePref("dom.ipc.keepProcessesAlive.");
if (StringBeginsWith(mRemoteType, NS_LITERAL_STRING_FROM_CSTRING(
FISSION_WEB_REMOTE_TYPE)) &&
if (StringBeginsWith(mRemoteType, FISSION_WEB_REMOTE_TYPE) &&
xpc::IsInAutomation()) {
keepAlivePref.Append(FISSION_WEB_REMOTE_TYPE);
keepAlivePref.AppendLiteral(".perOrigin");
} else {
keepAlivePref.Append(NS_ConvertUTF16toUTF8(mRemoteType));
keepAlivePref.Append(mRemoteType);
}
if (NS_FAILED(
Preferences::GetInt(keepAlivePref.get(), &processesToKeepAlive))) {
@ -2151,7 +2141,7 @@ TestShellParent* ContentParent::GetTestShellSingleton() {
void ContentParent::AppendDynamicSandboxParams(
std::vector<std::string>& aArgs) {
// For file content processes
if (GetRemoteType().EqualsLiteral(FILE_REMOTE_TYPE)) {
if (GetRemoteType() == FILE_REMOTE_TYPE) {
MacSandboxInfo::AppendFileAccessParam(aArgs, true);
}
}
@ -2454,7 +2444,7 @@ RefPtr<ContentParent::LaunchPromise> ContentParent::LaunchSubprocessAsync(
});
}
ContentParent::ContentParent(const nsAString& aRemoteType, int32_t aJSPluginID)
ContentParent::ContentParent(const nsACString& aRemoteType, int32_t aJSPluginID)
: mSelfRef(nullptr),
mSubprocess(nullptr),
mLaunchTS(TimeStamp::Now()),
@ -2503,7 +2493,7 @@ ContentParent::ContentParent(const nsAString& aRemoteType, int32_t aJSPluginID)
#endif
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
bool isFile = mRemoteType.EqualsLiteral(FILE_REMOTE_TYPE);
bool isFile = mRemoteType == FILE_REMOTE_TYPE;
mSubprocess = new GeckoChildProcessHost(GeckoProcessType_Content, isFile);
MOZ_LOG(ContentParent::GetLog(), LogLevel::Verbose,
("CreateSubprocess: ContentParent %p mSubprocess %p handle %" PRIuPTR,
@ -2809,7 +2799,7 @@ bool ContentParent::InitInternal(ProcessPriority aInitialPriority) {
# ifdef XP_LINUX
if (shouldSandbox) {
MOZ_ASSERT(!mSandboxBroker);
bool isFileProcess = mRemoteType.EqualsLiteral(FILE_REMOTE_TYPE);
bool isFileProcess = mRemoteType == FILE_REMOTE_TYPE;
UniquePtr<SandboxBroker::Policy> policy =
sSandboxBrokerPolicyFactory->GetContentPolicy(Pid(), isFileProcess);
if (policy) {
@ -3193,8 +3183,8 @@ ContentParent::GetName(nsAString& aName) {
NS_IMETHODIMP
ContentParent::GetState(nsIPropertyBag** aResult) {
auto props = MakeRefPtr<nsHashPropertyBag>();
props->SetPropertyAsAString(u"remoteTypePrefix"_ns,
RemoteTypePrefix(mRemoteType));
props->SetPropertyAsACString(u"remoteTypePrefix"_ns,
RemoteTypePrefix(mRemoteType));
*aResult = props.forget().downcast<nsIWritablePropertyBag>().take();
return NS_OK;
}
@ -5220,7 +5210,7 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindowInDifferentProcess(
// If we have enough data, check the schemes of the loader and loadee
// to make sure they make sense.
if (aURIToLoad && aURIToLoad->SchemeIs("file") &&
!GetRemoteType().EqualsLiteral(FILE_REMOTE_TYPE) &&
GetRemoteType() != FILE_REMOTE_TYPE &&
Preferences::GetBool("browser.tabs.remote.enforceRemoteTypeRestrictions",
false)) {
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED

Просмотреть файл

@ -53,17 +53,17 @@
// Process names as reported by about:memory are defined in
// ContentChild:RecvRemoteType. Add your value there too or it will be called
// "Web Content".
#define PREALLOC_REMOTE_TYPE "prealloc"
#define DEFAULT_REMOTE_TYPE "web"
#define FILE_REMOTE_TYPE "file"
#define EXTENSION_REMOTE_TYPE "extension"
#define PRIVILEGEDABOUT_REMOTE_TYPE "privilegedabout"
#define PRIVILEGEDMOZILLA_REMOTE_TYPE "privilegedmozilla"
#define PREALLOC_REMOTE_TYPE "prealloc"_ns
#define DEFAULT_REMOTE_TYPE "web"_ns
#define FILE_REMOTE_TYPE "file"_ns
#define EXTENSION_REMOTE_TYPE "extension"_ns
#define PRIVILEGEDABOUT_REMOTE_TYPE "privilegedabout"_ns
#define PRIVILEGEDMOZILLA_REMOTE_TYPE "privilegedmozilla"_ns
// These must start with the DEFAULT_REMOTE_TYPE above.
#define FISSION_WEB_REMOTE_TYPE "webIsolated"
#define WITH_COOP_COEP_REMOTE_TYPE_PREFIX "webCOOP+COEP="
#define LARGE_ALLOCATION_REMOTE_TYPE "webLargeAllocation"
#define FISSION_WEB_REMOTE_TYPE "webIsolated"_ns
#define WITH_COOP_COEP_REMOTE_TYPE_PREFIX "webCOOP+COEP="_ns
#define LARGE_ALLOCATION_REMOTE_TYPE "webLargeAllocation"_ns
class nsConsoleService;
class nsIContentProcessInfo;
@ -178,11 +178,11 @@ class ContentParent final
/** Shut down the content-process machinery. */
static void ShutDown();
static uint32_t GetPoolSize(const nsAString& aContentProcessType);
static uint32_t GetPoolSize(const nsACString& aContentProcessType);
static uint32_t GetMaxProcessCount(const nsAString& aContentProcessType);
static uint32_t GetMaxProcessCount(const nsACString& aContentProcessType);
static bool IsMaxProcessCountReached(const nsAString& aContentProcessType);
static bool IsMaxProcessCountReached(const nsACString& aContentProcessType);
static void ReleaseCachedProcesses();
@ -202,12 +202,12 @@ class ContentParent final
* 3. normal iframe
*/
static RefPtr<ContentParent::LaunchPromise> GetNewOrUsedBrowserProcessAsync(
Element* aFrameElement, const nsAString& aRemoteType,
Element* aFrameElement, const nsACString& aRemoteType,
hal::ProcessPriority aPriority =
hal::ProcessPriority::PROCESS_PRIORITY_FOREGROUND,
bool aPreferUsed = false);
static already_AddRefed<ContentParent> GetNewOrUsedBrowserProcess(
Element* aFrameElement, const nsAString& aRemoteType,
Element* aFrameElement, const nsACString& aRemoteType,
hal::ProcessPriority aPriority =
hal::ProcessPriority::PROCESS_PRIORITY_FOREGROUND,
bool aPreferUsed = false);
@ -223,7 +223,7 @@ class ContentParent final
* the process to be fully launched.
*/
static already_AddRefed<ContentParent> GetNewOrUsedLaunchingBrowserProcess(
Element* aFrameElement, const nsAString& aRemoteType,
Element* aFrameElement, const nsACString& aRemoteType,
hal::ProcessPriority aPriority =
hal::ProcessPriority::PROCESS_PRIORITY_FOREGROUND,
bool aPreferUsed = false);
@ -249,7 +249,7 @@ class ContentParent final
*/
static already_AddRefed<RemoteBrowser> CreateBrowser(
const TabContext& aContext, Element* aFrameElement,
const nsAString& aRemoteType, BrowsingContext* aBrowsingContext,
const nsACString& aRemoteType, BrowsingContext* aBrowsingContext,
ContentParent* aOpenerContentParent);
static void GetAll(nsTArray<ContentParent*>& aArray);
@ -260,9 +260,9 @@ class ContentParent final
static void BroadcastFontListChanged();
const nsAString& GetRemoteType() const override;
const nsACString& GetRemoteType() const override;
virtual void DoGetRemoteType(nsAString& aRemoteType,
virtual void DoGetRemoteType(nsACString& aRemoteType,
ErrorResult& aError) const override {
aRemoteType = GetRemoteType();
}
@ -722,7 +722,7 @@ class ContentParent final
* removed from this list, but will still be in the sContentParents list for
* the GetAll/GetAllEvenIfDead APIs.
*/
static nsClassHashtable<nsStringHashKey, nsTArray<ContentParent*>>*
static nsClassHashtable<nsCStringHashKey, nsTArray<ContentParent*>>*
sBrowserContentParents;
static UniquePtr<nsTArray<ContentParent*>> sPrivateContent;
static UniquePtr<nsDataHashtable<nsUint32HashKey, ContentParent*>>
@ -753,11 +753,11 @@ class ContentParent final
const OriginAttributes& aOriginAttributes);
explicit ContentParent(int32_t aPluginID)
: ContentParent(EmptyString(), aPluginID) {}
explicit ContentParent(const nsAString& aRemoteType)
: ContentParent(EmptyCString(), aPluginID) {}
explicit ContentParent(const nsACString& aRemoteType)
: ContentParent(aRemoteType, nsFakePluginTag::NOT_JSPLUGIN) {}
ContentParent(const nsAString& aRemoteType, int32_t aPluginID);
ContentParent(const nsACString& aRemoteType, int32_t aPluginID);
// Launch the subprocess and associated initialization.
// Returns false if the process fails to start.
@ -880,7 +880,7 @@ class ContentParent final
* |aContentProcessType|.
*/
static nsTArray<ContentParent*>& GetOrCreatePool(
const nsAString& aContentProcessType);
const nsACString& aContentProcessType);
mozilla::ipc::IPCResult RecvInitBackground(
Endpoint<mozilla::ipc::PBackgroundParent>&& aEndpoint);
@ -1365,7 +1365,7 @@ class ContentParent final
private:
// Return an existing ContentParent if possible. Otherwise, `nullptr`.
static already_AddRefed<ContentParent> GetUsedBrowserProcess(
const nsAString& aRemoteType, nsTArray<ContentParent*>& aContentParents,
const nsACString& aRemoteType, nsTArray<ContentParent*>& aContentParents,
uint32_t aMaxContentParents, bool aPreferUsed);
void AddToPool(nsTArray<ContentParent*>&);
@ -1389,7 +1389,7 @@ class ContentParent final
bool mIsAPreallocBlocker; // We called AddBlocker for this ContentParent
nsString mRemoteType;
nsCString mRemoteType;
ContentParentId mChildID;
int32_t mGeolocationWatchID;
@ -1538,13 +1538,13 @@ class ContentParent final
NS_DEFINE_STATIC_IID_ACCESSOR(ContentParent, NS_CONTENTPARENT_IID)
// This is the C++ version of remoteTypePrefix in E10SUtils.jsm.
const nsDependentSubstring RemoteTypePrefix(
const nsAString& aContentProcessType);
const nsDependentCSubstring RemoteTypePrefix(
const nsACString& aContentProcessType);
// This is based on isWebRemoteType in E10SUtils.jsm.
bool IsWebRemoteType(const nsAString& aContentProcessType);
bool IsWebRemoteType(const nsACString& aContentProcessType);
bool IsWebCoopCoepRemoteType(const nsAString& aContentProcessType);
bool IsWebCoopCoepRemoteType(const nsACString& aContentProcessType);
inline nsISupports* ToSupports(mozilla::dom::ContentParent* aContentParent) {
return static_cast<nsIDOMProcessParent*>(aContentParent);

Просмотреть файл

@ -45,7 +45,7 @@ class InProcessChild final : public nsIDOMProcessChild,
// |nullptr|.
static IProtocol* ParentActorFor(IProtocol* aActor);
const nsAString& GetRemoteType() const override { return VoidString(); }
const nsACString& GetRemoteType() const override { return VoidCString(); }
protected:
already_AddRefed<JSActor> InitJSActor(JS::HandleObject aMaybeActor,

Просмотреть файл

@ -47,7 +47,7 @@ class InProcessParent final : public nsIDOMProcessParent,
// |nullptr|.
static IProtocol* ChildActorFor(IProtocol* aActor);
const nsAString& GetRemoteType() const override { return VoidString(); };
const nsACString& GetRemoteType() const override { return VoidCString(); };
protected:
already_AddRefed<JSActor> InitJSActor(JS::HandleObject aMaybeActor,

Просмотреть файл

@ -258,7 +258,7 @@ struct JSWindowActorInfo
// Observer notifications this actor listens to.
nsCString[] observers;
nsString[] matches;
nsString[] remoteTypes;
nsCString[] remoteTypes;
nsString[] messageManagerGroups;
};
@ -271,7 +271,7 @@ struct JSProcessActorInfo
// Observer notifications this actor listens to.
nsCString[] observers;
nsString[] remoteTypes;
nsCString[] remoteTypes;
};
struct GMPAPITags
@ -632,7 +632,7 @@ child:
/**
* Send the remote type associated with the content process.
*/
async RemoteType(nsString aRemoteType);
async RemoteType(nsCString aRemoteType);
/**
* Send ServiceWorkerRegistrationData to child process.

Просмотреть файл

@ -37,7 +37,7 @@ class PreallocatedProcessManagerImpl final : public nsIObserver {
// See comments on PreallocatedProcessManager for these methods.
void AddBlocker(ContentParent* aParent);
void RemoveBlocker(ContentParent* aParent);
already_AddRefed<ContentParent> Take(const nsAString& aRemoteType);
already_AddRefed<ContentParent> Take(const nsACString& aRemoteType);
bool Provide(ContentParent* aParent);
void Erase(ContentParent* aParent);
@ -190,17 +190,17 @@ void PreallocatedProcessManagerImpl::RereadPrefs() {
}
already_AddRefed<ContentParent> PreallocatedProcessManagerImpl::Take(
const nsAString& aRemoteType) {
const nsACString& aRemoteType) {
if (!mEnabled || sShutdown) {
return nullptr;
}
RefPtr<ContentParent> process;
if (aRemoteType.EqualsLiteral(DEFAULT_REMOTE_TYPE)) {
if (aRemoteType == DEFAULT_REMOTE_TYPE) {
// we can recycle processes via Provide() for e10s only
process = mPreallocatedE10SProcess.forget();
if (process) {
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("Reuse " DEFAULT_REMOTE_TYPE " process %p", process.get()));
("Reuse web process %p", process.get()));
}
}
if (!process && !mPreallocatedProcesses.empty()) {
@ -210,7 +210,7 @@ already_AddRefed<ContentParent> PreallocatedProcessManagerImpl::Take(
// soon.
AllocateOnIdle();
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("Use " PREALLOC_REMOTE_TYPE " process %p", process.get()));
("Use prealloc process %p", process.get()));
}
if (process) {
ProcessPriorityManager::SetProcessPriority(process,
@ -220,15 +220,14 @@ already_AddRefed<ContentParent> PreallocatedProcessManagerImpl::Take(
}
bool PreallocatedProcessManagerImpl::Provide(ContentParent* aParent) {
MOZ_DIAGNOSTIC_ASSERT(
aParent->GetRemoteType().EqualsLiteral(DEFAULT_REMOTE_TYPE));
MOZ_DIAGNOSTIC_ASSERT(aParent->GetRemoteType() == DEFAULT_REMOTE_TYPE);
// This will take the already-running process even if there's a
// launch in progress; if that process hasn't been taken by the
// time the launch completes, the new process will be shut down.
if (mEnabled && !sShutdown && !mPreallocatedE10SProcess) {
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("Store for reuse " DEFAULT_REMOTE_TYPE " process %p", aParent));
("Store for reuse web process %p", aParent));
ProcessPriorityManager::SetProcessPriority(aParent,
PROCESS_PRIORITY_BACKGROUND);
mPreallocatedE10SProcess = aParent;
@ -300,8 +299,7 @@ bool PreallocatedProcessManagerImpl::CanAllocate() {
return mEnabled && sNumBlockers == 0 &&
mPreallocatedProcesses.size() < mNumberPreallocs && !sShutdown &&
(FissionAutostart() ||
!ContentParent::IsMaxProcessCountReached(
NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE)));
!ContentParent::IsMaxProcessCountReached(DEFAULT_REMOTE_TYPE));
}
void PreallocatedProcessManagerImpl::AllocateAfterDelay() {
@ -402,11 +400,11 @@ PreallocatedProcessManager::GetPPMImpl() {
}
/* static */
void PreallocatedProcessManager::AddBlocker(const nsAString& aRemoteType,
void PreallocatedProcessManager::AddBlocker(const nsACString& aRemoteType,
ContentParent* aParent) {
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("AddBlocker: %s %p (sNumBlockers=%d)",
NS_ConvertUTF16toUTF8(aRemoteType).get(), aParent,
PromiseFlatCString(aRemoteType).get(), aParent,
PreallocatedProcessManagerImpl::sNumBlockers));
if (auto impl = GetPPMImpl()) {
impl->AddBlocker(aParent);
@ -414,11 +412,11 @@ void PreallocatedProcessManager::AddBlocker(const nsAString& aRemoteType,
}
/* static */
void PreallocatedProcessManager::RemoveBlocker(const nsAString& aRemoteType,
void PreallocatedProcessManager::RemoveBlocker(const nsACString& aRemoteType,
ContentParent* aParent) {
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("RemoveBlocker: %s %p (sNumBlockers=%d)",
NS_ConvertUTF16toUTF8(aRemoteType).get(), aParent,
PromiseFlatCString(aRemoteType).get(), aParent,
PreallocatedProcessManagerImpl::sNumBlockers));
if (auto impl = GetPPMImpl()) {
impl->RemoveBlocker(aParent);
@ -427,7 +425,7 @@ void PreallocatedProcessManager::RemoveBlocker(const nsAString& aRemoteType,
/* static */
already_AddRefed<ContentParent> PreallocatedProcessManager::Take(
const nsAString& aRemoteType) {
const nsACString& aRemoteType) {
if (auto impl = GetPPMImpl()) {
return impl->Take(aRemoteType);
}

Просмотреть файл

@ -42,8 +42,8 @@ class PreallocatedProcessManager final {
* background. To avoid that, the PreallocatedProcessManager won't start up
* any processes while there is a blocker active.
*/
static void AddBlocker(const nsAString& aRemoteType, ContentParent* aParent);
static void RemoveBlocker(const nsAString& aRemoteType,
static void AddBlocker(const nsACString& aRemoteType, ContentParent* aParent);
static void RemoveBlocker(const nsACString& aRemoteType,
ContentParent* aParent);
/**
@ -56,7 +56,7 @@ class PreallocatedProcessManager final {
* If we use a preallocated process, it will schedule the start of
* another on Idle (AllocateOnIdle()).
*/
static already_AddRefed<ContentParent> Take(const nsAString& aRemoteType);
static already_AddRefed<ContentParent> Take(const nsACString& aRemoteType);
/**
* Cache a process (currently only DEFAULT_REMOTE_TYPE) for reuse later

Просмотреть файл

@ -28,7 +28,7 @@ class ProcessActor : public JSActorManager {
JSActorService* aActorSvc, const nsACString& aName,
ErrorResult& aRv) final;
virtual const nsAString& GetRemoteType() const = 0;
virtual const nsACString& GetRemoteType() const = 0;
};
} // namespace dom

Просмотреть файл

@ -734,7 +734,7 @@ ProcessPriority ParticularProcessPriorityManager::CurrentPriority() {
ProcessPriority ParticularProcessPriorityManager::ComputePriority() {
if (!mActiveBrowserParents.IsEmpty() ||
mContentParent->GetRemoteType().EqualsLiteral(EXTENSION_REMOTE_TYPE) ||
mContentParent->GetRemoteType() == EXTENSION_REMOTE_TYPE ||
mHoldsPlayingAudioWakeLock) {
return PROCESS_PRIORITY_FOREGROUND;
}

Просмотреть файл

@ -40,7 +40,7 @@ class WindowGlobalActor : public JSActorManager {
ErrorResult& aRv) final;
virtual nsIURI* GetDocumentURI() = 0;
virtual const nsAString& GetRemoteType() = 0;
virtual const nsACString& GetRemoteType() = 0;
virtual dom::BrowsingContext* BrowsingContext() = 0;
static WindowGlobalInit BaseInitializer(

Просмотреть файл

@ -359,7 +359,7 @@ mozilla::ipc::IPCResult WindowGlobalChild::RecvMakeFrameLocal(
// Trigger a process switch into the current process.
RemotenessOptions options;
options.mRemoteType.Assign(VoidString());
options.mRemoteType.Assign(VoidCString());
options.mPendingSwitchID.Construct(aPendingSwitchId);
options.mSwitchingInProgressLoad = true;
flo->ChangeRemoteness(options, IgnoreErrors());
@ -573,12 +573,12 @@ void WindowGlobalChild::SetDocumentPrincipal(
SendUpdateDocumentPrincipal(aNewDocumentPrincipal);
}
const nsAString& WindowGlobalChild::GetRemoteType() {
const nsACString& WindowGlobalChild::GetRemoteType() {
if (XRE_IsContentProcess()) {
return ContentChild::GetSingleton()->GetRemoteType();
}
return VoidString();
return VoidCString();
}
already_AddRefed<JSWindowActorChild> WindowGlobalChild::GetActor(

Просмотреть файл

@ -111,7 +111,7 @@ class WindowGlobalChild final : public WindowGlobalActor,
JS::Handle<JSObject*> aGivenProto) override;
protected:
const nsAString& GetRemoteType() override;
const nsACString& GetRemoteType() override;
already_AddRefed<JSActor> InitJSActor(JS::HandleObject aMaybeActor,
const nsACString& aName,

Просмотреть файл

@ -425,12 +425,12 @@ IPCResult WindowGlobalParent::RecvRawMessage(const JSActorMessageMeta& aMeta,
return IPC_OK();
}
const nsAString& WindowGlobalParent::GetRemoteType() {
const nsACString& WindowGlobalParent::GetRemoteType() {
if (RefPtr<BrowserParent> browserParent = GetBrowserParent()) {
return browserParent->Manager()->GetRemoteType();
}
return VoidString();
return VoidCString();
}
void WindowGlobalParent::NotifyContentBlockingEvent(

Просмотреть файл

@ -194,7 +194,7 @@ class WindowGlobalParent final : public WindowContext,
nsITransportSecurityInfo* GetSecurityInfo() { return mSecurityInfo; }
const nsAString& GetRemoteType() override;
const nsACString& GetRemoteType() override;
protected:
already_AddRefed<JSActor> InitJSActor(JS::HandleObject aMaybeActor,

Просмотреть файл

@ -19,7 +19,7 @@ int FuzzingInitContentParentIPC(int* argc, char*** argv) { return 0; }
static int RunContentParentIPCFuzzing(const uint8_t* data, size_t size) {
static mozilla::dom::ContentParent* p =
mozilla::ipc::ProtocolFuzzerHelper::CreateContentParent(
NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE));
DEFAULT_REMOTE_TYPE);
static nsTArray<nsCString> ignored = mozilla::ipc::LoadIPCMessageBlacklist(
getenv("MOZ_IPC_MESSAGE_FUZZ_BLACKLIST"));

Просмотреть файл

@ -121,7 +121,7 @@ void JSProcessActorProtocol::RemoveObservers() {
}
bool JSProcessActorProtocol::RemoteTypePrefixMatches(
const nsDependentSubstring& aRemoteType) {
const nsDependentCSubstring& aRemoteType) {
for (auto& remoteType : mRemoteTypes) {
if (StringBeginsWith(aRemoteType, remoteType)) {
return true;
@ -130,7 +130,7 @@ bool JSProcessActorProtocol::RemoteTypePrefixMatches(
return false;
}
bool JSProcessActorProtocol::Matches(const nsAString& aRemoteType) {
bool JSProcessActorProtocol::Matches(const nsACString& aRemoteType) {
if (!mRemoteTypes.IsEmpty() &&
!RemoteTypePrefixMatches(RemoteTypePrefix(aRemoteType))) {
return false;

Просмотреть файл

@ -54,15 +54,15 @@ class JSProcessActorProtocol final : public JSActorProtocol,
void AddObservers();
void RemoveObservers();
bool Matches(const nsAString& aRemoteType);
bool Matches(const nsACString& aRemoteType);
private:
explicit JSProcessActorProtocol(const nsACString& aName) : mName(aName) {}
bool RemoteTypePrefixMatches(const nsDependentSubstring& aRemoteType);
bool RemoteTypePrefixMatches(const nsDependentCSubstring& aRemoteType);
~JSProcessActorProtocol() = default;
nsCString mName;
nsTArray<nsString> mRemoteTypes;
nsTArray<nsCString> mRemoteTypes;
ParentSide mParent;
ChildSide mChild;

Просмотреть файл

@ -295,7 +295,7 @@ extensions::MatchPatternSet* JSWindowActorProtocol::GetURIMatcher() {
}
bool JSWindowActorProtocol::RemoteTypePrefixMatches(
const nsDependentSubstring& aRemoteType) {
const nsDependentCSubstring& aRemoteType) {
for (auto& remoteType : mRemoteTypes) {
if (StringBeginsWith(aRemoteType, remoteType)) {
return true;
@ -317,7 +317,7 @@ bool JSWindowActorProtocol::MessageManagerGroupMatches(
bool JSWindowActorProtocol::Matches(BrowsingContext* aBrowsingContext,
nsIURI* aURI,
const nsAString& aRemoteType) {
const nsACString& aRemoteType) {
MOZ_ASSERT(aBrowsingContext, "DocShell without a BrowsingContext!");
MOZ_ASSERT(aURI, "Must have URI!");

Просмотреть файл

@ -70,12 +70,12 @@ class JSWindowActorProtocol final : public JSActorProtocol,
void AddObservers();
void RemoveObservers();
bool Matches(BrowsingContext* aBrowsingContext, nsIURI* aURI,
const nsAString& aRemoteType);
const nsACString& aRemoteType);
private:
explicit JSWindowActorProtocol(const nsACString& aName) : mName(aName) {}
extensions::MatchPatternSet* GetURIMatcher();
bool RemoteTypePrefixMatches(const nsDependentSubstring& aRemoteType);
bool RemoteTypePrefixMatches(const nsDependentCSubstring& aRemoteType);
bool MessageManagerGroupMatches(BrowsingContext* aBrowsingContext);
~JSWindowActorProtocol() = default;
@ -83,7 +83,7 @@ class JSWindowActorProtocol final : public JSActorProtocol,
bool mAllFrames = false;
bool mIncludeChrome = false;
nsTArray<nsString> mMatches;
nsTArray<nsString> mRemoteTypes;
nsTArray<nsCString> mRemoteTypes;
nsTArray<nsString> mMessageManagerGroups;
ParentSide mParent;

Просмотреть файл

@ -103,8 +103,7 @@ nsresult PushNotifier::Dispatch(PushDispatcher& aDispatcher) {
// remote type is acceptable. This should not run when Fission is
// enabled, and we specifically don't want this for
// LARGE_ALLOCATION_REMOTE_TYPE, so don't use IsWebRemoteType().
if (!contentActors[i]->GetRemoteType().EqualsLiteral(
DEFAULT_REMOTE_TYPE)) {
if (contentActors[i]->GetRemoteType() != DEFAULT_REMOTE_TYPE) {
continue;
}

Просмотреть файл

@ -5,7 +5,7 @@
*/
dictionary RemotenessOptions {
required DOMString? remoteType;
required UTF8String? remoteType;
// Used to resume a given channel load within the target process. If present,
// it will be used rather than the `src` & `srcdoc` attributes on the

Просмотреть файл

@ -60,8 +60,8 @@ void TransmitPermissionsAndBlobURLsForPrincipalInfo(
} // namespace
// static
bool RemoteWorkerManager::MatchRemoteType(const nsAString& processRemoteType,
const nsAString& workerRemoteType) {
bool RemoteWorkerManager::MatchRemoteType(const nsACString& processRemoteType,
const nsACString& workerRemoteType) {
if (processRemoteType.Equals(workerRemoteType)) {
return true;
}
@ -89,7 +89,7 @@ bool RemoteWorkerManager::MatchRemoteType(const nsAString& processRemoteType,
}
// static
Result<nsString, nsresult> RemoteWorkerManager::GetRemoteType(
Result<nsCString, nsresult> RemoteWorkerManager::GetRemoteType(
const nsCOMPtr<nsIPrincipal>& aPrincipal, WorkerType aWorkerType) {
AssertIsOnMainThread();
@ -100,7 +100,7 @@ Result<nsString, nsresult> RemoteWorkerManager::GetRemoteType(
return Err(NS_ERROR_UNEXPECTED);
}
nsString remoteType;
nsCString remoteType = VoidCString();
// If Gecko is running in single process mode, there is no child process
// to select, return without assigning any remoteType.
@ -131,23 +131,21 @@ Result<nsString, nsresult> RemoteWorkerManager::GetRemoteType(
"browser.tabs.remote.separatePrivilegedMozillaWebContentProcess", false);
if (isMozExtension) {
remoteType.Assign(NS_LITERAL_STRING_FROM_CSTRING(EXTENSION_REMOTE_TYPE));
remoteType = EXTENSION_REMOTE_TYPE;
} else if (separatePrivilegedMozilla) {
bool isPrivilegedMozilla = false;
aPrincipal->IsURIInPrefList("browser.tabs.remote.separatedMozillaDomains",
&isPrivilegedMozilla);
if (isPrivilegedMozilla) {
remoteType.Assign(
NS_LITERAL_STRING_FROM_CSTRING(PRIVILEGEDMOZILLA_REMOTE_TYPE));
remoteType = PRIVILEGEDMOZILLA_REMOTE_TYPE;
} else if (aWorkerType == WorkerType::WorkerTypeShared && contentChild) {
remoteType = contentChild->GetRemoteType();
} else {
remoteType.Assign(
aWorkerType == WorkerType::WorkerTypeShared && contentChild
? contentChild->GetRemoteType()
: NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE));
remoteType = DEFAULT_REMOTE_TYPE;
}
} else {
remoteType.Assign(NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE));
remoteType = DEFAULT_REMOTE_TYPE;
}
return remoteType;
@ -349,7 +347,7 @@ void RemoteWorkerManager::AsyncCreationFailed(
}
/* static */
nsString RemoteWorkerManager::GetRemoteTypeForActor(
nsCString RemoteWorkerManager::GetRemoteTypeForActor(
const RemoteWorkerServiceParent* aActor) {
AssertIsInMainProcess();
AssertIsOnBackgroundThread();
@ -362,10 +360,10 @@ nsString RemoteWorkerManager::GetRemoteTypeForActor(
MakeScopeExit([&] { NS_ReleaseOnMainThread(contentParent.forget()); });
if (NS_WARN_IF(!contentParent)) {
return EmptyString();
return EmptyCString();
}
nsString aRemoteType(contentParent->GetRemoteType());
nsCString aRemoteType(contentParent->GetRemoteType());
return aRemoteType;
}
@ -551,7 +549,7 @@ void RemoteWorkerManager::LaunchNewContentProcess(
bgEventTarget = std::move(bgEventTarget),
self = RefPtr<RemoteWorkerManager>(this)](
const CallbackParamType& aValue,
const nsString& remoteType) mutable {
const nsCString& remoteType) mutable {
if (aValue.IsResolve()) {
if (isServiceWorker) {
TransmitPermissionsAndBlobURLsForPrincipalInfo(aValue.ResolveValue(),
@ -588,9 +586,7 @@ void RemoteWorkerManager::LaunchNewContentProcess(
__func__, [callback = std::move(processLaunchCallback),
workerRemoteType = aData.remoteType()]() mutable {
auto remoteType =
workerRemoteType.IsEmpty()
? NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE)
: workerRemoteType;
workerRemoteType.IsEmpty() ? DEFAULT_REMOTE_TYPE : workerRemoteType;
ContentParent::GetNewOrUsedBrowserProcessAsync(
/* aFrameElement = */ nullptr,

Просмотреть файл

@ -35,14 +35,14 @@ class RemoteWorkerManager final {
void Launch(RemoteWorkerController* aController,
const RemoteWorkerData& aData, base::ProcessId aProcessId);
static bool MatchRemoteType(const nsAString& processRemoteType,
const nsAString& workerRemoteType);
static bool MatchRemoteType(const nsACString& processRemoteType,
const nsACString& workerRemoteType);
/**
* Get the child process RemoteType where a RemoteWorker should be
* launched.
*/
static Result<nsString, nsresult> GetRemoteType(
static Result<nsCString, nsresult> GetRemoteType(
const nsCOMPtr<nsIPrincipal>& aPrincipal, WorkerType aWorkerType);
/**
@ -73,7 +73,7 @@ class RemoteWorkerManager final {
void AsyncCreationFailed(RemoteWorkerController* aController);
static nsString GetRemoteTypeForActor(
static nsCString GetRemoteTypeForActor(
const RemoteWorkerServiceParent* aActor);
// Iterate through all RemoteWorkerServiceParent actors, starting from a

Просмотреть файл

@ -72,7 +72,7 @@ struct RemoteWorkerData
nsID agentClusterId;
// Child process remote type where the worker should only run on.
nsString remoteType;
nsCString remoteType;
};
// ErrorData/ErrorDataNote correspond to WorkerErrorReport/WorkerErrorNote

Просмотреть файл

@ -12,54 +12,39 @@ using namespace mozilla::dom;
TEST(RemoteWorkerManager, TestMatchRemoteType)
{
static const struct {
const nsString processRemoteType;
const nsString workerRemoteType;
const nsCString processRemoteType;
const nsCString workerRemoteType;
const bool shouldMatch;
} tests[] = {
// Test exact matches between process and worker remote types.
{NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE),
NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE), true},
{NS_LITERAL_STRING_FROM_CSTRING(EXTENSION_REMOTE_TYPE),
NS_LITERAL_STRING_FROM_CSTRING(EXTENSION_REMOTE_TYPE), true},
{NS_LITERAL_STRING_FROM_CSTRING(PRIVILEGEDMOZILLA_REMOTE_TYPE),
NS_LITERAL_STRING_FROM_CSTRING(PRIVILEGEDMOZILLA_REMOTE_TYPE), true},
{DEFAULT_REMOTE_TYPE, DEFAULT_REMOTE_TYPE, true},
{EXTENSION_REMOTE_TYPE, EXTENSION_REMOTE_TYPE, true},
{PRIVILEGEDMOZILLA_REMOTE_TYPE, PRIVILEGEDMOZILLA_REMOTE_TYPE, true},
// Test workers with remoteType "web" not launched on non-web or coop+coep
// processes.
{NS_LITERAL_STRING_FROM_CSTRING(PRIVILEGEDMOZILLA_REMOTE_TYPE),
NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE), false},
{NS_LITERAL_STRING_FROM_CSTRING(PRIVILEGEDABOUT_REMOTE_TYPE),
NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE), false},
{NS_LITERAL_STRING_FROM_CSTRING(EXTENSION_REMOTE_TYPE),
NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE), false},
{NS_LITERAL_STRING_FROM_CSTRING(FILE_REMOTE_TYPE),
NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE), false},
{NS_LITERAL_STRING_FROM_CSTRING(WITH_COOP_COEP_REMOTE_TYPE_PREFIX),
NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE), false},
{PRIVILEGEDMOZILLA_REMOTE_TYPE, DEFAULT_REMOTE_TYPE, false},
{PRIVILEGEDABOUT_REMOTE_TYPE, DEFAULT_REMOTE_TYPE, false},
{EXTENSION_REMOTE_TYPE, DEFAULT_REMOTE_TYPE, false},
{FILE_REMOTE_TYPE, DEFAULT_REMOTE_TYPE, false},
{WITH_COOP_COEP_REMOTE_TYPE_PREFIX, DEFAULT_REMOTE_TYPE, false},
// Test workers with remoteType "web" launched in web child processes.
{NS_LITERAL_STRING_FROM_CSTRING(LARGE_ALLOCATION_REMOTE_TYPE),
NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE), true},
{NS_LITERAL_STRING_FROM_CSTRING(FISSION_WEB_REMOTE_TYPE),
NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE), true},
{LARGE_ALLOCATION_REMOTE_TYPE, DEFAULT_REMOTE_TYPE, true},
{FISSION_WEB_REMOTE_TYPE, DEFAULT_REMOTE_TYPE, true},
// Test empty remoteType default to "web" remoteType.
{NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE), EmptyString(),
true},
{NS_LITERAL_STRING_FROM_CSTRING(WITH_COOP_COEP_REMOTE_TYPE_PREFIX),
EmptyString(), false},
{NS_LITERAL_STRING_FROM_CSTRING(PRIVILEGEDMOZILLA_REMOTE_TYPE),
EmptyString(), false},
{NS_LITERAL_STRING_FROM_CSTRING(EXTENSION_REMOTE_TYPE), EmptyString(),
false},
{DEFAULT_REMOTE_TYPE, VoidCString(), true},
{WITH_COOP_COEP_REMOTE_TYPE_PREFIX, VoidCString(), false},
{PRIVILEGEDMOZILLA_REMOTE_TYPE, VoidCString(), false},
{EXTENSION_REMOTE_TYPE, VoidCString(), false},
};
for (const auto& test : tests) {
auto message =
nsPrintfCString(R"(MatchRemoteType("%s", "%s") should return %s)",
NS_ConvertUTF16toUTF8(test.processRemoteType).get(),
NS_ConvertUTF16toUTF8(test.workerRemoteType).get(),
test.shouldMatch ? "true" : "false");
auto message = nsPrintfCString(
R"(MatchRemoteType("%s", "%s") should return %s)",
test.processRemoteType.get(), test.workerRemoteType.get(),
test.shouldMatch ? "true" : "false");
ASSERT_EQ(RemoteWorkerManager::MatchRemoteType(test.processRemoteType,
test.workerRemoteType),
test.shouldMatch)

Просмотреть файл

@ -579,7 +579,7 @@ mozilla::ipc::IPCResult BackgroundParentImpl::RecvPFileCreatorConstructor(
if (!parent) {
isFileRemoteType = true;
} else {
isFileRemoteType = parent->GetRemoteType().EqualsLiteral(FILE_REMOTE_TYPE);
isFileRemoteType = parent->GetRemoteType() == FILE_REMOTE_TYPE;
NS_ReleaseOnMainThread("ContentParent release", parent.forget());
}

Просмотреть файл

@ -185,11 +185,11 @@ void ScriptPreloader::InitContentChild(ContentParent& parent) {
}
}
ProcessType ScriptPreloader::GetChildProcessType(const nsAString& remoteType) {
if (remoteType.EqualsLiteral(EXTENSION_REMOTE_TYPE)) {
ProcessType ScriptPreloader::GetChildProcessType(const nsACString& remoteType) {
if (remoteType == EXTENSION_REMOTE_TYPE) {
return ProcessType::Extension;
}
if (remoteType.EqualsLiteral(PRIVILEGEDABOUT_REMOTE_TYPE)) {
if (remoteType == PRIVILEGEDABOUT_REMOTE_TYPE) {
return ProcessType::PrivilegedAbout;
}
return ProcessType::Web;

Просмотреть файл

@ -75,7 +75,7 @@ class ScriptPreloader : public nsIObserver,
static ScriptPreloader& GetSingleton();
static ScriptPreloader& GetChildSingleton();
static ProcessType GetChildProcessType(const nsAString& remoteType);
static ProcessType GetChildProcessType(const nsACString& remoteType);
// Retrieves the script with the given cache key from the script cache.
// Returns null if the script is not cached.

Просмотреть файл

@ -64,7 +64,7 @@ SimpleChannelParent::Delete() {
}
NS_IMETHODIMP
SimpleChannelParent::GetRemoteType(nsAString& aRemoteType) {
SimpleChannelParent::GetRemoteType(nsACString& aRemoteType) {
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -77,5 +77,5 @@ interface nsIParentChannel : nsIStreamListener
/**
* The remote type of the target process for this load.
*/
readonly attribute AString remoteType;
readonly attribute AUTF8String remoteType;
};

Просмотреть файл

@ -1313,7 +1313,7 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
return false;
}
nsAutoString currentRemoteType(VoidString());
nsAutoCString currentRemoteType(VoidCString());
if (RefPtr<ContentParent> contentParent =
browsingContext->GetContentParent()) {
currentRemoteType = contentParent->GetRemoteType();
@ -1321,7 +1321,7 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
MOZ_ASSERT_IF(currentRemoteType.IsEmpty(), !OtherPid());
// Determine what type of content process this load should finish in.
nsAutoString preferredRemoteType(currentRemoteType);
nsAutoCString preferredRemoteType(currentRemoteType);
bool replaceBrowsingContext = false;
uint64_t specificGroupId = 0;
@ -1369,13 +1369,12 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
// high-resolution timers.
nsAutoCString siteOrigin;
resultPrincipal->GetSiteOrigin(siteOrigin);
preferredRemoteType =
NS_LITERAL_STRING_FROM_CSTRING(WITH_COOP_COEP_REMOTE_TYPE_PREFIX);
AppendUTF8toUTF16(siteOrigin, preferredRemoteType);
preferredRemoteType = WITH_COOP_COEP_REMOTE_TYPE_PREFIX;
preferredRemoteType.Append(siteOrigin);
} else if (isCOOPSwitch) {
// If we're doing a COOP switch, we do not need any affinity to the
// current remote type. Clear it back to the default value.
preferredRemoteType = NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE);
preferredRemoteType = DEFAULT_REMOTE_TYPE;
}
}
@ -1386,12 +1385,10 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
if (browsingContext->IsTop() &&
browsingContext->Group()->Toplevels().Length() == 1) {
if (IsLargeAllocationLoad(browsingContext, mChannel)) {
preferredRemoteType =
NS_LITERAL_STRING_FROM_CSTRING(LARGE_ALLOCATION_REMOTE_TYPE);
preferredRemoteType = LARGE_ALLOCATION_REMOTE_TYPE;
replaceBrowsingContext = true;
} else if (preferredRemoteType.EqualsLiteral(
LARGE_ALLOCATION_REMOTE_TYPE)) {
preferredRemoteType = NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE);
} else if (preferredRemoteType == LARGE_ALLOCATION_REMOTE_TYPE) {
preferredRemoteType = DEFAULT_REMOTE_TYPE;
replaceBrowsingContext = true;
}
}
@ -1403,10 +1400,9 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
// Toplevel extension BrowsingContexts must be loaded in the extension
// browsing context group, within the extension content process.
if (ExtensionPolicyService::GetSingleton().UseRemoteExtensions()) {
preferredRemoteType =
NS_LITERAL_STRING_FROM_CSTRING(EXTENSION_REMOTE_TYPE);
preferredRemoteType = EXTENSION_REMOTE_TYPE;
} else {
preferredRemoteType = VoidString();
preferredRemoteType = VoidCString();
}
if (browsingContext->Group()->Id() !=
@ -1425,8 +1421,7 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
LOG(
("DocumentLoadListener GetRemoteTypeForPrincipal "
"[this=%p, contentParent=%s, preferredRemoteType=%s]",
this, NS_ConvertUTF16toUTF8(currentRemoteType).get(),
NS_ConvertUTF16toUTF8(preferredRemoteType).get()));
this, currentRemoteType.get(), preferredRemoteType.get()));
nsCOMPtr<nsIE10SUtils> e10sUtils =
do_ImportModule("resource://gre/modules/E10SUtils.jsm", "E10SUtils");
@ -1441,7 +1436,7 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
currentPrincipal = wgp->DocumentPrincipal();
}
nsAutoString remoteType;
nsAutoCString remoteType;
rv = e10sUtils->GetRemoteTypeForPrincipal(
resultPrincipal, mChannelCreationURI, browsingContext->UseRemoteTabs(),
browsingContext->UseRemoteSubframes(), preferredRemoteType,
@ -1455,18 +1450,16 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
// other remote type, ensure the browsing context is replaced so that we leave
// the extension-specific BrowsingContextGroup.
if (browsingContext->IsTop() && currentRemoteType != remoteType &&
currentRemoteType.EqualsLiteral(EXTENSION_REMOTE_TYPE)) {
currentRemoteType == EXTENSION_REMOTE_TYPE) {
replaceBrowsingContext = true;
}
LOG(("GetRemoteTypeForPrincipal -> current:%s remoteType:%s",
NS_ConvertUTF16toUTF8(currentRemoteType).get(),
NS_ConvertUTF16toUTF8(remoteType).get()));
currentRemoteType.get(), remoteType.get()));
// Check if a process switch is needed.
if (currentRemoteType == remoteType && !replaceBrowsingContext) {
LOG(("Process Switch Abort: type (%s) is compatible",
NS_ConvertUTF16toUTF8(remoteType).get()));
LOG(("Process Switch Abort: type (%s) is compatible", remoteType.get()));
return false;
}
@ -1478,8 +1471,7 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
*aWillSwitchToRemote = !remoteType.IsEmpty();
LOG(("Process Switch: Changing Remoteness from '%s' to '%s'",
NS_ConvertUTF16toUTF8(currentRemoteType).get(),
NS_ConvertUTF16toUTF8(remoteType).get()));
currentRemoteType.get(), remoteType.get()));
mDoingProcessSwitch = true;
@ -2037,7 +2029,7 @@ DocumentLoadListener::Delete() {
}
NS_IMETHODIMP
DocumentLoadListener::GetRemoteType(nsAString& aRemoteType) {
DocumentLoadListener::GetRemoteType(nsACString& aRemoteType) {
RefPtr<CanonicalBrowsingContext> browsingContext = GetBrowsingContext();
if (!browsingContext) {
return NS_ERROR_UNEXPECTED;
@ -2046,7 +2038,7 @@ DocumentLoadListener::GetRemoteType(nsAString& aRemoteType) {
ErrorResult error;
browsingContext->GetCurrentRemoteType(aRemoteType, error);
if (error.Failed()) {
aRemoteType = VoidString();
aRemoteType = VoidCString();
}
return NS_OK;
}

Просмотреть файл

@ -899,8 +899,8 @@ mozilla::ipc::IPCResult NeckoParent::RecvGetPageThumbStream(
// ScriptSecurityManager, but if somehow the process has been tricked into
// sending this message, we send IPC_FAIL in order to crash that
// likely-compromised content process.
if (!static_cast<ContentParent*>(Manager())->GetRemoteType().EqualsLiteral(
PRIVILEGEDABOUT_REMOTE_TYPE)) {
if (static_cast<ContentParent*>(Manager())->GetRemoteType() !=
PRIVILEGEDABOUT_REMOTE_TYPE) {
return IPC_FAIL(this, "Wrong process type");
}

Просмотреть файл

@ -87,8 +87,8 @@ NS_IMETHODIMP
ParentChannelWrapper::Delete() { return NS_OK; }
NS_IMETHODIMP
ParentChannelWrapper::GetRemoteType(nsAString& aRemoteType) {
aRemoteType = VoidString();
ParentChannelWrapper::GetRemoteType(nsACString& aRemoteType) {
aRemoteType = VoidCString();
return NS_OK;
}

Просмотреть файл

@ -66,7 +66,7 @@ DataChannelParent::Delete() {
}
NS_IMETHODIMP
DataChannelParent::GetRemoteType(nsAString& aRemoteType) {
DataChannelParent::GetRemoteType(nsACString& aRemoteType) {
if (!CanSend()) {
return NS_ERROR_UNEXPECTED;
}

Просмотреть файл

@ -66,7 +66,7 @@ FileChannelParent::Delete() {
}
NS_IMETHODIMP
FileChannelParent::GetRemoteType(nsAString& aRemoteType) {
FileChannelParent::GetRemoteType(nsACString& aRemoteType) {
if (!CanSend()) {
return NS_ERROR_UNEXPECTED;
}

Просмотреть файл

@ -533,7 +533,7 @@ FTPChannelParent::Delete() {
}
NS_IMETHODIMP
FTPChannelParent::GetRemoteType(nsAString& aRemoteType) {
FTPChannelParent::GetRemoteType(nsACString& aRemoteType) {
if (!CanSend()) {
return NS_ERROR_UNEXPECTED;
}

Просмотреть файл

@ -1997,7 +1997,7 @@ HttpChannelParent::Delete() {
}
NS_IMETHODIMP
HttpChannelParent::GetRemoteType(nsAString& aRemoteType) {
HttpChannelParent::GetRemoteType(nsACString& aRemoteType) {
if (!CanSend()) {
return NS_ERROR_UNEXPECTED;
}

Просмотреть файл

@ -30,7 +30,7 @@ ContentProcessSandboxParams::ForThisProcess(
// (Otherwise, mBrokerFd will remain -1 from the default ctor.)
auto* cc = dom::ContentChild::GetSingleton();
params.mFileProcess = cc->GetRemoteType().EqualsLiteral(FILE_REMOTE_TYPE);
params.mFileProcess = cc->GetRemoteType() == FILE_REMOTE_TYPE;
nsAutoCString extraSyscalls;
nsresult rv = Preferences::GetCString(

Просмотреть файл

@ -505,7 +505,7 @@ void BackgroundHangThread::ReportHang(TimeDuration aHangTime,
HangDetails hangDetails(aHangTime,
nsDependentCString(XRE_GetProcessTypeString()),
VoidString(), mThreadName, mRunnableName,
VoidCString(), mThreadName, mRunnableName,
std::move(mHangStack), std::move(mAnnotations));
PersistedToDisk persistedToDisk = aPersistedToDisk;

Просмотреть файл

@ -55,7 +55,7 @@ nsHangDetails::GetProcess(nsACString& aName) {
}
NS_IMETHODIMP
nsHangDetails::GetRemoteType(nsAString& aName) {
nsHangDetails::GetRemoteType(nsACString& aName) {
aName.Assign(mDetails.remoteType());
return NS_OK;
}
@ -574,7 +574,7 @@ Result<HangDetails, nsresult> ReadHangDetailsFromFile(nsIFile* aFile) {
MOZ_TRY_VAR(result.threadName(), ReadTString<char>(fd));
MOZ_TRY_VAR(result.runnableName(), ReadTString<char>(fd));
MOZ_TRY_VAR(result.process(), ReadTString<char>(fd));
MOZ_TRY_VAR(result.remoteType(), ReadTString<char16_t>(fd));
MOZ_TRY_VAR(result.remoteType(), ReadTString<char>(fd));
uint32_t numAnnotations;
MOZ_TRY_VAR(numAnnotations, ReadUint(fd));

Просмотреть файл

@ -85,7 +85,7 @@ struct HangDetails
{
TimeDuration duration;
nsCString process;
nsString remoteType;
nsCString remoteType;
nsCString threadName;
nsCString runnableName;
HangStack stack;

Просмотреть файл

@ -50,7 +50,7 @@ interface nsIHangDetails : nsISupports
/**
* The remote type of the content process which produced the hang.
*/
readonly attribute AString remoteType;
readonly attribute AUTF8String remoteType;
/**
* Returns the stack which was captured by BHR. The offset is encoded as a hex

Просмотреть файл

@ -119,7 +119,7 @@ bool ExtensionPolicyService::IsExtensionProcess() const {
if (isRemote && XRE_IsContentProcess()) {
auto& remoteType = dom::ContentChild::GetSingleton()->GetRemoteType();
return remoteType.EqualsLiteral(EXTENSION_REMOTE_TYPE);
return remoteType == EXTENSION_REMOTE_TYPE;
}
return !isRemote && XRE_IsParentProcess();
}

Просмотреть файл

@ -32,11 +32,11 @@ interface nsIE10SUtils : nsISupports {
*
* @return The remote type to complete this load in.
*/
AString getRemoteTypeForPrincipal(in nsIPrincipal aPrincipal,
in nsIURI aChannelOriginalURI,
in boolean aMultiProcess,
in boolean aRemoteSubframes,
in AString aPreferredRemoteType,
in nsIPrincipal aCurrentPrincipal,
in boolean aIsSubframe);
AUTF8String getRemoteTypeForPrincipal(in nsIPrincipal aPrincipal,
in nsIURI aChannelOriginalURI,
in boolean aMultiProcess,
in boolean aRemoteSubframes,
in AUTF8String aPreferredRemoteType,
in nsIPrincipal aCurrentPrincipal,
in boolean aIsSubframe);
};

Просмотреть файл

@ -700,12 +700,12 @@ nsXULAppInfo::GetUniqueProcessID(uint64_t* aResult) {
}
NS_IMETHODIMP
nsXULAppInfo::GetRemoteType(nsAString& aRemoteType) {
nsXULAppInfo::GetRemoteType(nsACString& aRemoteType) {
if (XRE_IsContentProcess()) {
ContentChild* cc = ContentChild::GetSingleton();
aRemoteType.Assign(cc->GetRemoteType());
} else {
SetDOMStringToNull(aRemoteType);
aRemoteType = VoidCString();
}
return NS_OK;
@ -844,7 +844,7 @@ nsXULAppInfo::EnsureContentProcess() {
if (!XRE_IsParentProcess()) return NS_ERROR_NOT_AVAILABLE;
RefPtr<ContentParent> unused = ContentParent::GetNewOrUsedBrowserProcess(
nullptr, NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE));
nullptr, DEFAULT_REMOTE_TYPE);
return NS_OK;
}

Просмотреть файл

@ -947,8 +947,8 @@ TestShellParent* GetOrCreateTestShellParent() {
// this and you're sure you wouldn't be better off writing a "browser"
// chrome mochitest where you can have multiple types of content
// processes.
RefPtr<ContentParent> parent = ContentParent::GetNewOrUsedBrowserProcess(
nullptr, NS_LITERAL_STRING_FROM_CSTRING(DEFAULT_REMOTE_TYPE));
RefPtr<ContentParent> parent =
ContentParent::GetNewOrUsedBrowserProcess(nullptr, DEFAULT_REMOTE_TYPE);
parent.forget(&gContentParent);
} else if (!gContentParent->IsAlive()) {
return nullptr;

Просмотреть файл

@ -21,7 +21,7 @@ nsTArray<nsCString> LoadIPCMessageBlacklist(const char* aPath) {
}
mozilla::dom::ContentParent* ProtocolFuzzerHelper::CreateContentParent(
const nsAString& aRemoteType) {
const nsACString& aRemoteType) {
auto* cp = new mozilla::dom::ContentParent(aRemoteType);
// TODO: this duplicates MessageChannel::Open
cp->GetIPCChannel()->mWorkerThread = GetCurrentSerialEventTarget();

Просмотреть файл

@ -19,7 +19,7 @@ namespace ipc {
class ProtocolFuzzerHelper {
public:
static mozilla::dom::ContentParent* CreateContentParent(
const nsAString& aRemoteType);
const nsACString& aRemoteType);
static void CompositorBridgeParentSetup();

Просмотреть файл

@ -426,7 +426,7 @@ NS_IMETHODIMP nsExtProtocolChannel::Delete() {
return NS_OK;
}
NS_IMETHODIMP nsExtProtocolChannel::GetRemoteType(nsAString& aRemoteType) {
NS_IMETHODIMP nsExtProtocolChannel::GetRemoteType(nsACString& aRemoteType) {
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -68,7 +68,7 @@ struct ProcInfo {
// Process type
ProcType type;
// Origin, if any
nsString origin;
nsCString origin;
// Process filename (without the path name).
nsString filename;
// VMS in bytes.
@ -94,12 +94,12 @@ typedef MozPromise<ProcInfo, nsresult, true> ProcInfoPromise;
#ifdef XP_MACOSX
RefPtr<ProcInfoPromise> GetProcInfo(base::ProcessId pid, int32_t childId,
const ProcType& processType,
const nsAString& origin,
const nsACString& origin,
mach_port_t aChildTask = MACH_PORT_NULL);
#else
RefPtr<ProcInfoPromise> GetProcInfo(base::ProcessId pid, int32_t childId,
const ProcType& processType,
const nsAString& origin);
const nsACString& origin);
#endif
} // namespace mozilla

Просмотреть файл

@ -20,7 +20,7 @@
namespace mozilla {
RefPtr<ProcInfoPromise> GetProcInfo(base::ProcessId pid, int32_t childId, const ProcType& type,
const nsAString& origin, mach_port_t aChildTask) {
const nsACString& origin, mach_port_t aChildTask) {
auto holder = MakeUnique<MozPromiseHolder<ProcInfoPromise>>();
RefPtr<ProcInfoPromise> promise = holder->Ensure(__func__);
@ -33,7 +33,7 @@ RefPtr<ProcInfoPromise> GetProcInfo(base::ProcessId pid, int32_t childId, const
}
// Ensure that the string is still alive when `ResolveGetProcInfo` is called.
nsString originCopy(origin);
nsCString originCopy(origin);
auto ResolveGetProcinfo = [holder = std::move(holder), pid, type,
originCopy = std::move(originCopy), childId, aChildTask]() {
ProcInfo info;

Просмотреть файл

@ -211,7 +211,7 @@ class ThreadInfoReader final : public StatReader {
RefPtr<ProcInfoPromise> GetProcInfo(base::ProcessId pid, int32_t childId,
const ProcType& type,
const nsAString& origin) {
const nsACString& origin) {
auto holder = MakeUnique<MozPromiseHolder<ProcInfoPromise>>();
RefPtr<ProcInfoPromise> promise = holder->Ensure(__func__);
nsresult rv = NS_OK;
@ -224,7 +224,7 @@ RefPtr<ProcInfoPromise> GetProcInfo(base::ProcessId pid, int32_t childId,
}
// Ensure that the string is still alive when the runnable is called.
nsString originCopy(origin);
nsCString originCopy(origin);
RefPtr<nsIRunnable> r = NS_NewRunnableFunction(
__func__, [holder = std::move(holder), pid, type,
originCopy = std::move(originCopy), childId]() {

Просмотреть файл

@ -77,7 +77,7 @@ void AppendThreads(ProcInfo* info) {
RefPtr<ProcInfoPromise> GetProcInfo(base::ProcessId pid, int32_t childId,
const ProcType& type,
const nsAString& origin) {
const nsACString& origin) {
auto holder = MakeUnique<MozPromiseHolder<ProcInfoPromise>>();
RefPtr<ProcInfoPromise> promise = holder->Ensure(__func__);
@ -91,7 +91,7 @@ RefPtr<ProcInfoPromise> GetProcInfo(base::ProcessId pid, int32_t childId,
}
// Ensure that the string is still alive when `ResolveGetProcInfo` is called.
nsString originCopy(origin);
nsCString originCopy(origin);
RefPtr<nsIRunnable> r = NS_NewRunnableFunction(
__func__,
[holder = std::move(holder), originCopy = std::move(originCopy), pid,

Просмотреть файл

@ -112,7 +112,7 @@ interface nsIXULRuntime : nsISupports
* a URI if Fission is enabled, so don't use it for any kind of
* telemetry.
*/
readonly attribute AString remoteType;
readonly attribute AUTF8String remoteType;
/**
* If true, browser tabs may be opened by default in a different process