blob: 8907d48496a9cdede3cd38df869b4ffc489d58ca [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(async function() {
TestRunner.addResult(
`Tests that when console.trace is called in eval'ed script ending with //# sourceURL=url it will dump a stack trace that will have the url as the script source. Bug 47252.\n`);
await TestRunner.loadModule('console_test_runner');
await TestRunner.showPanel('console');
await TestRunner.evaluateInPagePromise(`
function evalSource()
{
function b()
{
console.trace();
}
function a()
{
b();
}
a();
}
function doEvalSource()
{
setTimeout(function() {
eval("(" + evalSource + ")()//# sourceURL=evalURL.js");
//# sourceURL=console-trace-in-eval.js
}, 0);
}
`);
function callback() {
ConsoleTestRunner.dumpConsoleMessages();
TestRunner.completeTest();
}
TestRunner.evaluateInPage('doEvalSource()');
ConsoleTestRunner.addConsoleSniffer(callback);
})();