WildcatIP / other.js

The Chatternet feature platform
GNU Affero General Public License v3.0
7 stars 1 forks source link

Native Promise is crashy in JavaScriptCore #79

Closed tonygentilcore closed 7 years ago

tonygentilcore commented 7 years ago

There's a JSC bug in 10 (fixed in the latest beta) that can crash when the native Promise implementation is used. We can work around this by forcing the Promise polyfill to be used.

/cc @kharmabum

aza commented 7 years ago

That's sorta crazy that native Promises were broken! On Mon, Oct 10, 2016 at 8:15 AM Tony Gentilcore notifications@github.com wrote:

There's a JSC bug in 10 (fixed in the latest beta) that can crash when the native Promise implementation is used. We can work around this by forcing the Promise polyfill to be used.

/cc @kharmabum https://github.com/kharmabum

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/other-xyz/other.js/issues/79, or mute the thread https://github.com/notifications/unsubscribe-auth/AAE1iKqtxteX95r12PIuKlXDEHORsqfJks5qylaHgaJpZM4KSrVj .

tonygentilcore commented 7 years ago

@kharmabum I implemented the polyfill workaround in 3.4.2. I tested it in the embed-test project that you gave me and verified that the polyfill is used. It requires providing a swift-based implementation of setTimeout. I have no idea what I'm doing in Swift, but copied the one from http://stackoverflow.com/a/30843832.

Note: I didn't test in the full app or attempt to reproduce the issue. Please verify the fix asap so that I can look into the issue deeper if this doesn't work.

tonygentilcore commented 7 years ago

Also, I guarded the promise polyfill force w/ a global variable that you'll have to set via something like this:

context.evaluateScript("__forcePromisePolyfill = true")