-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
setImmediate
is broken in file://
protocols in iOS.
#770
Comments
dtinth
added a commit
to dtinth/core-js
that referenced
this issue
Feb 17, 2020
Same problem here. After updating to latest core-js version we cannot deploy our web app to ios (inside a WKWebView that points to local files). |
@diegodalbosco try that patch #771 |
@slowcheetah We tried the patch and for our use case is working 🎉 Thanks @dtinth! |
Merged
This was referenced Apr 12, 2020
This was referenced Apr 25, 2020
This was referenced May 5, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background
We at @taskworld noticed that when our application is running inside Cordova, some Promise would never resolve. Instead, we’d get a weird error message on the console: “Unable to post message to file://. Recipient has origin null.”
Upon further investigation, we found that some of our 3rd-party libraries are using an outdated Promise implementation which depends on
setImmediate
.setImmediate
is broken in Cordova, so I decided to file an issue here incore-js
.Investigation
This situation happens in Cordova apps,
Web application is run on
file://
protocol using Safari’s engine.The
defer
selection logic selectspostMessage
to be used (MessageChannel
is not used due toIS_IOS
clause):core-js/packages/core-js/internals/task.js
Lines 61 to 81 in 4546ffe
The
postMessage
implementation of defer doesn’t work withfile:
protocol, it errors out with this:Suggested fix
If
location.protocol === 'file:'
, fallback to alternative methods. I made a PR #771 that implements the suggested fix.Current workaround
I investigated this issue while working on Taskworld, so gotta plug that in. 😄
The text was updated successfully, but these errors were encountered: