-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix work of non-standard V8
Error
features with wrapped Error
con…
…structors, close #1061
- Loading branch information
Showing
5 changed files
with
21 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
|
||
var $Error = Error; | ||
var replace = uncurryThis(''.replace); | ||
|
||
var TEST = (function (arg) { return String(Error(arg).stack); })('zxcasd'); | ||
var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd'); | ||
var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/; | ||
var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST); | ||
|
||
module.exports = function (stack, dropEntries) { | ||
if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string') { | ||
if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) { | ||
while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, ''); | ||
} return stack; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var defineProperty = require('../internals/object-define-property').f; | ||
|
||
module.exports = function (Target, Source, key) { | ||
key in Target || defineProperty(Target, key, { | ||
configurable: true, | ||
get: function () { return Source[key]; }, | ||
set: function (it) { Source[key] = it; } | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters