Closed shaoormunir closed 1 month ago
This has the potential to be quite large (10MB or more per domain). I think we should limit each value to the first X bytes (for some value of X) and/or exclude large base64 pieces of data (which could be encoded pictures).
WDYT?
@tunetheweb I agree with the size issue, will add a few size and length constraints while storing values.
Any update @shaoormunir as we have one week to get this reviewed and merged and have a growing queue of other metrics too.
@tunetheweb updated to only store the first 256 bytes for each local and session storage item
As discussed in https://github.com/HTTPArchive/custom-metrics/pull/124#issuecomment-2155352026 we should remove the number of calls.
I'm also questioning the value of the local and session storage data. Even with the 256 cap, it still can be quite big looking at the CNN example for example. That makes every single call for custom metrics, or payloads bigger, slower, and more expensive for every single user of the HTTP Archive. Do we have concrete plans for this data to justify that?
Closing due to inactivity but feel free to reopen if you're able to address the feedback
This PR adds a new custom metric to capture and return all key-value pairs from
localStorage
andsessionStorage
of the first-party website.Changes
getLocalStorageKeyValues
function to retrieve all key-value pairs from localStorage.getSessionStorageKeyValues
function to retrieve all key-value pairs from sessionStorage.storageData
to return for storage.Testing was done on the
webpagetest.org.
Test websites: