https://github.com/kripken/emscripten/blob/93479ecbd390aec4f8a3765fe04bcb365d0b31b2/src/postamble.js#L118-L141
postamble.js adds Module.then when -s MODULARIZE=1 but using it causes indefinite loop on Promise.resolve() and ES2017 await statement.
By the spec the resolving strategy is greedy: if an object has then method then it will be called with two function arguments including resolver and rejector. If the resolver is called with an object with a then method it will be called again with two function arguments, and then again, again.
Module.then resolves with Module which still has then, so the await statement loops indefinitely.
PS: Fixed some wrong concepts.
https://github.com/kripken/emscripten/blob/93479ecbd390aec4f8a3765fe04bcb365d0b31b2/src/postamble.js#L118-L141
postamble.js adds
Module.thenwhen-s MODULARIZE=1but using it causes indefinite loop onPromise.resolve()and ES2017awaitstatement.By the spec the resolving strategy is greedy: if an object has
thenmethod then it will be called with two function arguments including resolver and rejector. If the resolver is called with an object with athenmethod it will be called again with two function arguments, and then again, again.Module.thenresolves withModulewhich still hasthen, so theawaitstatement loops indefinitely.PS: Fixed some wrong concepts.