diff --git a/source-map-support.js b/source-map-support.js index 49ed72d..99b590c 100644 --- a/source-map-support.js +++ b/source-map-support.js @@ -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 diff --git a/test.js b/test.js index 1315c9f..47fc463 100644 --- a/test.js +++ b/test.js @@ -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(")");'