Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/widget/tests/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  test_clipboard_owner_chrome.html

  Sprache: HTML
 

 products/Sources/formale Sprachen/C/Firefox/widget/tests/test_clipboard_owner_chrome.html


<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1812078
-->

<head>
<title>Test for Bug 1812078</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script src="clipboard_helper.js"></script>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
<script class="testbody" type="application/javascript">

function testClipboardOwner(aClipboardType, aAsync) {
  let losingOwnership = false;
  const clipboardOwner = {
    QueryInterface: ChromeUtils.generateQI(["nsIClipboardOwner"]),
    // nsIClipboardOwner
    LosingOwnership() {
      losingOwnership = true;
    },
  };

  add_task(function test_clipboard_owner() {
    info(`Test clipboard owner for type ${aClipboardType} ${aAsync ? "async" : ""}`);

    // Setup clipboard owner.
    writeRandomStringToClipboard("text/plain", aClipboardType, clipboardOwner, aAsync);

    // Test should not lose ownership.
    clipboardTypes.forEach(function(otherType) {
      losingOwnership = false;
      if (aClipboardType != otherType && clipboard.isClipboardTypeSupported(otherType)) {
        // Test setting clipboard data.
        writeRandomStringToClipboard("text/plain", otherType);
        ok(!losingOwnership, `Should not lose ownership while setting data to type ${otherType}`);

        // Test async setting clipboard data.
        writeRandomStringToClipboard("text/plain", otherType, null, true);
        ok(!losingOwnership, `Should not lose ownership while async setting data to type ${otherType}`);
      }
    });

    // Test whether should lose ownership.
    losingOwnership = false;
    writeRandomStringToClipboard("text/plain", aClipboardType, clipboardOwner);
    ok(losingOwnership, `Should lose ownership while setting data to type ${aClipboardType}`);

    losingOwnership = false;
    writeRandomStringToClipboard("text/plain", aClipboardType, null, true);
    ok(losingOwnership, `Should lose ownership while async setting data to type ${aClipboardType}`);

    // Clean clipboard data.
    cleanupAllClipboard();
  });
}

/** Test for Bug 1812078 */
clipboardTypes.forEach(function(testType) {
  if (clipboard.isClipboardTypeSupported(testType)) {
    // Test sync set clipboard data.
    testClipboardOwner(testType, false);

    // Test async set clipboard data.
    testClipboardOwner(testType, true);
  }
});

</script>
</body>
</html>

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

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet am  2026-06-05) ¤

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