Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  test_imagebitmap_error_messages.html   Sprache: HTML

 

 products/Sources/formale Sprachen/C/Firefox/dom/canvas/test/test_imagebitmap_error_messages.html


<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Bug 2003863 - createImageBitmap rejection messages</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
</head>
<body>
<script>
"use strict";

SimpleTest.waitForExplicitFinish();

async function expectInvalidStateMessage(promise, expectedSubstring, label) {
  try {
    await promise;
    ok(false, `${label}: expected rejection, got resolution`);
  } catch (e) {
    is(e.name, "InvalidStateError", `${label}: error name`);
    ok(
      typeof e.message === "string" && e.message.includes(expectedSubstring),
      `${label}: message should include "${expectedSubstring}" (got: "${e.message}")`
    );
  }
}

async function run() {
  // HTMLImageElement that has no source data. Per HTML, an <img> with no src
  // is "complete", so this exercises the GetSurfaceFromElement no-surface
  // path rather than the !Complete() branch.
  await expectInvalidStateMessage(
    createImageBitmap(new Image()),
    "could not be decoded",
    "HTMLImageElement, no source"
  );

  // HTMLVideoElement with no src (NETWORK_EMPTY).
  await expectInvalidStateMessage(
    createImageBitmap(document.createElement("video")),
    "has not loaded any data",
    "HTMLVideoElement, NETWORK_EMPTY"
  );

  // <canvas> with width 0.
  {
    const canvas = document.createElement("canvas");
    canvas.width = 0;
    canvas.height = 10;
    await expectInvalidStateMessage(
      createImageBitmap(canvas),
      "width 0",
      "HTMLCanvasElement, width 0"
    );
  }

  // <canvas> with height 0.
  {
    const canvas = document.createElement("canvas");
    canvas.width = 10;
    canvas.height = 0;
    await expectInvalidStateMessage(
      createImageBitmap(canvas),
      "height 0",
      "HTMLCanvasElement, height 0"
    );
  }

  // Closed (detached) ImageBitmap.
  {
    const canvas = document.createElement("canvas");
    canvas.width = 10;
    canvas.height = 10;
    const bitmap = await createImageBitmap(canvas);
    bitmap.close();
    await expectInvalidStateMessage(
      createImageBitmap(bitmap),
      "closed or transferred",
      "Detached ImageBitmap"
    );
  }

  // Blob whose contents cannot be decoded as an image (Jake's headline case
  // from bug 2003863 comment 0).
  await expectInvalidStateMessage(
    createImageBitmap(new Blob(["YO"])),
    "could not be decoded",
    "Undecodable Blob"
  );

  SimpleTest.finish();
}

run();
</script>
</body>
</html>

Messung V0.5 in Prozent
C=100 H=100 G=100

¤ Dauer der Verarbeitung: 0.7 Sekunden  (vorverarbeitet am  2026-09-29) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1126864
#Domains=1897691