Disabling eval count because it can cause JS errors
This commit is contained in:
+8
-8
@@ -7,11 +7,11 @@
|
||||
*/
|
||||
/* global document: true, window: true */
|
||||
|
||||
exports.version = '0.1';
|
||||
exports.version = '0.1.a';
|
||||
|
||||
exports.module = function(phantomas) {
|
||||
'use strict';
|
||||
|
||||
|
||||
phantomas.setMetric('documentWriteCalls'); //@desc number of calls to either document.write or document.writeln
|
||||
phantomas.setMetric('evalCalls'); // @desc number of calls to eval (either direct or via setTimeout / setInterval)
|
||||
|
||||
@@ -25,23 +25,23 @@ exports.module = function(phantomas) {
|
||||
}
|
||||
|
||||
// spy calls to eval()
|
||||
phantomas.spy(window, 'eval', function(code) {
|
||||
/*phantomas.spy(window, 'eval', function(code) {
|
||||
report('eval() called directly', phantomas.getCaller(), phantomas.getBacktrace(), 'evalCalls');
|
||||
phantomas.log('eval\'ed code: ' + (code || '').substring(0, 150) + '(...)');
|
||||
});
|
||||
});*/
|
||||
|
||||
// spy calls to setTimeout / setInterval with string passed instead of a function
|
||||
phantomas.spy(window, 'setTimeout', function(fn, interval) {
|
||||
/*phantomas.spy(window, 'setTimeout', function(fn, interval) {
|
||||
if (typeof fn !== 'string') return;
|
||||
|
||||
report('eval() called via setTimeout("' + fn + '")', phantomas.getCaller(), phantomas.getBacktrace(), 'evalCalls');
|
||||
});
|
||||
});*/
|
||||
|
||||
phantomas.spy(window, 'setInterval', function(fn, interval) {
|
||||
/*phantomas.spy(window, 'setInterval', function(fn, interval) {
|
||||
if (typeof fn !== 'string') return;
|
||||
|
||||
report('eval() called via setInterval("' + fn + '")', phantomas.getCaller(), phantomas.getBacktrace(), 'evalCalls');
|
||||
});
|
||||
});*/
|
||||
|
||||
// spy document.write(ln)
|
||||
phantomas.spy(document, 'write', function(arg) {
|
||||
|
||||
Reference in New Issue
Block a user