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

Depends on D221957

Differential Revision: https://phabricator.services.mozilla.com/D221958
This commit is contained in:
Valentin Gosu
2024-09-24 12:29:08 +00:00
parent 7b36a93327
commit ebbb22fc8b
4 changed files with 22 additions and 3 deletions

View File

@@ -733,11 +733,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>).
@@ -752,6 +752,10 @@ static void AdjustPriorityAndClassOfServiceForLinkPreloadScripts(
adjustedPriority);
#endif
}
if (nsCOMPtr<nsIClassOfService> cos = do_QueryInterface(aChannel)) {
cos->SetFetchPriorityDOM(fetchPriority);
}
}
void AdjustPriorityForNonLinkPreloadScripts(nsIChannel* aChannel,
@@ -762,10 +766,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
@@ -801,6 +805,9 @@ void AdjustPriorityForNonLinkPreloadScripts(nsIChannel* aChannel,
#endif
}
}
if (nsCOMPtr<nsIClassOfService> cos = do_QueryInterface(aChannel)) {
cos->SetFetchPriorityDOM(fetchPriority);
}
}
// static