Improve script error dialogs #304

- Include the script's directory path #304.
- Exclude Windows-specific instructions on non-Windows OS.
- Standardize language across dialogs for consistency.

Other supporting changes:

- Add script diagnostics data collection from main process.
- Document script file storage and execution tamper protection in
  SECURITY.md.
- Remove redundant comment in `NodeReadbackFileWriter`.
- Centralize error display for uniformity and simplicity.
- Simpify `WindowVariablesValidator` to omit checks when not on the
  renderer process.
- Improve and centralize Electron environment detection.
- Use more emphatic language (don't worry) in error messages.
This commit is contained in:
undergroundwires
2024-01-17 23:59:05 +01:00
parent f03fc24098
commit 6ada8d425c
34 changed files with 1182 additions and 450 deletions

View File

@@ -15,7 +15,9 @@ describe('RendererApiProvider', () => {
setupContext(context: RendererApiProviderTestContext): RendererApiProviderTestContext;
readonly expectedValue: unknown;
}
const testScenarios: Record<PropertyKeys<Required<WindowVariables>>, WindowVariableTestCase> = {
const testScenarios: Record<
PropertyKeys<Required<WindowVariables>>,
WindowVariableTestCase> = {
isRunningAsDesktopApplication: {
description: 'returns true',
setupContext: (context) => context,
@@ -32,9 +34,12 @@ describe('RendererApiProvider', () => {
})(),
log: expectFacade({
instance: new LoggerStub(),
setupContext: (c, logger) => c.withLogger(logger),
setupContext: (c, instance) => c.withLogger(instance),
}),
dialog: expectIpcConsumer(IpcChannelDefinitions.Dialog),
scriptDiagnosticsCollector: expectIpcConsumer(
IpcChannelDefinitions.ScriptDiagnosticsCollector,
),
};
Object.entries(testScenarios).forEach((
[property, { description, setupContext, expectedValue }],
@@ -109,10 +114,10 @@ class RendererApiProviderTestContext {
public provideWindowVariables() {
return provideWindowVariables(
() => this.log,
() => this.os,
this.apiFacadeCreator,
this.ipcConsumerCreator,
() => this.os,
() => this.log,
);
}
}