YuzuJS/setImmediate

Redefining `global.onmessage` is breaking Firefox 49

haakonjack opened this issue · 3 comments

Firefox logs show:

Message: TypeError: can't define property "onmessage": Object is not extensible
  Stack:
    canUsePostMessage

Removing the setImmediate lib resolves the issue.

Sounds like a Firefox bug; have you tried filing it there?

@domenic This issue is reproducible (at least) in a case if code is running as Firefox's SDK-based addon content script. In this case global argument is not a Window, but self object that is, in its turn, naturally not extensible. Not sure about WebExtensions addons since I don't have any at this moment.

Test can be fixed by adding one more condition && !(global.port && global.port.emit) here. However there is one more place where you're modifying global so this is also need to be changed (most likely object choosing here). However I abstain from proposing changes in this area since I may not know about some implementation details.

Hope this information will help to resolve this issue since it currently breaks my addon too :)

Issue is probably not actual anymore, at least into add-on environment since Firefox is moving to WebExtensions that have no such problem