mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
b005b82248
This patch adds fetchpriority support for `<link rel=preload as=image>` and equivalent HTTP Link header. The fetchpriority value is passed from where the link is parsed down to `NewImageChannel` where the priority is initially set. Currently, the default equals PRIORITY_LOW, but is decreased a bit if LOAD_BACKGROUND flag is set (this is always the case for link preload images, see `imgLoader::LoadImage`). Later, the priority can be increased again depending on the category (see `imgRequest::BoostPriority`). In order to minimize the changes, the new calculation is to keep the initial setting to PRIORITY_LOW, adjust it using a new `network.fetchpriority.adjustments.*` preference depending on the fetchpriority attributes, and then preserve further adjustments for LOAD_BACKGROUND and `BoostPriority`. For the default value `fetchpriority=auto`, there is no adjustment i.e. we continue to start with PRIORITY_LOW. `fetchpriority=low/high` are respectively mapped to PRIORITY_LOW/PRIORITY_HIGH which is simple and consistent with the "Image" cases from Google's web.dev article https://web.dev/articles/fetch-priority. These values could of course be revised in the future after more experiments. This change is covered by the following tests below. The expectations is modified to match what is described above (i.e. map to PRIORITY_LOW or PRIORITY_HIGH with adjustment due to LOAD_BACKGROUND): - `link-initial-preload-image.h2.html` - `link-dynamic-preload-image.h2.html` - `kPipeHeaderPreloadImageLinks` Based on a patch by Mirko Brodesser (mbrodesser@igalia.com) Differential Revision: https://phabricator.services.mozilla.com/D197493 |
||
---|---|---|
.. | ||
gtest | ||
FetchPreloader.cpp | ||
FetchPreloader.h | ||
moz.build | ||
PreloaderBase.cpp | ||
PreloaderBase.h | ||
PreloadHashKey.cpp | ||
PreloadHashKey.h | ||
PreloadService.cpp | ||
PreloadService.h |