Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f21871d

Browse files
committed
JS: relax instantiation requirement for .prototype field
1 parent 96f1d91 commit f21871d

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

javascript/ql/src/semmle/javascript/dataflow/internal/AbstractPropertiesImpl.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ AbstractValue getAnInitialPropertyValue(DefiniteAbstractValue baseVal, string pr
4949
or
5050
// `f.prototype` for functions `f` that are instantiated
5151
propertyName = "prototype" and
52-
baseVal = any(NewExpr ne).getCallee().analyze().getALocalValue() and
5352
result = TAbstractInstance(baseVal)
5453
}
5554

javascript/ql/test/library-tests/CallGraphs/tests.expected

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,12 @@ test_getAFunctionValue
9292
| n.js:5:1:5:4 | m2.f | m2.js:2:6:2:18 | function() {} |
9393
| protoclass.js:3:1:5:1 | functio ... it();\\n} | protoclass.js:3:1:5:1 | functio ... it();\\n} |
9494
| protoclass.js:3:10:3:10 | F | protoclass.js:3:1:5:1 | functio ... it();\\n} |
95+
| protoclass.js:4:3:4:11 | this.init | protoclass.js:7:20:11:1 | functio ... m();\\n} |
9596
| protoclass.js:7:1:7:1 | F | protoclass.js:3:1:5:1 | functio ... it();\\n} |
9697
| protoclass.js:7:1:11:1 | F.proto ... m();\\n} | protoclass.js:7:20:11:1 | functio ... m();\\n} |
9798
| protoclass.js:7:20:11:1 | functio ... m();\\n} | protoclass.js:7:20:11:1 | functio ... m();\\n} |
99+
| protoclass.js:8:3:8:13 | this.method | protoclass.js:13:22:13:34 | function() {} |
100+
| protoclass.js:9:11:9:21 | this.method | protoclass.js:13:22:13:34 | function() {} |
98101
| protoclass.js:13:1:13:1 | F | protoclass.js:3:1:5:1 | functio ... it();\\n} |
99102
| protoclass.js:13:1:13:34 | F.proto ... on() {} | protoclass.js:13:22:13:34 | function() {} |
100103
| protoclass.js:13:22:13:34 | function() {} | protoclass.js:13:22:13:34 | function() {} |
@@ -405,6 +408,8 @@ test_getACallee
405408
| m.js:3:1:3:18 | module.exports.f() | m.js:1:13:1:25 | function() {} |
406409
| n.js:2:1:2:5 | m.f() | m.js:1:13:1:25 | function() {} |
407410
| n.js:5:1:5:6 | m2.f() | m2.js:2:6:2:18 | function() {} |
411+
| protoclass.js:4:3:4:13 | this.init() | protoclass.js:7:20:11:1 | functio ... m();\\n} |
412+
| protoclass.js:8:3:8:15 | this.method() | protoclass.js:13:22:13:34 | function() {} |
408413
| reflection.js:7:1:7:22 | reflective call | reflection.js:1:1:3:1 | functio ... x+y;\\n} |
409414
| reflection.js:8:1:8:25 | add.app ... 3, 19]) | reflection.js:5:15:5:39 | functio ... n 56; } |
410415
| reflection.js:8:1:8:25 | reflective call | reflection.js:1:1:3:1 | functio ... x+y;\\n} |

0 commit comments

Comments
 (0)