-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prevent "window.sessionStorage" access denied error
* @electron v13 => v14-beta upgrade resolves the error but @electron v14-beta (more likely its @chromium part) at the moment has problems of displaying the https://github.com/ProtonMail/react-components/blob/master/components/select/Select.tsx component in its dropdown state (clicking on this "select" control doesn't open the options list)
- Loading branch information
Showing
10 changed files
with
82 additions
and
50 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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,55 @@ | ||
import {WEBVIEW_LOGGERS} from "src/electron-preload/webview/lib/const"; | ||
import {curryFunctionMembers, testProtonMailAppPage} from "src/shared/util"; | ||
import {documentCookiesForCustomScheme, getLocationHref} from "src/electron-preload/webview/lib/util"; | ||
import {initProviderApi} from "./provider-api"; | ||
import {registerApi} from "./api"; | ||
import {setupProtonOpenNewTabEventHandler} from "src/electron-preload/webview/lib/custom-event"; | ||
import {setupProviderIntegration} from "./provider-api/setup"; | ||
const main = async (): Promise<void> => { | ||
const [ | ||
{WEBVIEW_LOGGERS}, | ||
{curryFunctionMembers, testProtonMailAppPage}, | ||
{documentCookiesForCustomScheme, getLocationHref}, | ||
{initProviderApi}, | ||
{registerApi}, | ||
{setupProtonOpenNewTabEventHandler}, | ||
{setupProviderIntegration}, | ||
] = await Promise.all([ | ||
import("src/electron-preload/webview/lib/const"), | ||
import("src/shared/util"), | ||
import("src/electron-preload/webview/lib/util"), | ||
import("./provider-api"), | ||
import("./api"), | ||
import("src/electron-preload/webview/lib/custom-event"), | ||
import("./provider-api/setup"), | ||
]); | ||
|
||
const logger = curryFunctionMembers(WEBVIEW_LOGGERS.primary, __filename); | ||
const protonAppPageStatus = testProtonMailAppPage({url: getLocationHref(), logger}); | ||
const logger = curryFunctionMembers(WEBVIEW_LOGGERS.primary, __filename); | ||
const protonAppPageStatus = testProtonMailAppPage({url: getLocationHref(), logger}); | ||
|
||
documentCookiesForCustomScheme.enable(logger, true); | ||
setupProtonOpenNewTabEventHandler(logger); | ||
setupProviderIntegration(protonAppPageStatus); | ||
documentCookiesForCustomScheme.enable(logger); | ||
setupProtonOpenNewTabEventHandler(logger); | ||
setupProviderIntegration(protonAppPageStatus); | ||
|
||
if (protonAppPageStatus.shouldInitProviderApi) { | ||
// TODO set up timeout | ||
initProviderApi() | ||
.then(registerApi) | ||
.catch((error) => { | ||
logger.error(error); | ||
throw error; | ||
}); | ||
} | ||
if (!protonAppPageStatus.shouldInitProviderApi) { | ||
return; | ||
} | ||
|
||
if (BUILD_ENVIRONMENT === "development") { | ||
window.addEventListener("error", (event) => { | ||
console.log("window.error event:", event); // eslint-disable-line no-console | ||
}); | ||
} | ||
try { | ||
// TODO set up timeout | ||
registerApi( | ||
await initProviderApi(), | ||
); | ||
} catch (error) { | ||
logger.error(error); | ||
throw error; | ||
} | ||
}; | ||
|
||
(async () => { | ||
await main(); | ||
})().catch((error) => { | ||
console.error( // eslint-disable-line no-console | ||
typeof error === "object" | ||
? ( | ||
new Error( | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
JSON.stringify({name: String(error.name), message: String(error.message), stack: String(error.stack)}), | ||
) | ||
) | ||
: error, | ||
); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
import path from "path"; | ||
|
||
import {ENVIRONMENT_STATE, srcRelativePath} from "webpack-configs/lib"; | ||
import {buildRendererConfig} from "./lib"; | ||
import {srcRelativePath} from "webpack-configs/lib"; | ||
|
||
const baseEntryName = "electron-preload/webview/calendar"; | ||
const src = (value: string): string => path.join(srcRelativePath(baseEntryName), value); | ||
|
||
export default buildRendererConfig( | ||
{ | ||
"electron-preload/webview/calendar": srcRelativePath("./electron-preload/webview/calendar/index.ts"), | ||
[`${baseEntryName}${ENVIRONMENT_STATE.e2e ? "-e2e" : ""}`]: src("./index.ts"), | ||
}, | ||
srcRelativePath("./electron-preload/webview/calendar/tsconfig.json"), | ||
src("./tsconfig.json"), | ||
); |
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 |
---|---|---|
@@ -1,9 +1,14 @@ | ||
import path from "path"; | ||
|
||
import {ENVIRONMENT_STATE, srcRelativePath} from "webpack-configs/lib"; | ||
import {buildRendererConfig} from "./lib"; | ||
import {srcRelativePath} from "webpack-configs/lib"; | ||
|
||
const baseEntryName = "electron-preload/webview/primary"; | ||
const src = (value: string): string => path.join(srcRelativePath(baseEntryName), value); | ||
|
||
export default buildRendererConfig( | ||
{ | ||
"electron-preload/webview/primary": srcRelativePath("./electron-preload/webview/primary/index.ts"), | ||
[`${baseEntryName}${ENVIRONMENT_STATE.e2e ? "-e2e" : ""}`]: src("./index.ts"), | ||
}, | ||
srcRelativePath("./electron-preload/webview/primary/tsconfig.json"), | ||
src("./tsconfig.json"), | ||
); |