jsTreeYLT.js 901 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * Saves the javascript interractions with the DOM
  3. *
  4. * Run phantomas with --js-execution-tree option to use this module
  5. */
  6. exports.version = '0.1';
  7. exports.module = function(phantomas) {
  8. 'use strict';
  9. phantomas.setMetric('javascriptExecutionTree');
  10. // save data
  11. phantomas.on('report', function() {
  12. phantomas.log('JS execution tree: Reading execution tree JSON');
  13. phantomas.evaluate(function() {(function(phantomas) {
  14. var fullTree = phantomas.readFullTree();
  15. if (fullTree === null) {
  16. phantomas.log('JS execution tree: error, the execution tree is not correctly closed');
  17. return;
  18. }
  19. phantomas.setMetric('javascriptExecutionTree', true, true);
  20. phantomas.addOffender('javascriptExecutionTree', JSON.stringify(fullTree));
  21. })(window.__phantomas);});
  22. });
  23. };