blob: af414735f09ce2fe69509d4de6e6a6bc6c8a1156 (
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
33
34
35
|
"use strict";
const { AddonTestUtils } = ChromeUtils.importESModule(
"resource://testing-common/AddonTestUtils.sys.mjs"
);
AddonTestUtils.init(this);
AddonTestUtils.createAppInfo(
"xpcshell@tests.mozilla.org",
"XPCShell",
"42",
"42"
);
add_task(async function helper() {
do_get_profile();
// The SearchService is also needed in order to construct the initial state,
// which means that the AddonManager needs to be available.
await AddonTestUtils.promiseStartupManager();
// The example.com domain will be used to host the dynamic layout JSON and
// the top stories JSON.
let server = AddonTestUtils.createHttpServer({ hosts: ["example.com"] });
server.registerDirectory("/", do_get_cwd());
Assert.equal(true, fetch instanceof Function);
var k = await fetch("http://example.com/");
console.log(k);
console.log(k.body);
var r = k.body.getReader();
console.log(r);
var v = await r.read();
console.log(v);
});
|