mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-15 04:23:12 +03:00
0b08bba0c7
Previously we always used `Function('return this')` but this triggers CSP errors since it's basically `eval`. Instead this adds a few preflight checks to look for objects like `globalThis`, `self`, etc. Currently we don't have a `#[wasm_bindgen]` function annotation to import a bare global field like `self`, but we test accesses with `self.self` and `globalThis.globalThis`, catching errors to handle any issues. Closes #1641 |
||
---|---|---|
.. | ||
crates | ||
headless | ||
no-std | ||
wasm | ||
non_wasm.rs | ||
std-crate-no-std-dep.rs | ||
unwrap_throw.rs |