mozilla/browserid — Issue #534: include.js catches postMessages not intended for it
Author: ianb
Created: 2011-11-04 22:38:20+00:00
State: open

I have an iframe that itself includes https://browserid.org/include.orig.js and that iframe receives postMessages from its parent. I'm sending some invalid JSON (the string "hello"), which browserid's include catches, but was not intended for browserid.

I get this (mostly harmless) exception:
Uncaught SyntaxError: Unexpected token h (include.orig.js:110)

It seems like a check of event.origin could determine immediately that the message didn't come from browserid, before any JSON parsing.