Merge pull request #5666 from electron/remote-promise-reject

Handle rejection of remote promises
This commit is contained in:
Cheng Zhao 2016-05-24 04:30:25 +00:00
commit cd444e82f9
4 changed files with 27 additions and 2 deletions

View file

@ -91,7 +91,9 @@ let valueToMeta = function (sender, value, optimizeSimpleObject = false) {
} else if (meta.type === 'buffer') {
meta.value = Array.prototype.slice.call(value, 0)
} else if (meta.type === 'promise') {
meta.then = valueToMeta(sender, function (v) { value.then(v) })
meta.then = valueToMeta(sender, function (onFulfilled, onRejected) {
value.then(onFulfilled, onRejected)
})
} else if (meta.type === 'error') {
meta.members = plainObjectToMeta(value)

View file

@ -47,7 +47,9 @@ var wrapArgs = function (args, visited) {
if (value.constructor != null && value.constructor.name === 'Promise') {
return {
type: 'promise',
then: valueToMeta(function (v) { value.then(v) })
then: valueToMeta(function (onFulfilled, onRejected) {
value.then(onFulfilled, onRejected)
})
}
} else if (v8Util.getHiddenValue(value, 'atomId')) {
return {