Skip to content

Commit 2d18092

Browse files
padenotmoz-wptsync-bot
authored andcommitted
Add a WPT to check that having two parameters with the same name in parameterDescriptors throws.
Differential Revision: https://phabricator.services.mozilla.com/D66383 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1565464 gecko-commit: af901d3bf5a584466557298cd5c038c0abfafd93 gecko-integration-branch: autoland gecko-reviewers: karlt
1 parent 0b02797 commit 2d18092

File tree

1 file changed

+43
-9
lines changed

1 file changed

+43
-9
lines changed

webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam-iterable.https.html

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,48 @@
7979
// Test a processor that has a get parameterDescriptors, but it returns
8080
// something that is not iterable.
8181
try {
82-
registerProcessor("invalid",
83-
class InvalidParamProcessor extends AudioWorkletProcessor {
84-
static get parameterDescriptors() {
85-
return 4;
86-
}
87-
constructor() { super(); }
88-
process() { }
89-
});
90-
throw "This should not have been reached.";
82+
registerProcessor("invalid",
83+
class InvalidParamProcessor extends AudioWorkletProcessor {
84+
static get parameterDescriptors() {
85+
return 4;
86+
}
87+
constructor() { super(); }
88+
process() { }
89+
});
90+
throw "This should not have been reached.";
9191
} catch (e) {
9292
// unclear how to signal success here, but we can signal failure in the
9393
// developer console
9494
if (e.name != "TypeError") {
9595
throw "This should be TypeError";
9696
}
9797
}
98+
// Test a processor that has a get parameterDescriptors, with a duplicate
99+
// param name something that is not iterable.
100+
try {
101+
registerProcessor("duplicate-param-name",
102+
class DuplicateParamProcessor extends AudioWorkletProcessor {
103+
static get parameterDescriptors() {
104+
var p = {
105+
name: "a",
106+
defaultValue: 1,
107+
minValue: 0,
108+
maxValue: 1,
109+
automationRate: "k-rate",
110+
};
111+
return [p,p];
112+
}
113+
constructor() { super(); }
114+
process() { }
115+
});
116+
throw "This should not have been reached.";
117+
} catch (e) {
118+
// unclear how to signal success here, but we can signal failure in the
119+
// developer console
120+
if (e.name != "NotSupportedError") {
121+
throw "This should be NotSupportedError";
122+
}
123+
}
98124
// Test a processor that has a no get parameterDescriptors.
99125
try {
100126
registerProcessor("no-params",
@@ -163,6 +189,14 @@
163189
new AudioWorkletNode(ac, "no-params");
164190
}, `Attempting to create an AudioWorkletNode from a processor
165191
that does not have a parameterDescriptors getter should work`);
192+
})
193+
.then(function() {
194+
test(function() {
195+
assert_throws_dom("InvalidStateError", function() {
196+
new AudioWorkletNode(ac, "duplicate-param-name");
197+
});
198+
}, `Attempting to create an AudioWorkletNode with two parameter
199+
descriptor with the same name should not work`);
166200
}).then(function() {
167201
done();
168202
});

0 commit comments

Comments
 (0)