Title: [268814] trunk
Revision
268814
Author
cdu...@apple.com
Date
2020-10-21 12:14:42 -0700 (Wed, 21 Oct 2020)

Log Message

MessagePort & MessageEvent should be exposed to AudioWorklets
https://bugs.webkit.org/show_bug.cgi?id=218037

Reviewed by Darin Adler.

Source/WebCore:

MessagePort & MessageEvent should be exposed to AudioWorklets:
- https://html.spec.whatwg.org/#the-messageevent-interface
- https://html.spec.whatwg.org/#message-ports

Test: http/wpt/webaudio/the-audio-api/the-audioworklet-interface/exposed-properties.https.html

* dom/MessageEvent.idl:
* dom/MessagePort.idl:

LayoutTests:

Add layout test coverage.

* http/wpt/webaudio/the-audio-api/the-audioworklet-interface/exposed-properties.https-expected.txt: Added.
* http/wpt/webaudio/the-audio-api/the-audioworklet-interface/exposed-properties.https.html: Added.
* http/wpt/webaudio/the-audio-api/the-audioworklet-interface/processors/exposed-properties-processor.js: Added.
(ExposedPropertiesTestProcessor.prototype.process):
(ExposedPropertiesTestProcessor):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (268813 => 268814)


--- trunk/LayoutTests/ChangeLog	2020-10-21 18:43:33 UTC (rev 268813)
+++ trunk/LayoutTests/ChangeLog	2020-10-21 19:14:42 UTC (rev 268814)
@@ -1,5 +1,20 @@
 2020-10-21  Chris Dumez  <cdu...@apple.com>
 
+        MessagePort & MessageEvent should be exposed to AudioWorklets
+        https://bugs.webkit.org/show_bug.cgi?id=218037
+
+        Reviewed by Darin Adler.
+
+        Add layout test coverage.
+
+        * http/wpt/webaudio/the-audio-api/the-audioworklet-interface/exposed-properties.https-expected.txt: Added.
+        * http/wpt/webaudio/the-audio-api/the-audioworklet-interface/exposed-properties.https.html: Added.
+        * http/wpt/webaudio/the-audio-api/the-audioworklet-interface/processors/exposed-properties-processor.js: Added.
+        (ExposedPropertiesTestProcessor.prototype.process):
+        (ExposedPropertiesTestProcessor):
+
+2020-10-21  Chris Dumez  <cdu...@apple.com>
+
         Make sure WebAudio API throws exceptions with useful error messages
         https://bugs.webkit.org/show_bug.cgi?id=218033
 

Added: trunk/LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/exposed-properties.https-expected.txt (0 => 268814)


--- trunk/LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/exposed-properties.https-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/exposed-properties.https-expected.txt	2020-10-21 19:14:42 UTC (rev 268814)
@@ -0,0 +1,3 @@
+
+PASS Exposed properties
+

Added: trunk/LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/exposed-properties.https.html (0 => 268814)


--- trunk/LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/exposed-properties.https.html	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/exposed-properties.https.html	2020-10-21 19:14:42 UTC (rev 268814)
@@ -0,0 +1,34 @@
+<!doctype html>
+<title>Tests which global properties are exposed to AudioWorklets</title>
+<script src=""
+<script src=""
+<script>
+var context;
+promise_setup(async (t) => {
+  context = new AudioContext();
+  const filePath = 'processors/exposed-properties-processor.js';
+  await context.audioWorklet.addModule(filePath);
+});
+
+const get_exposed_properties = async (node) => {
+  const event = await new Promise((resolve) => {
+    node.port._onmessage_ = resolve;
+  });
+  return event.data.exposed_properties;
+};
+
+promise_test(async (t) => {
+  const options = {
+    numberOfInputs: 0,
+    numberOfOutputs: 1
+  };
+
+  const node = new AudioWorkletNode(context, 'exposed-properties-test', options);
+  const exposed_properties = await get_exposed_properties(node);
+  assert_true(exposed_properties.includes('WorkletGlobalScope'), 'WorkletGlobalScope is exposed');
+  assert_true(exposed_properties.includes('AudioWorkletGlobalScope'), 'AudioWorkletGlobalScope is exposed');
+  assert_true(exposed_properties.includes('AudioWorkletProcessor'), 'AudioWorkletProcessor is exposed');
+  assert_true(exposed_properties.includes('MessagePort'), 'MessagePort is exposed');
+  assert_true(exposed_properties.includes('MessageEvent'), 'MessageEvent is exposed');
+}, 'Exposed properties');
+</script>

Added: trunk/LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/processors/exposed-properties-processor.js (0 => 268814)


--- trunk/LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/processors/exposed-properties-processor.js	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/processors/exposed-properties-processor.js	2020-10-21 19:14:42 UTC (rev 268814)
@@ -0,0 +1,10 @@
+class ExposedPropertiesTestProcessor extends AudioWorkletProcessor {
+  process(inputs, outputs) {
+    this.port.postMessage({
+      exposed_properties: Object.getOwnPropertyNames(globalThis)
+    });
+    return false;
+  }
+}
+
+registerProcessor('exposed-properties-test', ExposedPropertiesTestProcessor);

Modified: trunk/Source/WebCore/ChangeLog (268813 => 268814)


--- trunk/Source/WebCore/ChangeLog	2020-10-21 18:43:33 UTC (rev 268813)
+++ trunk/Source/WebCore/ChangeLog	2020-10-21 19:14:42 UTC (rev 268814)
@@ -1,5 +1,21 @@
 2020-10-21  Chris Dumez  <cdu...@apple.com>
 
+        MessagePort & MessageEvent should be exposed to AudioWorklets
+        https://bugs.webkit.org/show_bug.cgi?id=218037
+
+        Reviewed by Darin Adler.
+
+        MessagePort & MessageEvent should be exposed to AudioWorklets:
+        - https://html.spec.whatwg.org/#the-messageevent-interface
+        - https://html.spec.whatwg.org/#message-ports
+
+        Test: http/wpt/webaudio/the-audio-api/the-audioworklet-interface/exposed-properties.https.html
+
+        * dom/MessageEvent.idl:
+        * dom/MessagePort.idl:
+
+2020-10-21  Chris Dumez  <cdu...@apple.com>
+
         Make sure WebAudio API throws exceptions with useful error messages
         https://bugs.webkit.org/show_bug.cgi?id=218033
 

Modified: trunk/Source/WebCore/dom/MessageEvent.idl (268813 => 268814)


--- trunk/Source/WebCore/dom/MessageEvent.idl	2020-10-21 18:43:33 UTC (rev 268813)
+++ trunk/Source/WebCore/dom/MessageEvent.idl	2020-10-21 19:14:42 UTC (rev 268814)
@@ -33,7 +33,7 @@
 #endif
 
 [
-    Exposed=(Window,Worker),
+    Exposed=(Window,Worker,AudioWorklet),
     JSCustomMarkFunction,
     ReportExtraMemoryCost,
 ] interface MessageEvent : Event {

Modified: trunk/Source/WebCore/dom/MessagePort.idl (268813 => 268814)


--- trunk/Source/WebCore/dom/MessagePort.idl	2020-10-21 18:43:33 UTC (rev 268813)
+++ trunk/Source/WebCore/dom/MessagePort.idl	2020-10-21 19:14:42 UTC (rev 268814)
@@ -27,7 +27,7 @@
 
 [
     ActiveDOMObject,
-    Exposed=(Window,Worker),
+    Exposed=(Window,Worker,AudioWorklet),
     GenerateIsReachable=Impl,
     JSCustomMarkFunction,
 ] interface MessagePort : EventTarget {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to