mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
fix(browser): keep the Annotate pick armed when a page rewrites its URL fragment (#34423)
This commit is contained in:
@@ -133,14 +133,14 @@ export class BrowserGrabSessionController {
|
||||
}
|
||||
}
|
||||
|
||||
// Subframe navigations, such as ad loads, must not cancel the selection.
|
||||
// Subframe loads and in-place URL updates (scroll spies) keep the overlay's document.
|
||||
const handleNavigation = (
|
||||
_event: unknown,
|
||||
_url: unknown,
|
||||
_isInPlace: unknown,
|
||||
isInPlace: boolean,
|
||||
isMainFrame: boolean
|
||||
): void => {
|
||||
if (isMainFrame) {
|
||||
if (isMainFrame && !isInPlace) {
|
||||
settleOnce({ opId, kind: 'cancelled', reason: 'navigation' })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -546,6 +546,21 @@ describe('browserManager grab operations', () => {
|
||||
|
||||
expect(browserManager.hasActiveGrabOp('tab-1')).toBe(true)
|
||||
})
|
||||
|
||||
it('does not cancel grab when the page rewrites its URL in place', async () => {
|
||||
guestExecuteJavaScriptMock.mockImplementation(() => new Promise(() => {}))
|
||||
|
||||
void browserManager.awaitGrabSelection('tab-1', 'op-1', guest)
|
||||
|
||||
const navHandler = guestOnMock.mock.calls.findLast(
|
||||
([event]) => event === 'did-start-navigation'
|
||||
)?.[1] as ((...args: unknown[]) => void) | undefined
|
||||
|
||||
expect(navHandler).toBeTypeOf('function')
|
||||
navHandler?.(null, 'https://example.com/#section-2', true, true)
|
||||
|
||||
expect(browserManager.hasActiveGrabOp('tab-1')).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('destruction auto-cancel', () => {
|
||||
|
||||
Reference in New Issue
Block a user