Skip to content

Commit ca5db92

Browse files
committed
Bug 1590762 - Part 2: Bump the id for channel registration to uint64_t. r=mattwoodrow,necko-reviewers,valentin
This patch also makes the identifier for channels global, in the sense that the generated identifier is generated outside of and passed to the nsIRedirectChannelRegistrar. Differential Revision: https://phabricator.services.mozilla.com/D79820
1 parent d36c42d commit ca5db92

27 files changed

+74
-64
lines changed

docshell/base/BrowsingContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,7 @@ nsresult BrowsingContext::LoadURI(nsDocShellLoadState* aLoadState,
15851585
if (ContentParent* cp = Canonical()->GetContentParent()) {
15861586
// Attempt to initiate this load immediately in the parent, if it succeeds
15871587
// it'll return a unique identifier so that we can find it later.
1588-
uint32_t loadIdentifier = 0;
1588+
uint64_t loadIdentifier = 0;
15891589
if (Canonical()->AttemptLoadURIInParent(aLoadState, &loadIdentifier)) {
15901590
aLoadState->SetLoadIdentifier(loadIdentifier);
15911591
}

docshell/base/CanonicalBrowsingContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ MediaController* CanonicalBrowsingContext::GetMediaController() {
813813
}
814814

815815
bool CanonicalBrowsingContext::AttemptLoadURIInParent(
816-
nsDocShellLoadState* aLoadState, uint32_t* aLoadIdentifier) {
816+
nsDocShellLoadState* aLoadState, uint64_t* aLoadIdentifier) {
817817
// We currently only support starting loads directly from the
818818
// CanonicalBrowsingContext for top-level BCs.
819819
if (!IsTopContent() || !GetContentParent() ||

docshell/base/CanonicalBrowsingContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class CanonicalBrowsingContext final : public BrowsingContext {
151151
MediaController* GetMediaController();
152152

153153
bool AttemptLoadURIInParent(nsDocShellLoadState* aLoadState,
154-
uint32_t* aLoadIdentifier);
154+
uint64_t* aLoadIdentifier);
155155

156156
// Get or create a secure browser UI for this BrowsingContext
157157
nsISecureBrowserUI* GetSecureBrowserUI();

docshell/base/nsDocShellLoadState.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ class nsDocShellLoadState final {
238238
return mCancelContentJSEpoch;
239239
}
240240

241-
void SetLoadIdentifier(uint32_t aIdent) { mLoadIdentifier = aIdent; }
242-
uint32_t GetLoadIdentifier() const { return mLoadIdentifier; }
241+
void SetLoadIdentifier(uint64_t aIdent) { mLoadIdentifier = aIdent; }
242+
uint64_t GetLoadIdentifier() const { return mLoadIdentifier; }
243243

244244
// When loading a document through nsDocShell::LoadURI(), a special set of
245245
// flags needs to be set based on other values in nsDocShellLoadState. This
@@ -415,7 +415,7 @@ class nsDocShellLoadState final {
415415
// created in the parent process for this loads. DocumentChannels
416416
// created in the content process can use this to find and attach
417417
// to the in progress load.
418-
uint32_t mLoadIdentifier;
418+
uint64_t mLoadIdentifier;
419419
};
420420

421421
#endif /* nsDocShellLoadState_h__ */

dom/base/nsContentUtils.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9709,6 +9709,14 @@ uint64_t nsContentUtils::GenerateWindowId() {
97099709
return GenerateProcessSpecificId(++gNextWindowId);
97109710
}
97119711

9712+
// Next process-local load.
9713+
static Atomic<uint64_t> gNextLoadIdentifier(0);
9714+
9715+
/* static */
9716+
uint64_t nsContentUtils::GenerateLoadIdentifier() {
9717+
return GenerateProcessSpecificId(++gNextLoadIdentifier);
9718+
}
9719+
97129720
/* static */
97139721
bool nsContentUtils::GetUserIsInteracting() {
97149722
return UserInteractionObserver::sUserActive;

dom/base/nsContentUtils.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3149,6 +3149,12 @@ class nsContentUtils {
31493149
*/
31503150
static uint64_t GenerateWindowId();
31513151

3152+
/**
3153+
* Generate an ID for a load which is unique across processes and will never
3154+
* be recycled.
3155+
*/
3156+
static uint64_t GenerateLoadIdentifier();
3157+
31523158
/**
31533159
* Determine whether or not the user is currently interacting with the web
31543160
* browser. This method is safe to call from off of the main thread.

dom/ipc/ContentParent.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4090,7 +4090,7 @@ mozilla::ipc::IPCResult ContentParent::RecvLoadURIExternal(
40904090
}
40914091

40924092
mozilla::ipc::IPCResult ContentParent::RecvExtProtocolChannelConnectParent(
4093-
const uint32_t& registrarId) {
4093+
const uint64_t& registrarId) {
40944094
nsresult rv;
40954095

40964096
// First get the real channel created before redirect on the parent.

dom/ipc/ContentParent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ class ContentParent final
10361036
nsIURI* uri, nsIPrincipal* triggeringPrincipal,
10371037
const MaybeDiscarded<BrowsingContext>& aContext);
10381038
mozilla::ipc::IPCResult RecvExtProtocolChannelConnectParent(
1039-
const uint32_t& registrarId);
1039+
const uint64_t& registrarId);
10401040

10411041
mozilla::ipc::IPCResult RecvSyncMessage(
10421042
const nsString& aMsg, const ClonedMessageData& aData,

dom/ipc/DOMTypes.ipdlh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ struct DocShellLoadStateInit
277277
// bool mIsSrcDocLoad; // useless without sourcedocshell
278278
// nsIChannel pendingRedirectedChannel; // sent through other mechanism
279279

280-
uint32_t LoadIdentifier;
280+
uint64_t LoadIdentifier;
281281
};
282282

283283
struct TimedChannelInfo

dom/ipc/PContent.ipdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ parent:
978978
async SetURITitle(nsIURI uri, nsString title);
979979

980980
async LoadURIExternal(nsIURI uri, nsIPrincipal triggeringPrincipal, MaybeDiscardedBrowsingContext browsingContext);
981-
async ExtProtocolChannelConnectParent(uint32_t registrarId);
981+
async ExtProtocolChannelConnectParent(uint64_t registrarId);
982982

983983
// PrefService message
984984
sync GetGfxVars() returns (GfxVarUpdate[] vars);

0 commit comments

Comments
 (0)