|
1 /* vim:set ts=2 sw=2 sts=2 et: */ |
|
2 /* Any copyright is dedicated to the Public Domain. |
|
3 * http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
4 |
|
5 // Test that very long strings do not hang the browser. |
|
6 |
|
7 function test() |
|
8 { |
|
9 addTab("http://example.com/browser/browser/devtools/webconsole/test/test-bug-859170-longstring-hang.html"); |
|
10 |
|
11 let hud = null; |
|
12 |
|
13 gBrowser.selectedBrowser.addEventListener("load", function onLoad() { |
|
14 gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); |
|
15 openConsole(null, performTest); |
|
16 }, true); |
|
17 |
|
18 function performTest(aHud) |
|
19 { |
|
20 hud = aHud; |
|
21 info("wait for the initial long string"); |
|
22 |
|
23 waitForMessages({ |
|
24 webconsole: hud, |
|
25 messages: [ |
|
26 { |
|
27 name: "find 'foobar', no 'foobaz', in long string output", |
|
28 text: "foobar", |
|
29 noText: "foobaz", |
|
30 category: CATEGORY_WEBDEV, |
|
31 longString: true, |
|
32 }, |
|
33 ], |
|
34 }).then(onInitialString); |
|
35 } |
|
36 |
|
37 function onInitialString(aResults) |
|
38 { |
|
39 let clickable = aResults[0].longStrings[0]; |
|
40 ok(clickable, "long string ellipsis is shown"); |
|
41 clickable.scrollIntoView(false); |
|
42 |
|
43 EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow); |
|
44 |
|
45 info("wait for long string expansion"); |
|
46 |
|
47 waitForMessages({ |
|
48 webconsole: hud, |
|
49 messages: [ |
|
50 { |
|
51 name: "find 'foobaz' after expand, but no 'boom!' at the end", |
|
52 text: "foobaz", |
|
53 noText: "boom!", |
|
54 category: CATEGORY_WEBDEV, |
|
55 longString: false, |
|
56 }, |
|
57 { |
|
58 text: "too long to be displayed", |
|
59 longString: false, |
|
60 }, |
|
61 ], |
|
62 }).then(finishTest); |
|
63 } |
|
64 } |