Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/workers/test/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  fileReaderSyncErrors_worker.js   Sprache: JAVA

 
/**
 * Delegates "is" evaluation back to main thread.
 */

function is(actual, expected, message) {
  var rtnObj = new Object();
  rtnObj.actual = actual;
  rtnObj.expected = expected;
  rtnObj.message = message;
  postMessage(rtnObj);
}

/**
 * Tries to write to property.
 */

function writeProperty(file, property) {
  var oldValue = file[property];
  file[property] = -1;
  is(file[property], oldValue, "Property " + property + " should be readonly.");
}

/**
 * Passes junk arguments to FileReaderSync methods and expects an exception to
 * be thrown.
 */

function fileReaderJunkArgument(blob) {
  var fileReader = new FileReaderSync();

  try {
    fileReader.readAsBinaryString(blob);
    is(
      false,
      true,
      "Should have thrown an exception calling readAsBinaryString."
    );
  } catch (ex) {
    is(truetrue"Should have thrown an exception.");
  }

  try {
    fileReader.readAsDataURL(blob);
    is(falsetrue"Should have thrown an exception calling readAsDataURL.");
  } catch (ex) {
    is(truetrue"Should have thrown an exception.");
  }

  try {
    fileReader.readAsArrayBuffer(blob);
    is(
      false,
      true,
      "Should have thrown an exception calling readAsArrayBuffer."
    );
  } catch (ex) {
    is(truetrue"Should have thrown an exception.");
  }

  try {
    fileReader.readAsText(blob);
    is(falsetrue"Should have thrown an exception calling readAsText.");
  } catch (ex) {
    is(truetrue"Should have thrown an exception.");
  }
}

onmessage = function (event) {
  var file = event.data;

  // Test read only properties.
  writeProperty(file, "size");
  writeProperty(file, "type");
  writeProperty(file, "name");

  // Bad types.
  fileReaderJunkArgument(undefined);
  fileReaderJunkArgument(-1);
  fileReaderJunkArgument(1);
  fileReaderJunkArgument(new Object());
  fileReaderJunkArgument("hello");

  // Post undefined to indicate that testing has finished.
  postMessage(undefined);
};

Messung V0.5
C=92 H=97 G=94

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet)  ¤

*© 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.