Bug 1932162 - Set the initiatorType in HttpChannelParent and expose to scripts r=necko-reviewers,valentin

This changeset synchronizes the initiatorType from the child channel to the parent channel in asyncOpen.
It also removes noscript from initiatorType in nsITimedChannel

Differential Revision: https://phabricator.services.mozilla.com/D229378
This commit is contained in:
Julian Descottes 2024-11-20 09:07:36 +00:00
parent 6979182bd9
commit d5379133cb
5 changed files with 9 additions and 4 deletions

View File

@ -71,7 +71,7 @@ interface nsITimedChannel : nsISupports {
[noscript] attribute TimeStamp redirectEnd;
// The initiator type
[noscript] attribute AString initiatorType;
attribute AString initiatorType;
// This flag should be set to false only if a cross-domain redirect occurred
[noscript] attribute boolean allRedirectsSameOrigin;

View File

@ -387,6 +387,7 @@ struct HttpChannelOpenArgs
nsString classicScriptHintCharset;
nsString documentCharacterSet;
bool isUserAgentHeaderModified;
nsString initiatorType;
};
struct HttpChannelConnectArgs

View File

@ -2466,6 +2466,7 @@ nsresult HttpChannelChild::ContinueAsyncOpen() {
openArgs.classicScriptHintCharset() = mClassicScriptHintCharset;
openArgs.isUserAgentHeaderModified() = LoadIsUserAgentHeaderModified();
openArgs.initiatorType() = mInitiatorType;
RefPtr<Document> doc;
mLoadInfo->GetLoadingDocument(getter_AddRefs(doc));

View File

@ -178,7 +178,8 @@ bool HttpChannelParent::Init(const HttpChannelCreationArgs& aArgs) {
a.handleFetchEventStart(), a.handleFetchEventEnd(),
a.forceMainDocumentChannel(), a.navigationStartTimeStamp(),
a.earlyHintPreloaderId(), a.classicScriptHintCharset(),
a.documentCharacterSet(), a.isUserAgentHeaderModified());
a.documentCharacterSet(), a.isUserAgentHeaderModified(),
a.initiatorType());
}
case HttpChannelCreationArgs::THttpChannelConnectArgs: {
const HttpChannelConnectArgs& cArgs = aArgs.get_HttpChannelConnectArgs();
@ -446,7 +447,7 @@ bool HttpChannelParent::DoAsyncOpen(
const uint64_t& aEarlyHintPreloaderId,
const nsAString& aClassicScriptHintCharset,
const nsAString& aDocumentCharacterSet,
const bool& aIsUserAgentHeaderModified) {
const bool& aIsUserAgentHeaderModified, const nsString& aInitiatorType) {
MOZ_ASSERT(aURI, "aURI should not be NULL");
if (aEarlyHintPreloaderId) {
@ -582,6 +583,8 @@ bool HttpChannelParent::DoAsyncOpen(
httpChannel->SetIsUserAgentHeaderModified(aIsUserAgentHeaderModified);
httpChannel->SetInitiatorType(aInitiatorType);
RefPtr<ParentChannelListener> parentListener = new ParentChannelListener(
this, mBrowserParent ? mBrowserParent->GetBrowsingContext() : nullptr);

View File

@ -172,7 +172,7 @@ class HttpChannelParent final : public nsIInterfaceRequestor,
const uint64_t& aEarlyHintPreloaderId,
const nsAString& aClassicScriptHintCharset,
const nsAString& aDocumentCharacterSet,
const bool& aIsUserAgentHeaderModified);
const bool& aIsUserAgentHeaderModified, const nsString& aInitiatorType);
virtual mozilla::ipc::IPCResult RecvSetPriority(
const int16_t& priority) override;