Files
sousa-gecko/testing/web-platform/tests/webrtc/RTCError.html
T
Jan-Ivar Bruaroey 0b8a7f8fdb Bug 2039474 [wpt PR 59869] - WebRTC: adjust Interop 2026 subtest selection in four tests, a=testonly
Automatic update from web-platform-tests
WebRTC: scope Interop 2026 subtests in four tests (#59869)

Scope these subtests by inserting/removing `if (rest)` / `if (interop2026)`
guards in place around the existing subtest bodies — no subtest body is
moved, reordered, or reindented:

* webrtc/RTCConfiguration-iceServers.html: scope `with invalid turn url
  should throw SyntaxError` to interop-2026 (the `config_test` helper
  generates both the `new RTCPeerConnection(config) - ...` and
  `setConfiguration(config) - ...` subtests).
* webrtc/RTCError.html: scope `RTCError httpRequestStatusCode should not
  be supported.` to interop-2026.
* webrtc/RTCRtpParameters-codec.html: scope `Stats output-rtp should
  match the selected codec in simulcast usecase on a video sender` to
  interop-2026.
* webrtc/RTCSctpTransport-maxChannels.html: scope `Sctp transport has
  null maxChannels and maxMessageSize in have-local-offer` and `... in
  have-remote-offer` to rest only.

Part of Interop 2026 WebRTC focus area scoping; see
https://github.com/w3c/webrtc-pc/issues/3100. No `<meta name="variant">`
declarations are changed, so URLs as seen on wpt.fyi remain stable.
--

wpt-commits: 1d51a07a56b08957df1469f34359e96db3de2bcf
wpt-pr: 59869
2026-06-02 10:25:31 +00:00

99 lines
3.3 KiB
HTML

<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?interop-2026">
<meta name="variant" content="?rest">
<title>RTCError and RTCErrorInit</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="RTCPeerConnection-helper.js"></script>
<script>
'use strict';
const rest = !new URLSearchParams(location.search).has("interop-2026");
const interop2026 = !new URLSearchParams(location.search).has("rest");
if (interop2026) {
test(() => {
const error = new RTCError({errorDetail:'data-channel-failure'}, 'message');
assert_equals(error.message, 'message');
assert_equals(error.errorDetail, 'data-channel-failure');
}, 'RTCError constructor with errorDetail and message');
test(() => {
const error = new RTCError({errorDetail:'data-channel-failure'});
assert_equals(error.message, '');
}, 'RTCError constructor\'s message argument is optional');
test(() => {
assert_throws_js(TypeError, () => {
new RTCError();
});
assert_throws_js(TypeError, () => {
new RTCError({}); // {errorDetail} is missing.
});
}, 'RTCError constructor throws TypeError if arguments are missing');
test(() => {
assert_throws_js(TypeError, () => {
new RTCError({errorDetail:'invalid-error-detail'}, 'message');
});
}, 'RTCError constructor throws TypeError if the errorDetail is invalid');
test(() => {
const error = new RTCError({errorDetail:'data-channel-failure'}, 'message');
assert_equals(error.name, 'OperationError');
}, 'RTCError.name is \'OperationError\'');
test(() => {
const error = new RTCError({errorDetail:'data-channel-failure'}, 'message');
assert_equals(error.code, 0);
}, 'RTCError.code is 0');
test(() => {
const error = new RTCError({errorDetail:'data-channel-failure'}, 'message');
assert_throws_js(TypeError, () => {
error.errorDetail = 'dtls-failure';
});
}, 'RTCError.errorDetail is readonly.');
test(() => {
// Infers what are valid RTCErrorInit objects by passing them to the RTCError
// constructor.
assert_throws_js(TypeError, () => {
new RTCError({}, 'message');
});
new RTCError({errorDetail:'data-channel-failure'}, 'message');
}, 'RTCErrorInit.errorDetail is the only required attribute');
// All of these are number types (long or unsigned long).
const nullableAttributes = ['sdpLineNumber',
'sctpCauseCode',
'receivedAlert',
'sentAlert'];
nullableAttributes.forEach(attribute => {
test(() => {
const error = new RTCError({errorDetail:'data-channel-failure'}, 'message');
assert_equals(error[attribute], null);
}, 'RTCError.' + attribute + ' is null by default');
test(() => {
const error = new RTCError(
{errorDetail:'data-channel-failure', [attribute]: 0}, 'message');
assert_equals(error[attribute], 0);
}, 'RTCError.' + attribute + ' is settable by constructor');
test(() => {
const error = new RTCError({errorDetail:'data-channel-failure'}, 'message');
assert_throws_js(TypeError, () => {
error[attribute] = 42;
});
}, 'RTCError.' + attribute + ' is readonly');
});
test(function() {
assert_false("httpRequestStatusCode" in RTCError.prototype,
"Should not be supported on the prototype");
}, "RTCError httpRequestStatusCode should not be supported.");
}
</script>