We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3c40492 commit a93b778Copy full SHA for a93b778
crates/js-sys/src/lib.rs
@@ -4747,9 +4747,11 @@ pub fn global() -> Object {
4747
fn get_global() -> Result<Object, JsValue>;
4748
}
4749
4750
- let static_object = Global::get_global_this()
4751
- .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`.
4752
+ let static_object = Global::get_self()
4753
.or_else(|_| Global::get_window())
4754
+ .or_else(|_| Global::get_global_this())
4755
.or_else(|_| Global::get_global());
4756
if let Ok(obj) = static_object {
4757
if !obj.is_undefined() {
0 commit comments