michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: /* Bug 690552 */ michael@0: michael@0: function test() michael@0: { michael@0: waitForExplicitFinish(); michael@0: michael@0: gBrowser.selectedTab = gBrowser.addTab(); michael@0: gBrowser.selectedBrowser.addEventListener("load", function browserLoad() { michael@0: gBrowser.selectedBrowser.removeEventListener("load", browserLoad, true); michael@0: openScratchpad(runTests, {"state":{"text":""}}); michael@0: }, true); michael@0: michael@0: content.location = "data:text/html,
test that exceptions are output as " + michael@0: "comments for 'display' and not sent to the console in Scratchpad"; michael@0: } michael@0: michael@0: function runTests() michael@0: { michael@0: let scratchpad = gScratchpadWindow.Scratchpad; michael@0: michael@0: let message = "\"Hello World!\"" michael@0: let openComment = "\n/*\n"; michael@0: let closeComment = "\n*/"; michael@0: let error = "throw new Error(\"Ouch!\")"; michael@0: let syntaxError = "("; michael@0: michael@0: let tests = [{ michael@0: method: "display", michael@0: code: message, michael@0: result: message + openComment + "Hello World!" + closeComment, michael@0: label: "message display output" michael@0: }, michael@0: { michael@0: method: "display", michael@0: code: error, michael@0: result: error + openComment + "Exception: Ouch!\n@" + michael@0: scratchpad.uniqueName + ":1:1" + closeComment, michael@0: label: "error display output", michael@0: }, michael@0: { michael@0: method: "display", michael@0: code: syntaxError, michael@0: result: syntaxError + openComment + "Exception: syntax error\n@" + michael@0: scratchpad.uniqueName + ":1" + closeComment, michael@0: label: "syntaxError display output", michael@0: }, michael@0: { michael@0: method: "run", michael@0: code: message, michael@0: result: message, michael@0: label: "message run output", michael@0: }, michael@0: { michael@0: method: "run", michael@0: code: error, michael@0: result: error + openComment + "Exception: Ouch!\n@" + michael@0: scratchpad.uniqueName + ":1:1" + closeComment, michael@0: label: "error run output", michael@0: }, michael@0: { michael@0: method: "run", michael@0: code: syntaxError, michael@0: result: syntaxError + openComment + "Exception: syntax error\n@" + michael@0: scratchpad.uniqueName + ":1" + closeComment, michael@0: label: "syntaxError run output", michael@0: }]; michael@0: michael@0: runAsyncTests(scratchpad, tests).then(finish); michael@0: }