@endo/eventual-send
Advanced tools
Comparing version 0.15.3 to 0.15.4
@@ -6,2 +6,12 @@ # Change Log | ||
### [0.15.4](https://github.com/endojs/endo/compare/@endo/eventual-send@0.15.3...@endo/eventual-send@0.15.4) (2022-06-11) | ||
### Bug Fixes | ||
* **eventual-send:** no implicit rejection silencing; just harden ([ca07d81](https://github.com/endojs/endo/commit/ca07d8150fd1e12b9e90505a7c06ada6b25d0743)) | ||
* **eventual-send:** use `!Object.is(a, b)` instead of `a !== b` for NaNs ([2b7e418](https://github.com/endojs/endo/commit/2b7e4189182dcac17832bbdcfb6ac56e32fee456)) | ||
### [0.15.3](https://github.com/endojs/endo/compare/@endo/eventual-send@0.15.2...@endo/eventual-send@0.15.3) (2022-04-15) | ||
@@ -8,0 +18,0 @@ |
{ | ||
"name": "@endo/eventual-send", | ||
"version": "0.15.3", | ||
"version": "0.15.4", | ||
"description": "Extend a Promise class to implement the eventual-send API", | ||
@@ -30,4 +30,4 @@ "type": "module", | ||
"devDependencies": { | ||
"@endo/lockdown": "^0.1.13", | ||
"@endo/ses-ava": "^0.2.25", | ||
"@endo/lockdown": "^0.1.14", | ||
"@endo/ses-ava": "^0.2.26", | ||
"ava": "^3.12.1", | ||
@@ -66,3 +66,3 @@ "c8": "^7.7.3", | ||
}, | ||
"gitHead": "3ae52352ca54614f0bf40f74a6f3959ea5973c2e" | ||
"gitHead": "7be9306df5e5eae280134cbbaf0d3886b4e51536" | ||
} |
@@ -29,2 +29,3 @@ // @ts-check | ||
isFrozen, | ||
is: objectIs, | ||
} = Object; | ||
@@ -97,3 +98,3 @@ | ||
// this upstream. | ||
while (target !== p) { | ||
while (!objectIs(target, p)) { | ||
const parent = forwardedPromiseToPromise.get(target); | ||
@@ -109,3 +110,3 @@ forwardedPromiseToPromise.delete(target); | ||
// Note that everything except presences is covered here. | ||
while (target !== p) { | ||
while (!objectIs(target, p)) { | ||
const parent = forwardedPromiseToPromise.get(target); | ||
@@ -243,3 +244,3 @@ forwardedPromiseToPromise.set(target, p); | ||
// Ensure our data structure is a proper tree (avoid cycles). | ||
if (targetP && targetP !== handledP) { | ||
if (targetP && !objectIs(targetP, handledP)) { | ||
forwardedPromiseToPromise.set(handledP, targetP); | ||
@@ -253,7 +254,2 @@ } else { | ||
// Ensure our pendingHandler is cleaned up if not already. | ||
if (promiseToPendingHandler.has(handledP)) { | ||
handledP.then(_ => promiseToPendingHandler.delete(handledP)); | ||
} | ||
// Finish the resolution. | ||
@@ -267,6 +263,7 @@ superResolve(value); | ||
}; | ||
handledReject = err => { | ||
handledReject = reason => { | ||
if (resolved) { | ||
return; | ||
} | ||
harden(reason); | ||
assert( | ||
@@ -279,3 +276,3 @@ !forwardedPromiseToPromise.has(handledP), | ||
resolved = true; | ||
superReject(err); | ||
superReject(reason); | ||
continueForwarding(); | ||
@@ -411,3 +408,3 @@ }; | ||
prop = coerceToObjectProperty(prop); | ||
handle(target, 'getSendOnly', [prop]); | ||
handle(target, 'getSendOnly', [prop]).catch(() => {}); | ||
}, | ||
@@ -422,3 +419,3 @@ applyFunction(target, args) { | ||
args = [...args]; | ||
handle(target, 'applyFunctionSendOnly', [args]); | ||
handle(target, 'applyFunctionSendOnly', [args]).catch(() => {}); | ||
}, | ||
@@ -435,3 +432,3 @@ applyMethod(target, prop, args) { | ||
args = [...args]; | ||
handle(target, 'applyMethodSendOnly', [prop, args]); | ||
handle(target, 'applyMethodSendOnly', [prop, args]).catch(() => {}); | ||
}, | ||
@@ -456,3 +453,3 @@ resolve(value) { | ||
return harden( | ||
Promise.resolve().then(_ => new HandledPromise(executeThen)), | ||
Promise.resolve().then(() => new HandledPromise(executeThen)), | ||
); | ||
@@ -511,2 +508,3 @@ }, | ||
let raceIsOver = false; | ||
const win = (handlerName, handler, o) => { | ||
@@ -519,3 +517,3 @@ if (raceIsOver) { | ||
} catch (reason) { | ||
reject(reason); | ||
reject(harden(reason)); | ||
} | ||
@@ -525,7 +523,7 @@ raceIsOver = true; | ||
const lose = e => { | ||
const lose = reason => { | ||
if (raceIsOver) { | ||
return; | ||
} | ||
reject(e); | ||
reject(harden(reason)); | ||
raceIsOver = true; | ||
@@ -563,7 +561,2 @@ }; | ||
// Harden the fulfillment and rejection, as well as a workaround for | ||
// Node.js: silence "Unhandled Rejection" by default when using the static | ||
// methods. | ||
returnedP.then(harden, harden); | ||
// We return a handled promise with the default pending handler. This | ||
@@ -570,0 +563,0 @@ // prevents a race between the above Promise.resolves and pipelining. |
@@ -89,3 +89,3 @@ /* global globalThis */ | ||
}); | ||
return result; | ||
return harden(result); | ||
} finally { | ||
@@ -92,0 +92,0 @@ hiddenPriorError = undefined; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
81569
1147