From 0af3dbe1247f6de0574b7f024bf047ed8d79f0d1 Mon Sep 17 00:00:00 2001 From: Dmitriy Vasyura Date: Thu, 4 Dec 2025 13:34:23 -0800 Subject: [PATCH] Added test for ERR_ABORTED --- .../test/electron-main/webPageLoader.test.ts | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/vs/platform/webContentExtractor/test/electron-main/webPageLoader.test.ts b/src/vs/platform/webContentExtractor/test/electron-main/webPageLoader.test.ts index 4f3d218c467..8e0104afb8b 100644 --- a/src/vs/platform/webContentExtractor/test/electron-main/webPageLoader.test.ts +++ b/src/vs/platform/webContentExtractor/test/electron-main/webPageLoader.test.ts @@ -188,6 +188,38 @@ suite('WebPageLoader', () => { } }); + test('ERR_ABORTED is ignored and content extraction continues', () => runWithFakedTimers({ useFakeTimers: true }, async () => { + const uri = URI.parse('https://example.com/page'); + const axNodes = createMockAXNodes(); + + const loader = createWebPageLoader(uri); + + window.webContents.debugger.sendCommand.callsFake((command: string) => { + switch (command) { + case 'Network.enable': + return Promise.resolve(); + case 'Accessibility.getFullAXTree': + return Promise.resolve({ nodes: axNodes }); + default: + assert.fail(`Unexpected command: ${command}`); + } + }); + + const loadPromise = loader.load(); + + // Simulate ERR_ABORTED (-3) which should be ignored + const mockEvent: MockElectronEvent = {}; + window.webContents.emit('did-fail-load', mockEvent, -3, 'ERR_ABORTED'); + + const result = await loadPromise; + + // ERR_ABORTED should not cause an error status, content should be extracted + assert.strictEqual(result.status, 'ok'); + if (result.status === 'ok') { + assert.ok(result.result.includes('Test content from page')); + } + })); + //#endregion //#region Redirect Tests