michael@0: /* vim:set ts=2 sw=2 sts=2 et: */ michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ michael@0: * michael@0: * Contributor(s): michael@0: * Mihai Șucan michael@0: */ michael@0: michael@0: function consoleOpened(hud) { michael@0: hud.jsterm.clearOutput(); michael@0: michael@0: let scrollNode = hud.outputNode.parentNode; michael@0: michael@0: for (let i = 0; i < 150; i++) { michael@0: content.console.log("test message " + i); michael@0: } michael@0: michael@0: let oldScrollTop = -1; michael@0: michael@0: waitForMessages({ michael@0: webconsole: hud, michael@0: messages: [{ michael@0: text: "test message 149", michael@0: category: CATEGORY_WEBDEV, michael@0: severity: SEVERITY_LOG, michael@0: }], michael@0: }).then(() => { michael@0: oldScrollTop = scrollNode.scrollTop; michael@0: isnot(oldScrollTop, 0, "scroll location is not at the top"); michael@0: michael@0: hud.jsterm.execute("'hello world'", onExecute); michael@0: }); michael@0: michael@0: function onExecute(msg) michael@0: { michael@0: isnot(scrollNode.scrollTop, oldScrollTop, "scroll location updated"); michael@0: michael@0: oldScrollTop = scrollNode.scrollTop; michael@0: michael@0: msg.scrollIntoView(false); michael@0: michael@0: is(scrollNode.scrollTop, oldScrollTop, "scroll location is the same"); michael@0: michael@0: finishTest(); michael@0: } michael@0: } michael@0: michael@0: function test() { michael@0: addTab("data:text/html;charset=utf-8,Web Console test for bug 614793: jsterm result scroll"); michael@0: browser.addEventListener("load", function onLoad(aEvent) { michael@0: browser.removeEventListener(aEvent.type, onLoad, true); michael@0: openConsole(null, consoleOpened); michael@0: }, true); michael@0: } michael@0: