File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
lib/semmle/javascript/frameworks
test/library-tests/frameworks/Electron Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -41,18 +41,19 @@ module Electron {
4141 BrowserView ( ) { this = DataFlow:: moduleMember ( "electron" , "BrowserView" ) .getAnInstantiation ( ) }
4242 }
4343
44- /**
45- * An expression of type `BrowserWindow` or `BrowserView`.
46- */
47- private class BrowserObjectByType extends BrowserObject {
48- BrowserObjectByType ( ) {
49- exists ( string tp | tp = "BrowserWindow" or tp = "BrowserView" |
50- this .asExpr ( ) .getType ( ) .hasUnderlyingType ( "electron" , tp )
51- )
44+ private class ElectronEntryPoint extends API:: EntryPoint {
45+ ElectronEntryPoint ( ) { this = "Electron.Browser" }
46+
47+ override DataFlow:: SourceNode getASource ( ) {
48+ result .hasUnderlyingType ( [ "Electron.BrowserWindow" , "Electron.BrowserView" ] )
5249 }
5350 }
5451
55- private API:: Node browserObject ( ) { result .asSource ( ) instanceof NewBrowserObject }
52+ private API:: Node browserObject ( ) {
53+ result .asSource ( ) instanceof NewBrowserObject or
54+ result = API:: Node:: ofType ( "electron" , [ "BrowserWindow" , "BrowserView" ] ) or
55+ result = any ( ElectronEntryPoint e ) .getANode ( )
56+ }
5657
5758 /**
5859 * A data flow node whose value may originate from a browser object instantiation.
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ browserObject
1616| electron.js:63:3:63:5 | win |
1717| electron.js:65:18:65:20 | win |
1818| electronTs.ts:3:12:3:13 | bw |
19+ | electronTs.ts:3:12:3:13 | bw |
20+ | electronTs.ts:3:40:3:41 | bv |
1921| electronTs.ts:3:40:3:41 | bv |
2022| electronTs.ts:4:3:4:4 | bw |
2123| electronTs.ts:5:3:5:4 | bv |
You can’t perform that action at this time.
0 commit comments