Fix passing Promise with remote
Somehow using value.then.bind(value) would result in infinite loop, could be bug of Chromium.
This commit is contained in:
parent
dd4d3db47b
commit
6de9c4332f
4 changed files with 4 additions and 3 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
|
#include "build/build_config.h"
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
class Time;
|
class Time;
|
||||||
|
|
|
@ -106,7 +106,7 @@ var valueToMeta = function(sender, value, optimizeSimpleObject) {
|
||||||
} else if (meta.type === 'buffer') {
|
} else if (meta.type === 'buffer') {
|
||||||
meta.value = Array.prototype.slice.call(value, 0);
|
meta.value = Array.prototype.slice.call(value, 0);
|
||||||
} else if (meta.type === 'promise') {
|
} else if (meta.type === 'promise') {
|
||||||
meta.then = valueToMeta(sender, value.then.bind(value));
|
meta.then = valueToMeta(sender, function(v) { value.then(v); });
|
||||||
} else if (meta.type === 'error') {
|
} else if (meta.type === 'error') {
|
||||||
meta.members = plainObjectToMeta(value);
|
meta.members = plainObjectToMeta(value);
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ var wrapArgs = function(args, visited) {
|
||||||
} else if ((value != null ? value.constructor.name : void 0) === 'Promise') {
|
} else if ((value != null ? value.constructor.name : void 0) === 'Promise') {
|
||||||
return {
|
return {
|
||||||
type: 'promise',
|
type: 'promise',
|
||||||
then: valueToMeta(value.then.bind(value))
|
then: valueToMeta(function(v) { value.then(v); })
|
||||||
};
|
};
|
||||||
} else if ((value != null) && typeof value === 'object' && v8Util.getHiddenValue(value, 'atomId')) {
|
} else if ((value != null) && typeof value === 'object' && v8Util.getHiddenValue(value, 'atomId')) {
|
||||||
return {
|
return {
|
||||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 70f475e34dd5f580dc8d5184d6fa8e5c96c5f601
|
Subproject commit 7f9e25b50b373aea5e7d0a50c33aea22c85ee876
|
Loading…
Add table
Add a link
Reference in a new issue