Merge pull request #2969 from esbena/js/process-as-event-emitter

Approved by erik-krogh
This commit is contained in:
semmle-qlci
2020-03-04 20:24:12 +00:00
committed by GitHub
3 changed files with 19 additions and 1 deletions

View File

@@ -946,6 +946,15 @@ module NodeJSLib {
ImportedNodeJSEventEmitter() { this = getAnEventEmitterImport().getAnInstantiation() }
}
/**
* The NodeJS `process` object as an EventEmitter subclass.
*/
private class ProcessAsNodeJSEventEmitter extends NodeJSEventEmitter {
ProcessAsNodeJSEventEmitter() {
this = process()
}
}
/**
* A class that extends EventEmitter.
*/

View File

@@ -12,3 +12,5 @@
| tst.js:28:17:28:22 | "blab" | tst.js:25:16:25:20 | event |
| tst.js:34:18:34:22 | "BOH" | tst.js:33:17:33:17 | x |
| tst.js:40:20:40:27 | "yabity" | tst.js:39:19:39:19 | x |
| tst.js:46:28:46:38 | 'FirstData' | tst.js:43:45:43:49 | first |
| tst.js:47:29:47:40 | 'SecondData' | tst.js:44:37:44:42 | second |

View File

@@ -37,4 +37,11 @@ class ExtendsMyCustomEmitter extends MyEventEmitter{}
var em5 = new ExtendsMyCustomEmitter();
em5.on("yibity", (x) => {});
em5.emit("yibity", "yabity");
em5.emit("yibity", "yabity");
var process = require('process');
process.addListener('FirstEvent', function (first) {});
process.on('SecondEvent', function (second) {});
process.emit('FirstEvent', 'FirstData');
process.emit('SecondEvent', 'SecondData');