Skip to content

Commit ae43e90

Browse files
committed
JS: model process as an EventEmitter
1 parent dfa0713 commit ae43e90

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

javascript/ql/src/semmle/javascript/frameworks/NodeJSLib.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,15 @@ module NodeJSLib {
935935
ImportedNodeJSEventEmitter() { this = getAnEventEmitterImport().getAnInstantiation() }
936936
}
937937

938+
/**
939+
* The NodeJS `process` object as an EventEmitter subclass.
940+
*/
941+
private class ProcessAsNodeJSEventEmitter extends NodeJSEventEmitter {
942+
ProcessAsNodeJSEventEmitter() {
943+
this = process()
944+
}
945+
}
946+
938947
/**
939948
* A class that extends EventEmitter.
940949
*/

javascript/ql/test/library-tests/frameworks/EventEmitter/test.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212
| tst.js:28:17:28:22 | "blab" | tst.js:25:16:25:20 | event |
1313
| tst.js:34:18:34:22 | "BOH" | tst.js:33:17:33:17 | x |
1414
| tst.js:40:20:40:27 | "yabity" | tst.js:39:19:39:19 | x |
15+
| tst.js:46:28:46:38 | 'FirstData' | tst.js:43:45:43:49 | first |
16+
| tst.js:47:29:47:40 | 'SecondData' | tst.js:44:37:44:42 | second |

0 commit comments

Comments
 (0)