Skip to content

Commit a4e4957

Browse files
author
Max Schaefer
committed
JavaScript: Model webContents property.
1 parent ff83e60 commit a4e4957

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ module Electron {
6565
}
6666
}
6767

68+
/**
69+
* A reference to the `webContents` property of a browser object.
70+
*/
71+
class WebContents extends DataFlow::SourceNode {
72+
WebContents() {
73+
this.(DataFlow::PropRead).accesses(any(BrowserObject bo), "webContents")
74+
}
75+
}
76+
6877
/**
6978
* A Node.js-style HTTP or HTTPS request made using an Electron module.
7079
*/

javascript/ql/test/library-tests/frameworks/Electron/BrowserObject.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212
| electron.js:40:5:40:6 | bv |
1313
| electron.ts:3:12:3:13 | bw |
1414
| electron.ts:3:40:3:41 | bv |
15+
| electron.ts:4:3:4:4 | bw |
16+
| electron.ts:5:3:5:4 | bv |

javascript/ql/test/library-tests/frameworks/Electron/electron.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ function foo(x) {
3636
return x;
3737
}
3838

39-
foo(bw);
40-
foo(bv);
39+
foo(bw).webContents;
40+
foo(bv).webContents;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
///<reference path="./electron.d.ts"/>
22

33
function f(bw: Electron.BrowserWindow, bv: Electron.BrowserView) {
4+
bw.webContents;
5+
bv.webContents;
46
}

0 commit comments

Comments
 (0)