diff options
author | Benjamin Jones <bjones@galois.com> | 2013-06-13 16:41:24 -0700 |
---|---|---|
committer | Benjamin Jones <bjones@galois.com> | 2013-06-13 16:41:24 -0700 |
commit | 8e595706fc7fc7e3f51268efef59dfc276634bd9 (patch) | |
tree | 3e0cb656084caf3b7984a97b0735d3cc7368dcba /src | |
parent | 500179a7cea73f16eb5b99f1810426e4d3828468 (diff) | |
parent | dcef9bbbdf681791a21cdb55a2a7960d22fc53c9 (diff) |
Merge branch 'master' of src.galois.com:/srv/git/FiveUI
Diffstat (limited to 'src')
-rw-r--r-- | src/js/fiveui/injected/compute.js | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/js/fiveui/injected/compute.js b/src/js/fiveui/injected/compute.js index 36217ac..67f2d56 100644 --- a/src/js/fiveui/injected/compute.js +++ b/src/js/fiveui/injected/compute.js @@ -20,6 +20,7 @@ */ (function(){ + var guidGenerator = function () { var S4 = function() { return (((1+Math.random())*0x10000)|0).toString(16).substring(1); @@ -84,6 +85,15 @@ core.port.emit('ReportProblem', prob); }; + core.resetStats = function() { + core.reportStats( + { start: 0 + , end: 0 + , numRules: 0 + , numElts: 0 + }); + }; + core.reportStats = function(stats) { core.port.emit('ReportStats', stats); }; @@ -210,29 +220,24 @@ }; fiveui.stats.numElts = 0; // reset stats element counter - var report = function(message, node) { - var prob = core.hash(theRule, message, node); - var query = $(node); - if(!query.hasClass(prob.hash)) { - query.addClass(prob.hash); - core.reportProblem(prob); + var report = { + error:function(message, node) { + var prob = core.hash(theRule, message, node); + var query = $(node); + if(!query.hasClass(prob.hash)) { + query.addClass(prob.hash); + core.reportProblem(prob); + } } }; for(var i=0; i<rs.length; ++i) { - var theRule = rs[i]; - var scope = { - name: theRule.name, - description: theRule.description, - ruleSet: core.rules, - // maybe it would be better for this to be an argument to the rule? - report: report - }; + theRule = rs[i]; if (theRule.rule) { try { // note: fiveui.stats.numElts is updated as a side effect here - theRule.rule.apply(scope); + theRule.rule.call(window, report); } catch (e) { console.log('exception running rule: ' + theRule.name); console.log(e.toString()); @@ -330,5 +335,6 @@ }; registerBackendListeners(core.port); -}()); + core.resetStats(); +})(); |