question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unhandled rejection check causes errors in Firefox

See original GitHub issue
  • Bluebird 3.7.0
  • Firefox 71 (Nightly)

I recently upgraded from Bluebird 3.5.5 to 3.7.0, which happens to pull in the unhandled rejection handling from https://github.com/petkaantonov/bluebird/commit/60ef7a0e23fd320a11281f67c64a39ff95612ce9 (first added in 3.6.0).

The path which adds an iframe, grabs setTimeout from it, then removes it from the document does not appear to work in Firefox 71. Instead, calling this setTimeout fails with an NS_ERROR_NOT_INITIALIZED exception.

(As an aside, I am curious why you want to pull setTimeout from a throwaway frame like this… Why not just use the main document?)

For now, I will revert back to 3.5.5.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:11
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
MattiasBuelenscommented, Nov 6, 2019

As described here, Bluebird creates an iframe, takes its setTimeout function and then removes the iframe from the DOM. It then uses that function to schedule checks for unhandled rejections.

I suspect that Firefox destroys the window of the iframe when it’s removed from the DOM, and as such the setTimeout function becomes invalid.

Can’t we capture the original value of setTimeout while Bluebird is loading, and always use that inside deferUnhandledRejectionCheck? That way, Bluebird would not be affected by a test framework replacing the global setTimeout afterwards. It would also be much simpler, without needing platform-specific specializations.

1reaction
jaapzcommented, Dec 6, 2019

I was experiencing this bug as well and the newly released version 3.7.2 fixed it for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Window: unhandledrejection event - Web APIs | MDN
The unhandledrejection event is sent to the global scope of a script when a JavaScript Promise that has no rejection handler is rejected; ......
Read more >
Unhandled promise rejection - Firefox - Stack Overflow
I am using the latest version of FF and this code works in the latest version of Chrome and even Ie 11. Unhandled...
Read more >
Logging And Debugging Unhandled Promise Rejections In ...
If a Promise chain contains an error that is swallowed, it can lead to strange behaviors and hard to debug issues in your...
Read more >
Uncaught errors in Node.js and the browser
log('Unhandled Rejection at:', promise, 'reason:', reason);. });. readFile('./non-existent- ...
Read more >
Error Messages | Cypress Documentation
Test File Errors No tests found This message means that Cypress was unable ... or its unhandledrejection handler, Cypress will detect it and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found