From 7929daa48c0eb69649f62bbbde21e9bfd6c56e7a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 23 May 2016 15:07:01 -0700 Subject: [PATCH] Pass both callback values to then --- lib/browser/rpc-server.js | 4 +++- lib/renderer/api/remote.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/browser/rpc-server.js b/lib/browser/rpc-server.js index 8fdb77a6cdca..7ad6d2c22aef 100644 --- a/lib/browser/rpc-server.js +++ b/lib/browser/rpc-server.js @@ -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) diff --git a/lib/renderer/api/remote.js b/lib/renderer/api/remote.js index b6a0859a9c1d..d3fdec25aeb7 100644 --- a/lib/renderer/api/remote.js +++ b/lib/renderer/api/remote.js @@ -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 {