Skip to content

Commit

Permalink
Use a proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish committed Nov 30, 2023
1 parent 1a7982a commit 1aca17c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,13 @@ function configureProtocol(options: ElectronMainOptionsInternal): void {

protocol.registerSchemesAsPrivileged([SENTRY_CUSTOM_SCHEME]);

// We override this function so that later user calls to registerSchemesAsPrivileged don't overwrite our custom scheme
// We Proxy this function so that later user calls to registerSchemesAsPrivileged don't overwrite our custom scheme
// eslint-disable-next-line @typescript-eslint/unbound-method
const originalFn = protocol.registerSchemesAsPrivileged;
protocol.registerSchemesAsPrivileged = function (schemes) {
originalFn.call(this, [...schemes, SENTRY_CUSTOM_SCHEME]);
};
protocol.registerSchemesAsPrivileged = new Proxy(protocol.registerSchemesAsPrivileged, {
apply: (target, __, args: Parameters<typeof protocol.registerSchemesAsPrivileged>) => {
target([...args[0], SENTRY_CUSTOM_SCHEME]);
},
});

const rendererStatusChanged = createRendererAnrStatusHandler();

Expand Down

0 comments on commit 1aca17c

Please sign in to comment.