Enable structural mode for all operations if there is a Global extended attribute on the interface

This commit is contained in:
Anton Danilkin
2018-08-05 17:32:39 +03:00
committed by Alex Crichton
parent 90579416cf
commit ebab7d9fc8
3 changed files with 22 additions and 2 deletions

View File

@ -25,7 +25,9 @@
// interface XULControllers; // interface XULControllers;
// http://www.whatwg.org/specs/web-apps/current-work/ // http://www.whatwg.org/specs/web-apps/current-work/
[PrimaryGlobal, LegacyUnenumerableNamedProperties, NeedResolve] [Global=Window,
Exposed=Window,
LegacyUnenumerableNamedProperties]
/*sealed*/ interface Window : EventTarget { /*sealed*/ interface Window : EventTarget {
// the current browsing context // the current browsing context
[Unforgeable, Constant, StoreInSlot, [Unforgeable, Constant, StoreInSlot,

View File

@ -32,6 +32,7 @@ pub(crate) struct InterfaceData {
/// Whether only partial interfaces were encountered /// Whether only partial interfaces were encountered
pub(crate) partial: bool, pub(crate) partial: bool,
pub(crate) operations: BTreeMap<OperationId, OperationData>, pub(crate) operations: BTreeMap<OperationId, OperationData>,
pub(crate) global: bool,
} }
#[derive(PartialEq, Eq, PartialOrd, Ord)] #[derive(PartialEq, Eq, PartialOrd, Ord)]
@ -185,6 +186,7 @@ impl FirstPass<()> for webidl::ast::NonPartialInterface {
InterfaceData { InterfaceData {
partial: false, partial: false,
operations: Default::default(), operations: Default::default(),
global: false,
}, },
); );
@ -213,6 +215,7 @@ impl FirstPass<()> for webidl::ast::PartialInterface {
InterfaceData { InterfaceData {
partial: true, partial: true,
operations: Default::default(), operations: Default::default(),
global: false,
}, },
); );
@ -269,6 +272,17 @@ impl<'b> FirstPass<&'b str> for webidl::ast::ExtendedAttribute {
&rhs_arguments, &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(()) _ => Ok(())
} }
} }

View File

@ -656,7 +656,11 @@ impl<'a> FirstPassRecord<'a> {
.map(|arg| (&*arg.name, &*arg.type_, arg.variadic)), .map(|arg| (&*arg.name, &*arg.type_, arg.variadic)),
ret, ret,
kind, kind,
false, self
.interfaces
.get(self_name)
.map(|interface_data| interface_data.global)
.unwrap_or(false),
catch, catch,
doc_comment, doc_comment,
) )