summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/dynamic-register-processor.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/dynamic-register-processor.js')
-rw-r--r--testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/dynamic-register-processor.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/dynamic-register-processor.js b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/dynamic-register-processor.js
new file mode 100644
index 0000000000..5e825aebb4
--- /dev/null
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/dynamic-register-processor.js
@@ -0,0 +1,22 @@
+class ProcessorA extends AudioWorkletProcessor {
+ process() {
+ return true;
+ }
+}
+
+// ProcessorB registers ProcessorA upon the construction.
+class ProcessorB extends AudioWorkletProcessor {
+ constructor() {
+ super();
+ this.port.onmessage = () => {
+ registerProcessor('ProcessorA', ProcessorA);
+ this.port.postMessage({});
+ };
+ }
+
+ process() {
+ return true;
+ }
+}
+
+registerProcessor('ProcessorB', ProcessorB);