The iOS app opens offline: the page is kept however it was loaded (#506)
The phone in airplane mode opened to "Cannot reach ipodderx.sdf1.net". The service worker kept the page only when a navigation passed through it, and the app's own load from Swift may not, so it had no page to answer with. The page now asks the worker to keep / on every load, and the app, when a load fails for want of a connection, tries once more from the web view's cache (returnCacheDataDontLoad) before the alert. The Swift is not compiled here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RqkrVCCH8YcP2Y3i8VNYWA
This commit is contained in:
@@ -109,6 +109,16 @@ test('a page older than the script the server sends is loaded again, not run wit
|
||||
expect(await kept()).not.toContain('/app.js?v=000000000000');
|
||||
});
|
||||
|
||||
test('the page has the worker keep it however it was loaded, for the iOS app (#506)', async ({ page }) => {
|
||||
await controlled(page);
|
||||
const has = () => page.evaluate(async () => !!(await (await caches.open('ipx-page')).match('/')));
|
||||
// As if the load had not come through the worker, which the app's own load does not.
|
||||
await page.evaluate(async () => { await (await caches.open('ipx-page')).delete('/'); });
|
||||
expect(await has()).toBe(false);
|
||||
await page.evaluate(() => navigator.serviceWorker.controller!.postMessage({ keepPage: true }));
|
||||
await expect.poll(has).toBe(true);
|
||||
});
|
||||
|
||||
test('online, a picture in an item\'s text still comes from its publisher, through the worker', async ({ page }) => {
|
||||
await controlled(page);
|
||||
await page.locator('#feedlist .feed', { hasText: 'Offline Blog' }).click({ timeout: 20_000 });
|
||||
|
||||
Reference in New Issue
Block a user