Bug 1801582 - Fix fetch and font preloads not getting deduplicated r=necko-reviewers,kershaw

Differential Revision: https://phabricator.services.mozilla.com/D173532
This commit is contained in:
Manuel Bucher 2023-03-28 09:42:35 +00:00
parent fefd92b8e9
commit 5807a30612
2 changed files with 6 additions and 10 deletions

View File

@ -1,6 +0,0 @@
[link-header-preload.html]
expected:
if not debug: OK
CRASH
[Makes sure that Link headers preload resources]
expected: FAIL

View File

@ -219,8 +219,9 @@ void PreloadService::PreloadFont(nsIURI* aURI, const nsAString& aCrossOrigin,
CORSMode cors = dom::Element::StringToCORSMode(aCrossOrigin);
auto key = PreloadHashKey::CreateAsFont(aURI, cors);
// * Bug 1618549: Depending on where we decide to do the deduplication, we may
// want to check if the font is already being preloaded here.
if (PreloadExists(key)) {
return;
}
RefPtr<FontPreloader> preloader = new FontPreloader();
dom::ReferrerPolicy referrerPolicy = PreloadReferrerPolicy(aReferrerPolicy);
@ -234,8 +235,9 @@ void PreloadService::PreloadFetch(nsIURI* aURI, const nsAString& aCrossOrigin,
CORSMode cors = dom::Element::StringToCORSMode(aCrossOrigin);
auto key = PreloadHashKey::CreateAsFetch(aURI, cors);
// * Bug 1618549: Depending on where we decide to do the deduplication, we may
// want to check if a fetch is already being preloaded here.
if (PreloadExists(key)) {
return;
}
RefPtr<FetchPreloader> preloader = new FetchPreloader();
dom::ReferrerPolicy referrerPolicy = PreloadReferrerPolicy(aReferrerPolicy);