-
Notifications
You must be signed in to change notification settings - Fork 37.1k
Add timeout for content extraction in fetch tool #285102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -815,6 +815,34 @@ suite('WebPageLoader', () => { | |||||||
| assert.ok(window.webContents.executeJavaScript.called); | ||||||||
| })); | ||||||||
|
|
||||||||
| test('returns error when accessibility tree extraction hangs', () => runWithFakedTimers({ useFakeTimers: true }, async () => { | ||||||||
| const uri = URI.parse('https://example.com/page'); | ||||||||
| const loader = createWebPageLoader(uri); | ||||||||
|
|
||||||||
| window.webContents.debugger.sendCommand.callsFake((command: string) => { | ||||||||
| switch (command) { | ||||||||
| case 'Network.enable': | ||||||||
| return Promise.resolve(); | ||||||||
| case 'Accessibility.getFullAXTree': | ||||||||
| // Return a promise that never resolves to simulate hanging | ||||||||
| return new Promise(() => { }); | ||||||||
| default: | ||||||||
| assert.fail(`Unexpected command: ${command}`); | ||||||||
| } | ||||||||
| }); | ||||||||
|
|
||||||||
| const loadPromise = loader.load(); | ||||||||
| window.webContents.emit('did-start-loading'); | ||||||||
|
||||||||
| window.webContents.emit('did-start-loading'); | |
| window.webContents.emit('did-start-loading'); | |
| window.webContents.emit('did-finish-load'); |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a test case where accessibility tree extraction returns insufficient content quickly, but then DOM extraction hangs. This would provide more comprehensive coverage of the timeout behavior during the fallback extraction phase. Currently, the test only covers the case where accessibility tree extraction itself hangs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some cancellation? Like we shouldn't do the second async call if we've timed out.