Skip to content
This repository was archived by the owner on Nov 23, 2017. It is now read-only.

Commit 7d6a5c0

Browse files
committed
Bug 1304003 - Part 5: Rewrite browser_console_iframe_messages.js. r=bgrins
1 parent 27a6ffa commit 7d6a5c0

File tree

6 files changed

+92
-0
lines changed

6 files changed

+92
-0
lines changed

devtools/client/webconsole/new-console-output/test/mochitest/browser.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@ support-files =
77
test-console-table.html
88
test-console.html
99
test-console-filters.html
10+
test-iframes.html
11+
test-iframe1.html
12+
test-iframe2.html
13+
test-iframe3.html
1014

1115
[browser_webconsole_console_table.js]
1216
[browser_webconsole_filters.js]
1317
[browser_webconsole_init.js]
18+
[browser_webconsole_iframe_messages.js]
1419
[browser_webconsole_input_focus.js]
1520
[browser_webconsole_keyboard_accessibility.js]
1621
[browser_webconsole_observer_notifications.js]
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
2+
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
3+
/* Any copyright is dedicated to the Public Domain.
4+
* http://creativecommons.org/publicdomain/zero/1.0/ */
5+
6+
// Check that cached messages from nested iframes are displayed in the
7+
// Web Console.
8+
9+
"use strict";
10+
11+
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
12+
"new-console-output/test/mochitest/test-iframes.html";
13+
14+
add_task(function* () {
15+
// On e10s, the exception is triggered in child process
16+
// and is ignored by test harness
17+
if (!Services.appinfo.browserTabsRemoteAutostart) {
18+
expectUncaughtException();
19+
}
20+
21+
let hud = yield openNewTabAndConsole(TEST_URI);
22+
ok(hud, "web console opened");
23+
24+
yield waitFor(() => (
25+
findMessage(hud, "main file")
26+
&& findMessage(hud, "blah")
27+
&& findMessage(hud, "iframe 1")
28+
&& findMessage(hud, "iframe 2")
29+
&& findMessage(hud, "iframe 3")
30+
));
31+
ok(true, "Messages from iframes were displayed in console.");
32+
33+
// "iframe 1" console messages can be coalesced into one if they follow each
34+
// other in the sequence of messages (depending on timing). If they do not, then
35+
// they will be displayed in the console output independently, as separate
36+
// messages. This is why we need to check multiple possibilities.
37+
yield waitFor(() => (
38+
findMessages(hud, "iframe 1").length == 2
39+
|| findMessage(hud, "iframe 1").querySelector(".message-repeats").textContent == 2
40+
));
41+
ok(true, "Messages from nested iframes were displayed in console.");
42+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<html>
2+
<head>
3+
<script>
4+
console.log("iframe 1");
5+
</script>
6+
</head>
7+
<body>
8+
<h1>iframe 1</h1>
9+
</body>
10+
</html>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<html>
2+
<head>
3+
<script>
4+
console.log("iframe 2");
5+
blah;
6+
</script>
7+
</head>
8+
<body>
9+
<h1>iframe 2</h1>
10+
</body>
11+
</html>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<html>
2+
<head>
3+
<script>
4+
console.log("iframe 3");
5+
</script>
6+
</head>
7+
<body>
8+
<h1>iframe 3</h1>
9+
<iframe src="test-iframe1.html"></iframe>
10+
</body>
11+
</html>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<html>
2+
<head>
3+
<script>
4+
console.log("main file");
5+
</script>
6+
</head>
7+
<body>
8+
<h1>iframe console test</h1>
9+
<iframe src="test-iframe1.html"></iframe>
10+
<iframe src="test-iframe2.html"></iframe>
11+
<iframe src="test-iframe3.html"></iframe>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)