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 679467 */ 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 onLoad() { michael@0: gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); michael@0: openScratchpad(testFalsy); michael@0: }, true); michael@0: michael@0: content.location = "data:text/html,

test falsy display() values in Scratchpad"; michael@0: } michael@0: michael@0: function testFalsy() michael@0: { michael@0: let scratchpad = gScratchpadWindow.Scratchpad; michael@0: verifyFalsies(scratchpad).then(function() { michael@0: scratchpad.setBrowserContext(); michael@0: verifyFalsies(scratchpad).then(finish); michael@0: }); michael@0: } michael@0: michael@0: michael@0: function verifyFalsies(scratchpad) michael@0: { michael@0: let tests = [{ michael@0: method: "display", michael@0: code: "undefined", michael@0: result: "undefined\n/*\nundefined\n*/", michael@0: label: "undefined is displayed" michael@0: }, michael@0: { michael@0: method: "display", michael@0: code: "false", michael@0: result: "false\n/*\nfalse\n*/", michael@0: label: "false is displayed" michael@0: }, michael@0: { michael@0: method: "display", michael@0: code: "0", michael@0: result: "0\n/*\n0\n*/", michael@0: label: "0 is displayed" michael@0: }, michael@0: { michael@0: method: "display", michael@0: code: "null", michael@0: result: "null\n/*\nnull\n*/", michael@0: label: "null is displayed" michael@0: }, michael@0: { michael@0: method: "display", michael@0: code: "NaN", michael@0: result: "NaN\n/*\nNaN\n*/", michael@0: label: "NaN is displayed" michael@0: }, michael@0: { michael@0: method: "display", michael@0: code: "''", michael@0: result: "''\n/*\n\n*/", michael@0: label: "the empty string is displayed" michael@0: }]; michael@0: michael@0: return runAsyncTests(scratchpad, tests); michael@0: }