-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PromiseRejectionEvent does not conform to spec again #1509
Comments
Thanks for the report. I think it's possible we simply haven't updated the core build in a while - can you try building yourself? |
This seems to be the case. Contents of the package in registry (https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz) have precompiled artefacts in Cloning the repo and running build scripts (well, they run automatically through Diff between the two files shows the |
Upon further investigation, it seems there's another issue atop the one with wrong build. Emitted events still do not have the necessary properties even with correct build. According to CustomEvent WHATWG specification the constructor will ignore properties of the second let data = { cancelable: true, foo: 'foo' })
let event = new CustomEvent('test', data)
event.cancelable // true
event.foo // undefined |
Bluebird.js promises don't have event.reason, they instead have event.detail.reason. An unhanded rejection from bb causes an exception from your plugin. Given Bluebird's popularity it's probably worthwhile handing this case at least until they fix their side. As you can see they've taken a couple of kicks at this already. Links to their issues: petkaantonov/bluebird#1447 petkaantonov/bluebird#1509
Looks like this is not due to build issues. The commit which adds the property defines was merged on Oct 6, 2017 and 3.5.1 was released on Oct 4, 2017 @petkaantonov or @benjamingr would you mind releasing a patch version to get this updated? |
👍 on new release We were getting a lot of |
Any plans on doing a new release to fix this issue? |
Included in 3.5.2 release http://bluebirdjs.com/docs/changelog.html#3.5.2 |
Could you also take a look at this: #1509 (comment)? This might still be preventing Bluebird from generating proper events. |
Just upgraded to 3.5.3 to attempt to fix this issue, but per #1509 (comment) the expected fields are not present on the Tooling around in my dev console, it looks like you can (indeed, must) provide at least
Perhaps using/polyfilling |
@seansfkelley they are on the detail object
see http://bluebirdjs.com/docs/api/error-management-configuration.html#global-rejection-events |
What I was trying to say with that comment is not that the values are missing entirely, it's that like the OP says they're present, but in the wrong place:
Which your comment and the docs corroborate. This appears to still be the case in 3.5.5; on Firefox 66.0.5 (macOS 10.14) I get the following behavior:
It also appears to be the case on 3.5.2, which suggests that this issue was never fixed in the way that the OP was requesting. |
There are actually two issues: First that they're in the wrong place, second is that they are missing (from both places). First was meant to be fixed in #1464 and then again in this issue. The second was never addressed. See #1509 (comment) – it is simply not possible to have these properties added to |
Maybe they be added as ad hoc properties? var e = new Custo,mEvent(...);
e.promise = promise;
e.reason = reason |
I don't know what the polyfill situation is, but |
Yes we need to keep .detail working as well to not break old code relying on it. |
What version of bluebird is the issue happening on?
3.5.1
What platform and version? (For example Node.js 0.12 or Google Chrome 32)
Testing in Chrome 67, but it's irrelevant
Did this issue happen with earlier version of bluebird?
Do not know
Event objects fired with
unhandledrejection
andrejectionhandled
do not conform toPromiseRejectionEvent
specification: They do not havereason
andpromise
properties, instead they havedetail
property which contains the two.This issue was already raised as #1447 and fixed in #1464
And evidently the code is still there in master.
But it's gone in the build.
Here's the snipped from
bluebird.core.js
as compiled by default and as linked on the site (https://cdn.jsdelivr.net/bluebird/latest/bluebird.core.js):For some reasons, property defines are gone.
I imagine this is either issue with build scripts or
es5.defineProperty
shim.The text was updated successfully, but these errors were encountered: