Skip to content

Commit 8359f16

Browse files
committed
Backed out 7 changesets (bug 1650163, bug 1649477) for bustages on JSActor.cpp . CLOSED TREE
Backed out changeset 4a21afb65254 (bug 1650163) Backed out changeset c41753a56f5a (bug 1650163) Backed out changeset 5fb444c35764 (bug 1650163) Backed out changeset 830aa93d2b0c (bug 1649477) Backed out changeset eca6e9dce450 (bug 1649477) Backed out changeset 5b217aa88289 (bug 1649477) Backed out changeset 8959d02b840f (bug 1649477)
1 parent 1985358 commit 8359f16

File tree

93 files changed

+1174
-1001
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1174
-1001
lines changed

browser/components/about/AboutRedirector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ AboutRedirector::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
156156
// startup cache.
157157
if (XRE_IsContentProcess() && path.EqualsLiteral("home")) {
158158
auto& remoteType = dom::ContentChild::GetSingleton()->GetRemoteType();
159-
if (remoteType == PRIVILEGEDABOUT_REMOTE_TYPE) {
159+
if (remoteType.EqualsLiteral(PRIVILEGEDABOUT_REMOTE_TYPE)) {
160160
nsCOMPtr<nsIAboutNewTabService> aboutNewTabService =
161161
do_GetService("@mozilla.org/browser/aboutnewtab-service;1", &rv);
162162
NS_ENSURE_SUCCESS(rv, rv);

caps/nsScriptSecurityManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ nsresult nsScriptSecurityManager::CheckLoadURIFlags(
938938
}
939939

940940
auto& remoteType = dom::ContentChild::GetSingleton()->GetRemoteType();
941-
if (remoteType == PRIVILEGEDABOUT_REMOTE_TYPE) {
941+
if (remoteType.EqualsLiteral(PRIVILEGEDABOUT_REMOTE_TYPE)) {
942942
return NS_OK;
943943
}
944944
}

docshell/base/BrowsingContext.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,8 +1047,9 @@ bool BrowsingContext::CrossOriginIsolated() {
10471047
nsILoadInfo::
10481048
OPENER_POLICY_SAME_ORIGIN_EMBEDDER_POLICY_REQUIRE_CORP &&
10491049
XRE_IsContentProcess() &&
1050-
StringBeginsWith(ContentChild::GetSingleton()->GetRemoteType(),
1051-
WITH_COOP_COEP_REMOTE_TYPE_PREFIX);
1050+
StringBeginsWith(
1051+
ContentChild::GetSingleton()->GetRemoteType(),
1052+
NS_LITERAL_STRING_FROM_CSTRING(WITH_COOP_COEP_REMOTE_TYPE_PREFIX));
10521053
}
10531054

10541055
BrowsingContext::~BrowsingContext() {

docshell/base/CanonicalBrowsingContext.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ ContentParent* CanonicalBrowsingContext::GetContentParent() const {
9494
return cpm->GetContentProcessById(ContentParentId(mProcessId));
9595
}
9696

97-
void CanonicalBrowsingContext::GetCurrentRemoteType(nsACString& aRemoteType,
97+
void CanonicalBrowsingContext::GetCurrentRemoteType(nsAString& aRemoteType,
9898
ErrorResult& aRv) const {
9999
// If we're in the parent process, dump out the void string.
100100
if (mProcessId == 0) {
101-
aRemoteType = NOT_REMOTE_TYPE;
101+
aRemoteType.Assign(VoidString());
102102
return;
103103
}
104104

@@ -108,7 +108,7 @@ void CanonicalBrowsingContext::GetCurrentRemoteType(nsACString& aRemoteType,
108108
return;
109109
}
110110

111-
aRemoteType = cp->GetRemoteType();
111+
aRemoteType.Assign(cp->GetRemoteType());
112112
}
113113

114114
void CanonicalBrowsingContext::SetOwnerProcessId(uint64_t aProcessId) {
@@ -822,7 +822,7 @@ CanonicalBrowsingContext::PendingRemotenessChange::~PendingRemotenessChange() {
822822
}
823823

824824
RefPtr<CanonicalBrowsingContext::RemotenessPromise>
825-
CanonicalBrowsingContext::ChangeRemoteness(const nsACString& aRemoteType,
825+
CanonicalBrowsingContext::ChangeRemoteness(const nsAString& aRemoteType,
826826
uint64_t aPendingSwitchId,
827827
bool aReplaceBrowsingContext,
828828
uint64_t aSpecificGroupId) {

docshell/base/CanonicalBrowsingContext.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class CanonicalBrowsingContext final : public BrowsingContext {
5959
uint64_t EmbedderProcessId() const { return mEmbedderProcessId; }
6060
ContentParent* GetContentParent() const;
6161

62-
void GetCurrentRemoteType(nsACString& aRemoteType, ErrorResult& aRv) const;
62+
void GetCurrentRemoteType(nsAString& aRemoteType, ErrorResult& aRv) const;
6363

6464
void SetOwnerProcessId(uint64_t aProcessId);
6565

@@ -150,10 +150,10 @@ class CanonicalBrowsingContext final : public BrowsingContext {
150150
// Internal method to change which process a BrowsingContext is being loaded
151151
// in. The returned promise will resolve when the process switch is completed.
152152
//
153-
// A NOT_REMOTE_TYPE aRemoteType argument will perform a process switch into
154-
// the parent process, and the method will resolve with a null BrowserParent.
153+
// A VoidString() aRemoteType argument will perform a process switch into the
154+
// parent process, and the method will resolve with a null BrowserParent.
155155
using RemotenessPromise = MozPromise<RefPtr<BrowserParent>, nsresult, false>;
156-
RefPtr<RemotenessPromise> ChangeRemoteness(const nsACString& aRemoteType,
156+
RefPtr<RemotenessPromise> ChangeRemoteness(const nsAString& aRemoteType,
157157
uint64_t aPendingSwitchId,
158158
bool aReplaceBrowsingContext,
159159
uint64_t aSpecificGroupId);

dom/base/ChromeUtils.cpp

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ already_AddRefed<Promise> ChromeUtils::RequestProcInfo(GlobalObject& aGlobal,
795795
global->EventTargetFor(TaskCategory::Performance);
796796

797797
// Getting the parent proc info
798-
mozilla::GetProcInfo(parentPid, 0, mozilla::ProcType::Browser, ""_ns)
798+
mozilla::GetProcInfo(parentPid, 0, mozilla::ProcType::Browser, u""_ns)
799799
->Then(
800800
target, __func__,
801801
[target, domPromise, parentPid](ProcInfo aParentInfo) {
@@ -809,7 +809,7 @@ already_AddRefed<Promise> ChromeUtils::RequestProcInfo(GlobalObject& aGlobal,
809809
if (!aGeckoProcess->GetChildProcessHandle()) {
810810
return;
811811
}
812-
nsAutoCString origin;
812+
nsAutoString origin;
813813
base::ProcessId childPid =
814814
base::GetProcId(aGeckoProcess->GetChildProcessHandle());
815815
int32_t childId = 0;
@@ -832,42 +832,50 @@ already_AddRefed<Promise> ChromeUtils::RequestProcInfo(GlobalObject& aGlobal,
832832
// Converting the remoteType into a ProcType.
833833
// Ideally, the remoteType should be strongly typed
834834
// upstream, this would make the conversion less brittle.
835-
nsAutoCString remoteType(contentParent->GetRemoteType());
835+
nsAutoString remoteType(contentParent->GetRemoteType());
836836
if (StringBeginsWith(remoteType,
837-
FISSION_WEB_REMOTE_TYPE)) {
837+
NS_LITERAL_STRING_FROM_CSTRING(
838+
FISSION_WEB_REMOTE_TYPE))) {
838839
// WARNING: Do not change the order, as
839840
// `DEFAULT_REMOTE_TYPE` is a prefix of
840841
// `FISSION_WEB_REMOTE_TYPE`.
841842
type = mozilla::ProcType::WebIsolated;
842-
} else if (StringBeginsWith(remoteType,
843-
DEFAULT_REMOTE_TYPE)) {
843+
} else if (StringBeginsWith(
844+
remoteType, NS_LITERAL_STRING_FROM_CSTRING(
845+
DEFAULT_REMOTE_TYPE))) {
844846
type = mozilla::ProcType::Web;
845-
} else if (remoteType == FILE_REMOTE_TYPE) {
847+
} else if (remoteType.EqualsLiteral(FILE_REMOTE_TYPE)) {
846848
type = mozilla::ProcType::File;
847-
} else if (remoteType == EXTENSION_REMOTE_TYPE) {
849+
} else if (remoteType.EqualsLiteral(
850+
EXTENSION_REMOTE_TYPE)) {
848851
type = mozilla::ProcType::Extension;
849-
} else if (remoteType == PRIVILEGEDABOUT_REMOTE_TYPE) {
852+
} else if (remoteType.EqualsLiteral(
853+
PRIVILEGEDABOUT_REMOTE_TYPE)) {
850854
type = mozilla::ProcType::PrivilegedAbout;
851-
} else if (remoteType == PRIVILEGEDMOZILLA_REMOTE_TYPE) {
855+
} else if (remoteType.EqualsLiteral(
856+
PRIVILEGEDMOZILLA_REMOTE_TYPE)) {
852857
type = mozilla::ProcType::PrivilegedMozilla;
853858
} else if (StringBeginsWith(
854859
remoteType,
855-
WITH_COOP_COEP_REMOTE_TYPE_PREFIX)) {
860+
NS_LITERAL_STRING_FROM_CSTRING(
861+
WITH_COOP_COEP_REMOTE_TYPE_PREFIX))) {
856862
type = mozilla::ProcType::WebCOOPCOEP;
857-
} else if (remoteType == LARGE_ALLOCATION_REMOTE_TYPE) {
863+
} else if (remoteType.EqualsLiteral(
864+
LARGE_ALLOCATION_REMOTE_TYPE)) {
858865
type = mozilla::ProcType::WebLargeAllocation;
859-
} else if (remoteType == PREALLOC_REMOTE_TYPE) {
866+
} else if (remoteType.EqualsLiteral(
867+
PREALLOC_REMOTE_TYPE)) {
860868
type = mozilla::ProcType::Preallocated;
861869
} else {
862870
MOZ_CRASH("Unknown remoteType");
863871
}
864872

865873
// By convention, everything after '=' is the origin.
866-
nsACString::const_iterator cursor;
867-
nsACString::const_iterator end;
874+
nsAString::const_iterator cursor;
875+
nsAString::const_iterator end;
868876
remoteType.BeginReading(cursor);
869877
remoteType.EndReading(end);
870-
if (FindCharInReadable('=', cursor, end)) {
878+
if (FindCharInReadable(u'=', cursor, end)) {
871879
origin = Substring(++cursor, end);
872880
}
873881
childId = contentParent->ChildID();

dom/base/MessageManagerGlobal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class MessageManagerGlobal {
7575
return mMessageManager->GetProcessMessageManager(aError);
7676
}
7777

78-
void GetRemoteType(nsACString& aRemoteType, mozilla::ErrorResult& aError) {
78+
void GetRemoteType(nsAString& aRemoteType, mozilla::ErrorResult& aError) {
7979
if (!mMessageManager) {
8080
aError.Throw(NS_ERROR_NOT_INITIALIZED);
8181
return;

dom/base/nsFrameLoader.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, BrowsingContext* aBrowsingContext,
169169
mDetachedSubdocFrame(nullptr),
170170
mPendingSwitchID(0),
171171
mChildID(0),
172-
mRemoteType(NOT_REMOTE_TYPE),
172+
mRemoteType(VoidString()),
173173
mDepthTooGreat(false),
174174
mIsTopLevelContent(false),
175175
mDestroyCalled(false),
@@ -351,20 +351,17 @@ static bool InitialLoadIsRemote(Element* aOwner) {
351351
}
352352

353353
static void GetInitialRemoteTypeAndProcess(Element* aOwner,
354-
nsACString& aRemoteType,
354+
nsAString& aRemoteType,
355355
uint64_t* aChildID) {
356356
MOZ_ASSERT(XRE_IsParentProcess());
357357
*aChildID = 0;
358358

359359
// Check if there is an explicit `remoteType` attribute which we should use.
360-
nsAutoString remoteType;
361360
bool hasRemoteType =
362-
aOwner->GetAttr(kNameSpaceID_None, nsGkAtoms::RemoteType, remoteType);
363-
if (!hasRemoteType || remoteType.IsEmpty()) {
361+
aOwner->GetAttr(kNameSpaceID_None, nsGkAtoms::RemoteType, aRemoteType);
362+
if (!hasRemoteType || aRemoteType.IsEmpty()) {
364363
hasRemoteType = false;
365-
aRemoteType = DEFAULT_REMOTE_TYPE;
366-
} else {
367-
aRemoteType = NS_ConvertUTF16toUTF8(remoteType);
364+
aRemoteType.AssignLiteral(DEFAULT_REMOTE_TYPE);
368365
}
369366

370367
// Check if `sameProcessAsFrameLoader` was used to override the process.
@@ -531,7 +528,7 @@ void nsFrameLoader::LoadFrame(bool aOriginalSrc) {
531528
}
532529
}
533530

534-
void nsFrameLoader::ConfigRemoteProcess(const nsACString& aRemoteType,
531+
void nsFrameLoader::ConfigRemoteProcess(const nsAString& aRemoteType,
535532
ContentParent* aContentParent) {
536533
MOZ_DIAGNOSTIC_ASSERT(IsRemoteFrame(), "Must be a remote frame");
537534
MOZ_DIAGNOSTIC_ASSERT(!mRemoteBrowser, "Must not have a browser yet");

dom/base/nsFrameLoader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ class nsFrameLoader final : public nsStubMutationObserver,
398398
// `TryRemoteBrowser`, and a script blocker must be on the stack.
399399
//
400400
// |aContentParent|, if set, must have the remote type |aRemoteType|.
401-
void ConfigRemoteProcess(const nsACString& aRemoteType,
401+
void ConfigRemoteProcess(const nsAString& aRemoteType,
402402
mozilla::dom::ContentParent* aContentParent);
403403

404404
void MaybeNotifyCrashed(mozilla::dom::BrowsingContext* aBrowsingContext,
@@ -515,7 +515,7 @@ class nsFrameLoader final : public nsStubMutationObserver,
515515

516516
RefPtr<mozilla::dom::TabListener> mSessionStoreListener;
517517

518-
nsCString mRemoteType;
518+
nsString mRemoteType;
519519

520520
bool mDepthTooGreat : 1;
521521
bool mIsTopLevelContent : 1;

dom/base/nsFrameMessageManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ NS_INTERFACE_MAP_END
152152
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsFrameMessageManager)
153153
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFrameMessageManager)
154154

155-
void MessageManagerCallback::DoGetRemoteType(nsACString& aRemoteType,
155+
void MessageManagerCallback::DoGetRemoteType(nsAString& aRemoteType,
156156
ErrorResult& aError) const {
157157
aRemoteType.Truncate();
158158
mozilla::dom::ProcessMessageManager* parent = GetProcessMessageManager();
@@ -917,7 +917,7 @@ nsFrameMessageManager::GetProcessMessageManager(ErrorResult& aError) {
917917
return pmm.forget();
918918
}
919919

920-
void nsFrameMessageManager::GetRemoteType(nsACString& aRemoteType,
920+
void nsFrameMessageManager::GetRemoteType(nsAString& aRemoteType,
921921
ErrorResult& aError) const {
922922
aRemoteType.Truncate();
923923
if (mCallback) {

dom/base/nsFrameMessageManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class MessageManagerCallback {
9999
return nullptr;
100100
}
101101

102-
virtual void DoGetRemoteType(nsACString& aRemoteType,
102+
virtual void DoGetRemoteType(nsAString& aRemoteType,
103103
ErrorResult& aError) const;
104104

105105
protected:
@@ -178,7 +178,7 @@ class nsFrameMessageManager : public nsIMessageSender {
178178
}
179179
already_AddRefed<mozilla::dom::ProcessMessageManager>
180180
GetProcessMessageManager(mozilla::ErrorResult& aError);
181-
void GetRemoteType(nsACString& aRemoteType,
181+
void GetRemoteType(nsAString& aRemoteType,
182182
mozilla::ErrorResult& aError) const;
183183

184184
// SyncMessageSender

dom/chrome-webidl/BrowsingContext.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ interface CanonicalBrowsingContext : BrowsingContext {
136136
// synchronously create WindowGlobalParent. It can throw if somehow the
137137
// content process has died.
138138
[Throws]
139-
readonly attribute UTF8String? currentRemoteType;
139+
readonly attribute DOMString? currentRemoteType;
140140

141141
readonly attribute WindowGlobalParent? embedderWindowGlobal;
142142

dom/chrome-webidl/ChromeUtils.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ dictionary ChildProcInfoDictionary {
555555
sequence<ThreadInfoDictionary> threads = [];
556556
// Firefox info
557557
unsigned long long ChildID = 0;
558-
UTF8String origin = "";
558+
DOMString origin = "";
559559
WebIDLProcType type = "web";
560560
};
561561

dom/chrome-webidl/JSProcessActor.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ dictionary ProcessActorOptions {
4646
* can prefix match remote type either `web` or `webIsolated`. If not passed,
4747
* all content processes are allowed to instantiate the actor.
4848
*/
49-
sequence<UTF8String> remoteTypes;
49+
sequence<DOMString> remoteTypes;
5050

5151
/** This fields are used for configuring individual sides of the actor. */
5252
ProcessActorSidedOptions parent;

dom/chrome-webidl/JSWindowActor.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ dictionary WindowActorOptions {
9797
* can prefix match remote type either `web` or `webIsolated`. If not passed,
9898
* all content processes are allowed to instantiate the actor.
9999
*/
100-
sequence<UTF8String> remoteTypes;
100+
sequence<DOMString> remoteTypes;
101101

102102
/**
103103
* An array of MessageManagerGroup values which restrict which type

dom/chrome-webidl/MessageManager.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ interface mixin MessageSenderMixin {
322322
* Otherwise, it is empty.
323323
*/
324324
[Throws]
325-
readonly attribute UTF8String remoteType;
325+
readonly attribute DOMString remoteType;
326326
};
327327

328328
[ChromeOnly, Exposed=Window]

dom/interfaces/base/nsIContentProcess.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ interface nsIContentProcessProvider : nsISupports
4545
* nsIContentProcessProvider.NEW_PROCESS to ask the caller to create a new
4646
* content process.
4747
*/
48-
int32_t provideProcess(in AUTF8String aType,
48+
int32_t provideProcess(in AString aType,
4949
in Array<nsIContentProcessInfo> aAliveProcesses,
5050
in uint32_t aMaxCount);
5151
};

0 commit comments

Comments
 (0)