blob: c0babe9618935fa4e9cf74af95abf45414954e2a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const defer = require("devtools/shared/defer");
function testResolve() {
const deferred = defer();
deferred.resolve("success");
return deferred.promise;
}
function testReject() {
const deferred = defer();
deferred.reject("error");
return deferred.promise;
}
add_task(function* () {
const success = yield testResolve();
equal(success, "success");
let error;
try {
yield testReject();
} catch (e) {
error = e;
}
equal(error, "error");
});
|