Skip to content

postMessage is 'undefined' and throws 'setImmediate is not defined' error #68

@benjaminprojas

Description

@benjaminprojas

We are using setImmediate through a Promise polyfill (https://github.com/taylorhakes/promise-polyfill) and for the most part it is working perfectly. However, on a few sites, it is throwing a "setImmediate is not defined" error. I have traced the problem down to where it looks for postMessage (https://github.com/YuzuJS/setImmediate/blob/master/setImmediate.js#L87)

It is not getting through that if statement because postMessage is returning as undefined.

However, when I type postMessage in the console, it shows up as a function.

image

Is there a way that we can check to see if postMessage is available in the window object as well as in the global?

Am I missing something here?

We have two sites this is happening on and hundreds of sites where there is no issue (including all our dev sites).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions