Skip to content

Unexpected behavior with Promise.all when Promise is polyfilled by babel-polyfill/core-js. #473

@ngokevin

Description

@ngokevin

#470 (comment)

https://glitch.com/edit/#!/leaf-anchovy?path=index.html:1:0

Promise.all never resolves.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Hello, WebVR! • A-Frame</title>
    <meta name="description" content="Hello, WebVR! • A-Frame">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.0.0/polyfill.js"></script>
    <script src="https://aframe.io/releases/0.8.2/aframe.min.js"></script>
    <script>
      var promise = new Promise(resolve => {
        setTimeout(() => { resolve(); }, 1000);  
      });
      
      Promise.all([promise]).then(() => { console.log('Promise.all resolved.'); });
    </script>
  </head>
  <body>
    <a-scene background="color: #ECECEC">
      <a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9" shadow></a-box>
      <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E" shadow></a-sphere>
      <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D" shadow></a-cylinder>
      <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4" shadow></a-plane>
    </a-scene>
  </body>
</html>

With things like this it could betray a different more fundamental issue, such as async resource callbacks not inducing libUV to tick, so I'd rather understand what's happening than forcefully override it.

Source of the polyfill: https://raw.githubusercontent.com/zloirock/core-js/master/packages/core-js/modules/es.promise.js

I see it has some async calls in this microtask library: https://raw.githubusercontent.com/zloirock/core-js/master/packages/core-js/internals/microtask.js and https://raw.githubusercontent.com/zloirock/core-js/master/packages/core-js/internals/task.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions