Content security policy #1351

Closed
opened 2025-08-09 17:19:49 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @MrCrimp on 9/30/2016

The following files where reported from content security policy checking
domain-task/fetch.js

Inline eval() and functions() are not compliant with content security policy
var isBrowser = (new Function('try { return this === window; } catch (e) { return false; }'))();

This is how I'd do the same test

export const isNode = (typeof process === 'object' && Object.prototype.toString.call(process) === '[object process]');
export const isBrowser = !isNode && Object.prototype.toString.call(window) === '[object Window]';
*Originally created by @MrCrimp on 9/30/2016* The following files where reported from content security policy checking domain-task/fetch.js Inline eval() and functions() are not compliant with content security policy `var isBrowser = (new Function('try { return this === window; } catch (e) { return false; }'))();` This is how I'd do the same test ``` export const isNode = (typeof process === 'object' && Object.prototype.toString.call(process) === '[object process]'); export const isBrowser = !isNode && Object.prototype.toString.call(window) === '[object Window]'; ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1351
No description provided.