-
Notifications
You must be signed in to change notification settings - Fork 215
Description
This is a partial list of issues with the client's current support for guest frames which impact VitalSource, and that we'll need to solve.
- The current
FrameObserver/HypothesisInjectorsystem for adding the client to iframes on the page does not support discovering iframes that are contained in shadow roots. In the VitalSource book reader, the content frame is contained in a shadow root attached to a<mosaic-book>element. (Update: Resolved by exposing the ability for an integration to inject the client into a specific frame. See Implement "manual" injection of client into frames when requested by integration #3813) - If a guest iframe is unloaded, the sidebar is not notified (via a
destroyFrameRPC call) unless that frame is monitored byFrameObserver. The obvious thing to do here would be for theGuestclass to notify the sidebar when destroyed, and to callguest.destroy()from thewindow.unloadevent in the guest iframe. In my testing this works in Chrome and Firefox but I encountered a problem in Safari where MessagePort messages posted from this event handler don't seem to arrive in the destination frame. (Update: Fixed by Route guest frame unload notifications via host frame #3812) - The sidebar currently assumes that there is one "main" frame with no frame identifier and one or more sub-frames. Various parts of the UI, such as the Help panel, reflect only the URL from the main frame. In ebook readers we typically don't want to allow annotation in the host frame but only the content frame. (Update: Partially resolved. The Help panel now displays URLs from all connected frames. See Show URLs for all connected frames in help panel #3811)
- If multiple frames are connected to the sidebar, annotations can incorrectly be marked as orphans because the sidebar sends all loaded annotations to all frames, instead of only sending them to the frame with the corresponding document. (Inconsistent re-anchoring in multi-guest scenarios #3992) (Update: This has been fixed for VitalSource by not injecting the client into the host frame, so the only guest is the book content, and by only sending annotations to a single frame in
FrameSyncService. There are still things to fix in the general case outside of VS, see WIP - Fetch annotations for each frame separately #4193.) - Injection of the client by
HypothesisInjectorinto iframes on the page doesn't work in the browser extension, because theassetRootconfiguration setting is not injected. (Update: Fixed by Proxy asset urls from host frame into injected iframes #3814)
For issues (1) and (2), a possible solution might be to have some way for the document-type integration to signal that a particular frame should have the client injected, even if it would not have been auto-discovered by FrameObserver.
For issues (3) and (4), we'll need some way to signal to the sidebar that the top-level (host frame) should be ignored and not stored in the frames state. One way to do this would be to avoid instantiating the Guest class in that frame. However the annotator code currently has no support for host frames without guest functionality. So we'll either need to add that, or provide a way to signal that the guest functionality is inactive for a particular frame.