Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/app/e2e/regression/home.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ async function openHome(page: Page, input: Parameters<typeof mockStressTimeline>
await page.goto("/")
}

test("Home opens when the browser has no Array.prototype.toSorted", async ({ page }) => {
await page.addInitScript(() => {
const proto: { toSorted?: typeof Array.prototype.toSorted } = Array.prototype

delete proto.toSorted
})
const workspace = await mockWorkspace(page, { name: "LegacyBrowser" })
await seed(page, { usedProjects: { local: [workspace.projectID] } })
await page.goto("/")

const projects = page.getByRole("complementary", { name: "Projects" })
await expectAppVisible(projects.getByRole("button", { name: /LegacyBrowser/ }))
})

test("Home projects, utility rows, search and recent sessions show keyboard focus", async ({ page }) => {
const workspace = await mockWorkspace(page, { name: "HomeFocus" })

Expand Down
11 changes: 11 additions & 0 deletions packages/app/src/runtime/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,14 @@ if (!Promise.try) {
return new Promise<T>((resolve) => resolve(callback(...args)))
} as typeof Promise.try
}

// Older Android WebViews need this before the plugin command registry renders.
if (!Array.prototype.toSorted) {
Object.defineProperty(Array.prototype, "toSorted", {
configurable: true,
writable: true,
value: function toSorted<T>(this: ArrayLike<T>, compare?: (a: T, b: T) => number) {
return Array.from({ length: this.length }, (_, index) => this[index]).sort(compare)
},
})
}
Loading