-
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 |
---|---|---|
.. | ||
test | ||
README.md | ||
index.js | ||
port-finder.js | ||
port-provider.js | ||
port-rpc.js | ||
port-util.js |