Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/tests/non262/Promise/   (Browser von der Mozilla Stiftung 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(0, 0, "ok");

Messung V0.5
C=90 H=100 G=95

¤ Dauer der Verarbeitung: 0.0 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.