1. 16 Dec, 2021 8 commits
  2. 15 Dec, 2021 7 commits
  3. 13 Dec, 2021 12 commits
  4. 10 Dec, 2021 2 commits
  5. 09 Dec, 2021 5 commits
  6. 08 Dec, 2021 6 commits
    • Eduardo's avatar
      Apply suggestions from code review · f54ca621
      Eduardo authored
      Co-authored-by: 's avatarRobert Knight <robertknight@gmail.com>
      f54ca621
    • Eduardo's avatar
      Apply suggestions from code review · f05b0759
      Eduardo authored
      Co-authored-by: 's avatarRobert Knight <robertknight@gmail.com>
      f05b0759
    • Eduardo Sanz García's avatar
      Toggle annotation/note button in multi-frame scenarios · b802451d
      Eduardo Sanz García authored
      In order to toggle correctly the `Toolbar` button between `New page
      note` and `New annotation` we have created a new `guest-host` channel of
      communication. Previous code failed to toggle the button because it used
      an event emitter, hence assuming that the `Guest` was in the same frame
      as the host.
      
      - The `Sidebar` keeps track of the iframe that has currently text
        selected. It uses the `subFrameIdentifier`. If there is no
        `subFrameIdentifier` (currently the top `Guest` frame), it sets the
        identifier to 'main', referring to the frame with the main annotatable
        content. This will change in a follow up PR that will add more logic
        into which frame is tagged as 'main'.
      
      - Only one iframe at a time can have selected text.
      
      - The event emitter `hasSelectionChanged` has been replaced by three RPC
        methods: 'textSelectedAt`, 'textDeselectedAt', 'deselecTextExcept'
      
      - `deselecTextExcept` is used to clear text selections in other frames,
        except from the iframe that has the latest selection. This is not the
        neatest solution, but for now it works.
      
      On a follow up PR I will address the removal of the shadow left from
      previous a selection.
      
      Closes https://github.com/hypothesis/product-backlog/issues/1236
      b802451d
    • Robert Knight's avatar
      Capture message validation errors when handling port provider requests · dc90424c
      Robert Knight authored
      To help us debug issues with sidebar-host connection setup [1], report an
      error to the sidebar if PortProvider receives a message which looks like
      a port request (data has the structure `{ frame1: string, frame2:
      string, type: 'request' }`) but comes from a non-Window source, invalid
      origin or is not a valid combination of frames.
      
      [1] https://sentry.io/organizations/hypothesis/issues/2810452318/
      dc90424c
    • Robert Knight's avatar
      Handle port requests from guests with opaque origins · 905077aa
      Robert Knight authored
      When a guest frame with an opaque origin, such as file:// URL or a sandboxed
      iframe, sends a request for a port to the host frame, the `event.origin` value
      will be the string "null". This is not a legal value for the `targetOrigin`
      argument to `postMessage`, so we need to remap it to "*" (any origin).
      905077aa
    • Robert Knight's avatar
      Remove a test which doesn't test what it intends to · a9ce9227
      Robert Knight authored
      Dates are in fact JSON-serializable, but as strings.
      
      Recent changes to `isMessageEqual` mean that the `JSON.stringify` calls
      cannot fail, because the `isMessage` check ensures all the fields we
      serialize are strings. Writing a test to check for this failure mode is
      not possible. There is a refactoring hazard here, so I added a comment
      to call this out.
      a9ce9227