Skip to content
Merged
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
183 changes: 0 additions & 183 deletions patches/adm-zip@0.6.0.patch

This file was deleted.

13 changes: 5 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ supportedArchitectures:
overrides:
'@hono/node-server': 2.0.11
'@xmldom/xmldom@0.8': 0.8.15
adm-zip: ^0.6.0
adm-zip: ^0.6.1
brace-expansion: 5.0.9
minimatch: 10.2.5
deepmerge-ts: 8.0.0
Expand Down Expand Up @@ -73,11 +73,10 @@ minimumReleaseAgeExclude:
- ip-address
- undici

# adm-zip has no non-vulnerable published release: 0.6.0 fixes the 4 GB memory
# allocation advisory, but it and every release back to 0.5.9 follow destination
# symlinks during extraction. Keep the upstream-compatible symlink guard locally
# until a release newer than 0.6.0 includes cthackers/adm-zip#575. The regression
# test in scripts/adm-zip-symlink-patch.test.ts fails if this patch is dropped.
# adm-zip 0.6.1 fixes the declared-size allocation advisory and includes the
# destination-symlink protections previously carried as a local patch. The
# regression test in scripts/adm-zip-symlink-patch.test.ts keeps that protection
# pinned if a future release regresses it.

# Four patches to @anthropic-ai/sandbox-runtime, all in one patch file. Drop
# each once upstream does the same; the named test fails loudly if a version
Expand Down Expand Up @@ -112,4 +111,3 @@ minimumReleaseAgeExclude:
# `project-sandbox/worktree-preparation.test.ts`.
patchedDependencies:
'@anthropic-ai/sandbox-runtime@0.0.74': patches/@anthropic-ai__sandbox-runtime@0.0.74.patch
adm-zip@0.6.0: patches/adm-zip@0.6.0.patch
82 changes: 82 additions & 0 deletions src/main/windows/browser-context-menu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import {
buildBrowserContextMenuTemplate,
createBrowserGuestInspectionController,
inspectBrowserGuestElement,
suggestedImageFilename,
type BrowserContextMenuActions,
type BrowserContextMenuParams,
type BrowserGuestInspector,
} from './browser-context-menu.ts'

function baseParams(overrides: Partial<BrowserContextMenuParams> = {}): BrowserContextMenuParams {
Expand Down Expand Up @@ -189,6 +192,85 @@ describe('buildBrowserContextMenuTemplate', () => {
})
})

describe('inspectBrowserGuestElement', () => {
function recordingInspector(initiallyOpen = false): {
inspector: BrowserGuestInspector
calls: string[]
announceOpened: () => void
destroy: () => void
} {
const calls: string[] = []
let destroyed = false
let opened = initiallyOpen
let openedListener: (() => void) | undefined
const inspector: BrowserGuestInspector = {
isDestroyed: () => destroyed,
isDevToolsOpened: () => opened,
onceDevToolsOpened: (listener) => {
openedListener = listener
},
openDevTools: () => {
calls.push('open')
},
inspectElement: (x, y) => {
calls.push(`inspect:${String(x)},${String(y)}`)
},
}
return {
inspector,
calls,
announceOpened: (): void => {
opened = true
openedListener?.()
},
destroy: (): void => {
destroyed = true
},
}
}

it('waits for the native menu to close before opening and targeting DevTools', () => {
const recording = recordingInspector()
const controller = createBrowserGuestInspectionController(recording.inspector)

controller.selectElement(10, 20)
assert.deepEqual(recording.calls, [])

controller.menuClosed()
assert.deepEqual(recording.calls, ['open'])

recording.announceOpened()
assert.deepEqual(recording.calls, ['open', 'inspect:10,20'])
})

it('does nothing when the native menu closes without selecting Inspect Element', () => {
const recording = recordingInspector()
const controller = createBrowserGuestInspectionController(recording.inspector)

controller.menuClosed()

assert.deepEqual(recording.calls, [])
})

it('inspects immediately when DevTools are already open', () => {
const recording = recordingInspector(true)

inspectBrowserGuestElement(recording.inspector, 4, 8)

assert.deepEqual(recording.calls, ['inspect:4,8'])
})

it('does not inspect a guest destroyed while DevTools open', () => {
const recording = recordingInspector()

inspectBrowserGuestElement(recording.inspector, 2, 6)
recording.destroy()
recording.announceOpened()

assert.deepEqual(recording.calls, ['open'])
})
})

describe('suggestedImageFilename', () => {
it('uses the URL path basename when it has an extension', () => {
assert.equal(
Expand Down
Loading
Loading