Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 1x 7x 7x 7x 7x | type TExtendedWindow = typeof window & {
Cypress?: unknown;
};
/**
* Disallowing a client application to be bootstrapped in an iframe increases application security.
* Exceptions:
* - the app is bootstrapped in the integration testing environment (Cypress);
* - the app origin is http://localhost:4200.
* This functions should be used in the main.ts files of client application.
*/
export const applicationIsFramed = (
self = window.self,
top = window.top,
cypress = (window as TExtendedWindow).Cypress,
origin = window.location.origin,
): boolean => {
const framed = self !== top;
const cypressEnv = typeof cypress !== 'undefined';
const localhost = origin === 'http://localhost:4200';
return framed && (!cypressEnv || !localhost);
};
|