diff --git a/Libraries/LibWeb/StorageAPI/StorageKey.cpp b/Libraries/LibWeb/StorageAPI/StorageKey.cpp index daaa1d9dc79..6b66d28a2d8 100644 --- a/Libraries/LibWeb/StorageAPI/StorageKey.cpp +++ b/Libraries/LibWeb/StorageAPI/StorageKey.cpp @@ -26,6 +26,12 @@ Optional obtain_a_storage_key(HTML::Environment const& environment) return key; } +StorageKey obtain_a_storage_key_for_non_storage_purposes(URL::Origin const& origin) +{ + // NOTE: This function exists as there are cases where we don't have the full environment object, but we still need to obtain a storage key. + return { origin }; +} + // https://storage.spec.whatwg.org/#obtain-a-storage-key-for-non-storage-purposes StorageKey obtain_a_storage_key_for_non_storage_purposes(HTML::Environment const& environment) { diff --git a/Libraries/LibWeb/StorageAPI/StorageKey.h b/Libraries/LibWeb/StorageAPI/StorageKey.h index edcfbefa64b..c58243ce780 100644 --- a/Libraries/LibWeb/StorageAPI/StorageKey.h +++ b/Libraries/LibWeb/StorageAPI/StorageKey.h @@ -30,6 +30,7 @@ struct StorageKey { }; Optional obtain_a_storage_key(HTML::Environment const&); +StorageKey obtain_a_storage_key_for_non_storage_purposes(URL::Origin const&); StorageKey obtain_a_storage_key_for_non_storage_purposes(HTML::Environment const&); }