Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/testing/web-platform/tests/webrtc/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 3 kB image not shown  

Quelle  RTCError.html   Sprache: HTML

 
 products/Sources/formale Sprachen/C/Firefox/testing/web-platform/tests/webrtc/RTCError.html


<!doctype html>
<meta charset=utf-8>
<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';

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>

Messung V0.5
C=91 H=99 G=94

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.