diff options
48 files changed, 2549 insertions, 749 deletions
diff --git a/Cargo.lock b/Cargo.lock index ee14093c660..c42885fed85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1152,7 +1152,7 @@ dependencies = [ "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", "net_traits 0.0.1", - "new-ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ordered-float 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "packed_simd 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "range 0.0.1", "serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1781,7 +1781,7 @@ dependencies = [ "malloc_size_of 0.0.1", "msg 0.0.1", "net_traits 0.0.1", - "new-ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ordered-float 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "profile_traits 0.0.1", "range 0.0.1", @@ -2374,15 +2374,6 @@ dependencies = [ ] [[package]] -name = "new-ordered-float" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] name = "new_debug_unreachable" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2549,6 +2540,15 @@ dependencies = [ ] [[package]] +name = "ordered-float" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "ordermap" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2850,7 +2850,7 @@ dependencies = [ "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3571,12 +3571,12 @@ dependencies = [ "malloc_size_of 0.0.1", "malloc_size_of_derive 0.0.1", "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "new-ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "num-derive 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ordered-float 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4497,7 +4497,6 @@ dependencies = [ "checksum msdos_time 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aad9dfe950c057b1bfe9c1f2aa51583a8468ef2a5baba2ebbe06d775efeb7729" "checksum muldiv 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1cbef5aa2e8cd82a18cc20e26434cc9843e1ef46e55bfabe5bddb022236c5b3e" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" -"checksum new-ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8ccbebba6fb53a6d2bdcfaf79cb339bc136dee3bfff54dc337a334bafe36476a" "checksum new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0cdc457076c78ab54d5e0d6fa7c47981757f1e34dc39ff92787f217dede586c4" "checksum nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d37e713a259ff641624b6cb20e3b12b2952313ba36b6823c0f16e6cfd9e5de17" "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" @@ -4516,6 +4515,7 @@ dependencies = [ "checksum ogg_metadata 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fc665717454399cba557c55ad226148996e9266ee291f8a37a98bb2cded0a490" "checksum openssl 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)" = "a3605c298474a3aa69de92d21139fb5e2a81688d308262359d85cdd0d12a7985" "checksum openssl-sys 0.9.27 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdc5c4a02e69ce65046f1763a0181107038e02176233acb0b3351d7cc588f9" +"checksum ordered-float 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e9a3c8db0fca1fdb34404f0b1286db252f23930b9f7a481e376c16c0d5c309d4" "checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" "checksum osmesa-src 18.1.0-devel (git+https://github.com/servo/osmesa-src)" = "<none>" "checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b" diff --git a/components/gfx/Cargo.toml b/components/gfx/Cargo.toml index dda75bf1faf..a9f7a10c23f 100644 --- a/components/gfx/Cargo.toml +++ b/components/gfx/Cargo.toml @@ -29,7 +29,7 @@ libc = "0.2" log = "0.4" malloc_size_of = { path = "../malloc_size_of" } net_traits = {path = "../net_traits"} -new-ordered-float = "1.0" +ordered-float = "1.0" packed_simd = {version = "0.1", optional = true} range = {path = "../range"} serde = "1.0" diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml index ac387d59585..1b0e08ab92e 100644 --- a/components/layout/Cargo.toml +++ b/components/layout/Cargo.toml @@ -28,7 +28,7 @@ log = "0.4" malloc_size_of = { path = "../malloc_size_of" } msg = {path = "../msg"} net_traits = {path = "../net_traits"} -new-ordered-float = "1.0" +ordered-float = "1.0" parking_lot = "0.6" profile_traits = {path = "../profile_traits"} range = {path = "../range"} diff --git a/components/selectors/bloom.rs b/components/selectors/bloom.rs index d9056665ac4..f868fc7df16 100644 --- a/components/selectors/bloom.rs +++ b/components/selectors/bloom.rs @@ -318,8 +318,9 @@ fn create_and_insert_some_stuff() { assert!(bf.might_contain_hash(hash_as_str(i))); } - let false_positives = - (1001_usize..2000).filter(|i| bf.might_contain_hash(hash_as_str(*i))).count(); + let false_positives = (1001_usize..2000) + .filter(|i| bf.might_contain_hash(hash_as_str(*i))) + .count(); assert!(false_positives < 190, "{} is not < 190", false_positives); // 19%. @@ -331,7 +332,9 @@ fn create_and_insert_some_stuff() { assert!(bf.might_contain_hash(hash_as_str(i))); } - let false_positives = (0_usize..100).filter(|i| bf.might_contain_hash(hash_as_str(*i))).count(); + let false_positives = (0_usize..100) + .filter(|i| bf.might_contain_hash(hash_as_str(*i))) + .count(); assert!(false_positives < 20, "{} is not < 20", false_positives); // 20%. diff --git a/components/selectors/builder.rs b/components/selectors/builder.rs index 29ac822fa03..584a210152f 100644 --- a/components/selectors/builder.rs +++ b/components/selectors/builder.rs @@ -161,7 +161,8 @@ struct SelectorBuilderIter<'a, Impl: SelectorImpl> { impl<'a, Impl: SelectorImpl> ExactSizeIterator for SelectorBuilderIter<'a, Impl> { fn len(&self) -> usize { - self.current_simple_selectors.len() + self.rest_of_simple_selectors.len() + + self.current_simple_selectors.len() + + self.rest_of_simple_selectors.len() + self.combinators.len() } } @@ -228,7 +229,6 @@ struct Specificity { element_selectors: u32, } - impl AddAssign for Specificity { #[inline] fn add_assign(&mut self, rhs: Self) { @@ -306,10 +306,9 @@ where Component::Combinator(ref combinator) => { unreachable!( "Found combinator {:?} in simple selectors vector? {:?}", - combinator, - builder, + combinator, builder, ); - } + }, Component::PseudoElement(..) | Component::LocalName(..) => { specificity.element_selectors += 1 }, @@ -329,7 +328,7 @@ where // See: https://github.com/w3c/csswg-drafts/issues/1915 *specificity += Specificity::from(selector.specificity()); } - } + }, Component::ID(..) => { specificity.id_selectors += 1; }, diff --git a/components/selectors/matching.rs b/components/selectors/matching.rs index 1fe54b217d2..ef0c6563f3c 100644 --- a/components/selectors/matching.rs +++ b/components/selectors/matching.rs @@ -261,11 +261,10 @@ where let iter = selector.iter_from(selector.len() - from_offset); debug_assert!( iter.clone().next().is_some() || - (from_offset != selector.len() && - matches!( - selector.combinator_at_parse_order(from_offset), - Combinator::SlotAssignment | Combinator::PseudoElement - )), + (from_offset != selector.len() && matches!( + selector.combinator_at_parse_order(from_offset), + Combinator::SlotAssignment | Combinator::PseudoElement + )), "Got the math wrong: {:?} | {:?} | {} {}", selector, selector.iter_raw_match_order().as_slice(), @@ -663,8 +662,9 @@ where Component::Combinator(_) => unreachable!(), Component::Slotted(ref selector) => { // <slots> are never flattened tree slottables. - !element.is_html_slot_element() && element.assigned_slot().is_some() && - context.shared.nest(|context| { + !element.is_html_slot_element() && element.assigned_slot().is_some() && context + .shared + .nest(|context| { matches_complex_selector(selector.iter(), element, context, flags_setter) }) }, @@ -729,7 +729,7 @@ where None => { empty_string = ::parser::namespace_empty_string::<E::Impl>(); NamespaceConstraint::Specific(&empty_string) - } + }, }; element.attr_matches( &namespace, @@ -750,7 +750,8 @@ where }, Component::NonTSPseudoClass(ref pc) => { if context.matches_hover_and_active_quirk == MatchesHoverAndActiveQuirk::Yes && - !context.shared.is_nested() && pc.is_active_or_hover() && + !context.shared.is_nested() && + pc.is_active_or_hover() && !element.is_link() { return false; diff --git a/components/selectors/parser.rs b/components/selectors/parser.rs index d0f98cde57b..8e26ff63d8a 100644 --- a/components/selectors/parser.rs +++ b/components/selectors/parser.rs @@ -231,9 +231,10 @@ impl<Impl: SelectorImpl> SelectorList<Impl> { { let mut values = SmallVec::new(); loop { - values - .push(input - .parse_until_before(Delimiter::Comma, |input| parse_selector(parser, input))?); + values.push( + input + .parse_until_before(Delimiter::Comma, |input| parse_selector(parser, input))?, + ); match input.next() { Err(_) => return Ok(SelectorList(values)), Ok(&Token::Comma) => continue, @@ -434,7 +435,8 @@ where ref local_name, never_matches, .. - } if !never_matches => + } + if !never_matches => { if !visitor.visit_attribute_selector( &NamespaceConstraint::Specific(&namespace_empty_string::<Impl>()), @@ -451,7 +453,7 @@ where None => { empty_string = ::parser::namespace_empty_string::<Impl>(); NamespaceConstraint::Specific(&empty_string) - } + }, }; if !visitor.visit_attribute_selector( &namespace, @@ -536,7 +538,8 @@ impl<Impl: SelectorImpl> Selector<Impl> { self.iter_raw_match_order().all(|c| { matches!( *c, - Component::ExplicitUniversalType | Component::ExplicitAnyNamespace | + Component::ExplicitUniversalType | + Component::ExplicitAnyNamespace | Component::Combinator(Combinator::PseudoElement) | Component::PseudoElement(..) ) @@ -565,13 +568,13 @@ impl<Impl: SelectorImpl> Selector<Impl> { } // Skip the pseudo-element. - for _ in &mut iter { } + for _ in &mut iter {} match iter.next_sequence() { None => return false, Some(combinator) => { debug_assert_eq!(combinator, Combinator::PseudoElement); - } + }, } iter.is_featureless_host_selector() @@ -785,7 +788,9 @@ impl Combinator { pub fn is_ancestor(&self) -> bool { matches!( *self, - Combinator::Child | Combinator::Descendant | Combinator::PseudoElement | + Combinator::Child | + Combinator::Descendant | + Combinator::PseudoElement | Combinator::SlotAssignment ) } @@ -976,7 +981,8 @@ impl<Impl: SelectorImpl> ToCss for SelectorList<Impl> { W: fmt::Write, { let mut iter = self.0.iter(); - let first = iter.next() + let first = iter + .next() .expect("Empty SelectorList, should contain at least one selector"); first.to_css(dest)?; for selector in iter { @@ -1004,10 +1010,12 @@ impl<Impl: SelectorImpl> ToCss for Selector<Impl> { // which we need for |split|. So we split by combinators on a match-order // sequence and then reverse. - let mut combinators = self.iter_raw_match_order() + let mut combinators = self + .iter_raw_match_order() .rev() .filter_map(|x| x.as_combinator()); - let compound_selectors = self.iter_raw_match_order() + let compound_selectors = self + .iter_raw_match_order() .as_slice() .split(|x| x.is_combinator()) .rev(); @@ -1261,7 +1269,7 @@ impl<Impl: SelectorImpl> ToCss for AttrSelectorWithOptionalNamespace<Impl> { dest.write_char('|')? }, Some(NamespaceConstraint::Any) => dest.write_str("*|")?, - None => {} + None => {}, } display_to_css_identifier(&self.local_name, dest)?; match self.operation { @@ -1701,11 +1709,10 @@ where { let local_name_lower_cow = to_ascii_lowercase(&local_name); if let ParsedCaseSensitivity::CaseSensitive = case_sensitivity { - if namespace.is_none() && - include!(concat!( - env!("OUT_DIR"), - "/ascii_case_insensitive_html_attributes.rs" - )).contains(&*local_name_lower_cow) + if namespace.is_none() && include!(concat!( + env!("OUT_DIR"), + "/ascii_case_insensitive_html_attributes.rs" + )).contains(&*local_name_lower_cow) { case_sensitivity = ParsedCaseSensitivity::AsciiCaseInsensitiveIfInHtmlElementInHtmlDocument @@ -1798,7 +1805,9 @@ where } // Success. - Ok(Component::Negation(sequence.into_vec().into_boxed_slice().into())) + Ok(Component::Negation( + sequence.into_vec().into_boxed_slice().into(), + )) } /// simple_selector_sequence @@ -2041,9 +2050,7 @@ where } } else { SimpleSelectorParseResult::PseudoElement(P::parse_pseudo_element( - parser, - location, - name, + parser, location, name, )?) }; Ok(Some(parse_result)) @@ -2363,48 +2370,38 @@ pub mod tests { assert!(parse(":lang(en US)").is_err()); assert_eq!( parse("EeÉ"), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::LocalName(LocalName { - name: DummyAtom::from("EeÉ"), - lower_name: DummyAtom::from("eeÉ"), - }), - ], - specificity(0, 0, 1), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![Component::LocalName(LocalName { + name: DummyAtom::from("EeÉ"), + lower_name: DummyAtom::from("eeÉ"), + }), ], + specificity(0, 0, 1), + ), ])) ); assert_eq!( parse("|e"), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::ExplicitNoNamespace, - Component::LocalName(LocalName { - name: DummyAtom::from("e"), - lower_name: DummyAtom::from("e"), - }), - ], - specificity(0, 0, 1), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::ExplicitNoNamespace, + Component::LocalName(LocalName { + name: DummyAtom::from("e"), + lower_name: DummyAtom::from("e"), + }), + ], + specificity(0, 0, 1), + ), ])) ); // When the default namespace is not set, *| should be elided. // https://github.com/servo/servo/pull/17537 assert_eq!( parse_expected("*|e", Some("e")), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::LocalName(LocalName { - name: DummyAtom::from("e"), - lower_name: DummyAtom::from("e"), - }), - ], - specificity(0, 0, 1), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![Component::LocalName(LocalName { + name: DummyAtom::from("e"), + lower_name: DummyAtom::from("e"), + }), ], + specificity(0, 0, 1), + ), ])) ); // When the default namespace is set, *| should _not_ be elided (as foo // is no longer equivalent to *|foo--the former is only for foo in the @@ -2415,128 +2412,112 @@ pub mod tests { "*|e", &DummyParser::default_with_namespace(DummyAtom::from("https://mozilla.org")) ), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::ExplicitAnyNamespace, - Component::LocalName(LocalName { - name: DummyAtom::from("e"), - lower_name: DummyAtom::from("e"), - }), - ], - specificity(0, 0, 1), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::ExplicitAnyNamespace, + Component::LocalName(LocalName { + name: DummyAtom::from("e"), + lower_name: DummyAtom::from("e"), + }), + ], + specificity(0, 0, 1), + ), ])) ); assert_eq!( parse("*"), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec(vec![Component::ExplicitUniversalType], specificity(0, 0, 0)), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![Component::ExplicitUniversalType], + specificity(0, 0, 0) + ), ])) ); assert_eq!( parse("|*"), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::ExplicitNoNamespace, - Component::ExplicitUniversalType, - ], - specificity(0, 0, 0), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::ExplicitNoNamespace, + Component::ExplicitUniversalType, + ], + specificity(0, 0, 0), + ), ])) ); assert_eq!( parse_expected("*|*", Some("*")), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec(vec![Component::ExplicitUniversalType], specificity(0, 0, 0)), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![Component::ExplicitUniversalType], + specificity(0, 0, 0) + ), ])) ); assert_eq!( parse_ns( "*|*", &DummyParser::default_with_namespace(DummyAtom::from("https://mozilla.org")) ), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::ExplicitAnyNamespace, - Component::ExplicitUniversalType, - ], - specificity(0, 0, 0), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::ExplicitAnyNamespace, + Component::ExplicitUniversalType, + ], + specificity(0, 0, 0), + ), ])) ); assert_eq!( parse(".foo:lang(en-US)"), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::Class(DummyAtom::from("foo")), - Component::NonTSPseudoClass(PseudoClass::Lang("en-US".to_owned())), - ], - specificity(0, 2, 0), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::Class(DummyAtom::from("foo")), + Component::NonTSPseudoClass(PseudoClass::Lang("en-US".to_owned())), + ], + specificity(0, 2, 0), + ), ])) ); assert_eq!( parse("#bar"), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![Component::ID(DummyAtom::from("bar"))], - specificity(1, 0, 0), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![Component::ID(DummyAtom::from("bar"))], + specificity(1, 0, 0), + ), ])) ); assert_eq!( parse("e.foo#bar"), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::LocalName(LocalName { - name: DummyAtom::from("e"), - lower_name: DummyAtom::from("e"), - }), - Component::Class(DummyAtom::from("foo")), - Component::ID(DummyAtom::from("bar")), - ], - specificity(1, 1, 1), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::LocalName(LocalName { + name: DummyAtom::from("e"), + lower_name: DummyAtom::from("e"), + }), + Component::Class(DummyAtom::from("foo")), + Component::ID(DummyAtom::from("bar")), + ], + specificity(1, 1, 1), + ), ])) ); assert_eq!( parse("e.foo #bar"), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::LocalName(LocalName { - name: DummyAtom::from("e"), - lower_name: DummyAtom::from("e"), - }), - Component::Class(DummyAtom::from("foo")), - Component::Combinator(Combinator::Descendant), - Component::ID(DummyAtom::from("bar")), - ], - specificity(1, 1, 1), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::LocalName(LocalName { + name: DummyAtom::from("e"), + lower_name: DummyAtom::from("e"), + }), + Component::Class(DummyAtom::from("foo")), + Component::Combinator(Combinator::Descendant), + Component::ID(DummyAtom::from("bar")), + ], + specificity(1, 1, 1), + ), ])) ); // Default namespace does not apply to attribute selectors // https://github.com/mozilla/servo/pull/1652 let mut parser = DummyParser::default(); assert_eq!( parse_ns("[Foo]", &parser), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::AttributeInNoNamespaceExists { - local_name: DummyAtom::from("Foo"), - local_name_lower: DummyAtom::from("foo"), - }, - ], - specificity(0, 1, 0), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![Component::AttributeInNoNamespaceExists { + local_name: DummyAtom::from("Foo"), + local_name_lower: DummyAtom::from("foo"), + }, ], + specificity(0, 1, 0), + ), ])) ); assert!(parse_ns("svg|circle", &parser).is_err()); parser @@ -2544,30 +2525,26 @@ pub mod tests { .insert(DummyAtom("svg".into()), DummyAtom(SVG.into())); assert_eq!( parse_ns("svg|circle", &parser), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::Namespace(DummyAtom("svg".into()), SVG.into()), - Component::LocalName(LocalName { - name: DummyAtom::from("circle"), - lower_name: DummyAtom::from("circle"), - }), - ], - specificity(0, 0, 1), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::Namespace(DummyAtom("svg".into()), SVG.into()), + Component::LocalName(LocalName { + name: DummyAtom::from("circle"), + lower_name: DummyAtom::from("circle"), + }), + ], + specificity(0, 0, 1), + ), ])) ); assert_eq!( parse_ns("svg|*", &parser), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::Namespace(DummyAtom("svg".into()), SVG.into()), - Component::ExplicitUniversalType, - ], - specificity(0, 0, 0), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::Namespace(DummyAtom("svg".into()), SVG.into()), + Component::ExplicitUniversalType, + ], + specificity(0, 0, 0), + ), ])) ); // Default namespace does not apply to attribute selectors // https://github.com/mozilla/servo/pull/1652 @@ -2576,163 +2553,143 @@ pub mod tests { parser.default_ns = Some(MATHML.into()); assert_eq!( parse_ns("[Foo]", &parser), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::DefaultNamespace(MATHML.into()), - Component::AttributeInNoNamespaceExists { - local_name: DummyAtom::from("Foo"), - local_name_lower: DummyAtom::from("foo"), - }, - ], - specificity(0, 1, 0), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::DefaultNamespace(MATHML.into()), + Component::AttributeInNoNamespaceExists { + local_name: DummyAtom::from("Foo"), + local_name_lower: DummyAtom::from("foo"), + }, + ], + specificity(0, 1, 0), + ), ])) ); // Default namespace does apply to type selectors assert_eq!( parse_ns("e", &parser), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::DefaultNamespace(MATHML.into()), - Component::LocalName(LocalName { - name: DummyAtom::from("e"), - lower_name: DummyAtom::from("e"), - }), - ], - specificity(0, 0, 1), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::DefaultNamespace(MATHML.into()), + Component::LocalName(LocalName { + name: DummyAtom::from("e"), + lower_name: DummyAtom::from("e"), + }), + ], + specificity(0, 0, 1), + ), ])) ); assert_eq!( parse_ns("*", &parser), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::DefaultNamespace(MATHML.into()), - Component::ExplicitUniversalType, - ], - specificity(0, 0, 0), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::DefaultNamespace(MATHML.into()), + Component::ExplicitUniversalType, + ], + specificity(0, 0, 0), + ), ])) ); assert_eq!( parse_ns("*|*", &parser), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::ExplicitAnyNamespace, - Component::ExplicitUniversalType, - ], - specificity(0, 0, 0), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::ExplicitAnyNamespace, + Component::ExplicitUniversalType, + ], + specificity(0, 0, 0), + ), ])) ); // Default namespace applies to universal and type selectors inside :not and :matches, // but not otherwise. assert_eq!( parse_ns(":not(.cl)", &parser), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::DefaultNamespace(MATHML.into()), - Component::Negation( - vec![Component::Class(DummyAtom::from("cl"))].into_boxed_slice().into(), - ), - ], - specificity(0, 1, 0), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::DefaultNamespace(MATHML.into()), + Component::Negation( + vec![Component::Class(DummyAtom::from("cl"))] + .into_boxed_slice() + .into(), + ), + ], + specificity(0, 1, 0), + ), ])) ); assert_eq!( parse_ns(":not(*)", &parser), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::DefaultNamespace(MATHML.into()), - Component::Negation( - vec![ - Component::DefaultNamespace(MATHML.into()), - Component::ExplicitUniversalType, - ].into_boxed_slice().into(), - ), - ], - specificity(0, 0, 0), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::DefaultNamespace(MATHML.into()), + Component::Negation( + vec![ + Component::DefaultNamespace(MATHML.into()), + Component::ExplicitUniversalType, + ].into_boxed_slice() + .into(), + ), + ], + specificity(0, 0, 0), + ), ])) ); assert_eq!( parse_ns(":not(e)", &parser), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::DefaultNamespace(MATHML.into()), - Component::Negation( - vec![ - Component::DefaultNamespace(MATHML.into()), - Component::LocalName(LocalName { - name: DummyAtom::from("e"), - lower_name: DummyAtom::from("e"), - }), - ].into_boxed_slice().into(), - ), - ], - specificity(0, 0, 1), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::DefaultNamespace(MATHML.into()), + Component::Negation( + vec![ + Component::DefaultNamespace(MATHML.into()), + Component::LocalName(LocalName { + name: DummyAtom::from("e"), + lower_name: DummyAtom::from("e"), + }), + ].into_boxed_slice() + .into(), + ), + ], + specificity(0, 0, 1), + ), ])) ); assert_eq!( parse("[attr|=\"foo\"]"), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::AttributeInNoNamespace { - local_name: DummyAtom::from("attr"), - operator: AttrSelectorOperator::DashMatch, - value: DummyAtom::from("foo"), - never_matches: false, - case_sensitivity: ParsedCaseSensitivity::CaseSensitive, - }, - ], - specificity(0, 1, 0), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![Component::AttributeInNoNamespace { + local_name: DummyAtom::from("attr"), + operator: AttrSelectorOperator::DashMatch, + value: DummyAtom::from("foo"), + never_matches: false, + case_sensitivity: ParsedCaseSensitivity::CaseSensitive, + }, ], + specificity(0, 1, 0), + ), ])) ); // https://github.com/mozilla/servo/issues/1723 assert_eq!( parse("::before"), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![Component::PseudoElement(PseudoElement::Before)], - specificity(0, 0, 1) | HAS_PSEUDO_BIT, - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![Component::PseudoElement(PseudoElement::Before)], + specificity(0, 0, 1) | HAS_PSEUDO_BIT, + ), ])) ); assert_eq!( parse("::before:hover"), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::PseudoElement(PseudoElement::Before), - Component::NonTSPseudoClass(PseudoClass::Hover), - ], - specificity(0, 1, 1) | HAS_PSEUDO_BIT, - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::PseudoElement(PseudoElement::Before), + Component::NonTSPseudoClass(PseudoClass::Hover), + ], + specificity(0, 1, 1) | HAS_PSEUDO_BIT, + ), ])) ); assert_eq!( parse("::before:hover:hover"), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::PseudoElement(PseudoElement::Before), - Component::NonTSPseudoClass(PseudoClass::Hover), - Component::NonTSPseudoClass(PseudoClass::Hover), - ], - specificity(0, 2, 1) | HAS_PSEUDO_BIT, - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::PseudoElement(PseudoElement::Before), + Component::NonTSPseudoClass(PseudoClass::Hover), + Component::NonTSPseudoClass(PseudoClass::Hover), + ], + specificity(0, 2, 1) | HAS_PSEUDO_BIT, + ), ])) ); assert!(parse("::before:hover:active").is_err()); assert!(parse("::before:hover .foo").is_err()); @@ -2744,33 +2701,29 @@ pub mod tests { assert!(parse(":: before").is_err()); assert_eq!( parse("div ::after"), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::LocalName(LocalName { - name: DummyAtom::from("div"), - lower_name: DummyAtom::from("div"), - }), - Component::Combinator(Combinator::Descendant), - Component::Combinator(Combinator::PseudoElement), - Component::PseudoElement(PseudoElement::After), - ], - specificity(0, 0, 2) | HAS_PSEUDO_BIT, - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::LocalName(LocalName { + name: DummyAtom::from("div"), + lower_name: DummyAtom::from("div"), + }), + Component::Combinator(Combinator::Descendant), + Component::Combinator(Combinator::PseudoElement), + Component::PseudoElement(PseudoElement::After), + ], + specificity(0, 0, 2) | HAS_PSEUDO_BIT, + ), ])) ); assert_eq!( parse("#d1 > .ok"), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::ID(DummyAtom::from("d1")), - Component::Combinator(Combinator::Child), - Component::Class(DummyAtom::from("ok")), - ], - (1 << 20) + (1 << 10) + (0 << 0), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![ + Component::ID(DummyAtom::from("d1")), + Component::Combinator(Combinator::Child), + Component::Class(DummyAtom::from("ok")), + ], + (1 << 20) + (1 << 10) + (0 << 0), + ), ])) ); parser.default_ns = None; assert!(parse(":not(#provel.old)").is_err()); @@ -2778,96 +2731,81 @@ pub mod tests { assert!(parse("table[rules]:not([rules=\"none\"]):not([rules=\"\"])").is_ok()); assert_eq!( parse(":not(#provel)"), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::Negation( - vec![Component::ID(DummyAtom::from("provel"))].into_boxed_slice().into(), - ), - ], - specificity(1, 0, 0), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![Component::Negation( + vec![Component::ID(DummyAtom::from("provel"))] + .into_boxed_slice() + .into(), + ), ], + specificity(1, 0, 0), + ), ])) ); assert_eq!( parse_ns(":not(svg|circle)", &parser), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![Component::Negation( vec![ - Component::Negation( - vec![ - Component::Namespace(DummyAtom("svg".into()), SVG.into()), - Component::LocalName(LocalName { - name: DummyAtom::from("circle"), - lower_name: DummyAtom::from("circle"), - }), - ].into_boxed_slice().into(), - ), - ], - specificity(0, 0, 1), - ), - ])) + Component::Namespace(DummyAtom("svg".into()), SVG.into()), + Component::LocalName(LocalName { + name: DummyAtom::from("circle"), + lower_name: DummyAtom::from("circle"), + }), + ].into_boxed_slice() + .into(), + ), ], + specificity(0, 0, 1), + ), ])) ); // https://github.com/servo/servo/issues/16017 assert_eq!( parse_ns(":not(*)", &parser), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::Negation( - vec![Component::ExplicitUniversalType].into_boxed_slice().into(), - ), - ], - specificity(0, 0, 0), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![Component::Negation( + vec![Component::ExplicitUniversalType] + .into_boxed_slice() + .into(), + ), ], + specificity(0, 0, 0), + ), ])) ); assert_eq!( parse_ns(":not(|*)", &parser), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![Component::Negation( vec![ - Component::Negation( - vec![ - Component::ExplicitNoNamespace, - Component::ExplicitUniversalType, - ].into_boxed_slice().into(), - ), - ], - specificity(0, 0, 0), - ), - ])) + Component::ExplicitNoNamespace, + Component::ExplicitUniversalType, + ].into_boxed_slice() + .into(), + ), ], + specificity(0, 0, 0), + ), ])) ); // *| should be elided if there is no default namespace. // https://github.com/servo/servo/pull/17537 assert_eq!( parse_ns_expected(":not(*|*)", &parser, Some(":not(*)")), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( - vec![ - Component::Negation( - vec![Component::ExplicitUniversalType].into_boxed_slice().into(), - ), - ], - specificity(0, 0, 0), - ), - ])) + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![Component::Negation( + vec![Component::ExplicitUniversalType] + .into_boxed_slice() + .into(), + ), ], + specificity(0, 0, 0), + ), ])) ); assert_eq!( parse_ns(":not(svg|*)", &parser), - Ok(SelectorList::from_vec(vec![ - Selector::from_vec( + Ok(SelectorList::from_vec(vec![Selector::from_vec( + vec![Component::Negation( vec![ - Component::Negation( - vec![ - Component::Namespace(DummyAtom("svg".into()), SVG.into()), - Component::ExplicitUniversalType, - ].into_boxed_slice().into(), - ), - ], - specificity(0, 0, 0), - ), - ])) + Component::Namespace(DummyAtom("svg".into()), SVG.into()), + Component::ExplicitUniversalType, + ].into_boxed_slice() + .into(), + ), ], + specificity(0, 0, 0), + ), ])) ); assert!(parse("::slotted()").is_err()); @@ -2907,7 +2845,7 @@ pub mod tests { "*|*::before", &DummyParser::default_with_namespace(DummyAtom::from("https://mozilla.org")), ).unwrap() - .0[0]; + .0[0]; assert!(selector.is_universal()); } diff --git a/components/style/Cargo.toml b/components/style/Cargo.toml index fac4091f018..951ed615d99 100644 --- a/components/style/Cargo.toml +++ b/components/style/Cargo.toml @@ -50,7 +50,7 @@ num_cpus = {version = "1.1.0", optional = true} num-integer = "0.1" num-traits = "0.2" num-derive = "0.2" -new-ordered-float = "1.0" +ordered-float = "1.0" owning_ref = "0.3.3" parking_lot = "0.6" precomputed-hash = "0.1.1" diff --git a/ports/libsimpleservo/build.rs b/ports/libsimpleservo/build.rs index c684cc36554..8f7df1926d1 100644 --- a/ports/libsimpleservo/build.rs +++ b/ports/libsimpleservo/build.rs @@ -20,7 +20,8 @@ fn main() { fn android_main() { // Get the NDK path from NDK_HOME env. - let ndk_path = env::var_os("ANDROID_NDK").expect("Please set the ANDROID_NDK environment variable"); + let ndk_path = + env::var_os("ANDROID_NDK").expect("Please set the ANDROID_NDK environment variable"); let ndk_path = Path::new(&ndk_path); let target = env::var("TARGET").unwrap(); @@ -43,7 +44,11 @@ fn android_main() { }; // compiling android_native_app_glue.c - let c_file = ndk_path.join("sources").join("android").join("native_app_glue").join("android_native_app_glue.c"); + let c_file = ndk_path + .join("sources") + .join("android") + .join("native_app_glue") + .join("android_native_app_glue.c"); let sysroot = ndk_path.join("platforms").join(platform).join(arch); cc::Build::new() .file(c_file) @@ -53,13 +58,13 @@ fn android_main() { .compile("android_native_app_glue"); // Get the output directory. - let out_dir = env::var("OUT_DIR").expect("Cargo should have set the OUT_DIR environment variable"); + let out_dir = + env::var("OUT_DIR").expect("Cargo should have set the OUT_DIR environment variable"); println!("cargo:rustc-link-lib=static=android_native_app_glue"); println!("cargo:rustc-link-search=native={}", out_dir); println!("cargo:rustc-link-lib=log"); println!("cargo:rustc-link-lib=android"); - } fn generate_gl_bindings(target: &str) { diff --git a/ports/servo/browser.rs b/ports/servo/browser.rs index 9e58581d928..dee5055f449 100644 --- a/ports/servo/browser.rs +++ b/ports/servo/browser.rs @@ -75,7 +75,7 @@ impl Browser { }, event => { self.event_queue.push(event); - } + }, } } } @@ -85,7 +85,13 @@ impl Browser { } /// Handle key events before sending them to Servo. - fn handle_key_from_window(&mut self, ch: Option<char>, key: Key, state: KeyState, mods: KeyModifiers) { + fn handle_key_from_window( + &mut self, + ch: Option<char>, + key: Key, + state: KeyState, + mods: KeyModifiers, + ) { let pressed = state == KeyState::Pressed; // We don't match the state in the parent `match` because we don't want to do anything // on KeyState::Released when it's a combo that we handle on Pressed. For example, @@ -93,7 +99,7 @@ impl Browser { match (mods, ch, key, self.browser_id) { (CMD_OR_CONTROL, _, Key::R, Some(id)) => if pressed { self.event_queue.push(WindowEvent::Reload(id)); - } + }, (CMD_OR_CONTROL, _, Key::L, Some(id)) => if pressed { let url: String = if let Some(ref current_url) = self.current_url { current_url.to_string() @@ -107,69 +113,92 @@ impl Browser { self.event_queue.push(WindowEvent::LoadUrl(id, url)); } } - } + }, (CMD_OR_CONTROL, _, Key::Q, _) => if pressed { self.event_queue.push(WindowEvent::Quit); - } - (_, Some('3'), _, _) if mods ^ KeyModifiers::CONTROL == KeyModifiers::SHIFT => if pressed { - self.event_queue.push(WindowEvent::CaptureWebRender); - } + }, + (_, Some('3'), _, _) if mods ^ KeyModifiers::CONTROL == KeyModifiers::SHIFT => { + if pressed { + self.event_queue.push(WindowEvent::CaptureWebRender); + } + }, (KeyModifiers::CONTROL, None, Key::F10, _) => if pressed { - let event = WindowEvent::ToggleWebRenderDebug(WebRenderDebugOption::RenderTargetDebug); + let event = + WindowEvent::ToggleWebRenderDebug(WebRenderDebugOption::RenderTargetDebug); self.event_queue.push(event); - } + }, (KeyModifiers::CONTROL, None, Key::F11, _) => if pressed { - let event = WindowEvent::ToggleWebRenderDebug(WebRenderDebugOption::TextureCacheDebug); + let event = + WindowEvent::ToggleWebRenderDebug(WebRenderDebugOption::TextureCacheDebug); self.event_queue.push(event); - } + }, (KeyModifiers::CONTROL, None, Key::F12, _) => if pressed { let event = WindowEvent::ToggleWebRenderDebug(WebRenderDebugOption::Profiler); self.event_queue.push(event); - } + }, (CMD_OR_ALT, None, Key::Right, Some(id)) | (KeyModifiers::NONE, None, Key::NavigateForward, Some(id)) => if pressed { let event = WindowEvent::Navigation(id, TraversalDirection::Forward(1)); self.event_queue.push(event); - } + }, (CMD_OR_ALT, None, Key::Left, Some(id)) | (KeyModifiers::NONE, None, Key::NavigateBackward, Some(id)) => if pressed { let event = WindowEvent::Navigation(id, TraversalDirection::Back(1)); self.event_queue.push(event); - } + }, (KeyModifiers::NONE, None, Key::Escape, _) => if pressed { self.event_queue.push(WindowEvent::Quit); - } + }, _ => { self.platform_handle_key(ch, key, mods, state); - } + }, } } #[cfg(not(target_os = "win"))] - fn platform_handle_key(&mut self, ch: Option<char>, key: Key, mods: KeyModifiers, state: KeyState) { + fn platform_handle_key( + &mut self, + ch: Option<char>, + key: Key, + mods: KeyModifiers, + state: KeyState, + ) { let pressed = state == KeyState::Pressed; match (mods, key, self.browser_id) { (CMD_OR_CONTROL, Key::LeftBracket, Some(id)) => if pressed { let event = WindowEvent::Navigation(id, TraversalDirection::Back(1)); self.event_queue.push(event); - } + }, (CMD_OR_CONTROL, Key::RightBracket, Some(id)) => if pressed { let event = WindowEvent::Navigation(id, TraversalDirection::Back(1)); self.event_queue.push(event); - } + }, _ => { - self.event_queue.push(WindowEvent::KeyEvent(ch, key, state, mods)); - } + self.event_queue + .push(WindowEvent::KeyEvent(ch, key, state, mods)); + }, } } #[cfg(target_os = "win")] - fn platform_handle_key(&mut self, _ch: Option<char>, _key: Key, _mods: KeyModifiers, _state: KeyState) { + fn platform_handle_key( + &mut self, + _ch: Option<char>, + _key: Key, + _mods: KeyModifiers, + _state: KeyState, + ) { } /// Handle key events after they have been handled by Servo. - fn handle_key_from_servo(&mut self, _: Option<BrowserId>, ch: Option<char>, - key: Key, state: KeyState, mods: KeyModifiers) { + fn handle_key_from_servo( + &mut self, + _: Option<BrowserId>, + ch: Option<char>, + key: Key, + state: KeyState, + mods: KeyModifiers, + ) { if state == KeyState::Released { return; } @@ -177,55 +206,66 @@ impl Browser { match (mods, ch, key) { (CMD_OR_CONTROL, Some('='), _) | (CMD_OR_CONTROL, Some('+'), _) => { self.event_queue.push(WindowEvent::Zoom(1.1)); - } + }, (_, Some('='), _) if mods == (CMD_OR_CONTROL | KeyModifiers::SHIFT) => { self.event_queue.push(WindowEvent::Zoom(1.1)); }, (CMD_OR_CONTROL, Some('-'), _) => { self.event_queue.push(WindowEvent::Zoom(1.0 / 1.1)); - } + }, (CMD_OR_CONTROL, Some('0'), _) => { self.event_queue.push(WindowEvent::ResetZoom); - } + }, (KeyModifiers::NONE, None, Key::PageDown) => { - let scroll_location = ScrollLocation::Delta(TypedVector2D::new(0.0, - -self.window.page_height() + 2.0 * LINE_HEIGHT)); + let scroll_location = ScrollLocation::Delta(TypedVector2D::new( + 0.0, + -self.window.page_height() + 2.0 * LINE_HEIGHT, + )); self.scroll_window_from_key(scroll_location, TouchEventType::Move); - } + }, (KeyModifiers::NONE, None, Key::PageUp) => { - let scroll_location = ScrollLocation::Delta(TypedVector2D::new(0.0, - self.window.page_height() - 2.0 * LINE_HEIGHT)); + let scroll_location = ScrollLocation::Delta(TypedVector2D::new( + 0.0, + self.window.page_height() - 2.0 * LINE_HEIGHT, + )); self.scroll_window_from_key(scroll_location, TouchEventType::Move); - } + }, (KeyModifiers::NONE, None, Key::Home) => { self.scroll_window_from_key(ScrollLocation::Start, TouchEventType::Move); - } + }, (KeyModifiers::NONE, None, Key::End) => { self.scroll_window_from_key(ScrollLocation::End, TouchEventType::Move); - } + }, (KeyModifiers::NONE, None, Key::Up) => { - self.scroll_window_from_key(ScrollLocation::Delta(TypedVector2D::new(0.0, 3.0 * LINE_HEIGHT)), - TouchEventType::Move); - } + self.scroll_window_from_key( + ScrollLocation::Delta(TypedVector2D::new(0.0, 3.0 * LINE_HEIGHT)), + TouchEventType::Move, + ); + }, (KeyModifiers::NONE, None, Key::Down) => { - self.scroll_window_from_key(ScrollLocation::Delta(TypedVector2D::new(0.0, -3.0 * LINE_HEIGHT)), - TouchEventType::Move); - } + self.scroll_window_from_key( + ScrollLocation::Delta(TypedVector2D::new(0.0, -3.0 * LINE_HEIGHT)), + TouchEventType::Move, + ); + }, (KeyModifiers::NONE, None, Key::Left) => { - self.scroll_window_from_key(ScrollLocation::Delta(TypedVector2D::new(LINE_HEIGHT, 0.0)), - TouchEventType::Move); - } + self.scroll_window_from_key( + ScrollLocation::Delta(TypedVector2D::new(LINE_HEIGHT, 0.0)), + TouchEventType::Move, + ); + }, (KeyModifiers::NONE, None, Key::Right) => { - self.scroll_window_from_key(ScrollLocation::Delta(TypedVector2D::new(-LINE_HEIGHT, 0.0)), - TouchEventType::Move); - } + self.scroll_window_from_key( + ScrollLocation::Delta(TypedVector2D::new(-LINE_HEIGHT, 0.0)), + TouchEventType::Move, + ); + }, - _ => { - } + _ => {}, } } @@ -254,81 +294,93 @@ impl Browser { }; let title = format!("{} - Servo", title); self.window.set_title(&title); - } + }, EmbedderMsg::MoveTo(point) => { self.window.set_position(point); - } + }, EmbedderMsg::ResizeTo(size) => { self.window.set_inner_size(size); - } + }, EmbedderMsg::Alert(message, sender) => { if !opts::get().headless { - let _ = thread::Builder::new().name("display alert dialog".to_owned()).spawn(move || { - tinyfiledialogs::message_box_ok("Alert!", &message, MessageBoxIcon::Warning); - }).unwrap().join().expect("Thread spawning failed"); + let _ = thread::Builder::new() + .name("display alert dialog".to_owned()) + .spawn(move || { + tinyfiledialogs::message_box_ok( + "Alert!", + &message, + MessageBoxIcon::Warning, + ); + }).unwrap() + .join() + .expect("Thread spawning failed"); } if let Err(e) = sender.send(()) { let reason = format!("Failed to send Alert response: {}", e); - self.event_queue.push(WindowEvent::SendError(browser_id, reason)); + self.event_queue + .push(WindowEvent::SendError(browser_id, reason)); } - } + }, EmbedderMsg::AllowUnload(sender) => { // Always allow unload for now. if let Err(e) = sender.send(true) { let reason = format!("Failed to send AllowUnload response: {}", e); - self.event_queue.push(WindowEvent::SendError(browser_id, reason)); + self.event_queue + .push(WindowEvent::SendError(browser_id, reason)); } - } + }, EmbedderMsg::AllowNavigation(_url, sender) => { if let Err(e) = sender.send(true) { warn!("Failed to send AllowNavigation response: {}", e); } - } + }, EmbedderMsg::AllowOpeningBrowser(response_chan) => { // Note: would be a place to handle pop-ups config. // see Step 7 of #the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name if let Err(e) = response_chan.send(true) { warn!("Failed to send AllowOpeningBrowser response: {}", e); }; - } + }, EmbedderMsg::BrowserCreated(new_browser_id) => { // TODO: properly handle a new "tab" self.browsers.push(new_browser_id); if self.browser_id.is_none() { self.browser_id = Some(new_browser_id); } - self.event_queue.push(WindowEvent::SelectBrowser(new_browser_id)); - } + self.event_queue + .push(WindowEvent::SelectBrowser(new_browser_id)); + }, EmbedderMsg::KeyEvent(ch, key, state, modified) => { self.handle_key_from_servo(browser_id, ch, key, state, modified); - } + }, EmbedderMsg::SetCursor(cursor) => { self.window.set_cursor(cursor); - } + }, EmbedderMsg::NewFavicon(url) => { self.favicon = Some(url); - } + }, EmbedderMsg::HeadParsed => { self.loading_state = Some(LoadingState::Loading); - } + }, EmbedderMsg::HistoryChanged(urls, current) => { self.current_url = Some(urls[current].clone()); - } + }, EmbedderMsg::SetFullscreenState(state) => { self.window.set_fullscreen(state); - } + }, EmbedderMsg::LoadStart => { self.loading_state = Some(LoadingState::Connecting); - } + }, EmbedderMsg::LoadComplete => { self.loading_state = Some(LoadingState::Loaded); - } + }, EmbedderMsg::CloseBrowser => { // TODO: close the appropriate "tab". let _ = self.browsers.pop(); if let Some(prev_browser_id) = self.browsers.last() { self.browser_id = Some(*prev_browser_id); - self.event_queue.push(WindowEvent::SelectBrowser(*prev_browser_id)); + self.event_queue + .push(WindowEvent::SelectBrowser(*prev_browser_id)); } else { self.event_queue.push(WindowEvent::Quit); } @@ -336,92 +388,107 @@ impl Browser { EmbedderMsg::Shutdown => { self.shutdown_requested = true; }, - EmbedderMsg::Panic(_reason, _backtrace) => { - }, + EmbedderMsg::Panic(_reason, _backtrace) => {}, EmbedderMsg::GetSelectedBluetoothDevice(devices, sender) => { let selected = platform_get_selected_devices(devices); if let Err(e) = sender.send(selected) { - let reason = format!("Failed to send GetSelectedBluetoothDevice response: {}", e); + let reason = + format!("Failed to send GetSelectedBluetoothDevice response: {}", e); self.event_queue.push(WindowEvent::SendError(None, reason)); }; }, EmbedderMsg::SelectFiles(patterns, multiple_files, sender) => { - let res = match (opts::get().headless, get_selected_files(patterns, multiple_files)) { + let res = match ( + opts::get().headless, + get_selected_files(patterns, multiple_files), + ) { (true, _) | (false, None) => sender.send(None), - (false, Some(files)) => sender.send(Some(files)) + (false, Some(files)) => sender.send(Some(files)), }; if let Err(e) = res { let reason = format!("Failed to send SelectFiles response: {}", e); self.event_queue.push(WindowEvent::SendError(None, reason)); }; - } + }, EmbedderMsg::ShowIME(_kind) => { debug!("ShowIME received"); - } + }, EmbedderMsg::HideIME => { debug!("HideIME received"); - } + }, } } } - } #[cfg(target_os = "linux")] fn platform_get_selected_devices(devices: Vec<String>) -> Option<String> { let picker_name = "Choose a device"; - thread::Builder::new().name(picker_name.to_owned()).spawn(move || { - let dialog_rows: Vec<&str> = devices.iter() - .map(|s| s.as_ref()) - .collect(); - let dialog_rows: Option<&[&str]> = Some(dialog_rows.as_slice()); + thread::Builder::new() + .name(picker_name.to_owned()) + .spawn(move || { + let dialog_rows: Vec<&str> = devices.iter().map(|s| s.as_ref()).collect(); + let dialog_rows: Option<&[&str]> = Some(dialog_rows.as_slice()); - match tinyfiledialogs::list_dialog("Choose a device", &["Id", "Name"], dialog_rows) { - Some(device) => { - // The device string format will be "Address|Name". We need the first part of it. - device.split("|").next().map(|s| s.to_string()) - }, - None => { - None + match tinyfiledialogs::list_dialog("Choose a device", &["Id", "Name"], dialog_rows) { + Some(device) => { + // The device string format will be "Address|Name". We need the first part of it. + device.split("|").next().map(|s| s.to_string()) + }, + None => None, } - } - }).unwrap().join().expect("Thread spawning failed") + }).unwrap() + .join() + .expect("Thread spawning failed") } #[cfg(not(target_os = "linux"))] fn platform_get_selected_devices(devices: Vec<String>) -> Option<String> { for device in devices { if let Some(address) = device.split("|").next().map(|s| s.to_string()) { - return Some(address) + return Some(address); } } None } fn get_selected_files(patterns: Vec<FilterPattern>, multiple_files: bool) -> Option<Vec<String>> { - let picker_name = if multiple_files { "Pick files" } else { "Pick a file" }; - thread::Builder::new().name(picker_name.to_owned()).spawn(move || { - let mut filters = vec![]; - for p in patterns { - let s = "*.".to_string() + &p.0; - filters.push(s) - } - let filter_ref = &(filters.iter().map(|s| s.as_str()).collect::<Vec<&str>>()[..]); - let filter_opt = if filters.len() > 0 { Some((filter_ref, "")) } else { None }; + let picker_name = if multiple_files { + "Pick files" + } else { + "Pick a file" + }; + thread::Builder::new() + .name(picker_name.to_owned()) + .spawn(move || { + let mut filters = vec![]; + for p in patterns { + let s = "*.".to_string() + &p.0; + filters.push(s) + } + let filter_ref = &(filters.iter().map(|s| s.as_str()).collect::<Vec<&str>>()[..]); + let filter_opt = if filters.len() > 0 { + Some((filter_ref, "")) + } else { + None + }; - if multiple_files { - tinyfiledialogs::open_file_dialog_multi(picker_name, "", filter_opt) - } else { - let file = tinyfiledialogs::open_file_dialog(picker_name, "", filter_opt); - file.map(|x| vec![x]) - } - }).unwrap().join().expect("Thread spawning failed") + if multiple_files { + tinyfiledialogs::open_file_dialog_multi(picker_name, "", filter_opt) + } else { + let file = tinyfiledialogs::open_file_dialog(picker_name, "", filter_opt); + file.map(|x| vec![x]) + } + }).unwrap() + .join() + .expect("Thread spawning failed") } fn sanitize_url(request: &str) -> Option<ServoUrl> { let request = request.trim(); - ServoUrl::parse(&request).ok() + ServoUrl::parse(&request) + .ok() .or_else(|| { if request.contains('/') || is_reg_domain(request) { ServoUrl::parse(&format!("http://{}", request)).ok() @@ -429,9 +496,12 @@ fn sanitize_url(request: &str) -> Option<ServoUrl> { None } }).or_else(|| { - PREFS.get("shell.searchpage").as_string().and_then(|s: &str| { - let url = s.replace("%s", request); - ServoUrl::parse(&url).ok() - }) + PREFS + .get("shell.searchpage") + .as_string() + .and_then(|s: &str| { + let url = s.replace("%s", request); + ServoUrl::parse(&url).ok() + }) }) } diff --git a/ports/servo/glutin_app/keyutils.rs b/ports/servo/glutin_app/keyutils.rs index e816fa6cd36..2c685cf10e5 100644 --- a/ports/servo/glutin_app/keyutils.rs +++ b/ports/servo/glutin_app/keyutils.rs @@ -114,7 +114,7 @@ pub fn char_to_script_key(c: char) -> Option<constellation_msg::Key> { '\\' => Some(Key::Backslash), '}' => Some(Key::RightBracket), ']' => Some(Key::RightBracket), - _ => None + _ => None, } } @@ -233,69 +233,13 @@ pub fn winit_key_to_script_key(key: VirtualKeyCode) -> Result<constellation_msg: pub fn is_printable(key_code: VirtualKeyCode) -> bool { use winit::VirtualKeyCode::*; match key_code { - Escape | - F1 | - F2 | - F3 | - F4 | - F5 | - F6 | - F7 | - F8 | - F9 | - F10 | - F11 | - F12 | - F13 | - F14 | - F15 | - Snapshot | - Scroll | - Pause | - Insert | - Home | - Delete | - End | - PageDown | - PageUp | - Left | - Up | - Right | - Down | - Back | - LAlt | - LControl | - LShift | - LWin | - Mail | - MediaSelect | - MediaStop | - Mute | - MyComputer | - NavigateForward | - NavigateBackward | - NextTrack | - NoConvert | - PlayPause | - Power | - PrevTrack | - RAlt | - RControl | - RShift | - RWin | - Sleep | - Stop | - VolumeDown | - VolumeUp | - Wake | - WebBack | - WebFavorites | - WebForward | - WebHome | - WebRefresh | - WebSearch | - WebStop => false, + Escape | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | F13 | F14 | + F15 | Snapshot | Scroll | Pause | Insert | Home | Delete | End | PageDown | PageUp | + Left | Up | Right | Down | Back | LAlt | LControl | LShift | LWin | Mail | + MediaSelect | MediaStop | Mute | MyComputer | NavigateForward | NavigateBackward | + NextTrack | NoConvert | PlayPause | Power | PrevTrack | RAlt | RControl | RShift | + RWin | Sleep | Stop | VolumeDown | VolumeUp | Wake | WebBack | WebFavorites | + WebForward | WebHome | WebRefresh | WebSearch | WebStop => false, _ => true, } } - diff --git a/ports/servo/glutin_app/window.rs b/ports/servo/glutin_app/window.rs index 42df41c49c4..783f7e9a494 100644 --- a/ports/servo/glutin_app/window.rs +++ b/ports/servo/glutin_app/window.rs @@ -42,7 +42,6 @@ use winit::dpi::{LogicalPosition, LogicalSize, PhysicalSize}; #[cfg(target_os = "macos")] use winit::os::macos::{ActivationPolicy, WindowBuilderExt}; - // This should vary by zoom level and maybe actual text size (focused or under cursor) pub const LINE_HEIGHT: f32 = 38.0; @@ -91,20 +90,21 @@ impl HeadlessContext { attribs.push(3); attribs.push(0); - let context = unsafe { - osmesa_sys::OSMesaCreateContextAttribs(attribs.as_ptr(), ptr::null_mut()) - }; + let context = + unsafe { osmesa_sys::OSMesaCreateContextAttribs(attribs.as_ptr(), ptr::null_mut()) }; assert!(!context.is_null()); let mut buffer = vec![0; (width * height) as usize]; unsafe { - let ret = osmesa_sys::OSMesaMakeCurrent(context, - buffer.as_mut_ptr() as *mut _, - gl::UNSIGNED_BYTE, - width as i32, - height as i32); + let ret = osmesa_sys::OSMesaMakeCurrent( + context, + buffer.as_mut_ptr() as *mut _, + gl::UNSIGNED_BYTE, + width as i32, + height as i32, + ); assert_ne!(ret, 0); }; @@ -127,9 +127,7 @@ impl HeadlessContext { #[cfg(any(target_os = "linux", target_os = "macos"))] fn get_proc_address(s: &str) -> *const c_void { let c_str = CString::new(s).expect("Unable to create CString"); - unsafe { - mem::transmute(osmesa_sys::OSMesaGetProcAddress(c_str.as_ptr())) - } + unsafe { mem::transmute(osmesa_sys::OSMesaGetProcAddress(c_str.as_ptr())) } } #[cfg(not(any(target_os = "linux", target_os = "macos")))] @@ -167,18 +165,18 @@ fn window_creation_scale_factor() -> TypedScale<f32, DeviceIndependentPixel, Dev #[cfg(target_os = "windows")] fn window_creation_scale_factor() -> TypedScale<f32, DeviceIndependentPixel, DevicePixel> { - let hdc = unsafe { user32::GetDC(::std::ptr::null_mut()) }; - let ppi = unsafe { gdi32::GetDeviceCaps(hdc, winapi::wingdi::LOGPIXELSY) }; - TypedScale::new(ppi as f32 / 96.0) + let hdc = unsafe { user32::GetDC(::std::ptr::null_mut()) }; + let ppi = unsafe { gdi32::GetDeviceCaps(hdc, winapi::wingdi::LOGPIXELSY) }; + TypedScale::new(ppi as f32 / 96.0) } - impl Window { pub fn new( is_foreground: bool, window_size: TypedSize2D<u32, DeviceIndependentPixel>, ) -> Rc<Window> { - let win_size: DeviceUintSize = (window_size.to_f32() * window_creation_scale_factor()).to_u32(); + let win_size: DeviceUintSize = + (window_size.to_f32() * window_creation_scale_factor()).to_u32(); let width = win_size.to_untyped().width; let height = win_size.to_untyped().height; @@ -225,7 +223,10 @@ impl Window { .expect("Failed to create window."); unsafe { - glutin_window.context().make_current().expect("Couldn't make window current"); + glutin_window + .context() + .make_current() + .expect("Couldn't make window current"); } let PhysicalSize { @@ -234,8 +235,9 @@ impl Window { } = events_loop.get_primary_monitor().get_dimensions(); screen_size = TypedSize2D::new(screen_width as u32, screen_height as u32); // TODO(ajeffrey): can this fail? - let LogicalSize { width, height } = - glutin_window.get_inner_size().expect("Failed to get window inner size."); + let LogicalSize { width, height } = glutin_window + .get_inner_size() + .expect("Failed to get window inner size."); inner_size = TypedSize2D::new(width as u32, height as u32); glutin_window.show(); @@ -244,25 +246,17 @@ impl Window { }; let gl = match window_kind { - WindowKind::Window(ref window, ..) => { - match gl::GlType::default() { - gl::GlType::Gl => { - unsafe { - gl::GlFns::load_with(|s| window.get_proc_address(s) as *const _) - } - } - gl::GlType::Gles => { - unsafe { - gl::GlesFns::load_with(|s| window.get_proc_address(s) as *const _) - } - } - } - } - WindowKind::Headless(..) => { - unsafe { - gl::GlFns::load_with(|s| HeadlessContext::get_proc_address(s)) - } - } + WindowKind::Window(ref window, ..) => match gl::GlType::default() { + gl::GlType::Gl => unsafe { + gl::GlFns::load_with(|s| window.get_proc_address(s) as *const _) + }, + gl::GlType::Gles => unsafe { + gl::GlesFns::load_with(|s| window.get_proc_address(s) as *const _) + }, + }, + WindowKind::Headless(..) => unsafe { + gl::GlFns::load_with(|s| HeadlessContext::get_proc_address(s)) + }, }; if opts::get().headless { @@ -279,7 +273,7 @@ impl Window { let window = Window { kind: window_kind, - event_queue: RefCell::new(vec!()), + event_queue: RefCell::new(vec![]), mouse_down_button: Cell::new(None), mouse_down_point: Cell::new(TypedPoint2D::new(0, 0)), @@ -308,12 +302,12 @@ impl Window { let dpr = self.servo_hidpi_factor(); match self.kind { WindowKind::Window(ref window, _) => { - let size = window.get_inner_size().expect("Failed to get window inner size."); + let size = window + .get_inner_size() + .expect("Failed to get window inner size."); size.height as f32 * dpr.get() }, - WindowKind::Headless(ref context) => { - context.height as f32 * dpr.get() - } + WindowKind::Headless(ref context) => context.height as f32 * dpr.get(), } } @@ -344,7 +338,7 @@ impl Window { window.set_fullscreen(None); } }, - WindowKind::Headless(..) => {} + WindowKind::Headless(..) => {}, } self.fullscreen.set(state); } @@ -353,7 +347,10 @@ impl Window { self.animation_state.get() == AnimationState::Animating && !self.suspended.get() } - pub fn run<T>(&self, mut servo_callback: T) where T: FnMut() -> bool { + pub fn run<T>(&self, mut servo_callback: T) + where + T: FnMut() -> bool, + { match self.kind { WindowKind::Window(_, ref events_loop) => { let mut stop = false; @@ -384,7 +381,7 @@ impl Window { break; } } - } + }, WindowKind::Headless(..) => { loop { // Sleep the main thread to avoid using 100% CPU @@ -397,7 +394,7 @@ impl Window { break; } } - } + }, } } @@ -438,7 +435,12 @@ impl Window { self.toggle_modifier(KeyModifiers::SUPER, mods.logo); } - fn handle_keyboard_input(&self, element_state: ElementState, code: VirtualKeyCode, mods: ModifiersState) { + fn handle_keyboard_input( + &self, + element_state: ElementState, + code: VirtualKeyCode, + mods: ModifiersState, + ) { self.toggle_keyboard_modifiers(mods); if let Ok(key) = keyutils::winit_key_to_script_key(code) { @@ -452,7 +454,9 @@ impl Window { } else { self.last_pressed_key.set(None); let modifiers = self.key_modifiers.get(); - self.event_queue.borrow_mut().push(WindowEvent::KeyEvent(None, key, state, modifiers)); + self.event_queue + .borrow_mut() + .push(WindowEvent::KeyEvent(None, key, state, modifiers)); } } } @@ -464,34 +468,40 @@ impl Window { .. } => self.handle_received_character(ch), Event::WindowEvent { - event: winit::WindowEvent::KeyboardInput { - input: winit::KeyboardInput { - state, virtual_keycode: Some(virtual_keycode), modifiers, .. - }, .. - }, .. + event: + winit::WindowEvent::KeyboardInput { + input: + winit::KeyboardInput { + state, + virtual_keycode: Some(virtual_keycode), + modifiers, + .. + }, + .. + }, + .. } => self.handle_keyboard_input(state, virtual_keycode, modifiers), Event::WindowEvent { - event: winit::WindowEvent::MouseInput { - state, button, .. - }, .. + event: winit::WindowEvent::MouseInput { state, button, .. }, + .. } => { if button == MouseButton::Left || button == MouseButton::Right { self.handle_mouse(button, state, self.mouse_pos.get()); } }, Event::WindowEvent { - event: winit::WindowEvent::CursorMoved { - position, - .. - }, + event: winit::WindowEvent::CursorMoved { position, .. }, .. } => { let pos = position.to_physical(self.device_hidpi_factor().get() as f64); let (x, y): (i32, i32) = pos.into(); self.mouse_pos.set(TypedPoint2D::new(x, y)); - self.event_queue.borrow_mut().push( - WindowEvent::MouseWindowMoveEventClass(TypedPoint2D::new(x as f32, y as f32))); - } + self.event_queue + .borrow_mut() + .push(WindowEvent::MouseWindowMoveEventClass(TypedPoint2D::new( + x as f32, y as f32, + ))); + }, Event::WindowEvent { event: winit::WindowEvent::MouseWheel { delta, phase, .. }, .. @@ -499,9 +509,10 @@ impl Window { let (mut dx, mut dy) = match delta { MouseScrollDelta::LineDelta(dx, dy) => (dx, dy * LINE_HEIGHT), MouseScrollDelta::PixelDelta(position) => { - let position = position.to_physical(self.device_hidpi_factor().get() as f64); + let position = + position.to_physical(self.device_hidpi_factor().get() as f64); (position.x as f32, position.y as f32) - } + }, }; // Scroll events snap to the major axis of movement, with vertical // preferred over horizontal. @@ -524,10 +535,14 @@ impl Window { let phase = winit_phase_to_touch_event_type(touch.phase); let id = TouchId(touch.id as i32); - let position = touch.location.to_physical(self.device_hidpi_factor().get() as f64); + let position = touch + .location + .to_physical(self.device_hidpi_factor().get() as f64); let point = TypedPoint2D::new(position.x as f32, position.y as f32); - self.event_queue.borrow_mut().push(WindowEvent::Touch(phase, id, point)); - } + self.event_queue + .borrow_mut() + .push(WindowEvent::Touch(phase, id, point)); + }, Event::WindowEvent { event: winit::WindowEvent::Refresh, .. @@ -537,7 +552,7 @@ impl Window { .. } => { self.event_queue.borrow_mut().push(WindowEvent::Quit); - } + }, Event::WindowEvent { event: winit::WindowEvent::Resized(size), .. @@ -555,17 +570,17 @@ impl Window { self.inner_size.set(new_size); self.event_queue.borrow_mut().push(WindowEvent::Resize); } - } + }, Event::Suspended(suspended) => { self.suspended.set(suspended); if !suspended { self.event_queue.borrow_mut().push(WindowEvent::Idle); } - } + }, Event::Awakened => { self.event_queue.borrow_mut().push(WindowEvent::Idle); - } - _ => {} + }, + _ => {}, } } @@ -580,9 +595,12 @@ impl Window { } /// Helper function to handle a click - fn handle_mouse(&self, button: winit::MouseButton, - action: winit::ElementState, - coords: TypedPoint2D<i32, DevicePixel>) { + fn handle_mouse( + &self, + button: winit::MouseButton, + action: winit::ElementState, + coords: TypedPoint2D<i32, DevicePixel>, + ) { use servo::script_traits::MouseButton; let max_pixel_dist = 10.0 * self.servo_hidpi_factor().get(); @@ -591,17 +609,20 @@ impl Window { self.mouse_down_point.set(coords); self.mouse_down_button.set(Some(button)); MouseWindowEvent::MouseDown(MouseButton::Left, coords.to_f32()) - } + }, ElementState::Released => { let mouse_up_event = MouseWindowEvent::MouseUp(MouseButton::Left, coords.to_f32()); match self.mouse_down_button.get() { None => mouse_up_event, Some(but) if button == but => { let pixel_dist = self.mouse_down_point.get() - coords; - let pixel_dist = ((pixel_dist.x * pixel_dist.x + - pixel_dist.y * pixel_dist.y) as f32).sqrt(); + let pixel_dist = + ((pixel_dist.x * pixel_dist.x + pixel_dist.y * pixel_dist.y) as f32) + .sqrt(); if pixel_dist < max_pixel_dist { - self.event_queue.borrow_mut().push(WindowEvent::MouseWindowEventClass(mouse_up_event)); + self.event_queue + .borrow_mut() + .push(WindowEvent::MouseWindowEventClass(mouse_up_event)); MouseWindowEvent::Click(MouseButton::Left, coords.to_f32()) } else { mouse_up_event @@ -609,19 +630,17 @@ impl Window { }, Some(_) => mouse_up_event, } - } + }, }; - self.event_queue.borrow_mut().push(WindowEvent::MouseWindowEventClass(event)); + self.event_queue + .borrow_mut() + .push(WindowEvent::MouseWindowEventClass(event)); } fn device_hidpi_factor(&self) -> TypedScale<f32, DeviceIndependentPixel, DevicePixel> { match self.kind { - WindowKind::Window(ref window, ..) => { - TypedScale::new(window.get_hidpi_factor() as f32) - } - WindowKind::Headless(..) => { - TypedScale::new(1.0) - } + WindowKind::Window(ref window, ..) => TypedScale::new(window.get_hidpi_factor() as f32), + WindowKind::Headless(..) => TypedScale::new(1.0), } } @@ -630,8 +649,8 @@ impl Window { Some(device_pixels_per_px) => TypedScale::new(device_pixels_per_px), _ => match opts::get().output_file { Some(_) => TypedScale::new(1.0), - None => self.device_hidpi_factor() - } + None => self.device_hidpi_factor(), + }, } } @@ -676,11 +695,11 @@ impl Window { CursorKind::AllScroll => MouseCursor::AllScroll, CursorKind::ZoomIn => MouseCursor::ZoomIn, CursorKind::ZoomOut => MouseCursor::ZoomOut, - _ => MouseCursor::Default + _ => MouseCursor::Default, }; window.set_cursor(winit_cursor); - } - WindowKind::Headless(..) => {} + }, + WindowKind::Headless(..) => {}, } } } @@ -695,13 +714,19 @@ impl WindowMethods for Window { WindowKind::Window(ref window, _) => { // TODO(ajeffrey): can this fail? let dpr = self.device_hidpi_factor(); - let LogicalSize { width, height } = window.get_outer_size().expect("Failed to get window outer size."); - let LogicalPosition { x, y } = window.get_position().unwrap_or(LogicalPosition::new(0., 0.)); + let LogicalSize { width, height } = window + .get_outer_size() + .expect("Failed to get window outer size."); + let LogicalPosition { x, y } = window + .get_position() + .unwrap_or(LogicalPosition::new(0., 0.)); let win_size = (TypedSize2D::new(width as f32, height as f32) * dpr).to_u32(); let win_origin = (TypedPoint2D::new(x as f32, y as f32) * dpr).to_i32(); let screen = (self.screen_size.to_f32() * dpr).to_u32(); - let LogicalSize { width, height } = window.get_inner_size().expect("Failed to get window inner size."); + let LogicalSize { width, height } = window + .get_inner_size() + .expect("Failed to get window inner size."); let inner_size = (TypedSize2D::new(width as f32, height as f32) * dpr).to_u32(); let viewport = DeviceUintRect::new(TypedPoint2D::zero(), inner_size); @@ -718,7 +743,8 @@ impl WindowMethods for Window { }, WindowKind::Headless(ref context) => { let dpr = self.servo_hidpi_factor(); - let size = (TypedSize2D::new(context.width, context.height).to_f32() * dpr).to_u32(); + let size = + (TypedSize2D::new(context.width, context.height).to_f32() * dpr).to_u32(); EmbedderCoordinates { viewport: DeviceUintRect::new(TypedPoint2D::zero(), size), framebuffer: size, @@ -727,7 +753,7 @@ impl WindowMethods for Window { screen_avail: size, hidpi_factor: dpr, } - } + }, } } @@ -737,8 +763,8 @@ impl WindowMethods for Window { if let Err(err) = window.swap_buffers() { warn!("Failed to swap window buffers ({}).", err); } - } - WindowKind::Headless(..) => {} + }, + WindowKind::Headless(..) => {}, } } @@ -752,9 +778,7 @@ impl WindowMethods for Window { WindowKind::Window(_, ref events_loop) => { Some(Arc::new(events_loop.borrow().create_proxy())) }, - WindowKind::Headless(..) => { - None - } + WindowKind::Headless(..) => None, }; GlutinEventLoopWaker { proxy } } @@ -782,7 +806,11 @@ impl WindowMethods for Window { self.animation_state.set(state); } - fn prepare_for_composite(&self, _width: Length<u32, DevicePixel>, _height: Length<u32, DevicePixel>) -> bool { + fn prepare_for_composite( + &self, + _width: Length<u32, DevicePixel>, + _height: Length<u32, DevicePixel>, + ) -> bool { true } diff --git a/ports/servo/main.rs b/ports/servo/main.rs index c4cd657d138..8345d03850d 100644 --- a/ports/servo/main.rs +++ b/ports/servo/main.rs @@ -19,12 +19,17 @@ // Have this here rather than in non_android_main.rs to work around // https://github.com/rust-lang/rust/issues/53205 -#[cfg(not(target_os = "android"))] #[macro_use] extern crate log; +#[cfg(not(target_os = "android"))] +#[macro_use] +extern crate log; -#[cfg(not(target_os = "android"))] include!("non_android_main.rs"); +#[cfg(not(target_os = "android"))] +include!("non_android_main.rs"); #[cfg(target_os = "android")] pub fn main() { - println!("Cannot start /ports/servo/ on Android. \ - Use /support/android/apk/ + /ports/libsimpleservo/ instead"); + println!( + "Cannot start /ports/servo/ on Android. \ + Use /support/android/apk/ + /ports/libsimpleservo/ instead" + ); } diff --git a/ports/servo/non_android_main.rs b/ports/servo/non_android_main.rs index 7db35a35e78..7fcc5f0df35 100644 --- a/ports/servo/non_android_main.rs +++ b/ports/servo/non_android_main.rs @@ -4,20 +4,29 @@ extern crate backtrace; extern crate euclid; -#[cfg(target_os = "windows")] extern crate gdi32; +#[cfg(target_os = "windows")] +extern crate gdi32; extern crate gleam; extern crate glutin; -#[macro_use] extern crate lazy_static; -#[cfg(any(target_os = "linux", target_os = "macos"))] extern crate osmesa_sys; +#[macro_use] +extern crate lazy_static; +#[cfg(any(target_os = "linux", target_os = "macos"))] +extern crate osmesa_sys; extern crate servo; #[cfg(feature = "unstable")] #[macro_use] extern crate sig; -#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))] +#[cfg(any( + target_os = "macos", + target_os = "linux", + target_os = "windows" +))] extern crate tinyfiledialogs; +#[cfg(target_os = "windows")] +extern crate user32; +#[cfg(target_os = "windows")] +extern crate winapi; extern crate winit; -#[cfg(target_os = "windows")] extern crate winapi; -#[cfg(target_os = "windows")] extern crate user32; // The window backed by glutin mod glutin_app; @@ -100,21 +109,21 @@ pub fn main() { warn!("Panic hook called."); let msg = match info.payload().downcast_ref::<&'static str>() { Some(s) => *s, - None => { - match info.payload().downcast_ref::<String>() { - Some(s) => &**s, - None => "Box<Any>", - } + None => match info.payload().downcast_ref::<String>() { + Some(s) => &**s, + None => "Box<Any>", }, }; let current_thread = thread::current(); let name = current_thread.name().unwrap_or("<unnamed>"); if let Some(location) = info.location() { - println!("{} (thread {}, at {}:{})", - msg, - name, - location.file(), - location.line()); + println!( + "{} (thread {}, at {}:{})", + msg, + name, + location.file(), + location.line() + ); } else { println!("{} (thread {})", msg, name); } @@ -142,7 +151,9 @@ pub fn main() { // or a blank page in case the homepage is not set either. let cwd = env::current_dir().unwrap(); let cmdline_url = opts::get().url.clone(); - let pref_url = PREFS.get("shell.homepage").as_string() + let pref_url = PREFS + .get("shell.homepage") + .as_string() .and_then(|str| parse_url_or_filename(&cwd, str).ok()); let blank_url = ServoUrl::parse("about:blank").ok(); @@ -195,43 +206,49 @@ pub fn main() { #[allow(non_snake_case)] #[no_mangle] -pub extern "C" fn glBindVertexArrayOES(_array: usize) -{ +pub extern "C" fn glBindVertexArrayOES(_array: usize) { unimplemented!() } #[allow(non_snake_case)] #[no_mangle] -pub extern "C" fn glDeleteVertexArraysOES(_n: isize, _arrays: *const ()) -{ +pub extern "C" fn glDeleteVertexArraysOES(_n: isize, _arrays: *const ()) { unimplemented!() } #[allow(non_snake_case)] #[no_mangle] -pub extern "C" fn glGenVertexArraysOES(_n: isize, _arrays: *const ()) -{ +pub extern "C" fn glGenVertexArraysOES(_n: isize, _arrays: *const ()) { unimplemented!() } #[allow(non_snake_case)] #[no_mangle] -pub extern "C" fn glRenderbufferStorageMultisampleIMG(_: isize, _: isize, _: isize, _: isize, _: isize) -{ +pub extern "C" fn glRenderbufferStorageMultisampleIMG( + _: isize, + _: isize, + _: isize, + _: isize, + _: isize, +) { unimplemented!() } #[allow(non_snake_case)] #[no_mangle] -pub extern "C" fn glFramebufferTexture2DMultisampleIMG(_: isize, _: isize, _: isize, _: isize, _: isize, _: isize) -{ +pub extern "C" fn glFramebufferTexture2DMultisampleIMG( + _: isize, + _: isize, + _: isize, + _: isize, + _: isize, + _: isize, +) { unimplemented!() } #[allow(non_snake_case)] #[no_mangle] -pub extern "C" fn glDiscardFramebufferEXT(_: isize, _: isize, _: *const ()) -{ +pub extern "C" fn glDiscardFramebufferEXT(_: isize, _: isize, _: *const ()) { unimplemented!() } - diff --git a/ports/servo/platform/macos/mod.rs b/ports/servo/platform/macos/mod.rs index b980b83f5fb..9aaa63b8a1a 100644 --- a/ports/servo/platform/macos/mod.rs +++ b/ports/servo/platform/macos/mod.rs @@ -16,4 +16,3 @@ pub fn deinit() { #[link_section = "__TEXT,__info_plist"] #[no_mangle] pub static INFO_PLIST: [u8; 619] = *include_bytes!("Info.plist"); - diff --git a/servo-tidy.toml b/servo-tidy.toml index bf1dd489553..f687e5cb692 100644 --- a/servo-tidy.toml +++ b/servo-tidy.toml @@ -15,18 +15,14 @@ lint-scripts = [ [blocked-packages] rand = [ "crossbeam-channel", - "deque", "gaol", "hashglobe", # only uses in tests "ipc-channel", - "num-bigint", "parking_lot_core", "phf_generator", "rayon", "rayon-core", "servo_rand", - "servo-websocket", - "tempdir", "tempfile", "uuid", "ws", diff --git a/tests/wpt/include.ini b/tests/wpt/include.ini index c1727e52b18..b407d2acec7 100644 --- a/tests/wpt/include.ini +++ b/tests/wpt/include.ini @@ -109,6 +109,8 @@ skip: true skip: false [url] skip: false +[wasm] + skip: false [webaudio] skip: false [WebCryptoAPI] diff --git a/tests/wpt/metadata/wasm/idlharness.any.js.ini b/tests/wpt/metadata/wasm/idlharness.any.js.ini new file mode 100644 index 00000000000..29825fa93a0 --- /dev/null +++ b/tests/wpt/metadata/wasm/idlharness.any.js.ini @@ -0,0 +1,429 @@ +[idlharness.any.worker.html] + [Global interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [Table interface object length] + expected: FAIL + + [Instance must be primary interface of instance] + expected: FAIL + + [Instance interface object name] + expected: FAIL + + [Table interface: operation grow(unsigned long)] + expected: FAIL + + [Memory interface object name] + expected: FAIL + + [Memory interface: memory must inherit property "grow(unsigned long)" with the proper type] + expected: FAIL + + [Module interface: operation exports(Module)] + expected: FAIL + + [Stringification of mod] + expected: FAIL + + [Instance interface: existence and properties of interface prototype object] + expected: FAIL + + [Memory must be primary interface of memory] + expected: FAIL + + [Module interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [Global interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [WebAssembly namespace: operation instantiate(BufferSource, object)] + expected: FAIL + + [Instance interface: attribute exports] + expected: FAIL + + [Module interface: mod must inherit property "imports(Module)" with the proper type] + expected: FAIL + + [Global interface: operation valueOf()] + expected: FAIL + + [Module interface object name] + expected: FAIL + + [Memory interface: existence and properties of interface prototype object] + expected: FAIL + + [Table interface: existence and properties of interface object] + expected: FAIL + + [Module interface: existence and properties of interface object] + expected: FAIL + + [Table interface: operation get(unsigned long)] + expected: FAIL + + [Instance interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [Stringification of instance] + expected: FAIL + + [Table interface: existence and properties of interface prototype object] + expected: FAIL + + [Instance interface: existence and properties of interface object] + expected: FAIL + + [Module interface: calling customSections(Module, USVString) on mod with too few arguments must throw TypeError] + expected: FAIL + + [Global interface: existence and properties of interface prototype object] + expected: FAIL + + [Module interface: calling imports(Module) on mod with too few arguments must throw TypeError] + expected: FAIL + + [Module interface: mod must inherit property "exports(Module)" with the proper type] + expected: FAIL + + [Memory interface: operation grow(unsigned long)] + expected: FAIL + + [Global interface: existence and properties of interface object] + expected: FAIL + + [Table interface: attribute length] + expected: FAIL + + [Module interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [Global interface object length] + expected: FAIL + + [Table interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [Memory interface: calling grow(unsigned long) on memory with too few arguments must throw TypeError] + expected: FAIL + + [WebAssembly namespace: operation validate(BufferSource)] + expected: FAIL + + [Memory interface: existence and properties of interface object] + expected: FAIL + + [Module interface: operation customSections(Module, USVString)] + expected: FAIL + + [Global interface object name] + expected: FAIL + + [Module interface: mod must inherit property "customSections(Module, USVString)" with the proper type] + expected: FAIL + + [Memory interface: memory must inherit property "buffer" with the proper type] + expected: FAIL + + [Module interface: existence and properties of interface prototype object] + expected: FAIL + + [Table interface: operation set(unsigned long, Function)] + expected: FAIL + + [Memory interface object length] + expected: FAIL + + [WebAssembly namespace: operation instantiate(Module, object)] + expected: FAIL + + [Memory interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [Module interface object length] + expected: FAIL + + [Instance interface: instance must inherit property "exports" with the proper type] + expected: FAIL + + [Global interface: attribute value] + expected: FAIL + + [Table interface object name] + expected: FAIL + + [Memory interface: attribute buffer] + expected: FAIL + + [Module interface: operation imports(Module)] + expected: FAIL + + [Instance interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [WebAssembly namespace: operation compile(BufferSource)] + expected: FAIL + + [Stringification of memory] + expected: FAIL + + [Memory interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [Module interface: calling exports(Module) on mod with too few arguments must throw TypeError] + expected: FAIL + + [Instance interface object length] + expected: FAIL + + [Table interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [Module must be primary interface of mod] + expected: FAIL + + +[idlharness.any.html] + [RuntimeError interface: existence and properties of interface prototype object] + expected: FAIL + + [CompileError interface object length] + expected: FAIL + + [Global interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [Table interface object length] + expected: FAIL + + [Instance must be primary interface of instance] + expected: FAIL + + [LinkError interface object name] + expected: FAIL + + [LinkError interface: existence and properties of interface object] + expected: FAIL + + [Instance interface object name] + expected: FAIL + + [LinkError interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [Table interface: operation grow(unsigned long)] + expected: FAIL + + [Memory interface object name] + expected: FAIL + + [Memory interface: memory must inherit property "grow(unsigned long)" with the proper type] + expected: FAIL + + [Module interface: operation exports(Module)] + expected: FAIL + + [Stringification of mod] + expected: FAIL + + [Instance interface: existence and properties of interface prototype object] + expected: FAIL + + [RuntimeError interface object length] + expected: FAIL + + [Memory must be primary interface of memory] + expected: FAIL + + [Module interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [Global interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [WebAssembly namespace: operation instantiate(BufferSource, object)] + expected: FAIL + + [Instance interface: attribute exports] + expected: FAIL + + [RuntimeError interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [Module interface: mod must inherit property "imports(Module)" with the proper type] + expected: FAIL + + [CompileError interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [Global interface: operation valueOf()] + expected: FAIL + + [Module interface object name] + expected: FAIL + + [CompileError interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [Memory interface: existence and properties of interface prototype object] + expected: FAIL + + [Table interface: existence and properties of interface object] + expected: FAIL + + [Module interface: existence and properties of interface object] + expected: FAIL + + [Table interface: operation get(unsigned long)] + expected: FAIL + + [CompileError interface object name] + expected: FAIL + + [Instance interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [Stringification of instance] + expected: FAIL + + [Table interface: existence and properties of interface prototype object] + expected: FAIL + + [RuntimeError interface: existence and properties of interface object] + expected: FAIL + + [Instance interface: existence and properties of interface object] + expected: FAIL + + [Module interface: calling customSections(Module, USVString) on mod with too few arguments must throw TypeError] + expected: FAIL + + [Global interface: existence and properties of interface prototype object] + expected: FAIL + + [CompileError interface: existence and properties of interface object] + expected: FAIL + + [Module interface: calling imports(Module) on mod with too few arguments must throw TypeError] + expected: FAIL + + [Module interface: mod must inherit property "exports(Module)" with the proper type] + expected: FAIL + + [Memory interface: operation grow(unsigned long)] + expected: FAIL + + [Global interface: existence and properties of interface object] + expected: FAIL + + [Table interface: attribute length] + expected: FAIL + + [Module interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [Global interface object length] + expected: FAIL + + [Table interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [Memory interface: calling grow(unsigned long) on memory with too few arguments must throw TypeError] + expected: FAIL + + [WebAssembly namespace: operation validate(BufferSource)] + expected: FAIL + + [LinkError interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [Memory interface: existence and properties of interface object] + expected: FAIL + + [Module interface: operation customSections(Module, USVString)] + expected: FAIL + + [Global interface object name] + expected: FAIL + + [Module interface: mod must inherit property "customSections(Module, USVString)" with the proper type] + expected: FAIL + + [Memory interface: memory must inherit property "buffer" with the proper type] + expected: FAIL + + [CompileError interface: existence and properties of interface prototype object] + expected: FAIL + + [Module interface: existence and properties of interface prototype object] + expected: FAIL + + [Table interface: operation set(unsigned long, Function)] + expected: FAIL + + [RuntimeError interface object name] + expected: FAIL + + [Memory interface object length] + expected: FAIL + + [WebAssembly namespace: operation instantiate(Module, object)] + expected: FAIL + + [LinkError interface object length] + expected: FAIL + + [LinkError interface: existence and properties of interface prototype object] + expected: FAIL + + [Memory interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [Module interface object length] + expected: FAIL + + [Instance interface: instance must inherit property "exports" with the proper type] + expected: FAIL + + [Global interface: attribute value] + expected: FAIL + + [Table interface object name] + expected: FAIL + + [Memory interface: attribute buffer] + expected: FAIL + + [Module interface: operation imports(Module)] + expected: FAIL + + [Instance interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [WebAssembly namespace: operation compile(BufferSource)] + expected: FAIL + + [Stringification of memory] + expected: FAIL + + [RuntimeError interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [Memory interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [Module interface: calling exports(Module) on mod with too few arguments must throw TypeError] + expected: FAIL + + [Instance interface object length] + expected: FAIL + + [Table interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [Module must be primary interface of mod] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/constructor/compile.any.js.ini b/tests/wpt/metadata/wasm/jsapi/constructor/compile.any.js.ini new file mode 100644 index 00000000000..9578de40fc5 --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/constructor/compile.any.js.ini @@ -0,0 +1,45 @@ +[compile.any.worker.html] + [Invalid arguments] + expected: FAIL + + [Invalid code] + expected: FAIL + + [Branding] + expected: FAIL + + [Missing argument] + expected: FAIL + + [Result type] + expected: FAIL + + [Promise type] + expected: FAIL + + [Changing the buffer] + expected: FAIL + + +[compile.any.html] + [Invalid arguments] + expected: FAIL + + [Invalid code] + expected: FAIL + + [Branding] + expected: FAIL + + [Missing argument] + expected: FAIL + + [Result type] + expected: FAIL + + [Promise type] + expected: FAIL + + [Changing the buffer] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/constructor/instantiate-bad-imports.any.js.ini b/tests/wpt/metadata/wasm/jsapi/constructor/instantiate-bad-imports.any.js.ini new file mode 100644 index 00000000000..d0cc05aafdc --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/constructor/instantiate-bad-imports.any.js.ini @@ -0,0 +1,179 @@ +[instantiate-bad-imports.any.html] + expected: ERROR + [WebAssembly.instantiate(module): Non-object module: NaN] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: null] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object imports argument: null] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: 0.1] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: undefined] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object module: 1] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object imports argument: symbol "Symbol()"] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object module: ""] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: ""] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object module: true] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object module: symbol "Symbol()"] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object imports argument: 1] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: symbol "Symbol()"] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: object "[object Object\]"] + expected: FAIL + + [WebAssembly.instantiate(module): Importing an i64 global] + expected: FAIL + + [WebAssembly.instantiate(module): Imports argument with missing property: empty object] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object imports argument: true] + expected: FAIL + + [WebAssembly.instantiate(module): Imports argument with missing property: wrong property] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: 1] + expected: FAIL + + [WebAssembly.instantiate(module): Imports argument with missing property: undefined] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object imports argument: NaN] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object module: null] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: true] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object module: 0.1] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: NaN] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object module: undefined] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object imports argument: ""] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object imports argument: 0.1] + expected: FAIL + + [WebAssembly.instantiate(module): Missing imports argument] + expected: FAIL + + +[instantiate-bad-imports.any.worker.html] + expected: ERROR + [WebAssembly.instantiate(module): Non-object module: NaN] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: null] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object imports argument: null] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: 0.1] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: undefined] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object module: 1] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object imports argument: symbol "Symbol()"] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object module: ""] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: ""] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object module: true] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object module: symbol "Symbol()"] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object imports argument: 1] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: symbol "Symbol()"] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: object "[object Object\]"] + expected: FAIL + + [WebAssembly.instantiate(module): Importing an i64 global] + expected: FAIL + + [WebAssembly.instantiate(module): Imports argument with missing property: empty object] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object imports argument: true] + expected: FAIL + + [WebAssembly.instantiate(module): Imports argument with missing property: wrong property] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: 1] + expected: FAIL + + [WebAssembly.instantiate(module): Imports argument with missing property: undefined] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object imports argument: NaN] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object module: null] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: true] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object module: 0.1] + expected: FAIL + + [WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: NaN] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object module: undefined] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object imports argument: ""] + expected: FAIL + + [WebAssembly.instantiate(module): Non-object imports argument: 0.1] + expected: FAIL + + [WebAssembly.instantiate(module): Missing imports argument] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/constructor/instantiate.any.js.ini b/tests/wpt/metadata/wasm/jsapi/constructor/instantiate.any.js.ini new file mode 100644 index 00000000000..945f1e8cc37 --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/constructor/instantiate.any.js.ini @@ -0,0 +1,63 @@ +[instantiate.any.html] + [Invalid arguments] + expected: FAIL + + [exports and imports: buffer argument] + expected: FAIL + + [Invalid code] + expected: FAIL + + [BufferSource argument] + expected: FAIL + + [Branding] + expected: FAIL + + [Missing arguments] + expected: FAIL + + [exports and imports: Module argument] + expected: FAIL + + [Module argument] + expected: FAIL + + [Changing the buffer] + expected: FAIL + + [Promise type] + expected: FAIL + + +[instantiate.any.worker.html] + [Invalid arguments] + expected: FAIL + + [exports and imports: buffer argument] + expected: FAIL + + [Invalid code] + expected: FAIL + + [BufferSource argument] + expected: FAIL + + [Branding] + expected: FAIL + + [Missing arguments] + expected: FAIL + + [exports and imports: Module argument] + expected: FAIL + + [Module argument] + expected: FAIL + + [Changing the buffer] + expected: FAIL + + [Promise type] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/global/constructor.any.js.ini b/tests/wpt/metadata/wasm/jsapi/global/constructor.any.js.ini new file mode 100644 index 00000000000..621971f49a4 --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/global/constructor.any.js.ini @@ -0,0 +1,189 @@ +[constructor.any.html] + [Explicit value object with toString for type f32] + expected: FAIL + + [Explicit value true for type f64] + expected: FAIL + + [Explicit value undefined for type f64] + expected: FAIL + + [Explicit value 2 for type f32] + expected: FAIL + + [i64 with default] + expected: FAIL + + [Explicit value 2 for type i32] + expected: FAIL + + [Explicit value false for type i32] + expected: FAIL + + [Default value for type f32] + expected: FAIL + + [Explicit value undefined for type i32] + expected: FAIL + + [Explicit value object with valueOf for type f32] + expected: FAIL + + [Explicit value false for type f32] + expected: FAIL + + [Explicit value true for type i32] + expected: FAIL + + [Explicit value null for type f32] + expected: FAIL + + [Explicit value undefined for type f32] + expected: FAIL + + [Explicit value 2 for type f64] + expected: FAIL + + [Default value for type i32] + expected: FAIL + + [Explicit value false for type f64] + expected: FAIL + + [Explicit value "3" for type f64] + expected: FAIL + + [Explicit value null for type i32] + expected: FAIL + + [Explicit value object with toString for type i32] + expected: FAIL + + [Explicit value true for type f32] + expected: FAIL + + [Explicit value object with valueOf for type f64] + expected: FAIL + + [name] + expected: FAIL + + [Explicit value null for type f64] + expected: FAIL + + [Explicit value object with toString for type f64] + expected: FAIL + + [Default value for type f64] + expected: FAIL + + [Explicit value "3" for type i32] + expected: FAIL + + [length] + expected: FAIL + + [Explicit value object with valueOf for type i32] + expected: FAIL + + [Order of evaluation] + expected: FAIL + + [Explicit value "3" for type f32] + expected: FAIL + + +[constructor.any.worker.html] + [Explicit value object with toString for type f32] + expected: FAIL + + [Explicit value true for type f64] + expected: FAIL + + [Explicit value undefined for type f64] + expected: FAIL + + [Explicit value 2 for type f32] + expected: FAIL + + [i64 with default] + expected: FAIL + + [Explicit value 2 for type i32] + expected: FAIL + + [Explicit value false for type i32] + expected: FAIL + + [Default value for type f32] + expected: FAIL + + [Explicit value undefined for type i32] + expected: FAIL + + [Explicit value object with valueOf for type f32] + expected: FAIL + + [Explicit value false for type f32] + expected: FAIL + + [Explicit value true for type i32] + expected: FAIL + + [Explicit value null for type f32] + expected: FAIL + + [Explicit value undefined for type f32] + expected: FAIL + + [Explicit value 2 for type f64] + expected: FAIL + + [Default value for type i32] + expected: FAIL + + [Explicit value false for type f64] + expected: FAIL + + [Explicit value "3" for type f64] + expected: FAIL + + [Explicit value null for type i32] + expected: FAIL + + [Explicit value object with toString for type i32] + expected: FAIL + + [Explicit value true for type f32] + expected: FAIL + + [Explicit value object with valueOf for type f64] + expected: FAIL + + [name] + expected: FAIL + + [Explicit value null for type f64] + expected: FAIL + + [Explicit value object with toString for type f64] + expected: FAIL + + [Default value for type f64] + expected: FAIL + + [Explicit value "3" for type i32] + expected: FAIL + + [length] + expected: FAIL + + [Explicit value object with valueOf for type i32] + expected: FAIL + + [Order of evaluation] + expected: FAIL + + [Explicit value "3" for type f32] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/global/toString.any.js.ini b/tests/wpt/metadata/wasm/jsapi/global/toString.any.js.ini new file mode 100644 index 00000000000..6fc9a681760 --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/global/toString.any.js.ini @@ -0,0 +1,9 @@ +[toString.any.html] + [Object.prototype.toString on an Global] + expected: FAIL + + +[toString.any.worker.html] + [Object.prototype.toString on an Global] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/global/value-set.any.js.ini b/tests/wpt/metadata/wasm/jsapi/global/value-set.any.js.ini new file mode 100644 index 00000000000..cf3cf67c5e8 --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/global/value-set.any.js.ini @@ -0,0 +1,201 @@ +[value-set.any.html] + [Mutable f64 (true on prototype)] + expected: FAIL + + [Mutable i32 (true on prototype)] + expected: FAIL + + [Immutable f32 (missing)] + expected: FAIL + + [Immutable i32 (empty string)] + expected: FAIL + + [i64 with default] + expected: FAIL + + [Mutable f64 (one)] + expected: FAIL + + [Mutable f32 (string)] + expected: FAIL + + [Mutable i32 (true)] + expected: FAIL + + [Mutable i32 (string)] + expected: FAIL + + [Immutable f32 (false)] + expected: FAIL + + [Immutable f64 (empty string)] + expected: FAIL + + [Immutable i32 (undefined)] + expected: FAIL + + [Mutable f32 (one)] + expected: FAIL + + [Calling setter without argument] + expected: FAIL + + [Immutable i32 (zero)] + expected: FAIL + + [Immutable f64 (undefined)] + expected: FAIL + + [Mutable i32 (one)] + expected: FAIL + + [Immutable f32 (zero)] + expected: FAIL + + [Immutable i32 (null)] + expected: FAIL + + [Immutable f64 (false)] + expected: FAIL + + [Immutable f64 (missing)] + expected: FAIL + + [Immutable f64 (null)] + expected: FAIL + + [Mutable f32 (true on prototype)] + expected: FAIL + + [Immutable i32 (false)] + expected: FAIL + + [Immutable i32 (missing)] + expected: FAIL + + [Mutable f32 (true)] + expected: FAIL + + [Immutable f32 (null)] + expected: FAIL + + [Branding] + expected: FAIL + + [Immutable f64 (zero)] + expected: FAIL + + [Mutable f64 (true)] + expected: FAIL + + [Mutable f64 (string)] + expected: FAIL + + [Immutable f32 (empty string)] + expected: FAIL + + [Immutable f32 (undefined)] + expected: FAIL + + +[value-set.any.worker.html] + [Mutable f64 (true on prototype)] + expected: FAIL + + [Mutable i32 (true on prototype)] + expected: FAIL + + [Immutable f32 (missing)] + expected: FAIL + + [Immutable i32 (empty string)] + expected: FAIL + + [i64 with default] + expected: FAIL + + [Mutable f64 (one)] + expected: FAIL + + [Mutable f32 (string)] + expected: FAIL + + [Mutable i32 (true)] + expected: FAIL + + [Mutable i32 (string)] + expected: FAIL + + [Immutable f32 (false)] + expected: FAIL + + [Immutable f64 (empty string)] + expected: FAIL + + [Immutable i32 (undefined)] + expected: FAIL + + [Mutable f32 (one)] + expected: FAIL + + [Calling setter without argument] + expected: FAIL + + [Immutable i32 (zero)] + expected: FAIL + + [Immutable f64 (undefined)] + expected: FAIL + + [Mutable i32 (one)] + expected: FAIL + + [Immutable f32 (zero)] + expected: FAIL + + [Immutable i32 (null)] + expected: FAIL + + [Immutable f64 (false)] + expected: FAIL + + [Immutable f64 (missing)] + expected: FAIL + + [Immutable f64 (null)] + expected: FAIL + + [Mutable f32 (true on prototype)] + expected: FAIL + + [Immutable i32 (false)] + expected: FAIL + + [Immutable i32 (missing)] + expected: FAIL + + [Mutable f32 (true)] + expected: FAIL + + [Immutable f32 (null)] + expected: FAIL + + [Branding] + expected: FAIL + + [Immutable f64 (zero)] + expected: FAIL + + [Mutable f64 (true)] + expected: FAIL + + [Mutable f64 (string)] + expected: FAIL + + [Immutable f32 (empty string)] + expected: FAIL + + [Immutable f32 (undefined)] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/global/valueOf.any.js.ini b/tests/wpt/metadata/wasm/jsapi/global/valueOf.any.js.ini new file mode 100644 index 00000000000..db00839e79f --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/global/valueOf.any.js.ini @@ -0,0 +1,9 @@ +[valueOf.any.worker.html] + [Branding] + expected: FAIL + + +[valueOf.any.html] + [Branding] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/instance/constructor-bad-imports.any.js.ini b/tests/wpt/metadata/wasm/jsapi/instance/constructor-bad-imports.any.js.ini new file mode 100644 index 00000000000..50df713a8b3 --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/instance/constructor-bad-imports.any.js.ini @@ -0,0 +1,5 @@ +[constructor-bad-imports.any.worker.html] + expected: ERROR + +[constructor-bad-imports.any.html] + expected: ERROR diff --git a/tests/wpt/metadata/wasm/jsapi/instance/constructor.any.js.ini b/tests/wpt/metadata/wasm/jsapi/instance/constructor.any.js.ini new file mode 100644 index 00000000000..1f493551629 --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/instance/constructor.any.js.ini @@ -0,0 +1,9 @@ +[constructor.any.html] + [exports] + expected: FAIL + + +[constructor.any.worker.html] + [exports] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/interface.any.js.ini b/tests/wpt/metadata/wasm/jsapi/interface.any.js.ini new file mode 100644 index 00000000000..20cc7a4cd9b --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/interface.any.js.ini @@ -0,0 +1,101 @@ +[interface.any.html] + expected: ERROR + [WebAssembly.Table.get] + expected: FAIL + + [WebAssembly.Table.length] + expected: FAIL + + [WebAssembly.Module.imports] + expected: FAIL + + [WebAssembly.Module.exports] + expected: FAIL + + [WebAssembly.Memory.grow] + expected: FAIL + + [WebAssembly.Memory.buffer] + expected: FAIL + + [WebAssembly.Global: prototype] + expected: FAIL + + [WebAssembly.compile] + expected: FAIL + + [WebAssembly.Module.customSections] + expected: FAIL + + [WebAssembly.Table.set] + expected: FAIL + + [WebAssembly.Instance.exports] + expected: FAIL + + [WebAssembly.validate] + expected: FAIL + + [WebAssembly.Global: prototype.constructor] + expected: FAIL + + [WebAssembly.Global: property descriptor] + expected: FAIL + + [WebAssembly.instantiate] + expected: FAIL + + [WebAssembly.Table.grow] + expected: FAIL + + +[interface.any.worker.html] + expected: ERROR + [WebAssembly.Table.get] + expected: FAIL + + [WebAssembly.Table.length] + expected: FAIL + + [WebAssembly.Module.imports] + expected: FAIL + + [WebAssembly.Module.exports] + expected: FAIL + + [WebAssembly.Memory.grow] + expected: FAIL + + [WebAssembly.Memory.buffer] + expected: FAIL + + [WebAssembly.Global: prototype] + expected: FAIL + + [WebAssembly.compile] + expected: FAIL + + [WebAssembly.Module.customSections] + expected: FAIL + + [WebAssembly.Table.set] + expected: FAIL + + [WebAssembly.Instance.exports] + expected: FAIL + + [WebAssembly.validate] + expected: FAIL + + [WebAssembly.Global: prototype.constructor] + expected: FAIL + + [WebAssembly.Global: property descriptor] + expected: FAIL + + [WebAssembly.instantiate] + expected: FAIL + + [WebAssembly.Table.grow] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/memory/constructor.any.js.ini b/tests/wpt/metadata/wasm/jsapi/memory/constructor.any.js.ini new file mode 100644 index 00000000000..1f772686b95 --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/memory/constructor.any.js.ini @@ -0,0 +1,93 @@ +[constructor.any.worker.html] + [Out-of-range maximum value in descriptor: -Infinity] + expected: FAIL + + [Out-of-range maximum value in descriptor: NaN] + expected: FAIL + + [Out-of-range maximum value in descriptor: 4294967296] + expected: FAIL + + [Out-of-range initial value in descriptor: NaN] + expected: FAIL + + [Proxy descriptor] + expected: FAIL + + [Out-of-range initial value in descriptor: Infinity] + expected: FAIL + + [Undefined initial value in descriptor] + expected: FAIL + + [Out-of-range maximum value in descriptor: 68719476736] + expected: FAIL + + [Out-of-range initial value in descriptor: 4294967296] + expected: FAIL + + [Out-of-range maximum value in descriptor: -1] + expected: FAIL + + [Invalid descriptor argument] + expected: FAIL + + [Out-of-range initial value in descriptor: -Infinity] + expected: FAIL + + [Out-of-range maximum value in descriptor: Infinity] + expected: FAIL + + [Out-of-range initial value in descriptor: -1] + expected: FAIL + + [Out-of-range initial value in descriptor: 68719476736] + expected: FAIL + + +[constructor.any.html] + [Out-of-range maximum value in descriptor: -Infinity] + expected: FAIL + + [Out-of-range maximum value in descriptor: NaN] + expected: FAIL + + [Out-of-range maximum value in descriptor: 4294967296] + expected: FAIL + + [Out-of-range initial value in descriptor: NaN] + expected: FAIL + + [Proxy descriptor] + expected: FAIL + + [Out-of-range initial value in descriptor: Infinity] + expected: FAIL + + [Undefined initial value in descriptor] + expected: FAIL + + [Out-of-range maximum value in descriptor: 68719476736] + expected: FAIL + + [Out-of-range initial value in descriptor: 4294967296] + expected: FAIL + + [Out-of-range maximum value in descriptor: -1] + expected: FAIL + + [Invalid descriptor argument] + expected: FAIL + + [Out-of-range initial value in descriptor: -Infinity] + expected: FAIL + + [Out-of-range maximum value in descriptor: Infinity] + expected: FAIL + + [Out-of-range initial value in descriptor: -1] + expected: FAIL + + [Out-of-range initial value in descriptor: 68719476736] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/memory/grow.any.js.ini b/tests/wpt/metadata/wasm/jsapi/memory/grow.any.js.ini new file mode 100644 index 00000000000..d478b35bd79 --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/memory/grow.any.js.ini @@ -0,0 +1,63 @@ +[grow.any.worker.html] + [Out-of-range argument: 68719476736] + expected: FAIL + + [Out-of-range argument: 4294967296] + expected: FAIL + + [Missing arguments] + expected: FAIL + + [Out-of-range argument: -1] + expected: FAIL + + [Out-of-range argument: NaN] + expected: FAIL + + [Out-of-range argument: object "[object Object\]"] + expected: FAIL + + [Out-of-range argument: -Infinity] + expected: FAIL + + [Out-of-range argument: "0x100000000"] + expected: FAIL + + [Out-of-range argument: undefined] + expected: FAIL + + [Out-of-range argument: Infinity] + expected: FAIL + + +[grow.any.html] + [Out-of-range argument: 68719476736] + expected: FAIL + + [Out-of-range argument: 4294967296] + expected: FAIL + + [Missing arguments] + expected: FAIL + + [Out-of-range argument: -1] + expected: FAIL + + [Out-of-range argument: NaN] + expected: FAIL + + [Out-of-range argument: object "[object Object\]"] + expected: FAIL + + [Out-of-range argument: -Infinity] + expected: FAIL + + [Out-of-range argument: "0x100000000"] + expected: FAIL + + [Out-of-range argument: undefined] + expected: FAIL + + [Out-of-range argument: Infinity] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/module/customSections.any.js.ini b/tests/wpt/metadata/wasm/jsapi/module/customSections.any.js.ini new file mode 100644 index 00000000000..18816b55b2c --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/module/customSections.any.js.ini @@ -0,0 +1,9 @@ +[customSections.any.html] + [Missing arguments] + expected: FAIL + + +[customSections.any.worker.html] + [Missing arguments] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/module/exports.any.js.ini b/tests/wpt/metadata/wasm/jsapi/module/exports.any.js.ini new file mode 100644 index 00000000000..54360845d67 --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/module/exports.any.js.ini @@ -0,0 +1,9 @@ +[exports.any.html] + [exports] + expected: FAIL + + +[exports.any.worker.html] + [exports] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/table/constructor.any.js.ini b/tests/wpt/metadata/wasm/jsapi/table/constructor.any.js.ini new file mode 100644 index 00000000000..44aefcd9aa1 --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/table/constructor.any.js.ini @@ -0,0 +1,99 @@ +[constructor.any.html] + [Out-of-range maximum value in descriptor: -Infinity] + expected: FAIL + + [Out-of-range maximum value in descriptor: NaN] + expected: FAIL + + [Out-of-range maximum value in descriptor: 4294967296] + expected: FAIL + + [Out-of-range initial value in descriptor: NaN] + expected: FAIL + + [Proxy descriptor] + expected: FAIL + + [Out-of-range initial value in descriptor: Infinity] + expected: FAIL + + [Undefined initial value in descriptor] + expected: FAIL + + [Out-of-range maximum value in descriptor: 68719476736] + expected: FAIL + + [Out-of-range initial value in descriptor: 4294967296] + expected: FAIL + + [Out-of-range maximum value in descriptor: -1] + expected: FAIL + + [Order of evaluation for descriptor] + expected: FAIL + + [Out-of-range initial value in descriptor: -Infinity] + expected: FAIL + + [Out-of-range maximum value in descriptor: Infinity] + expected: FAIL + + [Type conversion for descriptor.element] + expected: FAIL + + [Out-of-range initial value in descriptor: -1] + expected: FAIL + + [Out-of-range initial value in descriptor: 68719476736] + expected: FAIL + + +[constructor.any.worker.html] + [Out-of-range maximum value in descriptor: -Infinity] + expected: FAIL + + [Out-of-range maximum value in descriptor: NaN] + expected: FAIL + + [Out-of-range maximum value in descriptor: 4294967296] + expected: FAIL + + [Out-of-range initial value in descriptor: NaN] + expected: FAIL + + [Proxy descriptor] + expected: FAIL + + [Out-of-range initial value in descriptor: Infinity] + expected: FAIL + + [Undefined initial value in descriptor] + expected: FAIL + + [Out-of-range maximum value in descriptor: 68719476736] + expected: FAIL + + [Out-of-range initial value in descriptor: 4294967296] + expected: FAIL + + [Out-of-range maximum value in descriptor: -1] + expected: FAIL + + [Order of evaluation for descriptor] + expected: FAIL + + [Out-of-range initial value in descriptor: -Infinity] + expected: FAIL + + [Out-of-range maximum value in descriptor: Infinity] + expected: FAIL + + [Type conversion for descriptor.element] + expected: FAIL + + [Out-of-range initial value in descriptor: -1] + expected: FAIL + + [Out-of-range initial value in descriptor: 68719476736] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/table/get-set.any.js.ini b/tests/wpt/metadata/wasm/jsapi/table/get-set.any.js.ini new file mode 100644 index 00000000000..bce5b3e6e88 --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/table/get-set.any.js.ini @@ -0,0 +1,117 @@ +[get-set.any.worker.html] + [Setting out-of-range argument: NaN] + expected: FAIL + + [Getting out-of-range argument: undefined] + expected: FAIL + + [Setting out-of-range argument: -1] + expected: FAIL + + [Setting out-of-range argument: 4294967296] + expected: FAIL + + [Getting out-of-range argument: NaN] + expected: FAIL + + [Getting out-of-range argument: 4294967296] + expected: FAIL + + [Setting out-of-range argument: "0x100000000"] + expected: FAIL + + [Setting out-of-range argument: object "[object Object\]"] + expected: FAIL + + [Setting out-of-range argument: Infinity] + expected: FAIL + + [Setting out-of-range argument: 68719476736] + expected: FAIL + + [Missing arguments: get] + expected: FAIL + + [Getting out-of-range argument: 68719476736] + expected: FAIL + + [Getting out-of-range argument: Infinity] + expected: FAIL + + [Setting out-of-range argument: undefined] + expected: FAIL + + [Getting out-of-range argument: -1] + expected: FAIL + + [Getting out-of-range argument: "0x100000000"] + expected: FAIL + + [Getting out-of-range argument: object "[object Object\]"] + expected: FAIL + + [Setting out-of-range argument: -Infinity] + expected: FAIL + + [Getting out-of-range argument: -Infinity] + expected: FAIL + + +[get-set.any.html] + [Setting out-of-range argument: NaN] + expected: FAIL + + [Getting out-of-range argument: undefined] + expected: FAIL + + [Setting out-of-range argument: -1] + expected: FAIL + + [Setting out-of-range argument: 4294967296] + expected: FAIL + + [Getting out-of-range argument: NaN] + expected: FAIL + + [Getting out-of-range argument: 4294967296] + expected: FAIL + + [Setting out-of-range argument: "0x100000000"] + expected: FAIL + + [Setting out-of-range argument: object "[object Object\]"] + expected: FAIL + + [Setting out-of-range argument: Infinity] + expected: FAIL + + [Setting out-of-range argument: 68719476736] + expected: FAIL + + [Missing arguments: get] + expected: FAIL + + [Getting out-of-range argument: 68719476736] + expected: FAIL + + [Getting out-of-range argument: Infinity] + expected: FAIL + + [Setting out-of-range argument: undefined] + expected: FAIL + + [Getting out-of-range argument: -1] + expected: FAIL + + [Getting out-of-range argument: "0x100000000"] + expected: FAIL + + [Getting out-of-range argument: object "[object Object\]"] + expected: FAIL + + [Setting out-of-range argument: -Infinity] + expected: FAIL + + [Getting out-of-range argument: -Infinity] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/table/grow.any.js.ini b/tests/wpt/metadata/wasm/jsapi/table/grow.any.js.ini new file mode 100644 index 00000000000..11b89d68fa9 --- /dev/null +++ b/tests/wpt/metadata/wasm/jsapi/table/grow.any.js.ini @@ -0,0 +1,63 @@ +[grow.any.html] + [Out-of-range argument: 68719476736] + expected: FAIL + + [Out-of-range argument: -Infinity] + expected: FAIL + + [Out-of-range argument: 4294967296] + expected: FAIL + + [Out-of-range argument: Infinity] + expected: FAIL + + [Missing arguments] + expected: FAIL + + [Out-of-range argument: -1] + expected: FAIL + + [Out-of-range argument: undefined] + expected: FAIL + + [Out-of-range argument: NaN] + expected: FAIL + + [Out-of-range argument: object "[object Object\]"] + expected: FAIL + + [Out-of-range argument: "0x100000000"] + expected: FAIL + + +[grow.any.worker.html] + [Out-of-range argument: 68719476736] + expected: FAIL + + [Out-of-range argument: -Infinity] + expected: FAIL + + [Out-of-range argument: 4294967296] + expected: FAIL + + [Out-of-range argument: Infinity] + expected: FAIL + + [Missing arguments] + expected: FAIL + + [Out-of-range argument: -1] + expected: FAIL + + [Out-of-range argument: undefined] + expected: FAIL + + [Out-of-range argument: NaN] + expected: FAIL + + [Out-of-range argument: object "[object Object\]"] + expected: FAIL + + [Out-of-range argument: "0x100000000"] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/serialization/broadcastchannel-success-and-failure.html.ini b/tests/wpt/metadata/wasm/serialization/broadcastchannel-success-and-failure.html.ini new file mode 100644 index 00000000000..5b9a17d8f5b --- /dev/null +++ b/tests/wpt/metadata/wasm/serialization/broadcastchannel-success-and-failure.html.ini @@ -0,0 +1,4 @@ +[broadcastchannel-success-and-failure.html] + [WebAssembly.Module cannot cross agent clusters, BroadcastChannel edition] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/serialization/broadcastchannel-success.html.ini b/tests/wpt/metadata/wasm/serialization/broadcastchannel-success.html.ini new file mode 100644 index 00000000000..50d9fdee6c9 --- /dev/null +++ b/tests/wpt/metadata/wasm/serialization/broadcastchannel-success.html.ini @@ -0,0 +1,4 @@ +[broadcastchannel-success.html] + [Structured cloning of WebAssembly.Module: BroadcastChannel within the same agent cluster] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/serialization/identity-not-preserved.html.ini b/tests/wpt/metadata/wasm/serialization/identity-not-preserved.html.ini new file mode 100644 index 00000000000..394cfbc06d7 --- /dev/null +++ b/tests/wpt/metadata/wasm/serialization/identity-not-preserved.html.ini @@ -0,0 +1,11 @@ +[identity-not-preserved.html] + expected: TIMEOUT + [postMessaging to this window does not give back the same WebAssembly.Module] + expected: TIMEOUT + + [postMessaging to a worker and back does not give back the same WebAssembly.Module] + expected: TIMEOUT + + [postMessaging to an iframe and back does not give back the same WebAssembly.Module] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/wasm/serialization/nested-worker-success.any.js.ini b/tests/wpt/metadata/wasm/serialization/nested-worker-success.any.js.ini new file mode 100644 index 00000000000..c5630c0fce9 --- /dev/null +++ b/tests/wpt/metadata/wasm/serialization/nested-worker-success.any.js.ini @@ -0,0 +1,9 @@ +[nested-worker-success.any.sharedworker.html] + [nested-worker-success] + expected: FAIL + + +[nested-worker-success.any.worker.html] + [postMessaging to a dedicated sub-worker allows them to see each others' modifications] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/serialization/no-transferring.html.ini b/tests/wpt/metadata/wasm/serialization/no-transferring.html.ini new file mode 100644 index 00000000000..af448eaecf2 --- /dev/null +++ b/tests/wpt/metadata/wasm/serialization/no-transferring.html.ini @@ -0,0 +1,10 @@ +[no-transferring.html] + [Trying to transfer a WebAssembly.Module to a worker throws] + expected: FAIL + + [Trying to transfer a WebAssembly.Module through a MessagePort throws] + expected: FAIL + + [Trying to transfer a WebAssembly.Module to this window throws] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/serialization/serialization-via-idb.any.js.ini b/tests/wpt/metadata/wasm/serialization/serialization-via-idb.any.js.ini new file mode 100644 index 00000000000..9b767ec6435 --- /dev/null +++ b/tests/wpt/metadata/wasm/serialization/serialization-via-idb.any.js.ini @@ -0,0 +1,15 @@ +[serialization-via-idb.any.worker.html] + [WebAssembly.Module cloning via the IndexedDB: is interleaved correctly] + expected: FAIL + + [WebAssembly.Module cloning via IndexedDB: basic case] + expected: FAIL + + +[serialization-via-idb.any.html] + [WebAssembly.Module cloning via the IndexedDB: is interleaved correctly] + expected: FAIL + + [WebAssembly.Module cloning via IndexedDB: basic case] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/serialization/serialization-via-notifications-api.any.js.ini b/tests/wpt/metadata/wasm/serialization/serialization-via-notifications-api.any.js.ini new file mode 100644 index 00000000000..bb6adeaf259 --- /dev/null +++ b/tests/wpt/metadata/wasm/serialization/serialization-via-notifications-api.any.js.ini @@ -0,0 +1,15 @@ +[serialization-via-notifications-api.any.html] + [WebAssembly.Module cloning via the Notifications API's data member: basic case] + expected: FAIL + + [WebAssembly.Module cloning via the Notifications API's data member: is interleaved correctly] + expected: FAIL + + +[serialization-via-notifications-api.any.worker.html] + [WebAssembly.Module cloning via the Notifications API's data member: basic case] + expected: FAIL + + [WebAssembly.Module cloning via the Notifications API's data member: is interleaved correctly] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/serialization/window-domain-success.sub.html.ini b/tests/wpt/metadata/wasm/serialization/window-domain-success.sub.html.ini new file mode 100644 index 00000000000..cc8bf757e8f --- /dev/null +++ b/tests/wpt/metadata/wasm/serialization/window-domain-success.sub.html.ini @@ -0,0 +1,4 @@ +[window-domain-success.sub.html] + [postMessaging to a same-origin-domain (but not same-origin) iframe allows them to instantiate] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/serialization/window-messagechannel-success.html.ini b/tests/wpt/metadata/wasm/serialization/window-messagechannel-success.html.ini new file mode 100644 index 00000000000..3d5f3dffc9f --- /dev/null +++ b/tests/wpt/metadata/wasm/serialization/window-messagechannel-success.html.ini @@ -0,0 +1,4 @@ +[window-messagechannel-success.html] + [postMessaging to a dedicated worker via MessageChannel allows them to instantiate] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/serialization/window-serviceworker-failure.https.html.ini b/tests/wpt/metadata/wasm/serialization/window-serviceworker-failure.https.html.ini new file mode 100644 index 00000000000..e364efb71bd --- /dev/null +++ b/tests/wpt/metadata/wasm/serialization/window-serviceworker-failure.https.html.ini @@ -0,0 +1,4 @@ +[window-serviceworker-failure.https.html] + [WebAssembly.Module cannot cross agent clusters, service worker edition] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/serialization/window-sharedworker-failure.html.ini b/tests/wpt/metadata/wasm/serialization/window-sharedworker-failure.html.ini new file mode 100644 index 00000000000..8b35b3b7739 --- /dev/null +++ b/tests/wpt/metadata/wasm/serialization/window-sharedworker-failure.html.ini @@ -0,0 +1,4 @@ +[window-sharedworker-failure.html] + [WebAssembly.Modules cannot cross agent clusters, shared worker edition] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/serialization/window-similar-but-cross-origin-success.sub.html.ini b/tests/wpt/metadata/wasm/serialization/window-similar-but-cross-origin-success.sub.html.ini new file mode 100644 index 00000000000..6383bcb6d88 --- /dev/null +++ b/tests/wpt/metadata/wasm/serialization/window-similar-but-cross-origin-success.sub.html.ini @@ -0,0 +1,4 @@ +[window-similar-but-cross-origin-success.sub.html] + [postMessaging to a not same-origin-domain, but similar origin, iframe allows them to instantiate] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/serialization/window-simple-success.html.ini b/tests/wpt/metadata/wasm/serialization/window-simple-success.html.ini new file mode 100644 index 00000000000..45431db4f4e --- /dev/null +++ b/tests/wpt/metadata/wasm/serialization/window-simple-success.html.ini @@ -0,0 +1,13 @@ +[window-simple-success.html] + [postMessaging to a same-origin opened window allows them to instantiate] + expected: FAIL + + [postMessaging to a same-origin deeply-nested iframe allows them to instantiate] + expected: FAIL + + [postMessaging to a dedicated worker allows them to instantiate] + expected: FAIL + + [postMessaging to a same-origin iframe allows them to instantiate] + expected: FAIL + |