1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_bug_592442_closing_brackets.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 +/* vim:set ts=2 sw=2 sts=2 et: */ 1.5 +/* ***** BEGIN LICENSE BLOCK ***** 1.6 + * Any copyright is dedicated to the Public Domain. 1.7 + * http://creativecommons.org/publicdomain/zero/1.0/ 1.8 + * 1.9 + * Contributor(s): 1.10 + * Julian Viereck <jviereck@mozilla.com> 1.11 + * Patrick Walton <pcwalton@mozilla.com> 1.12 + * Mihai Șucan <mihai.sucan@gmail.com> 1.13 + * 1.14 + * ***** END LICENSE BLOCK ***** */ 1.15 + 1.16 +// Tests that, when the user types an extraneous closing bracket, no error 1.17 +// appears. 1.18 + 1.19 +function test() { 1.20 + addTab("data:text/html;charset=utf-8,test for bug 592442"); 1.21 + browser.addEventListener("load", function onLoad() { 1.22 + browser.removeEventListener("load", onLoad, true); 1.23 + openConsole(null, testExtraneousClosingBrackets); 1.24 + }, true); 1.25 +} 1.26 + 1.27 +function testExtraneousClosingBrackets(hud) { 1.28 + let jsterm = hud.jsterm; 1.29 + 1.30 + jsterm.setInputValue("document.getElementById)"); 1.31 + 1.32 + let error = false; 1.33 + try { 1.34 + jsterm.complete(jsterm.COMPLETE_HINT_ONLY); 1.35 + } 1.36 + catch (ex) { 1.37 + error = true; 1.38 + } 1.39 + 1.40 + ok(!error, "no error was thrown when an extraneous bracket was inserted"); 1.41 + 1.42 + finishTest(); 1.43 +} 1.44 +