There is a subtle issue here: all parts of the suggested promise implementation run synchronously.
In spec-compliant promises, the executor runs synchronously [1][2], but the promise must wait until the next turn of the event loop [3] before calling the 'then' method.