mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-30 16:12:16 +00:00
Fixing bug with Firefox extension content scripts (#2099)
This commit is contained in:
parent
3c40492fa3
commit
a93b778b5c
@ -4747,9 +4747,11 @@ pub fn global() -> Object {
|
||||
fn get_global() -> Result<Object, JsValue>;
|
||||
}
|
||||
|
||||
let static_object = Global::get_global_this()
|
||||
.or_else(|_| Global::get_self())
|
||||
// The order is important: in Firefox Extension Content Scripts `globalThis`
|
||||
// is a Sandbox (not Window), so `globalThis` must be checked after `window`.
|
||||
let static_object = Global::get_self()
|
||||
.or_else(|_| Global::get_window())
|
||||
.or_else(|_| Global::get_global_this())
|
||||
.or_else(|_| Global::get_global());
|
||||
if let Ok(obj) = static_object {
|
||||
if !obj.is_undefined() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user