mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
JS: Add async functions to test
This commit is contained in:
@@ -27,11 +27,13 @@
|
||||
| exceptions.js:21:17:21:24 | source() | exceptions.js:24:10:24:21 | e.toString() |
|
||||
| exceptions.js:21:17:21:24 | source() | exceptions.js:25:10:25:18 | e.message |
|
||||
| exceptions.js:21:17:21:24 | source() | exceptions.js:26:10:26:19 | e.fileName |
|
||||
| exceptions.js:66:6:66:13 | source() | exceptions.js:11:10:11:10 | e |
|
||||
| exceptions.js:66:6:66:13 | source() | exceptions.js:32:10:32:10 | e |
|
||||
| exceptions.js:66:6:66:13 | source() | exceptions.js:33:10:33:21 | e.toString() |
|
||||
| exceptions.js:66:6:66:13 | source() | exceptions.js:34:10:34:18 | e.message |
|
||||
| exceptions.js:66:6:66:13 | source() | exceptions.js:35:10:35:19 | e.fileName |
|
||||
| exceptions.js:48:16:48:23 | source() | exceptions.js:50:10:50:10 | e |
|
||||
| exceptions.js:59:24:59:31 | source() | exceptions.js:61:12:61:12 | e |
|
||||
| exceptions.js:88:6:88:13 | source() | exceptions.js:11:10:11:10 | e |
|
||||
| exceptions.js:88:6:88:13 | source() | exceptions.js:32:10:32:10 | e |
|
||||
| exceptions.js:88:6:88:13 | source() | exceptions.js:33:10:33:21 | e.toString() |
|
||||
| exceptions.js:88:6:88:13 | source() | exceptions.js:34:10:34:18 | e.message |
|
||||
| exceptions.js:88:6:88:13 | source() | exceptions.js:35:10:35:19 | e.fileName |
|
||||
| indexOf.js:4:11:4:18 | source() | indexOf.js:9:10:9:10 | x |
|
||||
| partialCalls.js:4:17:4:24 | source() | partialCalls.js:17:14:17:14 | x |
|
||||
| partialCalls.js:4:17:4:24 | source() | partialCalls.js:20:14:20:14 | y |
|
||||
|
||||
@@ -23,7 +23,7 @@ function test(unsafe, safe) {
|
||||
sink(e); // NOT OK
|
||||
sink(e.toString()); // NOT OK
|
||||
sink(e.message); // NOT OK
|
||||
sink(e.fileName); // OK
|
||||
sink(e.fileName); // OK - but flagged anyway
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -32,7 +32,7 @@ function test(unsafe, safe) {
|
||||
sink(e); // NOT OK
|
||||
sink(e.toString()); // NOT OK
|
||||
sink(e.message); // NOT OK
|
||||
sink(e.fileName); // OK
|
||||
sink(e.fileName); // OK - but flagged anyway
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -41,7 +41,25 @@ function test(unsafe, safe) {
|
||||
sink(e); // NOT OK
|
||||
sink(e.toString()); // NOT OK
|
||||
sink(e.message); // NOT OK
|
||||
sink(e.fileName); // OK
|
||||
sink(e.fileName); // OK - but flagged anyway
|
||||
}
|
||||
|
||||
try {
|
||||
throwAsync(source());
|
||||
} catch (e) {
|
||||
sink(e); // OK - but flagged anyway
|
||||
}
|
||||
|
||||
throwAsync(source()).catch(e => {
|
||||
sink(e); // NOT OK - but not flagged
|
||||
});
|
||||
|
||||
async function asyncTester() {
|
||||
try {
|
||||
await throwAsync(source());
|
||||
} catch (e) {
|
||||
sink(e); // NOT OK
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,5 +81,11 @@ function throwError1(x) {
|
||||
throw new Error(x);
|
||||
}
|
||||
|
||||
async function throwAsync(x) {
|
||||
throw x; // doesn't actually throw - returns failed promise
|
||||
}
|
||||
|
||||
test(source(), "hello");
|
||||
test("hey", "hello"); // no single-call inlining
|
||||
|
||||
// semmle-extractor-options: --experimental
|
||||
|
||||
Reference in New Issue
Block a user