processing / processing/p5.js

[p5.js 2.0+ Bug Report]: Blob URLs created by p5.File._load() for video/audio files are never revoked

Open
#9,134 10 comments 0 reactions 1 assignee View on GitHub

@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:
  1. Create a File representing a video or audio file.
  2. Pass the file to p5.File._load(), which creates an object URL and exposes it through file.data.
  3. Pass file.data to createImg(), then call img.remove(). Observe that URL.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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.