1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_bug_585956_console_trace.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,46 @@ 1.4 +/* vim:set ts=2 sw=2 sts=2 et: */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-585956-console-trace.html"; 1.10 + 1.11 +function test() { 1.12 + Task.spawn(runner).then(finishTest); 1.13 + 1.14 + function* runner() { 1.15 + let {tab} = yield loadTab("data:text/html;charset=utf8,<p>hello"); 1.16 + let hud = yield openConsole(tab); 1.17 + 1.18 + content.location = TEST_URI; 1.19 + 1.20 + let [result] = yield waitForMessages({ 1.21 + webconsole: hud, 1.22 + messages: [{ 1.23 + name: "console.trace output", 1.24 + consoleTrace: { 1.25 + file: "test-bug-585956-console-trace.html", 1.26 + fn: "window.foobar585956c", 1.27 + }, 1.28 + }], 1.29 + }); 1.30 + 1.31 + let node = [...result.matched][0]; 1.32 + ok(node, "found trace log node"); 1.33 + 1.34 + let obj = node._messageObject; 1.35 + ok(obj, "console.trace message object"); 1.36 + 1.37 + // The expected stack trace object. 1.38 + let stacktrace = [ 1.39 + { filename: TEST_URI, functionName: "window.foobar585956c", language: 2, lineNumber: 9 }, 1.40 + { filename: TEST_URI, functionName: "foobar585956b", language: 2, lineNumber: 14 }, 1.41 + { filename: TEST_URI, functionName: "foobar585956a", language: 2, lineNumber: 18 }, 1.42 + { filename: TEST_URI, functionName: "", language: 2, lineNumber: 21 } 1.43 + ]; 1.44 + 1.45 + ok(obj._stacktrace, "found stacktrace object"); 1.46 + is(obj._stacktrace.toSource(), stacktrace.toSource(), "stacktrace is correct"); 1.47 + isnot(node.textContent.indexOf("bug-585956"), -1, "found file name"); 1.48 + } 1.49 +}