Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

Fix unsafe-eval CSP violation - closes #336 #346

Merged
merged 2 commits into from
Aug 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/regenerator-runtime/runtime-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

// This method of obtaining a reference to the global object needs to be
// kept identical to the way it is obtained in runtime.js
var g = (function() { return this })() || Function("return this")();
var g = (function() {
return this || (typeof self === "object" && self);
})() || Function("return this")();

// Use `getOwnPropertyNames` because not all browsers support calling
// `hasOwnProperty` on the global `self` object in a worker. See #183.
Expand Down
4 changes: 3 additions & 1 deletion packages/regenerator-runtime/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,5 +715,7 @@
// In sloppy mode, unbound `this` refers to the global object, fallback to
// Function constructor if we're in global strict mode. That is sadly a form
// of indirect eval which violates Content Security Policy.
(function() { return this })() || Function("return this")()
(function() {
return this || (typeof self === "object" && self);
})() || Function("return this")()
);