Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/tests/non262/Promise/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1012 B image not shown  

Quelle  self-resolve.js

  Sprache: JAVA
 

// |reftest| skip-if(!xulRuntime.shell) -- needs drainJobQueue

// Resolve Promise with itself by directly calling the "Promise Resolve Function".
let resolve;
let promise = new Promise(function(x) { resolve = x; });
resolve(promise)

let results = [];
promise.then(res => assertEq(truefalse"not reached")).catch(res => {
    assertEq(res instanceof TypeError, true);
    results.push("rejected");
});

drainJobQueue()

assertEq(results.length, 1);
assertEq(results[0], "rejected");


// Resolve Promise with itself when the "Promise Resolve Function" is called
// from (the fast path in) PromiseReactionJob.
results = [];

promise = new Promise(x => { resolve = x; });
let promise2 = promise.then(() => promise2);

promise2.then(() => assertEq(truefalse"not reached"), res => {
    assertEq(res instanceof TypeError, true);
    results.push("rejected");
});

resolve();

drainJobQueue();

assertEq(results.length, 1);
assertEq(results[0], "rejected");


this.reportCompare && reportCompare(00"ok");

Messung V0.5 in Prozent
C=92 H=94 G=92

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-06-04) ¤

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