Bug 1596594 close MessagePort after 'recordfinished' is sent r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 15 Nov 2019 13:26:23 +0000
changeset 502352 06248120ae60f264025c41a0cf6c62967b659b34
parent 502351 48577632f4b3af48fc3a29b85d395d5e50ce9357
child 502353 7553b88698cb6552427de9638bbb63c5776495a5
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1596594
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1596594 close MessagePort after 'recordfinished' is sent r=padenot so that 'recordfinished' is not sent again. Additional messages posted are dropped without error. `close()`ing to disentangle the MessagePort is also good practice as it allows GC of otherwise unused objects. Differential Revision: https://phabricator.services.mozilla.com/D53100
testing/web-platform/tests/webaudio/js/worklet-recorder.js
--- a/testing/web-platform/tests/webaudio/js/worklet-recorder.js
+++ b/testing/web-platform/tests/webaudio/js/worklet-recorder.js
@@ -25,16 +25,17 @@ class RecorderProcessor extends AudioWor
   }
 
   process(inputs, outputs) {
     if (this._recordBufferLength <= currentFrame) {
       this.port.postMessage({
         type: 'recordfinished',
         recordBuffer: this._recordBuffer
       });
+      this.port.close();
       return false;
     }
 
     // Records the incoming data from |inputs| and also bypasses the data to
     // |outputs|.
     const input = inputs[0];
     const output = outputs[0];
     for (let channel = 0; channel < input.length; ++channel) {