michael@0: /* vim:set ts=2 sw=2 sts=2 et: */ michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: // Test that objects given to console.log() are inspectable. michael@0: michael@0: function test() michael@0: { michael@0: waitForExplicitFinish(); michael@0: michael@0: addTab("data:text/html;charset=utf8,test for bug 676722 - inspectable objects for window.console"); michael@0: michael@0: gBrowser.selectedBrowser.addEventListener("load", function onLoad() { michael@0: gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); michael@0: openConsole(null, performTest); michael@0: }, true); michael@0: } michael@0: michael@0: function performTest(hud) michael@0: { michael@0: hud.jsterm.clearOutput(true); michael@0: michael@0: hud.jsterm.execute("myObj = {abba: 'omgBug676722'}"); michael@0: hud.jsterm.execute("console.log('fooBug676722', myObj)"); michael@0: michael@0: waitForMessages({ michael@0: webconsole: hud, michael@0: messages: [{ michael@0: text: "fooBug676722", michael@0: category: CATEGORY_WEBDEV, michael@0: severity: SEVERITY_LOG, michael@0: objects: true, michael@0: }], michael@0: }).then(([result]) => { michael@0: let msg = [...result.matched][0]; michael@0: ok(msg, "message element"); michael@0: let body = msg.querySelector(".message-body"); michael@0: ok(body, "message body"); michael@0: let clickable = result.clickableElements[0]; michael@0: ok(clickable, "the console.log() object anchor was found"); michael@0: ok(body.textContent.contains('{ abba: "omgBug676722" }'), michael@0: "clickable node content is correct"); michael@0: michael@0: hud.jsterm.once("variablesview-fetched", michael@0: (aEvent, aVar) => { michael@0: ok(aVar, "object inspector opened on click"); michael@0: michael@0: findVariableViewProperties(aVar, [{ michael@0: name: "abba", michael@0: value: "omgBug676722", michael@0: }], { webconsole: hud }).then(finishTest); michael@0: }); michael@0: michael@0: executeSoon(function() { michael@0: EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow); michael@0: }); michael@0: }); michael@0: }