• Robert Knight's avatar
    Route guest frame unload notifications via host frame · c56cf3fa
    Robert Knight authored
    Change how the sidebar is notified of guest frames being unloaded to
    support guest frames where the client has been loaded via means other
    than `HypothesisInjector` or where the guest is cross-origin.
    
    Instead of listening for the guest frame's 'unload' event from the
    parent frame in `HypothesisInjector`, the guest frame instead listens
    for this event itself and sends a `hypothesisGuestUnloaded` message to
    the host frame via `window.postMessage`, which in turn is handled in the
    `Sidebar` class to relay it to the sidebar app via a `destroyFrame` RPC
    call. This indirect route works around a bug in Safari (see code
    comments).
    
    As well as supporting future use cases, this also simplifies the
    `HypothesisInjector` class as it no longer needs access to the `Bridge`.
    c56cf3fa
guest-test.js 36.1 KB