diff --git a/crates/web-sys/webidls/enabled/Window.webidl b/crates/web-sys/webidls/enabled/Window.webidl index 15339126..142ca0d0 100644 --- a/crates/web-sys/webidls/enabled/Window.webidl +++ b/crates/web-sys/webidls/enabled/Window.webidl @@ -25,7 +25,9 @@ // interface XULControllers; // http://www.whatwg.org/specs/web-apps/current-work/ -[PrimaryGlobal, LegacyUnenumerableNamedProperties, NeedResolve] +[Global=Window, + Exposed=Window, + LegacyUnenumerableNamedProperties] /*sealed*/ interface Window : EventTarget { // the current browsing context [Unforgeable, Constant, StoreInSlot, diff --git a/crates/webidl/src/first_pass.rs b/crates/webidl/src/first_pass.rs index e072737f..6242ed09 100644 --- a/crates/webidl/src/first_pass.rs +++ b/crates/webidl/src/first_pass.rs @@ -32,6 +32,7 @@ pub(crate) struct InterfaceData { /// Whether only partial interfaces were encountered pub(crate) partial: bool, pub(crate) operations: BTreeMap, + pub(crate) global: bool, } #[derive(PartialEq, Eq, PartialOrd, Ord)] @@ -185,6 +186,7 @@ impl FirstPass<()> for webidl::ast::NonPartialInterface { InterfaceData { partial: false, operations: Default::default(), + global: false, }, ); @@ -213,6 +215,7 @@ impl FirstPass<()> for webidl::ast::PartialInterface { InterfaceData { partial: true, operations: Default::default(), + global: false, }, ); @@ -269,6 +272,17 @@ impl<'b> FirstPass<&'b str> for webidl::ast::ExtendedAttribute { &rhs_arguments, ) }, + webidl::ast::ExtendedAttribute::Identifier( + webidl::ast::IdentifierExtendedAttribute { lhs, .. } + ) + | webidl::ast::ExtendedAttribute::IdentifierList( + webidl::ast::IdentifierListExtendedAttribute { lhs, .. } + ) + if lhs == "Global" => + { + record.interfaces.get_mut(self_name).unwrap().global = true; + Ok(()) + } _ => Ok(()) } } diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index f9b44417..507a32b9 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -656,7 +656,11 @@ impl<'a> FirstPassRecord<'a> { .map(|arg| (&*arg.name, &*arg.type_, arg.variadic)), ret, kind, - false, + self + .interfaces + .get(self_name) + .map(|interface_data| interface_data.global) + .unwrap_or(false), catch, doc_comment, )