Skip to content

Commit bd6768e

Browse files
committed
JS: Fix closure namespace prefix and update tests
1 parent b1f9db9 commit bd6768e

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

javascript/ql/src/semmle/javascript/Closure.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ module Closure {
212212
or
213213
name = namespace
214214
)
215+
or
216+
name = "goog" // The closure libraries themselves use the "goog" namespace
215217
}
216218

217219
/**
@@ -220,6 +222,8 @@ module Closure {
220222
bindingset[name]
221223
private predicate hasClosureNamespacePrefix(string name) {
222224
isClosureNamespace(name.substring(0, name.indexOf(".")))
225+
or
226+
isClosureNamespace(name)
223227
}
224228

225229
/**
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import javascript
2+
import semmle.javascript.dataflow.internal.FlowSteps
23

3-
from DataFlow::InvokeNode node, int imprecision
4-
select node, node.getACallee(imprecision), imprecision
4+
from DataFlow::InvokeNode node, Function callee
5+
where calls(node, callee)
6+
select node, callee, 0

javascript/ql/test/library-tests/Closure/moduleImport.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
| foo.bar | tests/nestedAccess.js:3:14:3:36 | goog.re ... o.bar') |
22
| foo.bar.x | tests/nestedAccess.js:5:1:5:8 | fooBar.x |
3-
| foo.bar.x | tests/nestedAccess.js:10:9:10:11 | z.x |
43
| foo.bar.x.y | tests/nestedAccess.js:5:1:5:10 | fooBar.x.y |
54
| foo.bar.x.y.z | tests/nestedAccess.js:5:1:5:12 | fooBar.x.y.z |
65
| goog | tests/es6Module.js:1:1:1:4 | goog |

0 commit comments

Comments
 (0)