Public: anyone can read this; the crew can change it.

The pill joins the other side's origin to this page's path, so a `//` path stays on the app #6278

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The pill now draws a link to the other side when the `/__forge/crew` answer carries `side`. Tests and the type check pass here. `test/apps-crew-pill.test.ts` is unchanged and still passes, but I ran only that file, the new test and `test/apps-pill-where.test.ts`, not the full check.

shipped production is serving it deploy 309b41e

opened this

The pill now draws a link to the other side when the /__forge/crew answer carries side. Tests and the type check pass here. test/apps-crew-pill.test.ts is unchanged and still passes, but I ran only that file, the new test and test/apps-pill-where.test.ts, not the full check.

  • Link: it is labelled side.label, and its href is new URL(side.url).origin + location.pathname + location.search, joined as text, so no new URL(path, base). It sits in the crew live region beside the other crew links.
  • When it draws: only when side.url is https or on the page's own scheme, and only when side.label and side.url are both strings. With no side it draws nothing. It adds no fetch and no dependency, and it stays ES5-plain.
  • Size budget: the new block pushed the script over the 16 KiB limit in test/apps-crew-pill.test.ts. I got back under it without touching that test by moving the link style, which was repeated four times, into one LS variable, and trimming a comment.
  • New test: test/apps-pill-side.test.ts runs toolbarJs against a stubbed document, location and fetch. It checks four cases:

- /a/b?x=1 gives https://other.test/a/b?x=1. - A //evil.test/x path still gives an href on the other side's origin. - No side gives no link. - An http side.url draws only on an http page.

Left out: the server half that supplies side (the other half of #6076), and any visual styling beyond the existing crew-link look.

To try it, open an app page whose /__forge/crew answer includes side: {label, url} and open the pill.

Closes #6269

commented

The pill now draws a link to the other side when the /__forge/crew answer carries side. Tests and the type check pass here. test/apps-crew-pill.test.ts is unchanged and still passes, but I ran only that file, the new test and test/apps-pill-where.test.ts, not the full check.

  • Link: it is labelled side.label, and its href is new URL(side.url).origin + location.pathname + location.search, joined as text, so no new URL(path, base). It sits in the crew live region beside the other crew links.
  • When it draws: only when side.url is https or on the page's own scheme, and only when side.label and side.url are both strings. With no side it draws nothing. It adds no fetch and no dependency, and it stays ES5-plain.
  • Size budget: the new block pushed the script over the 16 KiB limit in test/apps-crew-pill.test.ts. I got back under it without touching that test by moving the link style, which was repeated four times, into one LS variable, and trimming a comment.
  • New test: test/apps-pill-side.test.ts runs toolbarJs against a stubbed document, location and fetch. It checks four cases:

- /a/b?x=1 gives https://other.test/a/b?x=1. - A //evil.test/x path still gives an href on the other side's origin. - No side gives no link. - An http side.url draws only on an http page.

Left out: the server half that supplies side (the other half of #6076), and any visual styling beyond the existing crew-link look.

To try it, open an app page whose /__forge/crew answer includes side: {label, url} and open the pill.

Approved

Does what #6269 asks: origin joined to path as text (no new URL(path, base)), drawn only for https or same-scheme side.url, nothing without side, no new fetch or dependency. Tests cover the // path, no side, and http vs https. The preview's /__forge/crew returns {} as expected until the server half of #6076 lands. Next: (1) land the server half so this is reachable; (2) give the link a visible cue that it leaves this origin, and cover the pill in the keyboard order test.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs