• Robert Knight's avatar
    Revise how guest notifies host and sidebar when it is unloaded · 4b021476
    Robert Knight authored
    Change how the guest notifies other frames, specifically the sidebar and host,
    when it is unloaded. The host and sidebar now receive a `frameDestroyed` message
    from the corresponding guest port, which allows them to easily close the right
    port and remove it from the list of active guest ports.
    
    Due to a Safari bug (see code comments) we can't send the `frameDestroyed`
    messages from the guest frame while it is being unloaded. However it is possible
    to first transfer the port to the host frame and then have the host frame send
    the message on the same port. I also tried sending the message from the guest
    frame, and then transferring the port to the host frame but that didn't work.
    This workaround has the advantage that it is transparent to the receiver of the
    `frameDestroyed` message.
    
    This change is also a step towards possibly not relying on user-provided guest
    frame identifiers in the sidebar, which only become available once the
    `documentInfoChanged` call has been received. Instead the sidebar could
    use its own internal IDs for guest frames, avoiding the possibility for
    conflicts.
    
    Changes in detail:
    
     - Add `disconnect` method to PortRPC
    
     - When guest is unloaded, transfer ports to the host frame in a
       `hypothesisGuestUnloaded` message, and make the host frame dispatch
       `frameDestroyed` calls on these ports.
    
     - Handle `frameDestroyed` in sidebar by closing port, removing it from
       the active guest list and removing the associated frame from the
       store
    
     - Handle `frameDestroyed` in host frame by closing port and removing it
       from the active guest list
    4b021476
Name
Last commit
Last update
..
messaging Loading commit data...
test Loading commit data...
config-fragment.js Loading commit data...
frame-error-capture.js Loading commit data...
injector.js Loading commit data...
listener-collection.js Loading commit data...
prompts.js Loading commit data...
random.js Loading commit data...
renderer-options.js Loading commit data...
shortcut.js Loading commit data...
type-coercions.js Loading commit data...
user-agent.js Loading commit data...
warn-once.js Loading commit data...