1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/webconsole/test/browser_longstring_hang.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,64 @@ 1.4 +/* vim:set ts=2 sw=2 sts=2 et: */ 1.5 +/* Any copyright is dedicated to the Public Domain. 1.6 + * http://creativecommons.org/publicdomain/zero/1.0/ */ 1.7 + 1.8 +// Test that very long strings do not hang the browser. 1.9 + 1.10 +function test() 1.11 +{ 1.12 + addTab("http://example.com/browser/browser/devtools/webconsole/test/test-bug-859170-longstring-hang.html"); 1.13 + 1.14 + let hud = null; 1.15 + 1.16 + gBrowser.selectedBrowser.addEventListener("load", function onLoad() { 1.17 + gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); 1.18 + openConsole(null, performTest); 1.19 + }, true); 1.20 + 1.21 + function performTest(aHud) 1.22 + { 1.23 + hud = aHud; 1.24 + info("wait for the initial long string"); 1.25 + 1.26 + waitForMessages({ 1.27 + webconsole: hud, 1.28 + messages: [ 1.29 + { 1.30 + name: "find 'foobar', no 'foobaz', in long string output", 1.31 + text: "foobar", 1.32 + noText: "foobaz", 1.33 + category: CATEGORY_WEBDEV, 1.34 + longString: true, 1.35 + }, 1.36 + ], 1.37 + }).then(onInitialString); 1.38 + } 1.39 + 1.40 + function onInitialString(aResults) 1.41 + { 1.42 + let clickable = aResults[0].longStrings[0]; 1.43 + ok(clickable, "long string ellipsis is shown"); 1.44 + clickable.scrollIntoView(false); 1.45 + 1.46 + EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow); 1.47 + 1.48 + info("wait for long string expansion"); 1.49 + 1.50 + waitForMessages({ 1.51 + webconsole: hud, 1.52 + messages: [ 1.53 + { 1.54 + name: "find 'foobaz' after expand, but no 'boom!' at the end", 1.55 + text: "foobaz", 1.56 + noText: "boom!", 1.57 + category: CATEGORY_WEBDEV, 1.58 + longString: false, 1.59 + }, 1.60 + { 1.61 + text: "too long to be displayed", 1.62 + longString: false, 1.63 + }, 1.64 + ], 1.65 + }).then(finishTest); 1.66 + } 1.67 +}