michael@0: /* vim:set ts=2 sw=2 sts=2 et: */ michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: // Test that very long strings do not hang the browser. michael@0: michael@0: function test() michael@0: { michael@0: addTab("http://example.com/browser/browser/devtools/webconsole/test/test-bug-859170-longstring-hang.html"); michael@0: michael@0: let hud = null; michael@0: michael@0: gBrowser.selectedBrowser.addEventListener("load", function onLoad() { michael@0: gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); michael@0: openConsole(null, performTest); michael@0: }, true); michael@0: michael@0: function performTest(aHud) michael@0: { michael@0: hud = aHud; michael@0: info("wait for the initial long string"); michael@0: michael@0: waitForMessages({ michael@0: webconsole: hud, michael@0: messages: [ michael@0: { michael@0: name: "find 'foobar', no 'foobaz', in long string output", michael@0: text: "foobar", michael@0: noText: "foobaz", michael@0: category: CATEGORY_WEBDEV, michael@0: longString: true, michael@0: }, michael@0: ], michael@0: }).then(onInitialString); michael@0: } michael@0: michael@0: function onInitialString(aResults) michael@0: { michael@0: let clickable = aResults[0].longStrings[0]; michael@0: ok(clickable, "long string ellipsis is shown"); michael@0: clickable.scrollIntoView(false); michael@0: michael@0: EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow); michael@0: michael@0: info("wait for long string expansion"); michael@0: michael@0: waitForMessages({ michael@0: webconsole: hud, michael@0: messages: [ michael@0: { michael@0: name: "find 'foobaz' after expand, but no 'boom!' at the end", michael@0: text: "foobaz", michael@0: noText: "boom!", michael@0: category: CATEGORY_WEBDEV, michael@0: longString: false, michael@0: }, michael@0: { michael@0: text: "too long to be displayed", michael@0: longString: false, michael@0: }, michael@0: ], michael@0: }).then(finishTest); michael@0: } michael@0: }