[p5.js 2.0+ Bug Report]: Blob URLs created by p5.File._load() for video/audio files are never revoked
Open
@slash-init is already working on this.
Since Sep 3, 2026.
Area:DOM
Area:IO
p5.js 2.0+
- Dominant language
- JavaScript
- Stars
- 24k
- Forks
- 3.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 25
Description
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- WebGPU
- p5.strands
- Build process
- Unit testing
- Internationalization
- Friendly errors
- Other (specify if possible)
p5.js version
v2.3.1
Web browser and version
firefox 154.0
Operating system
Linux Fedora release 44
Steps to reproduce this
Steps:
- Create a
Filerepresenting a video or audio file. - Pass the file to
p5.File._load(), which creates an object URL and exposes it throughfile.data. - Pass
file.datatocreateImg(), then callimg.remove(). Observe thatURL.revokeObjectURL()is never called for the object URL created by_load().
Snippet:
test('does not revoke the object URL when the created image is removed', async () => {
const blob = new Blob(['fake video'], { type: 'video/mp4' });
const inputFile = new window.File([blob], 'test.mp4', {
type: 'video/mp4'
});
const objectURL = 'blob:test-url';
vi.spyOn(URL, 'createObjectURL').mockReturnValue(objectURL);
const revokeObjectURL = vi.spyOn(URL, 'revokeObjectURL');
let file;
File._load(inputFile, loadedFile => {
file = loadedFile;
});
const img = mockP5Prototype.createImg(file.data, '');
img.remove();
expect(revokeObjectURL).not.toHaveBeenCalled();
});
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.