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.

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).