i feel like we could skip around all these dirty global/static variables if we did something like `addEvent(window, 'message', onMessage.call(dialog, provider, callback))` (exact syntax may differ from advertised)