Skip to content

Commit

Permalink
Merge pull request #130 from Merott/native-callsite-wrap
Browse files Browse the repository at this point in the history
return native code CallSite as is
  • Loading branch information
LinusU authored Jun 29, 2016
2 parents 70c54a8 + 91c828e commit ab9b248
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source-map-support.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ function cloneCallSite(frame) {
}

function wrapCallSite(frame) {
if(frame.isNative()) {
return frame;
}

// Most call sites will return the source file from getFileName(), but code
// passed to eval() ending in "//# sourceURL=..." will return the source file
// from getScriptNameOrSourceURL() instead
Expand Down
10 changes: 10 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@ it('eval with sourceURL inside eval', function() {
]);
});

it('native function', function() {
compareStackTrace(createSingleLineSourceMap(), [
'[1].map(function(x) { throw new Error(x); });'
], [
'Error: 1',
/\/.original\.js/,
/at Array\.map \(native\)/
]);
});

it('function constructor', function() {
compareStackTrace(createMultiLineSourceMap(), [
'throw new Function(")");'
Expand Down

0 comments on commit ab9b248

Please sign in to comment.