mirror of
https://github.com/hohn/codeql-javascript-multiflow.git
synced 2025-12-16 12:03:03 +01:00
Add nested if() test. Update source locations.
This commit is contained in:
committed by
=Michael Hohn
parent
d02e26d6d2
commit
405b3a0661
29
tests/10-NestedIf/10-NestedIf.expected
Normal file
29
tests/10-NestedIf/10-NestedIf.expected
Normal file
@@ -0,0 +1,29 @@
|
||||
nodes
|
||||
| sample-utility-0.js:5:13:5:46 | value |
|
||||
| sample-utility-0.js:5:21:5:46 | this.ge ... value') |
|
||||
| sample-utility-0.js:5:21:5:46 | this.ge ... value') |
|
||||
| sample-utility-0.js:17:34:17:38 | value |
|
||||
| sample-utility-0.js:18:13:18:14 | ua |
|
||||
| sample-utility-0.js:18:13:18:14 | ua |
|
||||
| sample-utility-1.js:2:9:2:42 | value |
|
||||
| sample-utility-1.js:2:17:2:42 | this.ge ... value') |
|
||||
| sample-utility-1.js:2:17:2:42 | this.ge ... value') |
|
||||
| sample-utility-1.js:14:31:14:35 | value |
|
||||
| sample-utility-1.js:15:9:15:10 | ua |
|
||||
| sample-utility-1.js:15:9:15:10 | ua |
|
||||
edges
|
||||
| sample-utility-0.js:5:13:5:46 | value | sample-utility-0.js:17:34:17:38 | value |
|
||||
| sample-utility-0.js:5:21:5:46 | this.ge ... value') | sample-utility-0.js:5:13:5:46 | value |
|
||||
| sample-utility-0.js:5:21:5:46 | this.ge ... value') | sample-utility-0.js:5:13:5:46 | value |
|
||||
| sample-utility-0.js:17:34:17:38 | value | sample-utility-0.js:17:34:17:38 | value |
|
||||
| sample-utility-0.js:17:34:17:38 | value | sample-utility-0.js:18:13:18:14 | ua |
|
||||
| sample-utility-0.js:17:34:17:38 | value | sample-utility-0.js:18:13:18:14 | ua |
|
||||
| sample-utility-1.js:2:9:2:42 | value | sample-utility-1.js:14:31:14:35 | value |
|
||||
| sample-utility-1.js:2:17:2:42 | this.ge ... value') | sample-utility-1.js:2:9:2:42 | value |
|
||||
| sample-utility-1.js:2:17:2:42 | this.ge ... value') | sample-utility-1.js:2:9:2:42 | value |
|
||||
| sample-utility-1.js:14:31:14:35 | value | sample-utility-1.js:14:31:14:35 | value |
|
||||
| sample-utility-1.js:14:31:14:35 | value | sample-utility-1.js:15:9:15:10 | ua |
|
||||
| sample-utility-1.js:14:31:14:35 | value | sample-utility-1.js:15:9:15:10 | ua |
|
||||
#select
|
||||
| sample-utility-0.js:18:13:18:14 | ua | sample-utility-0.js:5:21:5:46 | this.ge ... value') | sample-utility-0.js:18:13:18:14 | ua | Data flow from $@ to $@. | sample-utility-0.js:5:21:5:46 | this.ge ... value') | this.ge ... value') | sample-utility-0.js:18:13:18:14 | ua | ua |
|
||||
| sample-utility-1.js:15:9:15:10 | ua | sample-utility-1.js:2:17:2:42 | this.ge ... value') | sample-utility-1.js:15:9:15:10 | ua | Data flow from $@ to $@. | sample-utility-1.js:2:17:2:42 | this.ge ... value') | this.ge ... value') | sample-utility-1.js:15:9:15:10 | ua | ua |
|
||||
1
tests/10-NestedIf/10-NestedIf.qlref
Normal file
1
tests/10-NestedIf/10-NestedIf.qlref
Normal file
@@ -0,0 +1 @@
|
||||
10-NestedIf.ql
|
||||
30
tests/10-NestedIf/sample-utility-0.js
Normal file
30
tests/10-NestedIf/sample-utility-0.js
Normal file
@@ -0,0 +1,30 @@
|
||||
var SampleUtility = function(){};
|
||||
SampleUtility.prototype = Object.extendsObject(Processor, {
|
||||
|
||||
setUserStatus: function() {
|
||||
var value = this.getParameter('value');
|
||||
|
||||
var ua = new GR('users');
|
||||
ua.query();
|
||||
|
||||
if(!ua.hasNext()){
|
||||
ua.initialize();
|
||||
ua.setValue('status',value);
|
||||
ua.insert();
|
||||
}
|
||||
else {
|
||||
ua.next();
|
||||
ua.setValue('status',value); // unsafe
|
||||
ua.update();
|
||||
// Nested if() test.
|
||||
if (ua.safeToWrite()) {
|
||||
ua.setValue('status', value); // safe
|
||||
ua.update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
type: 'SampleUtility'
|
||||
});
|
||||
17
tests/10-NestedIf/sample-utility-1.js
Normal file
17
tests/10-NestedIf/sample-utility-1.js
Normal file
@@ -0,0 +1,17 @@
|
||||
var SampleUtility = function () {
|
||||
var value = this.getParameter('value');
|
||||
|
||||
var ua = new GR('users');
|
||||
ua.query();
|
||||
|
||||
if (!ua.hasNext()) {
|
||||
ua.initialize();
|
||||
ua.setValue('status', value);
|
||||
ua.insert();
|
||||
}
|
||||
else {
|
||||
ua.next();
|
||||
ua.setValue('status', value);
|
||||
ua.update();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user