browser/devtools/webconsole/test/browser_webconsole_bug_614793_jsterm_scroll.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* vim:set ts=2 sw=2 sts=2 et: */
michael@0 2 /*
michael@0 3 * Any copyright is dedicated to the Public Domain.
michael@0 4 * http://creativecommons.org/publicdomain/zero/1.0/
michael@0 5 *
michael@0 6 * Contributor(s):
michael@0 7 * Mihai Șucan <mihai.sucan@gmail.com>
michael@0 8 */
michael@0 9
michael@0 10 function consoleOpened(hud) {
michael@0 11 hud.jsterm.clearOutput();
michael@0 12
michael@0 13 let scrollNode = hud.outputNode.parentNode;
michael@0 14
michael@0 15 for (let i = 0; i < 150; i++) {
michael@0 16 content.console.log("test message " + i);
michael@0 17 }
michael@0 18
michael@0 19 let oldScrollTop = -1;
michael@0 20
michael@0 21 waitForMessages({
michael@0 22 webconsole: hud,
michael@0 23 messages: [{
michael@0 24 text: "test message 149",
michael@0 25 category: CATEGORY_WEBDEV,
michael@0 26 severity: SEVERITY_LOG,
michael@0 27 }],
michael@0 28 }).then(() => {
michael@0 29 oldScrollTop = scrollNode.scrollTop;
michael@0 30 isnot(oldScrollTop, 0, "scroll location is not at the top");
michael@0 31
michael@0 32 hud.jsterm.execute("'hello world'", onExecute);
michael@0 33 });
michael@0 34
michael@0 35 function onExecute(msg)
michael@0 36 {
michael@0 37 isnot(scrollNode.scrollTop, oldScrollTop, "scroll location updated");
michael@0 38
michael@0 39 oldScrollTop = scrollNode.scrollTop;
michael@0 40
michael@0 41 msg.scrollIntoView(false);
michael@0 42
michael@0 43 is(scrollNode.scrollTop, oldScrollTop, "scroll location is the same");
michael@0 44
michael@0 45 finishTest();
michael@0 46 }
michael@0 47 }
michael@0 48
michael@0 49 function test() {
michael@0 50 addTab("data:text/html;charset=utf-8,Web Console test for bug 614793: jsterm result scroll");
michael@0 51 browser.addEventListener("load", function onLoad(aEvent) {
michael@0 52 browser.removeEventListener(aEvent.type, onLoad, true);
michael@0 53 openConsole(null, consoleOpened);
michael@0 54 }, true);
michael@0 55 }
michael@0 56

mercurial