Mainly, you can receive a Promise value from another browser window (iframe, etc.), which would have its own Promise different from the one in the current window/frame, and that check would fail to identify the Promise instance.
Above paragraph consists confusing mentioning of transfer a Promise between browser windows. But if it is about postMessage method, it is seems to be impossible to transfer Promise object. (or even callback function) Would you please kindly illustrate with code sample what is it about?
Take a page and put an iframe in it. Inside the iframe, create a promise, then set it into a variable in the parent frame, using a reference like window.top or something like that, to get to the parent window.
Then, check that copied promise with val instanceof Promise, and it'll fail. Because the two "windows" have a separate copy of Promise.
Thanks for prompt reply!
Most helpful comment
Take a page and put an iframe in it. Inside the iframe, create a promise, then set it into a variable in the parent frame, using a reference like
window.topor something like that, to get to the parent window.Then, check that copied promise with
val instanceof Promise, and it'll fail. Because the two "windows" have a separate copy ofPromise.