Skip to content

Commit

Permalink
fix for the beforeunload dialog in the proxyless mode (#2833)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKamaev authored Jan 5, 2023
1 parent e4ae013 commit e87c636
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/client/sandbox/event/unload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ export default class UnloadSandbox extends SandboxBase {
}

private _createEventHandler (eventProperties: EventProperties): Function {
const that = this;

return function (e, originListener): void {
// NOTE: Overriding the returnValue property to prevent a native dialog.
nativeMethods.objectDefineProperty(e, 'returnValue', createPropertyDesc({
Expand Down Expand Up @@ -107,6 +109,13 @@ export default class UnloadSandbox extends SandboxBase {
eventProperties.storedReturnValue = UnloadSandbox._prepareStoredReturnValue(res);
eventProperties.prevented = true;
}

// NOTE: need to return value to show `beforeunload` dialog
// in proxyless mode to handle the dialog in the cdp
if (that.proxyless)
return res;

return void 0;
};
}

Expand Down

0 comments on commit e87c636

Please sign in to comment.