JS: restrict alert location to a single line

This commit is contained in:
Esben Sparre Andreasen
2018-08-08 10:50:42 +02:00
parent e1947f04df
commit 8ee943f264
2 changed files with 4 additions and 3 deletions

View File

@@ -11,6 +11,7 @@
*/
import javascript
import semmle.javascript.RestrictedLocations
/**
* Holds if `e` is an expression of the given `kind` that must be guarded by a
@@ -59,4 +60,4 @@ where needsGuard(e, kind) and unguarded(e, ctor) and
sc.getBinder() = ctor and
sc.getEnclosingFunction() != ctor
)
select ctor, "The super constructor must be called before using '$@'.", e, kind
select (FirstLineOf)ctor, "The super constructor must be called before using '$@'.", e, kind

View File

@@ -10,5 +10,5 @@
| invalid.js:14:35:14:118 | () { cl ... er(); } | The super constructor must be called before using '$@'. | invalid.js:14:99:14:102 | this | this |
| invalid.js:15:71:15:95 | () { th ... er(); } | The super constructor must be called before using '$@'. | invalid.js:15:76:15:79 | this | this |
| invalid.js:16:35:16:66 | () { if ... .a(); } | The super constructor must be called before using '$@'. | invalid.js:16:56:16:59 | this | this |
| invalid.js:26:16:29:5 | () {\\n ... ;\\n } | The super constructor must be called before using '$@'. | invalid.js:27:9:27:12 | this | this |
| invalid.js:26:16:29:5 | () {\\n ... ;\\n } | The super constructor must be called before using '$@'. | invalid.js:28:9:28:12 | this | this |
| invalid.js:26:16:26:19 | () {\\n ... ;\\n } | The super constructor must be called before using '$@'. | invalid.js:27:9:27:12 | this | this |
| invalid.js:26:16:26:19 | () {\\n ... ;\\n } | The super constructor must be called before using '$@'. | invalid.js:28:9:28:12 | this | this |