neogeographica / singleplayer_scripts

Linux desktop and browser integration for SP Quake.
3 stars 0 forks source link

in V2 Chrome extension, need to call revokeObjectURL? #38

Open neogeographica opened 1 year ago

neogeographica commented 1 year ago

The old V2 extension (and perhaps the Firefox extension if I base that on V2) uses createObjectURL to download the blob. I'm not sure when/if the created URL (and therefore its referenced blob) will get garbage collected; documentation says "when the document is unloaded" but I'm not sure what that is in the case of this extension's background.js script.

I could explicitly call revokeObjectURL if needed, although not until I'm sure that it's unused/unreferenced. I guess that would be in the handleDownloadChanged callback in the same spot as clearing status and re-enabling the context menu.

It may be that the current garbage collecting behavior is fine though. Need to check.

neogeographica commented 1 year ago

Probably fine with non-persistent page.

If the page needed to be persistent, we could call revokeObjectURL when the handleDownloadChanged handler detects that the download is complete.