Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Commit

Permalink
Merge branch 'zombie-164-use-strict'
Browse files Browse the repository at this point in the history
  • Loading branch information
mozfreddyb committed Sep 30, 2014
2 parents 3197aca + 1521d22 commit f8ba736
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 16 deletions.
2 changes: 2 additions & 0 deletions client/js/experimentctrl.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

scanjsModule.controller('ExperimentCtrl', ['$scope', 'ScanSvc', function ExperimentCtrl($scope, ScanSvc) {
if (!document.getElementById("experiment-mirror").children.length) {
$scope.codeMirror = new CodeMirror(document.getElementById('experiment-mirror'), {
Expand Down
2 changes: 2 additions & 0 deletions client/js/locationctrl.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

scanjsModule.controller('LocationCtrl', ['$scope', '$location', function LocationCtrl($scope, $location) {
$scope.tabBtnClass = function (page) {
var current = $location.path().substring(1) || 'scan';
Expand Down
2 changes: 2 additions & 0 deletions client/js/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

var scanjsModule = angular.module('scanjs', ['ui.bootstrap', 'ngRoute']);

scanjsModule.config(['$routeProvider',
Expand Down
2 changes: 2 additions & 0 deletions client/js/rulesctrl.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

scanjsModule.controller('RuleListCtrl', ['$scope', 'ScanSvc', function RuleListCtrl($scope, ScanSvc) {
$scope.rulesFile = "../common/rules.json";
$scope.rules = []; //JSON rules object
Expand Down
26 changes: 14 additions & 12 deletions client/js/scanctrl.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

scanjsModule.controller('ScanCtrl', ['$scope', 'ScanSvc', function ScanCtrl($scope, ScanSvc) {
if (!document.getElementById("codeMirrorDiv").children.length) {
$scope.codeMirror = new CodeMirror(document.getElementById('codeMirrorDiv'), {
Expand Down Expand Up @@ -35,7 +37,7 @@ scanjsModule.controller('ScanCtrl', ['$scope', 'ScanSvc', function ScanCtrl($sco
$scope.inputFiles.forEach(function (scriptFile, i) {
if (document.getElementById('doScan_'+i).checked) {
pending++;
$scope.throbOutput = true;
$scope.throbOutput = true;
ScanSvc.newScan(scriptFile.name,scriptFile.asText());
}
});
Expand All @@ -62,19 +64,19 @@ scanjsModule.controller('ScanCtrl', ['$scope', 'ScanSvc', function ScanCtrl($sco
}, []);
}

$scope.filterResults=function(issue){
if(!issue){
$scope.filterResults=function(issue) {
if (!issue) {
$scope.filteredResults=$scope.results;
}
else{
if(typeof issue.name != "undefined") {
$scope.filteredResults=$scope.results.filter(function(result){
return result.filename === issue.name;
});
}else {
$scope.filteredResults=$scope.results.filter(function(result){
return result.rule.name == issue;
});
else {
if (typeof issue.name != "undefined") {
$scope.filteredResults = $scope.results.filter(function(result) {
return result.filename === issue.name;
});
} else {
$scope.filteredResults = $scope.results.filter(function(result) {
return result.rule.name == issue;
});
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions client/js/scanservice.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

scanjsModule.factory('ScanSvc', ['$rootScope', '$http', function($rootScope, $http) {
var ScanService = {
//results:[],
Expand Down
2 changes: 2 additions & 0 deletions client/js/scanworker.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

/* this makes sure that console.log can be used, even if it is undefined.
We won't see the message though, since this kind of postMessage isn't handled in scanservice.js */
if (typeof console === "undefined") {
Expand Down
9 changes: 5 additions & 4 deletions common/scan.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// Plain browser env
mod(this.ScanJS || (this.ScanJS = {}), this.acorn.walk);
})(function (exports, walk) {
"use strict";

// Default parser, override this object to change*
// needs parser.parse to produce an AST
Expand Down Expand Up @@ -328,7 +329,7 @@

var nodeTests = {};
//each node type may have multiple tests, so first create arrays of test funcs
for (i in rulesData) {
for (var i in rulesData) {
var rule = rulesData[i];
//parse rule source
var template;
Expand Down Expand Up @@ -364,7 +365,7 @@

rules = {};
//create a single function for each nodeType, which calls all the test functions
for (nodeType in nodeTests) {
for (var nodeType in nodeTests) {
rules[nodeType] = function (tests, node) {
tests.forEach(function (test) {
test.call(this, node);
Expand Down Expand Up @@ -401,8 +402,8 @@
aw_found_callback = found_callback;
}

function aw_setParser(parserName){
parser = parserName ;
function aw_setParser(newParser){
parser = newParser;
}

exports.rules = rules;
Expand Down

0 comments on commit f8ba736

Please sign in to comment.