-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix resolve system proxy error when no windows available (#7375)
* fix resolve system proxy error when no windows available Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix electronBrowserWindowInjectable id Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> --------- Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
- Loading branch information
Showing
6 changed files
with
70 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...main/utils/resolve-system-proxy/electron-browser-window.global-override-for-injectable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Copyright (c) OpenLens Authors. All rights reserved. | ||
* Licensed under MIT License. See LICENSE in root directory for more information. | ||
*/ | ||
|
||
import { getGlobalOverride } from "@k8slens/test-utils"; | ||
import type { BrowserWindow, Session, WebContents } from "electron"; | ||
import electronBrowserWindowInjectable from "./electron-browser-window.injectable"; | ||
|
||
export default getGlobalOverride( | ||
electronBrowserWindowInjectable, | ||
() => () => ({ | ||
webContents: { | ||
session: { | ||
resolveProxy: () => "DIRECT", | ||
} as unknown as Session, | ||
} as unknown as WebContents, | ||
} as unknown as BrowserWindow), | ||
); |
19 changes: 19 additions & 0 deletions
19
packages/core/src/main/utils/resolve-system-proxy/electron-browser-window.injectable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Copyright (c) OpenLens Authors. All rights reserved. | ||
* Licensed under MIT License. See LICENSE in root directory for more information. | ||
*/ | ||
import { getInjectable } from "@ogre-tools/injectable"; | ||
import type { BrowserWindowConstructorOptions } from "electron"; | ||
import { BrowserWindow } from "electron"; | ||
|
||
const electronBrowserWindowInjectable = getInjectable({ | ||
id: "electron-browser-window", | ||
instantiate: () => { | ||
return (opts: BrowserWindowConstructorOptions) => { | ||
return new BrowserWindow(opts); | ||
}; | ||
}, | ||
causesSideEffects: true, | ||
}); | ||
|
||
export default electronBrowserWindowInjectable; |
14 changes: 0 additions & 14 deletions
14
packages/core/src/main/utils/resolve-system-proxy/electron.injectable.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters