Skip to content
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

Update Promise PJs #10762

Merged
merged 1 commit into from Aug 2, 2017
Merged

Conversation

jridgewell
Copy link
Contributor

@jridgewell jridgewell commented Aug 2, 2017

Fixes #10730.

A very interesting bug where promise adoption (an inner promise being
returned in side a #then block causes the outer to adopt the inner)
would not update the state of the outer promise if the inner was still
pending.

This only appeared when:

  1. The outer promise was stored, and not used as a larger chain.
  2. The inner promise was pending.
  3. The outer promise has a #then block after the inner promise
    resolved.
var inner = new Promise(res => setTimeout(res, 0));
var outer = new Promise(res => res(inner));

// wait till after inner resolves
outer.then(() => {
  // I'll never be called. Whooops.
});

Fixes ampproject#10730.

A very interesting bug where promise adoption (an inner promise being
returned in side a `#then` block causes the outer to adopt the inner)
would not update the state of the outer promise if the inner was still
pending.

This only appeared when:

1. The outer promise was stored, and not used as a larger chain.
2. The inner promise was pending.
3. The outer promise has a `#then` block _after_ the inner promise
  resolved.
Copy link

@dreamofabear dreamofabear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the super quick fix!

@dreamofabear dreamofabear merged commit 8f3c876 into ampproject:master Aug 2, 2017
cvializ pushed a commit that referenced this pull request Aug 2, 2017
Fixes #10730.

A very interesting bug where promise adoption (an inner promise being
returned in side a `#then` block causes the outer to adopt the inner)
would not update the state of the outer promise if the inner was still
pending.

This only appeared when:

1. The outer promise was stored, and not used as a larger chain.
2. The inner promise was pending.
3. The outer promise has a `#then` block _after_ the inner promise
  resolved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

amp-bind: Doesn't work on IE11
4 participants