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
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Check that JS errors and CSS warnings open view source when their source link
// is clicked in the Browser Console.
"use strict";
const TEST_URI =
"data:text/html;charset=utf8,<!DOCTYPE html><p>hello world" +
"<button onclick='foobar.explode()'>click!</button>";
add_task(async function () {
// Disable the preloaded process as it creates processes intermittently
// which forces the emission of RDP requests we aren't correctly waiting for.
await pushPref("dom.ipc.processPrelaunch.enabled", false);
await pushPref("devtools.browsertoolbox.scope", "everything");
await addTab(TEST_URI);
const hud = await BrowserConsoleManager.toggleBrowserConsole();
ok(hud, "browser console opened");
// On e10s, the exception is triggered in child process
// and is ignored by test harness
if (!Services.appinfo.browserTabsRemoteAutostart) {
expectUncaughtException();
}
info("generate exception and wait for the message");
SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
const button = content.document.querySelector("button");
button.click();
});
const messageText = "ReferenceError: foobar is not defined";
const msg = await waitFor(
() => findErrorMessage(hud, messageText),
`Message "${messageText}" wasn't found`
);
ok(msg, `Message found: "${messageText}"`);
const locationNode = msg.querySelector(
".message-location .frame-link-source"
);
ok(locationNode, "Message location link element found");
const onTabOpen = BrowserTestUtils.waitForNewTab(
gBrowser,
url => url.startsWith("view-source:"),
true
);
locationNode.click();
await onTabOpen;
ok(true, "The view source tab was opened in response to clicking the link");
});
|