JavaScript: Add support for globalThis.

This commit is contained in:
Max Schaefer
2019-05-10 08:28:51 +01:00
parent 9bc7ce1fac
commit a4bffe35fd
5 changed files with 9 additions and 0 deletions

View File

@@ -2,6 +2,8 @@
## General improvements
* Suppor for `globalThis` has been added.
* Support for the following frameworks and libraries has been improved:
- [firebase](https://www.npmjs.com/package/firebase)
- [mongodb](https://www.npmjs.com/package/mongodb)

View File

@@ -311,6 +311,9 @@ DataFlow::SourceNode globalObjectRef() {
// DOM and service workers
result = globalVarRef("self")
or
// ECMAScript 2020
result = globalVarRef("globalThis")
or
// `require("global")`
result = moduleImport("global")
or

View File

@@ -11,3 +11,4 @@
| tst.js:4:1:4:6 | window |
| tst.js:4:1:4:13 | window.window |
| tst.js:5:1:5:4 | self |
| tst.js:6:1:6:10 | globalThis |

View File

@@ -4,9 +4,11 @@
| document | tst.js:3:1:3:15 | window.document |
| document | tst.js:4:1:4:22 | window. ... ocument |
| document | tst.js:5:1:5:13 | self.document |
| document | tst.js:6:1:6:19 | globalThis.document |
| foo | tst3.js:4:1:4:5 | w.foo |
| global | tst2.js:7:1:7:6 | global |
| global | tst2.js:8:1:8:6 | global |
| globalThis | tst.js:6:1:6:10 | globalThis |
| goog | tst3.js:1:1:1:4 | goog |
| goog | tst3.js:3:9:3:12 | goog |
| self | tst.js:5:1:5:4 | self |

View File

@@ -3,3 +3,4 @@ this;
window.document;
window.window.document;
self.document;
globalThis.document;