Safari drops ticks for backgrounded tasks iOS 14
See original GitHub issueWe are developing an Cordova based iOS App. Everything works fine on iOS 13, but we experience issues on iOS 14.
Whenever the App is sent to background and retrieved again the app is unresponsive as we use Q.js for our ViewManager.
When debugging this via the Safari Web Inspector I noticed that var def = Q.defer(); def.promise.done(function(value) { alert(value); }); def.resolve("Done")
works before but not after sending the app to the background.
However native Javascript Promises work as expected new Promise(function(resolve, reject) { resolve("Done"); }).then(function(value) { alert(value) });
When inspecting the def
variable using def.promise.inspect()
the state is resolved and I can see the value, however none of the functions (resolve, reject, finally) are called, neither in the done, nor in the then function.
Anyone experience similar issues?
Edit: We are using Q#1.5.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (3 by maintainers)
Top GitHub Comments
There were reports of Safari dropping timer events ages ago. I don’t know whether they went away, but your description of the problem seems to indicate a regression. Apart from looking for a more reliable primitive for timers as @benjamingr hints at, there is not a lot Q can do, and changing the underlying nextTick implementation requires very time consuming testing.
To wit, you can see some of that rigor over on https://github.com/kriskowal/asap, which I’ve not updated in ages.
It may be worthwhile to file an issue against Safari.
FYI, I opened FB8533670 with Apple regarding a change in
onmessage
in WKWebView on iPadOS 14 as the App leaves the foreground. My related Apple Developer Forum post is here, for tracking.Ended up making a temporary patch to q.js:
setTimeout
right before posting a messageflush()
When the posted message is missed, the timeout calls
flush()
.