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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// XXX Remove this when the file is migrated to the new frontend.
/* eslint-disable no-undef */
// See Bug 595223.
const PREF = "devtools.webconsole.persistlog";
const TEST_FILE = "test-network.html";
var hud;
add_task(async function () {
Services.prefs.setBoolPref(PREF, true);
const jar = getJar(getRootDirectory(gTestPath));
const dir = jar
? extractJarToTmp(jar)
: getChromeDir(getResolvedURI(gTestPath));
dir.append(TEST_FILE);
const uri = Services.io.newFileURI(dir);
// Open tab with correct remote type so we don't switch processes when we load
// the file:// URI, otherwise we won't get the same web console.
const remoteType = E10SUtils.getRemoteTypeForURI(
uri.spec,
gMultiProcessBrowser,
gFissionBrowser
);
await loadTab("about:blank", remoteType);
hud = await openConsole();
await clearOutput(hud);
await navigateTo(uri.spec);
await testMessages();
Services.prefs.clearUserPref(PREF);
hud = null;
});
function testMessages() {
return waitForMessagesByType({
webconsole: hud,
messages: [
{
text: "running network console logging tests",
typeSelector: ".console-api",
category: CATEGORY_WEBDEV,
severity: SEVERITY_LOG,
},
{
text: "test-network.html",
typeSelector: ".network",
category: CATEGORY_NETWORK,
severity: SEVERITY_LOG,
},
{
text: "test-image.png",
typeSelector: ".network",
category: CATEGORY_NETWORK,
severity: SEVERITY_LOG,
},
{
text: "testscript.js",
typeSelector: ".network",
category: CATEGORY_NETWORK,
severity: SEVERITY_LOG,
},
],
});
}
|