Skip to content

Commit 107ec3b

Browse files
committed
JS: add test with self=this variable
1 parent 78bd760 commit 107ec3b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

javascript/ql/test/library-tests/TaintTracking/sanitizer-guards.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,16 @@ class C {
2525
addEventListener('hey', () => {
2626
sink(this.x); // NOT OK
2727
});
28+
29+
let self = this;
30+
if (isSafe(self.x)) {
31+
sink(self.x); // OK
32+
}
33+
34+
addEventListener('hey', function() {
35+
if (isSafe(self.x)) {
36+
sink(self.x); // OK
37+
}
38+
});
2839
}
2940
}

0 commit comments

Comments
 (0)