Skip to content
Commit 621c6059 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Chromium LUCI CQ
Browse files

[ios] Avoid crashing if metadata map is missing some entries

Crashes have been reported in the wild caused by missing entries
in metadata_map when calling SerializeWebStateList(...).

As there is no reproduction steps, change add a workaround in
SessionRestorationServiceImpl where the map is filled with the
metadata for all WebState in the WebStateList. This is done by
introducing WebState::SerializeMetadataToProto(...) to create
the metadata from a WebState, and UpdateMetadataMap(...) which
ensure that the metadata map contains items for all WebStates
in the WebStateList (and only those WebStates).

Call UpdateMetadataMap(...) after loading the data to purge the
metadata for evicted WebStates, and just before serializing the
WebStateList (to ensure there is no crash).

Fixed: 332533665
Change-Id: I04eef6bbb12fc0b17fbe7f78ce6783a5038290ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5419321


Reviewed-by: default avatarMike Dougherty <michaeldo@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1281970}
parent 802f9edb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment