Fix toString shim
This commit is contained in:
parent
f8bc802e13
commit
49c3cb3767
@ -270,6 +270,10 @@ function CallSiteToString() {
|
|||||||
var isMethodCall = !(this.isToplevel() || isConstructor);
|
var isMethodCall = !(this.isToplevel() || isConstructor);
|
||||||
if (isMethodCall) {
|
if (isMethodCall) {
|
||||||
var typeName = this.getTypeName();
|
var typeName = this.getTypeName();
|
||||||
|
// Fixes shim to be backward compatable with Node v0 to v4
|
||||||
|
if (typeName === "[object Object]") {
|
||||||
|
typeName = "null";
|
||||||
|
}
|
||||||
var methodName = this.getMethodName();
|
var methodName = this.getMethodName();
|
||||||
if (functionName) {
|
if (functionName) {
|
||||||
if (typeName && functionName.indexOf(typeName) != 0) {
|
if (typeName && functionName.indexOf(typeName) != 0) {
|
||||||
|
15
test.js
15
test.js
@ -259,6 +259,21 @@ it('throw with empty source map', function() {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('throw in Timeout with empty source map', function(done) {
|
||||||
|
compareStdout(done, createEmptySourceMap(), [
|
||||||
|
'require("./source-map-support").install();',
|
||||||
|
'setTimeout(function () {',
|
||||||
|
' throw new Error("this is the error")',
|
||||||
|
'})'
|
||||||
|
], [
|
||||||
|
/\/.generated.js:3$/,
|
||||||
|
' throw new Error("this is the error")',
|
||||||
|
/^ \^$/,
|
||||||
|
'Error: this is the error',
|
||||||
|
/^ at ((null)|(Timeout))\._onTimeout \((?:.*\/)?.generated.js:3:11\)$/
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
it('throw with source map with gap', function() {
|
it('throw with source map with gap', function() {
|
||||||
compareStackTrace(createSourceMapWithGap(), [
|
compareStackTrace(createSourceMapWithGap(), [
|
||||||
'throw new Error("test");'
|
'throw new Error("test");'
|
||||||
|
Loading…
Reference in New Issue
Block a user