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