Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3b45c0a014e66a261fa7937747a44dce01589f4f
      
https://github.com/WebKit/WebKit/commit/3b45c0a014e66a261fa7937747a44dce01589f4f
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-08-09 (Sun, 09 Aug 2026)

  Changed paths:
    M LayoutTests/webaudio/convolver-setBuffer-null-expected.txt
    M LayoutTests/webaudio/convolver-setBuffer-null.html
    M Source/WebCore/Modules/webaudio/ConvolverNode.cpp

  Log Message:
  -----------
  Setting ConvolverNode.buffer to null does not release the impulse response
https://bugs.webkit.org/show_bug.cgi?id=321384
rdar://184434803

Reviewed by Chris Dumez.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

setBufferForBindings() returned early on a null buffer without touching m_reverb
or m_buffer, so assigning null left the node fully configured with the previous
impulse response. Two consequences: the attribute stopped round-tripping, since
bufferForBindings() returns m_buffer and ConvolverNode.idl declares a plain
nullable attribute with no custom setter, so conv.buffer = ir followed by
conv.buffer = null still returned ir; and process() only zeroes its output when
m_reverb is null, so the stale response kept convolving indefinitely. tailTime()
and latencyTime() likewise kept reporting the old response length, holding the
node in tail processing.

The early return predates 2012; 103415@main only removed the adjacent
ASSERT(buffer) that fired on it, leaving the clearing unimplemented. Clear
m_reverb and m_buffer under m_processLock instead, which is the lock both are
guarded by. The graph lock the non-null path takes is not needed here, since
nothing propagates a channel count on this path.

The output channel count is deliberately left alone. It was propagated
downstream when the response was set, and checkNumberOfChannelsForInput()
already leaves it untouched while m_buffer is null, so resetting it would
reconfigure downstream nodes with no basis in the specification.

Also remove the null check guarding the channel-count propagation in the
non-null path, which the early return above made unreachable as false.

The existing webaudio/convolver-setBuffer-null.html only set null on a fresh
convolver, where m_buffer is already null, so it passed throughout. Convert it
from js-test-pre.js to testharness.js so it runs in other engines, and extend it
to cover the round-trip after a response is set and an offline render that must
be silent afterwards. The render assertion is exact rather than thresholded,
because the fixed path zeroes the bus without running the FFT. A companion
assertion checks that a convolver with a response renders non-silent, so the
silence check cannot pass for the wrong reason.

* LayoutTests/webaudio/convolver-setBuffer-null-expected.txt:
* LayoutTests/webaudio/convolver-setBuffer-null.html:
* Source/WebCore/Modules/webaudio/ConvolverNode.cpp:
(WebCore::ConvolverNode::setBufferForBindings):

Canonical link: https://commits.webkit.org/318870@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to