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: 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(runTests); michael@0: }, true); michael@0: michael@0: content.location = "data:text/html;charset=utf8,test Scratchpad." + michael@0: "openErrorConsole()"; michael@0: } michael@0: michael@0: function runTests() michael@0: { michael@0: Services.obs.addObserver(function observer(aSubject) { michael@0: Services.obs.removeObserver(observer, "web-console-created"); michael@0: aSubject.QueryInterface(Ci.nsISupportsString); michael@0: michael@0: let hud = HUDService.getBrowserConsole(); michael@0: ok(hud, "browser console is open"); michael@0: is(aSubject.data, hud.hudId, "notification hudId is correct"); michael@0: michael@0: HUDService.toggleBrowserConsole().then(finish); michael@0: }, "web-console-created", false); michael@0: michael@0: let hud = HUDService.getBrowserConsole(); michael@0: ok(!hud, "browser console is not open"); michael@0: info("wait for the browser console to open from Scratchpad"); michael@0: michael@0: gScratchpadWindow.Scratchpad.openErrorConsole(); michael@0: }