-
Eduardo Sanz García authored
Background information Currently, the bucket-bar should display anchor positions only from a _single_ guest frame. This is because there is no merging mechanism for anchor positions from multiple guest frames. Before this PR * The host frame listened for `anchorsChanged` events from _all_ the guest frames. * Only _one_ guest frame sent this event. We referred to this guest frame as having the 'main' annotatable content. The 'main' annotatable guest frame was identified by not having a `subFrameIdentifier` (a configuration option added to a guest frame when the Hypothesis client was injected). Hence, the 'main' annotatable guest frame was always the frame where the Hypothesis loaded initially (in contrast with the injection mechanism). In this PR We have reversed the logic of how the `anchorChanged` RPC events are send and received: * _Every_ guest frame sends `anchorsChanged` RPC events to the host frame. * The host frame chooses to listen to only _one_ guest frame for the `anchorsChanged` RPC events: the guest frame that connects first with the host. For non-VitalSource case, the first guest frame that connects to the host frame is the one where the Hypothesis client was initially loaded (doesn't contain `subFrameIdentifier` option). For the VitalSource, because of #4176, there is no guest frame in the host frame. This allows the guest frame in the book content, where the Hypothesis client was injected, to send anchor positions, and positions to be reflected in the host's bucket-bar.
c3f6ebe9