Add a communication channel for forcing reloads across tab sessions.

Review Request #13048 — Created May 16, 2023 and submitted — Latest diff uploaded

Information

Review Board
release-6.x

Reviewers

The new behavior for the unified banner means that individual tabs fetch
and keep track of pending review/draft IDs more eagerly than before. The
result of this is that it was easier to hit bugs when performing actions
with a review request open in multiple tabs.

This change adds a small utility that makes use of the
BroadcastChannel API to coordinate across multiple tabs/windows within
a browser session. Right now the only message that we send is "reload",
which asks other tabs to reload their contents. This is sent when
something is either published or discarded, which invalidates draft IDs.

The broadcast channel is origin-wide, so each PageView can implement a
method to return a data blob that's used for filtering whether or not to
reload. The default implementation is empty, and ReviewablePageView
will filter based on the review request ID (so any open tabs related to
that review request will be triggered).

  • Ran js-tests.
  • Published review requests, reviews, and replies from one tab, and saw
    other tabs pop up the alert and reload.
  • Discarded drafts from the unified banner and from the review dialog,
    and saw other tabs pop up the alert and reload.

Commits

Files

    Loading...