2014-10-17 19:30:19 +04:00
|
|
|
function run_test()
|
|
|
|
{
|
|
|
|
// Hack around Promise.jsm being stuck on my global
|
2017-12-21 13:08:17 +03:00
|
|
|
Assert.equal(false, PromiseDebugging === undefined);
|
2014-10-17 19:30:19 +04:00
|
|
|
var res;
|
|
|
|
var p = new Promise(function(resolve, reject) { res = resolve });
|
|
|
|
var state = PromiseDebugging.getState(p);
|
2017-12-21 13:08:17 +03:00
|
|
|
Assert.equal(state.state, "pending");
|
2014-10-17 19:30:19 +04:00
|
|
|
|
|
|
|
do_test_pending();
|
|
|
|
|
|
|
|
p.then(function() {
|
|
|
|
var state = PromiseDebugging.getState(p);
|
2017-12-21 13:08:17 +03:00
|
|
|
Assert.equal(state.state, "fulfilled");
|
|
|
|
Assert.equal(state.value, 5);
|
2014-10-17 19:30:19 +04:00
|
|
|
do_test_finished();
|
|
|
|
});
|
|
|
|
|
|
|
|
res(5);
|
|
|
|
}
|