servo/components/shared
Sebastian C 27c8a899ea
Replace hsts preload list hashmap with an FST (#37015)
This reduces the memory used by the preload list to just 1.9MB. The
total memory savings in HSTS from
pre-103cbed928
is now 62MB, or 96%. And in terms of total resident memory is a 7.5%
reduction. The DAFSA/DAWG used by Firefox is 1.1MB so there could be
additional gains available but this seems like the best option based on
maintained libraries available (I could not find a good maintained
library for DAFSAs in Rust).

The main trick is this: the FST map API is currently designed to map
byte sequences to u64 values. Because we only need to determine if a
preloaded domain has the `includeSubdomains` flag set, we encode that
into the lowest bit of the ids in the map. This way finding an entry in
the map directly provides us with the `includeSubdomains` flag and we
don't need to keep another mapping in memory or on disk.

Updated the `./mach update-hsts-preload` command to generate the new FST
map file. (Not sure if I need to update any dev-dependencies anywhere
for this change)

This change also replaces the use of "mozilla.org" with "example.com" in
the HSTS unit tests to make sure that entries in the preload list do not
influence the tests (since example.com should not ever end up on the
preload list)

Testing: Updated unit tests
Fixes: #25929

---------

Signed-off-by: Sebastian C <sebsebmc@gmail.com>
2025-05-20 04:26:55 +00:00
..
background_hang_monitor script: add skeleton implementation of FontFace API (#35262) 2025-02-19 05:50:01 +00:00
base Reduce indexing boilerplate for serializable/transferrable objects. (#36624) 2025-04-22 02:02:02 +00:00
bluetooth Include WebViewId into EmbedderMsg variants where possible (#35211) 2025-01-30 11:15:35 +00:00
canvas Introduce snapshot concept of canvas (#36119) 2025-04-23 07:32:47 +00:00
compositing Implement wheel action in webdriver (#36744) 2025-05-07 08:41:34 +00:00
constellation Propagate destination through load_data (#37020) 2025-05-17 08:22:11 +00:00
devtools devtools: Allow highlighting elements from the inspector (#35822) 2025-05-05 10:10:25 +00:00
embedder Replace hsts preload list hashmap with an FST (#37015) 2025-05-20 04:26:55 +00:00
fonts Update rustfmt to the 2024 style edition (#35764) 2025-03-03 11:26:53 +00:00
net Add memory reporting for public suffix list (#37049) 2025-05-19 18:50:22 +00:00
profile Remove layout-2013 profiling categories (#37014) 2025-05-15 16:54:02 +00:00
script libservo: Allow embedders to execute JavaScript scripts via the API (#35720) 2025-05-13 12:54:18 +00:00
script_layout svg: Add mock SVGImageElement interface (#36975) 2025-05-13 10:43:10 +00:00
snapshot Introduce snapshot concept of canvas (#36119) 2025-04-23 07:32:47 +00:00
webgpu Introduce snapshot concept of canvas (#36119) 2025-04-23 07:32:47 +00:00
webxr libservo: Move EventLooperWaker from webxr_traits to embedder_traits (#36420) 2025-04-09 14:19:33 +00:00