Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit e76aa88

Browse files
author
Jean-Yves Avenard
committed
Bug 1556489 - P4. Add ability to set Document object on LoadInfo. r=mayhemer,ckerschb
This will be required to access the Performance object from future DocumentChannel. Differential Revision: https://phabricator.services.mozilla.com/D41133
1 parent a23b70b commit e76aa88

4 files changed

Lines changed: 18 additions & 5 deletions

File tree

ipc/glue/BackgroundUtils.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,12 @@ nsresult LoadInfoToLoadInfoArgs(nsILoadInfo* aLoadInfo,
594594
nsresult LoadInfoArgsToLoadInfo(
595595
const Maybe<LoadInfoArgs>& aOptionalLoadInfoArgs,
596596
nsILoadInfo** outLoadInfo) {
597+
return LoadInfoArgsToLoadInfo(aOptionalLoadInfoArgs, nullptr, outLoadInfo);
598+
}
599+
600+
nsresult LoadInfoArgsToLoadInfo(
601+
const Maybe<LoadInfoArgs>& aOptionalLoadInfoArgs, nsINode* aLoadingContext,
602+
nsILoadInfo** outLoadInfo) {
597603
if (aOptionalLoadInfoArgs.isNothing()) {
598604
*outLoadInfo = nullptr;
599605
return NS_OK;
@@ -747,7 +753,8 @@ nsresult LoadInfoArgsToLoadInfo(
747753
loadInfoArgs.serviceWorkerTaintingSynthesized(),
748754
loadInfoArgs.documentHasUserInteracted(),
749755
loadInfoArgs.documentHasLoaded(), loadInfoArgs.cspNonce(),
750-
loadInfoArgs.skipContentSniffing(), loadInfoArgs.requestBlockingReason());
756+
loadInfoArgs.skipContentSniffing(), loadInfoArgs.requestBlockingReason(),
757+
aLoadingContext);
751758

752759
if (loadInfoArgs.isFromProcessingFrameAttributes()) {
753760
loadInfo->SetIsFromProcessingFrameAttributes();

ipc/glue/BackgroundUtils.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
class nsIContentSecurityPolicy;
1717
class nsILoadInfo;
18+
class nsINode;
1819
class nsIPrincipal;
1920
class nsIRedirectHistoryEntry;
2021

@@ -132,6 +133,9 @@ nsresult LoadInfoToLoadInfoArgs(
132133
nsresult LoadInfoArgsToLoadInfo(
133134
const Maybe<mozilla::net::LoadInfoArgs>& aOptionalLoadInfoArgs,
134135
nsILoadInfo** outLoadInfo);
136+
nsresult LoadInfoArgsToLoadInfo(
137+
const Maybe<mozilla::net::LoadInfoArgs>& aOptionalLoadInfoArgs,
138+
nsINode* aLoadingContext, nsILoadInfo** outLoadInfo);
135139

136140
/**
137141
* Fills ParentLoadInfoForwarderArgs with properties we want to carry to child

netwerk/base/LoadInfo.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,8 @@ LoadInfo::LoadInfo(
508508
bool aIsPreflight, bool aLoadTriggeredFromExternal,
509509
bool aServiceWorkerTaintingSynthesized, bool aDocumentHasUserInteracted,
510510
bool aDocumentHasLoaded, const nsAString& aCspNonce,
511-
bool aSkipContentSniffing, uint32_t aRequestBlockingReason)
511+
bool aSkipContentSniffing, uint32_t aRequestBlockingReason,
512+
nsINode* aLoadingContext)
512513
: mLoadingPrincipal(aLoadingPrincipal),
513514
mTriggeringPrincipal(aTriggeringPrincipal),
514515
mPrincipalToInherit(aPrincipalToInherit),
@@ -521,6 +522,7 @@ LoadInfo::LoadInfo(
521522
mReservedClientInfo(aReservedClientInfo),
522523
mInitialClientInfo(aInitialClientInfo),
523524
mController(aController),
525+
mLoadingContext(do_GetWeakReference(aLoadingContext)),
524526
mSecurityFlags(aSecurityFlags),
525527
mInternalContentPolicyType(aContentPolicyType),
526528
mTainting(aTainting),

netwerk/base/LoadInfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace ipc {
4040
// we have to forward declare that function so we can use it as a friend.
4141
nsresult LoadInfoArgsToLoadInfo(
4242
const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
43-
nsILoadInfo** outLoadInfo);
43+
nsINode* aLoadingContext, nsILoadInfo** outLoadInfo);
4444
} // namespace ipc
4545

4646
namespace net {
@@ -155,7 +155,7 @@ class LoadInfo final : public nsILoadInfo {
155155
bool aServiceWorkerTaintingSynthesized,
156156
bool aDocumentHasUserInteracted, bool aDocumentHasLoaded,
157157
const nsAString& aCspNonce, bool aSkipContentSniffing,
158-
uint32_t aRequestBlockingReason);
158+
uint32_t aRequestBlockingReason, nsINode* aLoadingContext);
159159
LoadInfo(const LoadInfo& rhs);
160160

161161
NS_IMETHOD GetRedirects(JSContext* aCx,
@@ -164,7 +164,7 @@ class LoadInfo final : public nsILoadInfo {
164164

165165
friend nsresult mozilla::ipc::LoadInfoArgsToLoadInfo(
166166
const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
167-
nsILoadInfo** outLoadInfo);
167+
nsINode* aLoadingContext, nsILoadInfo** outLoadInfo);
168168

169169
~LoadInfo() = default;
170170

0 commit comments

Comments
 (0)