[web] Preload encrypted media
Summary:
Resolves ENG-3679.
Used fetch to preload encrypted media. The current preloadImage function used to preload them by creating a dummy <img /> element and setting the src property, which was not suitable for encrypted media.
The introduced function in fact preloads any request, including images, but I left the original because browser might have some optimizations for images. Also it is used in other places in the codebase e.g. to get the dimensions.
Test Plan:
Entered an encrypted media chat and selected a photo to send. Observed the Dev Tools Network tab to see that the encrypted media was preloaded:
Note the two subsequent requests to b281...3d58. The first one is sent from the preload function (media-utils.js, 251ms), while the other is read from disk-cache. Remember to uncheck the "Disable cache" option in devtools.
Reviewers: atul, ashoat
Reviewed By: ashoat
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D8050