mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
Clarify native extension type boundaries
This commit is contained in:
@@ -48,6 +48,7 @@ vi.mock('./profile-sessions/browser-extension-session-loader', () => ({
|
||||
_profile: string,
|
||||
_id: string,
|
||||
run: (session: Electron.Session) => Promise<unknown>
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: this fixture operation callback does not use native session members.
|
||||
) => run({} as Electron.Session),
|
||||
hasBrowserExtensionProfileDemand: () => true,
|
||||
getBrowserExtensionSessionForProfile: vi.fn(),
|
||||
|
||||
@@ -46,6 +46,7 @@ vi.mock('../profile-sessions/browser-extension-session-loader', () => ({
|
||||
_profile: string,
|
||||
_id: string,
|
||||
run: (session: Electron.Session) => Promise<unknown>
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: this fixture operation callback does not use native session members.
|
||||
) => run({} as Electron.Session),
|
||||
hasBrowserExtensionProfileDemand: () => true,
|
||||
getBrowserExtensionSessionForProfile: (profileId: string) =>
|
||||
|
||||
+1
@@ -36,6 +36,7 @@ vi.mock('../profile-sessions/browser-extension-session-loader', () => ({
|
||||
_profile: string,
|
||||
_id: string,
|
||||
run: (session: Electron.Session) => Promise<unknown>
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: this fixture operation callback does not use native session members.
|
||||
) => run({} as Electron.Session),
|
||||
hasBrowserExtensionProfileDemand: () => true,
|
||||
getBrowserExtensionSessionForProfile: () => ({}),
|
||||
|
||||
@@ -440,6 +440,7 @@ it('reuses completed full maintenance until the install store changes, and scope
|
||||
it('skips repeated no-worker cleanup only after completion and invalidates it for every worker generation', async () => {
|
||||
const { refreshWorkerRegistration } = await import('./browser-extension-worker-registration')
|
||||
const clearStorageData = vi.fn(async () => {})
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: worker registration cleanup only calls the provided clearStorageData method.
|
||||
const session = { clearStorageData } as unknown as Electron.Session
|
||||
const prepared = {
|
||||
extensionId: 'b'.repeat(32),
|
||||
|
||||
@@ -100,11 +100,11 @@ export function installMainWindowWebviewSecurity(mainWindow: BrowserWindow): voi
|
||||
{ url: string; options: Electron.LoadURLOptions }
|
||||
>()
|
||||
const captureInitialNavigation = (_event: Electron.Event, guest: Electron.WebContents): void => {
|
||||
const arguments_ =
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: Electron WebContents exposes getLastWebPreferences at runtime; its public type omits it.
|
||||
(
|
||||
guest as Electron.WebContents & { getLastWebPreferences: () => Electron.WebPreferences }
|
||||
).getLastWebPreferences()?.additionalArguments ?? []
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: Electron WebContents exposes getLastWebPreferences at runtime; its public type omits it.
|
||||
const nativeGuest = guest as Electron.WebContents & {
|
||||
getLastWebPreferences: () => Electron.WebPreferences
|
||||
}
|
||||
const arguments_ = nativeGuest.getLastWebPreferences()?.additionalArguments ?? []
|
||||
const marker = arguments_.find((argument) => pendingInitialNavigation.has(argument))
|
||||
if (!marker) {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user