Bug 1900561 - Set nsIClassOfService::fetchPriority where callers use nsISupportsPriority.adjustPriority r=acreskey

Differential Revision: https://phabricator.services.mozilla.com/D221958
This commit is contained in:
Valentin Gosu
2024-09-19 10:24:22 +00:00
parent 9760236c83
commit 86dd18c852
4 changed files with 22 additions and 3 deletions

View File

@@ -717,11 +717,11 @@ static void AdjustPriorityAndClassOfServiceForLinkPreloadScripts(
return;
}
const auto fetchPriority = ToFetchPriority(aRequest->FetchPriority());
if (nsCOMPtr<nsISupportsPriority> supportsPriority =
do_QueryInterface(aChannel)) {
LOG(("Is <link rel=[module]preload"));
const auto fetchPriority = ToFetchPriority(aRequest->FetchPriority());
// The spec defines the priority to be set in an implementation defined
// manner (<https://fetch.spec.whatwg.org/#concept-fetch>, step 15 and
// <https://html.spec.whatwg.org/#concept-script-fetch-options-fetch-priority>).
@@ -736,6 +736,10 @@ static void AdjustPriorityAndClassOfServiceForLinkPreloadScripts(
adjustedPriority);
#endif
}
if (nsCOMPtr<nsIClassOfService> cos = do_QueryInterface(aChannel)) {
cos->SetFetchPriorityDOM(fetchPriority);
}
}
void AdjustPriorityForNonLinkPreloadScripts(nsIChannel* aChannel,
@@ -746,10 +750,10 @@ void AdjustPriorityForNonLinkPreloadScripts(nsIChannel* aChannel,
return;
}
const auto fetchPriority = ToFetchPriority(aRequest->FetchPriority());
if (nsCOMPtr<nsISupportsPriority> supportsPriority =
do_QueryInterface(aChannel)) {
LOG(("Is not <link rel=[module]preload"));
const auto fetchPriority = ToFetchPriority(aRequest->FetchPriority());
// The spec defines the priority to be set in an implementation defined
// manner (<https://fetch.spec.whatwg.org/#concept-fetch>, step 15 and
@@ -785,6 +789,9 @@ void AdjustPriorityForNonLinkPreloadScripts(nsIChannel* aChannel,
#endif
}
}
if (nsCOMPtr<nsIClassOfService> cos = do_QueryInterface(aChannel)) {
cos->SetFetchPriorityDOM(fetchPriority);
}
}
// static