Used to know when nodes are GC’d and can be removed from the graph
On allocation, each node is assigned an ID that is accessible via a ChromeOnly property
When a node is reclaimed, a ChromeOnly event is fired that says the ID of the reclaimed node
Technical Solutions
CallWatcher can be reimplemented in a content script
Tom (see Mozilla Support Staff) is working on formalizing this sort of thing in a new web extension API
Finalization
Use TC39 WeakRef and Finalizer API
Native implementation maybe not ready by the time we want to remove the Web Audio tool
But there is a working polyfill! Till Schneidereit has it
In a content script:
assign each newly allocated audio node an ID
set a finalizer for that node that uses this ID as its holdings
when the node is reclaimed, the finalizer runs with the ID holdings, which we postMessage (or whatever messaging API content scripts have) the ID up to the web extension itself, so it can clean up