blob: 3ac0f28bd7cd314723152d9f641c6ca39a518de7 (
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("resource://devtools/shared/defer.js");
function testResolve() {
const deferred = defer();
deferred.resolve("success");
return deferred.promise;
}
function testReject() {
const deferred = defer();
deferred.reject("error");
return deferred.promise;
}
add_task(async function () {
const success = await testResolve();
equal(success, "success");
let error;
try {
await testReject();
} catch (e) {
error = e;
}
equal(error, "error");
});
|