Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
changed hasEval logic to always test for eval when CSP securityPolicy…
Browse files Browse the repository at this point in the history
….allowsEval is true
  • Loading branch information
mangini committed Sep 4, 2013
1 parent e4ffed1 commit 18308da
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/observe.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@

var hasObserve = detectObjectObserve();

var hasEval = false;
try {
if ('securityPolicy' in document) {
hasEval = document.securityPolicy.allowsEval === true;
} else {
// don't test for eval if document has CSP securityPolicy object and we can see that
// eval is not supported. This avoids an error message in console even when the exception
// is caught
var hasEval = ! ('securityPolicy' in document) || document.securityPolicy.allowsEval;
if (hasEval) {
try {
var f = new Function('', 'return true;');
hasEval = f();
} catch (ex) {
}
} catch (ex) {
}

function isIndex(s) {
Expand Down

0 comments on commit 18308da

Please sign in to comment.