mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
src: fix regression that a source marker is lost
PR-URL: https://github.com/nodejs/node/pull/43086 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
1 parent
130bdf0b31
commit
223418adf5
2 files changed
+11
-3
No files matched your search
+2
-1
@@ -62,7 +62,8 @@ static std::string GetErrorSource(Isolate* isolate,
|
||||
// added in the JavaScript context:
|
||||
Environment* env = Environment::GetCurrent(isolate);
|
||||
const bool has_source_map_url =
|
||||
!message->GetScriptOrigin().SourceMapUrl().IsEmpty();
|
||||
!message->GetScriptOrigin().SourceMapUrl().IsEmpty() &&
|
||||
!message->GetScriptOrigin().SourceMapUrl()->IsUndefined();
|
||||
if (has_source_map_url && env != nullptr && env->source_maps_enabled()) {
|
||||
return sourceline;
|
||||
}
|
||||
|
||||
@@ -25,8 +25,10 @@ const assert = require('assert');
|
||||
const exec = require('child_process').exec;
|
||||
const fixtures = require('../common/fixtures');
|
||||
|
||||
function errExec(script, callback) {
|
||||
const cmd = `"${process.argv[0]}" "${fixtures.path(script)}"`;
|
||||
function errExec(script, option, callback) {
|
||||
callback = typeof option === 'function' ? option : callback;
|
||||
option = typeof option === 'string' ? option : '';
|
||||
const cmd = `"${process.argv[0]}" ${option} "${fixtures.path(script)}"`;
|
||||
return exec(cmd, (err, stdout, stderr) => {
|
||||
// There was some error
|
||||
assert.ok(err);
|
||||
@@ -79,3 +81,8 @@ errExec('throws_error6.js', common.mustCall((err, stdout, stderr) => {
|
||||
errExec('throws_error7.js', common.mustCall((err, stdout, stderr) => {
|
||||
assert.match(stderr, /throw {\r?\n\^\r?\n{ toString: \[Function: toString] }\r?\n\r?\nNode\.js \S+\r?\n$/);
|
||||
}));
|
||||
|
||||
// Regression tests for https://github.com/nodejs/node/issues/39149
|
||||
errExec('throws_error7.js', '--enable-source-maps', common.mustCall((err, stdout, stderr) => {
|
||||
assert.match(stderr, /throw {\r?\n\^\r?\n{ toString: \[Function: toString] }\r?\n\r?\nNode\.js \S+\r?\n$/);
|
||||
}));
|
||||
Reference in new issue
Block a user