bluebird: PromiseRejectionEvent does not conform to spec again

  1. What version of bluebird is the issue happening on? 3.5.1

  2. What platform and version? (For example Node.js 0.12 or Google Chrome 32) Testing in Chrome 67, but it’s irrelevant

  3. Did this issue happen with earlier version of bluebird? Do not know

Event objects fired with unhandledrejection and rejectionhandled do not conform to PromiseRejectionEvent specification: They do not have reason and promise properties, instead they have detail 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):

		var fireDomEvent = (function() {
			try {
				if (typeof CustomEvent === "function") {
					var event = new CustomEvent("CustomEvent");
					util.global.dispatchEvent(event);
					return function(name, event) {
						var domEvent = new CustomEvent(name.toLowerCase(), {
							detail: event,
							cancelable: true
						});
						return !util.global.dispatchEvent(domEvent);
					};
				} else if (typeof Event === "function") {
// ...

For some reasons, property defines are gone. I imagine this is either issue with build scripts or es5.defineProperty shim.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 15 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Any plans on doing a new release to fix this issue?

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?

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 js/browser directory without those defines. Therefore installing bluebird as a dependancy of another package yields some apparently outdated version which is still named 3.5.1 in package.json and in comment header in the file itself. Same with the version linked on the website.

Cloning the repo and running build scripts (well, they run automatically through prepublish hook) yields a version with those defines (which is also named 3.5.1 both in package.json and in comment header).

Diff between the two files shows the PromiseRejectionEvent properties, some FakeConstructor magic and copyright year.