return native code CallSite as is

This commit is contained in:
Merott Movahedi 2016-03-27 14:12:52 +01:00
parent 70c54a8ab6
commit 91c828e375
2 changed files with 14 additions and 0 deletions

View File

@ -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

10
test.js
View File

@ -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(")");'