summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose <pepone@users.noreply.github.com>2020-12-02 11:57:35 +0100
committerGitHub <noreply@github.com>2020-12-02 11:57:35 +0100
commitb7207440a5bfceec2d9274bb403eb6540cac20f3 (patch)
treeae267765b182ef70b6484f62c8a341ad1c0ceca5
parentExpand wildcard items in VC++ projects (diff)
downloadice-b7207440a5bfceec2d9274bb403eb6540cac20f3.tar.bz2
ice-b7207440a5bfceec2d9274bb403eb6540cac20f3.tar.xz
ice-b7207440a5bfceec2d9274bb403eb6540cac20f3.zip
Workaround JS frameworks that don't support Symbol.species with Promise types (#1170)
-rw-r--r--CHANGELOG-3.7.md5
-rw-r--r--js/src/Ice/AsyncResultBase.js2
-rw-r--r--js/src/Ice/OutgoingAsync.js16
-rw-r--r--js/src/Ice/Promise.js2
4 files changed, 20 insertions, 5 deletions
diff --git a/CHANGELOG-3.7.md b/CHANGELOG-3.7.md
index b8bf240dee4..cc7c5794f0d 100644
--- a/CHANGELOG-3.7.md
+++ b/CHANGELOG-3.7.md
@@ -72,6 +72,11 @@ These are the changes since Ice 3.7.4.
The property `Ice.AcceptClassCycles` can be set to a value greater than `0`
to change this behavior.
+## JS Changes
+
+- Add default constructor for Promise derived objects, this works around problems with
+ JavaScript frameworks that don't support Symbol.species with their Promise implementations.
+
# Changes in Ice 3.7.4
These are the changes since Ice 3.7.3.
diff --git a/js/src/Ice/AsyncResultBase.js b/js/src/Ice/AsyncResultBase.js
index e0dc8d63496..41aba896d10 100644
--- a/js/src/Ice/AsyncResultBase.js
+++ b/js/src/Ice/AsyncResultBase.js
@@ -10,7 +10,7 @@ class AsyncResultBase extends Ice.Promise
{
super();
this._communicator = communicator;
- this._instance = communicator !== null ? communicator.instance : null;
+ this._instance = communicator ? communicator.instance : null;
this._operation = op;
this._connection = connection;
this._proxy = proxy;
diff --git a/js/src/Ice/OutgoingAsync.js b/js/src/Ice/OutgoingAsync.js
index 109f58a3298..8a4426cc719 100644
--- a/js/src/Ice/OutgoingAsync.js
+++ b/js/src/Ice/OutgoingAsync.js
@@ -55,7 +55,14 @@ class ProxyOutgoingAsyncBase extends OutgoingAsyncBase
{
constructor(prx, operation)
{
- super(prx.ice_getCommunicator(), operation, null, prx, null);
+ if (prx)
+ {
+ super(prx.ice_getCommunicator(), operation, null, prx, null);
+ }
+ else
+ {
+ super();
+ }
this._mode = null;
this._cnt = 0;
this._sent = false;
@@ -190,8 +197,11 @@ class OutgoingAsync extends ProxyOutgoingAsyncBase
constructor(prx, operation, completed)
{
super(prx, operation);
- this._encoding = Protocol.getCompatibleEncoding(this._proxy._getReference().getEncoding());
- this._completed = completed;
+ if (prx)
+ {
+ this._encoding = Protocol.getCompatibleEncoding(this._proxy._getReference().getEncoding());
+ this._completed = completed;
+ }
}
prepare(op, mode, ctx)
diff --git a/js/src/Ice/Promise.js b/js/src/Ice/Promise.js
index 0375853329b..8bad6331db0 100644
--- a/js/src/Ice/Promise.js
+++ b/js/src/Ice/Promise.js
@@ -16,7 +16,7 @@ class P extends Promise
res = resolve;
rej = reject;
- if(cb !== undefined)
+ if(cb)
{
cb(resolve, reject);
}