From 06389d34041e3f43f74faa0d914505b8276d72d7 Mon Sep 17 00:00:00 2001 From: Jan Henning Date: Sun, 11 Mar 2018 20:01:33 +0100 Subject: [PATCH 01/50] Bug 1358598 - Show ongoing notifications even if they're not the "official" foreground notification. r=jchen We can have only one "official" foreground notification that's associated with the NotificationService to keep the OS from background-killing us at the same time, but that doesn't mean that we should simply ignore any further ongoing notifications possibly arriving afterwards. MozReview-Commit-ID: L8rigs6GKzH --HG-- extra : rebase_source : 4f8f5f76a422930c6b5e3e6d0c6e8b37d6c11123 --- .../mozilla/gecko/notifications/NotificationClient.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationClient.java b/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationClient.java index 913b85127372..d8392a801e13 100644 --- a/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationClient.java +++ b/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationClient.java @@ -182,7 +182,7 @@ public final class NotificationClient implements NotificationListener { if (ongoing != isOngoing(mNotifications.get(name))) { // In order to change notification from ongoing to non-ongoing, or vice versa, // we have to remove the previous notification, because ongoing notifications - // use a different id value than non-ongoing notifications. + // might use a different id value than non-ongoing notifications. onNotificationClose(name); } @@ -200,6 +200,8 @@ public final class NotificationClient implements NotificationListener { // Shortcut to update the current foreground notification, instead of // going through the service. mNotificationManager.notify(R.id.foregroundNotification, notification); + } else { + mNotificationManager.notify(name, 0, notification); } } @@ -317,6 +319,10 @@ public final class NotificationClient implements NotificationListener { for (final String name : mNotifications.keySet()) { final Notification notification = mNotifications.get(name); if (isOngoing(notification)) { + // The same reasoning as above applies - the current foreground notification + // uses a special ID, so we need to close its old instantiation and then + // re-add it with the new ID through the NotificationService. + onNotificationClose(name); setForegroundNotificationLocked(name, notification); return; } From 835d04eeac10b1652f493665b62a58892efb7e19 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 9 Mar 2018 15:22:44 +0100 Subject: [PATCH 02/50] Bug 1443224 - Throw correct exceptions when trying to set the channelCount, the channelCountMode and the channelInterpretation on a ChannelSplitterNode. r=baku Spec: https://webaudio.github.io/web-audio-api/#dom-audionode-channelcount Google has written a web platform test this is going to be merged soon (we currently fail it). MozReview-Commit-ID: 1RpASaIJrhm --HG-- extra : rebase_source : d03145bf90796fb8b1557a4affaf75c22bee2f76 extra : source : e7b5b629fb30c4c8b8708979e926029f4e743420 --- dom/media/webaudio/AudioNode.cpp | 5 ++++- dom/media/webaudio/AudioNode.h | 2 +- dom/media/webaudio/ChannelSplitterNode.h | 13 +++++++++++++ dom/webidl/AudioNode.webidl | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/dom/media/webaudio/AudioNode.cpp b/dom/media/webaudio/AudioNode.cpp index f251861cd74a..7fd85b195618 100644 --- a/dom/media/webaudio/AudioNode.cpp +++ b/dom/media/webaudio/AudioNode.cpp @@ -91,7 +91,10 @@ AudioNode::Initialize(const AudioNodeOptions& aOptions, ErrorResult& aRv) } if (aOptions.mChannelInterpretation.WasPassed()) { - SetChannelInterpretationValue(aOptions.mChannelInterpretation.Value()); + SetChannelInterpretationValue(aOptions.mChannelInterpretation.Value(), aRv); + if (NS_WARN_IF(aRv.Failed())) { + return; + } } } diff --git a/dom/media/webaudio/AudioNode.h b/dom/media/webaudio/AudioNode.h index eb01289b19b1..f3d159b0bb53 100644 --- a/dom/media/webaudio/AudioNode.h +++ b/dom/media/webaudio/AudioNode.h @@ -152,7 +152,7 @@ public: { return mChannelInterpretation; } - void SetChannelInterpretationValue(ChannelInterpretation aMode) + virtual void SetChannelInterpretationValue(ChannelInterpretation aMode, ErrorResult& aRv) { mChannelInterpretation = aMode; SendChannelMixingParametersToStream(); diff --git a/dom/media/webaudio/ChannelSplitterNode.h b/dom/media/webaudio/ChannelSplitterNode.h index 361df4b9a35b..10720f66b9c0 100644 --- a/dom/media/webaudio/ChannelSplitterNode.h +++ b/dom/media/webaudio/ChannelSplitterNode.h @@ -31,6 +31,19 @@ public: return Create(aAudioContext, aOptions, aRv); } + void SetChannelCount(uint32_t aChannelCount, ErrorResult& aRv) + { + aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); + } + void SetChannelCountModeValue(ChannelCountMode aMode, ErrorResult& aRv) + { + aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); + } + void SetChannelInterpretationValue(ChannelInterpretation aMode, ErrorResult& aRv) + { + aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); + } + JSObject* WrapObject(JSContext* aCx, JS::Handle aGivenProto) override; uint16_t NumberOfOutputs() const override { return mOutputCount; } diff --git a/dom/webidl/AudioNode.webidl b/dom/webidl/AudioNode.webidl index f8d22feaf8f1..80b33e50eeb2 100644 --- a/dom/webidl/AudioNode.webidl +++ b/dom/webidl/AudioNode.webidl @@ -58,6 +58,7 @@ interface AudioNode : EventTarget { attribute unsigned long channelCount; [SetterThrows] attribute ChannelCountMode channelCountMode; + [SetterThrows] attribute ChannelInterpretation channelInterpretation; }; From 611dd9995e794a6b2c276eac456a7f14fd9b08fc Mon Sep 17 00:00:00 2001 From: Cosmin Sabou Date: Mon, 12 Mar 2018 11:53:54 +0200 Subject: [PATCH 03/50] Backed out changeset 7386deb98f9a (bug 1443224) for build bustages on dom/ChannelSplitterNode.h --- dom/media/webaudio/AudioNode.cpp | 5 +---- dom/media/webaudio/AudioNode.h | 2 +- dom/media/webaudio/ChannelSplitterNode.h | 13 ------------- dom/webidl/AudioNode.webidl | 1 - 4 files changed, 2 insertions(+), 19 deletions(-) diff --git a/dom/media/webaudio/AudioNode.cpp b/dom/media/webaudio/AudioNode.cpp index 7fd85b195618..f251861cd74a 100644 --- a/dom/media/webaudio/AudioNode.cpp +++ b/dom/media/webaudio/AudioNode.cpp @@ -91,10 +91,7 @@ AudioNode::Initialize(const AudioNodeOptions& aOptions, ErrorResult& aRv) } if (aOptions.mChannelInterpretation.WasPassed()) { - SetChannelInterpretationValue(aOptions.mChannelInterpretation.Value(), aRv); - if (NS_WARN_IF(aRv.Failed())) { - return; - } + SetChannelInterpretationValue(aOptions.mChannelInterpretation.Value()); } } diff --git a/dom/media/webaudio/AudioNode.h b/dom/media/webaudio/AudioNode.h index f3d159b0bb53..eb01289b19b1 100644 --- a/dom/media/webaudio/AudioNode.h +++ b/dom/media/webaudio/AudioNode.h @@ -152,7 +152,7 @@ public: { return mChannelInterpretation; } - virtual void SetChannelInterpretationValue(ChannelInterpretation aMode, ErrorResult& aRv) + void SetChannelInterpretationValue(ChannelInterpretation aMode) { mChannelInterpretation = aMode; SendChannelMixingParametersToStream(); diff --git a/dom/media/webaudio/ChannelSplitterNode.h b/dom/media/webaudio/ChannelSplitterNode.h index 10720f66b9c0..361df4b9a35b 100644 --- a/dom/media/webaudio/ChannelSplitterNode.h +++ b/dom/media/webaudio/ChannelSplitterNode.h @@ -31,19 +31,6 @@ public: return Create(aAudioContext, aOptions, aRv); } - void SetChannelCount(uint32_t aChannelCount, ErrorResult& aRv) - { - aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); - } - void SetChannelCountModeValue(ChannelCountMode aMode, ErrorResult& aRv) - { - aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); - } - void SetChannelInterpretationValue(ChannelInterpretation aMode, ErrorResult& aRv) - { - aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); - } - JSObject* WrapObject(JSContext* aCx, JS::Handle aGivenProto) override; uint16_t NumberOfOutputs() const override { return mOutputCount; } diff --git a/dom/webidl/AudioNode.webidl b/dom/webidl/AudioNode.webidl index 80b33e50eeb2..f8d22feaf8f1 100644 --- a/dom/webidl/AudioNode.webidl +++ b/dom/webidl/AudioNode.webidl @@ -58,7 +58,6 @@ interface AudioNode : EventTarget { attribute unsigned long channelCount; [SetterThrows] attribute ChannelCountMode channelCountMode; - [SetterThrows] attribute ChannelInterpretation channelInterpretation; }; From 2f3c2434f4da8b1a9d8eda0638cbfa9cc0542a78 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Mon, 12 Mar 2018 04:52:02 -0400 Subject: [PATCH 04/50] servo: Merge #20275 - Finish cleaning up trait bounds generation in style_derive (from servo:derive-all-the-things); r=emilio Source-Repo: https://github.com/servo/servo Source-Revision: 9d4cdfcfc31e4d3fca16e074c7481211f880be9f --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : d9b39c62cbcc55b8ae6297c250a12cab2fb2f046 --- servo/components/style/values/animated/mod.rs | 6 + servo/components/style/values/distance.rs | 4 + .../style/values/generics/basic_shape.rs | 1 + servo/components/style/values/generics/svg.rs | 8 +- servo/components/style_derive/animate.rs | 43 ++++-- servo/components/style_derive/cg.rs | 141 +----------------- .../style_derive/compute_squared_distance.rs | 100 ++++++++----- servo/components/style_derive/lib.rs | 2 +- .../style_derive/to_animated_zero.rs | 37 +++-- 9 files changed, 134 insertions(+), 208 deletions(-) diff --git a/servo/components/style/values/animated/mod.rs b/servo/components/style/values/animated/mod.rs index ad81a4ecc4aa..9e0653d8a008 100644 --- a/servo/components/style/values/animated/mod.rs +++ b/servo/components/style/values/animated/mod.rs @@ -35,6 +35,9 @@ pub mod effects; /// /// If the two values are not similar, an error is returned unless a fallback /// function has been specified through `#[animate(fallback)]`. +/// +/// Trait bounds for type parameter `Foo` can be opted out of with +/// `#[animation(no_bound(Foo))]` on the type definition. pub trait Animate: Sized { /// Animate a value towards another one, given an animation procedure. fn animate(&self, other: &Self, procedure: Procedure) -> Result; @@ -78,6 +81,9 @@ pub trait ToAnimatedValue { /// /// If a variant is annotated with `#[animation(error)]`, the corresponding /// `match` arm is not generated. +/// +/// Trait bounds for type parameter `Foo` can be opted out of with +/// `#[animation(no_bound(Foo))]` on the type definition. pub trait ToAnimatedZero: Sized { /// Returns a value that, when added with an underlying value, will produce the underlying /// value. This is used for SMIL animation's "by-animation" where SMIL first interpolates from diff --git a/servo/components/style/values/distance.rs b/servo/components/style/values/distance.rs index f17b9931ddab..5f84f17caad2 100644 --- a/servo/components/style/values/distance.rs +++ b/servo/components/style/values/distance.rs @@ -21,6 +21,10 @@ use std::ops::Add; /// /// If the two values are not similar, an error is returned unless a fallback /// function has been specified through `#[distance(fallback)]`. +/// +/// Trait bounds for type parameter `Foo` can be opted out of with +/// `#[animation(no_bound(Foo))]` on the type definition, trait bounds for +/// fields can be opted into with `#[distance(field_bound)]` on the field. pub trait ComputeSquaredDistance { /// Computes the squared distance between two animatable values. fn compute_squared_distance(&self, other: &Self) -> Result; diff --git a/servo/components/style/values/generics/basic_shape.rs b/servo/components/style/values/generics/basic_shape.rs index ef9eac14ec7b..8c798b468ae9 100644 --- a/servo/components/style/values/generics/basic_shape.rs +++ b/servo/components/style/values/generics/basic_shape.rs @@ -43,6 +43,7 @@ pub enum ShapeBox { /// A shape source, for some reference box. #[allow(missing_docs)] +#[animation(no_bound(ImageOrUrl))] #[derive(Animate, Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)] pub enum ShapeSource { #[animation(error)] diff --git a/servo/components/style/values/generics/svg.rs b/servo/components/style/values/generics/svg.rs index 6d9928ec1af4..a856633ff474 100644 --- a/servo/components/style/values/generics/svg.rs +++ b/servo/components/style/values/generics/svg.rs @@ -15,6 +15,7 @@ use values::distance::{ComputeSquaredDistance, SquaredDistance}; /// An SVG paint value /// /// +#[animation(no_bound(UrlPaintServer))] #[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq)] #[derive(ToAnimatedValue, ToComputedValue, ToCss)] pub struct SVGPaint { @@ -29,6 +30,7 @@ pub struct SVGPaint { /// Whereas the spec only allows PaintServer /// to have a fallback, Gecko lets the context /// properties have a fallback as well. +#[animation(no_bound(UrlPaintServer))] #[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq)] #[derive(ToAnimatedValue, ToAnimatedZero, ToComputedValue, ToCss)] pub enum SVGPaintKind { @@ -203,7 +205,11 @@ pub enum SVGLength { pub enum SVGStrokeDashArray { /// `[ | | ]#` #[css(comma)] - Values(#[css(if_empty = "none", iterable)] Vec), + Values( + #[css(if_empty = "none", iterable)] + #[distance(field_bound)] + Vec, + ), /// `context-value` ContextValue, } diff --git a/servo/components/style_derive/animate.rs b/servo/components/style_derive/animate.rs index 912f7dbc9f2c..e54f1819c997 100644 --- a/servo/components/style_derive/animate.rs +++ b/servo/components/style_derive/animate.rs @@ -2,23 +2,31 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use cg::{self, WhereClause}; +use cg; +use darling::util::IdentList; use quote::Tokens; use syn::{DeriveInput, Path}; use synstructure::{Structure, VariantInfo}; -pub fn derive(input: DeriveInput) -> Tokens { - let name = &input.ident; - let trait_path = parse_quote!(values::animated::Animate); - let (impl_generics, ty_generics, mut where_clause) = - cg::trait_parts(&input, &trait_path); +pub fn derive(mut input: DeriveInput) -> Tokens { + let animation_input_attrs = cg::parse_input_attrs::(&input); + let no_bound = animation_input_attrs.no_bound.unwrap_or_default(); + let mut where_clause = input.generics.where_clause.take(); + for param in input.generics.type_params() { + if !no_bound.contains(¶m.ident) { + cg::add_predicate( + &mut where_clause, + parse_quote!(#param: ::values::animated::Animate), + ); + } + } + input.generics.where_clause = where_clause; - let input_attrs = cg::parse_input_attrs::(&input); let s = Structure::new(&input); let mut append_error_clause = s.variants().len() > 1; let mut match_body = s.variants().iter().fold(quote!(), |body, variant| { - let arm = match derive_variant_arm(variant, &mut where_clause) { + let arm = match derive_variant_arm(variant) { Ok(arm) => arm, Err(()) => { append_error_clause = true; @@ -29,6 +37,7 @@ pub fn derive(input: DeriveInput) -> Tokens { }); if append_error_clause { + let input_attrs = cg::parse_input_attrs::(&input); if let Some(fallback) = input_attrs.fallback { match_body.append_all(quote! { (this, other) => #fallback(this, other, procedure) @@ -38,6 +47,9 @@ pub fn derive(input: DeriveInput) -> Tokens { } } + let name = &input.ident; + let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl(); + quote! { impl #impl_generics ::values::animated::Animate for #name #ty_generics #where_clause { #[allow(unused_variables, unused_imports)] @@ -55,10 +67,7 @@ pub fn derive(input: DeriveInput) -> Tokens { } } -fn derive_variant_arm( - variant: &VariantInfo, - where_clause: &mut WhereClause, -) -> Result { +fn derive_variant_arm(variant: &VariantInfo) -> Result { let variant_attrs = cg::parse_variant_attrs::(&variant.ast()); if variant_attrs.error { return Err(()); @@ -78,7 +87,6 @@ fn derive_variant_arm( let #result = ::std::clone::Clone::clone(#this); } } else { - where_clause.add_trait_bound(&result.ast().ty); quote! { let #result = ::values::animated::Animate::animate(#this, #other, procedure)?; @@ -99,10 +107,19 @@ struct AnimateInputAttrs { fallback: Option, } +#[darling(attributes(animation), default)] +#[derive(Default, FromDeriveInput)] +pub struct AnimationInputAttrs { + pub no_bound: Option, +} + #[darling(attributes(animation), default)] #[derive(Default, FromVariant)] pub struct AnimationVariantAttrs { pub error: bool, + // Only here because of structs, where the struct definition acts as a + // variant itself. + pub no_bound: Option, } #[darling(attributes(animation), default)] diff --git a/servo/components/style_derive/cg.rs b/servo/components/style_derive/cg.rs index 694973103cea..ff391c791804 100644 --- a/servo/components/style_derive/cg.rs +++ b/servo/components/style_derive/cg.rs @@ -3,83 +3,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use darling::{FromDeriveInput, FromField, FromVariant}; -use quote::{ToTokens, Tokens}; -use std::collections::HashSet; +use quote::Tokens; use syn::{self, AngleBracketedGenericArguments, Binding, DeriveInput, Field}; -use syn::{GenericArgument, GenericParam, Ident, ImplGenerics, Path}; -use syn::{PathArguments, PathSegment, QSelf, Type, TypeArray, TypeGenerics}; +use syn::{GenericArgument, GenericParam, Ident, Path}; +use syn::{PathArguments, PathSegment, QSelf, Type, TypeArray}; use syn::{TypeParam, TypeParen, TypePath, TypeSlice, TypeTuple}; use syn::{Variant, WherePredicate}; -use syn::visit::{self, Visit}; use synstructure::{self, BindingInfo, BindStyle, VariantAst, VariantInfo}; -pub struct WhereClause<'input, 'path> { - pub inner: Option, - pub params: Vec<&'input TypeParam>, - trait_path: &'path Path, - trait_output: Option, - bounded_types: HashSet, -} - -impl<'input, 'path> ToTokens for WhereClause<'input, 'path> { - fn to_tokens(&self, tokens: &mut Tokens) { - self.inner.to_tokens(tokens); - } -} - -impl<'input, 'path> WhereClause<'input, 'path> { - pub fn add_trait_bound(&mut self, ty: &Type) { - let trait_path = self.trait_path; - let mut found = self.trait_output.map(|_| HashSet::new()); - if self.bounded_types.contains(&ty) { - return; - } - if !is_parameterized(&ty, &self.params, found.as_mut()) { - return; - } - self.bounded_types.insert(ty.clone()); - - let output = if let Some(output) = self.trait_output { - output - } else { - add_predicate(&mut self.inner, where_predicate(ty.clone(), trait_path, None)); - return; - }; - - if let Type::Path(syn::TypePath { ref path, .. }) = *ty { - if path_to_ident(path).is_some() { - add_predicate(&mut self.inner, where_predicate(ty.clone(), trait_path, None)); - return; - } - } - - let output_type = map_type_params(ty, &self.params, &mut |ident| { - parse_quote!(<#ident as ::#trait_path>::#output) - }); - - let pred = where_predicate( - ty.clone(), - trait_path, - Some((output, output_type)), - ); - - add_predicate(&mut self.inner, pred); - - if let Some(found) = found { - for ident in found { - let ty = Type::Path(syn::TypePath { qself: None, path: ident.into() }); - if !self.bounded_types.contains(&ty) { - self.bounded_types.insert(ty.clone()); - add_predicate( - &mut self.inner, - where_predicate(ty, trait_path, None), - ); - }; - } - } - } -} - pub fn add_predicate( where_clause: &mut Option, pred: WherePredicate, @@ -139,36 +70,6 @@ pub fn fmap_trait_output( segment.into() } -pub fn is_parameterized( - ty: &Type, - params: &[&TypeParam], - found: Option<&mut HashSet>, -) -> bool { - struct IsParameterized<'a, 'b> { - params: &'a [&'a TypeParam], - has_free: bool, - found: Option<&'b mut HashSet>, - } - - impl<'a, 'b, 'ast> Visit<'ast> for IsParameterized<'a, 'b> { - fn visit_path(&mut self, path: &'ast Path) { - if let Some(ident) = path_to_ident(path) { - if self.params.iter().any(|param| param.ident == ident) { - self.has_free = true; - if let Some(ref mut found) = self.found { - found.insert(ident.clone()); - } - } - } - visit::visit_path(self, path); - } - } - - let mut visitor = IsParameterized { params, has_free: false, found }; - visitor.visit_type(ty); - visitor.has_free -} - pub fn map_type_params(ty: &Type, params: &[&TypeParam], f: &mut F) -> Type where F: FnMut(&Ident) -> Type, @@ -314,33 +215,6 @@ pub fn ref_pattern<'a>( (v.pat(), v.bindings().iter().cloned().collect()) } -pub fn trait_parts<'input, 'path>( - input: &'input DeriveInput, - trait_path: &'path Path, -) -> (ImplGenerics<'input>, TypeGenerics<'input>, WhereClause<'input, 'path>) { - let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl(); - let where_clause = WhereClause { - inner: where_clause.cloned(), - params: input.generics.type_params().into_iter().collect::>(), - trait_path, - trait_output: None, - bounded_types: HashSet::new() - }; - (impl_generics, ty_generics, where_clause) -} - -fn trait_ref(path: &Path, output: Option<(Ident, Type)>) -> Path { - let segments = path.segments.iter().collect::>(); - let (name, parent) = segments.split_last().unwrap(); - - let last_segment: PathSegment = if let Some((param, ty)) = output { - parse_quote!(#name<#param = #ty>) - } else { - parse_quote!(#name) - }; - parse_quote!(::#(#parent::)*#last_segment) -} - pub fn value<'a>( variant: &'a VariantInfo, prefix: &str, @@ -351,15 +225,6 @@ pub fn value<'a>( (v.pat(), v.bindings().iter().cloned().collect()) } -pub fn where_predicate( - bounded_ty: Type, - trait_path: &Path, - trait_output: Option<(Ident, Type)>, -) -> WherePredicate { - let trait_ref = trait_ref(trait_path, trait_output); - parse_quote!(#bounded_ty: #trait_ref) -} - /// Transforms "FooBar" to "foo-bar". /// /// If the first Camel segment is "Moz", "Webkit", or "Servo", the result string diff --git a/servo/components/style_derive/compute_squared_distance.rs b/servo/components/style_derive/compute_squared_distance.rs index 6254340e358f..07408bbcddb5 100644 --- a/servo/components/style_derive/compute_squared_distance.rs +++ b/servo/components/style_derive/compute_squared_distance.rs @@ -2,52 +2,71 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use animate::AnimationVariantAttrs; +use animate::{AnimationInputAttrs, AnimationVariantAttrs}; use cg; use quote::Tokens; use syn::{DeriveInput, Path}; use synstructure; -pub fn derive(input: DeriveInput) -> Tokens { - let name = &input.ident; - let trait_path = parse_quote!(values::distance::ComputeSquaredDistance); - let (impl_generics, ty_generics, mut where_clause) = - cg::trait_parts(&input, &trait_path); - - let input_attrs = cg::parse_input_attrs::(&input); - let s = synstructure::Structure::new(&input); - let mut append_error_clause = s.variants().len() > 1; - - let mut match_body = s.variants().iter().fold(quote!(), |body, variant| { - let attrs = cg::parse_variant_attrs::(&variant.ast()); - if attrs.error { - append_error_clause = true; - return body; +pub fn derive(mut input: DeriveInput) -> Tokens { + let animation_input_attrs = cg::parse_input_attrs::(&input); + let no_bound = animation_input_attrs.no_bound.unwrap_or_default(); + let mut where_clause = input.generics.where_clause.take(); + for param in input.generics.type_params() { + if !no_bound.contains(¶m.ident) { + cg::add_predicate( + &mut where_clause, + parse_quote!(#param: ::values::distance::ComputeSquaredDistance), + ); } + } - let (this_pattern, this_info) = cg::ref_pattern(&variant, "this"); - let (other_pattern, other_info) = cg::ref_pattern(&variant, "other"); - let sum = if this_info.is_empty() { - quote! { ::values::distance::SquaredDistance::from_sqrt(0.) } - } else { - let mut sum = quote!(); - sum.append_separated(this_info.iter().zip(&other_info).map(|(this, other)| { - where_clause.add_trait_bound(&this.ast().ty); - quote! { - ::values::distance::ComputeSquaredDistance::compute_squared_distance(#this, #other)? - } - }), quote!(+)); - sum - }; - quote! { - #body - (&#this_pattern, &#other_pattern) => { - Ok(#sum) + let (mut match_body, append_error_clause) = { + let s = synstructure::Structure::new(&input); + let mut append_error_clause = s.variants().len() > 1; + + let match_body = s.variants().iter().fold(quote!(), |body, variant| { + let attrs = cg::parse_variant_attrs::(&variant.ast()); + if attrs.error { + append_error_clause = true; + return body; } - } - }); + + let (this_pattern, this_info) = cg::ref_pattern(&variant, "this"); + let (other_pattern, other_info) = cg::ref_pattern(&variant, "other"); + let sum = if this_info.is_empty() { + quote! { ::values::distance::SquaredDistance::from_sqrt(0.) } + } else { + let mut sum = quote!(); + sum.append_separated(this_info.iter().zip(&other_info).map(|(this, other)| { + let field_attrs = cg::parse_field_attrs::(&this.ast()); + if field_attrs.field_bound { + let ty = &this.ast().ty; + cg::add_predicate( + &mut where_clause, + parse_quote!(#ty: ::values::distance::ComputeSquaredDistance), + ); + } + quote! { + ::values::distance::ComputeSquaredDistance::compute_squared_distance(#this, #other)? + } + }), quote!(+)); + sum + }; + quote! { + #body + (&#this_pattern, &#other_pattern) => { + Ok(#sum) + } + } + }); + + (match_body, append_error_clause) + }; + input.generics.where_clause = where_clause; if append_error_clause { + let input_attrs = cg::parse_input_attrs::(&input); if let Some(fallback) = input_attrs.fallback { match_body.append_all(quote! { (this, other) => #fallback(this, other) @@ -57,6 +76,9 @@ pub fn derive(input: DeriveInput) -> Tokens { } } + let name = &input.ident; + let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl(); + quote! { impl #impl_generics ::values::distance::ComputeSquaredDistance for #name #ty_generics #where_clause { #[allow(unused_variables, unused_imports)] @@ -78,3 +100,9 @@ pub fn derive(input: DeriveInput) -> Tokens { struct DistanceInputAttrs { fallback: Option, } + +#[darling(attributes(distance), default)] +#[derive(Default, FromField)] +struct DistanceFieldAttrs { + field_bound: bool, +} diff --git a/servo/components/style_derive/lib.rs b/servo/components/style_derive/lib.rs index e414a3bd3f21..e9d799fe9a95 100644 --- a/servo/components/style_derive/lib.rs +++ b/servo/components/style_derive/lib.rs @@ -45,7 +45,7 @@ pub fn derive_parse(stream: TokenStream) -> TokenStream { parse::derive(input).into() } -#[proc_macro_derive(ToAnimatedZero, attributes(animation))] +#[proc_macro_derive(ToAnimatedZero, attributes(animation, zero))] pub fn derive_to_animated_zero(stream: TokenStream) -> TokenStream { let input = syn::parse(stream).unwrap(); to_animated_zero::derive(input).into() diff --git a/servo/components/style_derive/to_animated_zero.rs b/servo/components/style_derive/to_animated_zero.rs index 8094e46874d7..9ee786f7ec87 100644 --- a/servo/components/style_derive/to_animated_zero.rs +++ b/servo/components/style_derive/to_animated_zero.rs @@ -2,20 +2,26 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use animate::{AnimationVariantAttrs, AnimationFieldAttrs}; +use animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs}; use cg; use quote; use syn; use synstructure; -pub fn derive(input: syn::DeriveInput) -> quote::Tokens { - let name = &input.ident; - let trait_path = parse_quote!(values::animated::ToAnimatedZero); - let (impl_generics, ty_generics, mut where_clause) = - cg::trait_parts(&input, &trait_path); +pub fn derive(mut input: syn::DeriveInput) -> quote::Tokens { + let animation_input_attrs = cg::parse_input_attrs::(&input); + let no_bound = animation_input_attrs.no_bound.unwrap_or_default(); + let mut where_clause = input.generics.where_clause.take(); + for param in input.generics.type_params() { + if !no_bound.contains(¶m.ident) { + cg::add_predicate( + &mut where_clause, + parse_quote!(#param: ::values::animated::ToAnimatedZero), + ); + } + } - let s = synstructure::Structure::new(&input); - let to_body = s.each_variant(|variant| { + let to_body = synstructure::Structure::new(&input).each_variant(|variant| { let attrs = cg::parse_variant_attrs::(&variant.ast()); if attrs.error { return Some(quote! { Err(()) }); @@ -26,21 +32,10 @@ pub fn derive(input: syn::DeriveInput) -> quote::Tokens { computations.append_all(bindings_pairs.map(|(binding, mapped_binding)| { let field_attrs = cg::parse_field_attrs::(&binding.ast()); if field_attrs.constant { - if cg::is_parameterized(&binding.ast().ty, &where_clause.params, None) { - cg::add_predicate( - &mut where_clause.inner, - cg::where_predicate( - binding.ast().ty.clone(), - &parse_quote!(std::clone::Clone), - None, - ), - ); - } quote! { let #mapped_binding = ::std::clone::Clone::clone(#binding); } } else { - where_clause.add_trait_bound(&binding.ast().ty); quote! { let #mapped_binding = ::values::animated::ToAnimatedZero::to_animated_zero(#binding)?; @@ -50,6 +45,10 @@ pub fn derive(input: syn::DeriveInput) -> quote::Tokens { computations.append_all(quote! { Ok(#mapped) }); Some(computations) }); + input.generics.where_clause = where_clause; + + let name = &input.ident; + let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl(); quote! { impl #impl_generics ::values::animated::ToAnimatedZero for #name #ty_generics #where_clause { From ae32006cefa5a799aae54d35fa7dbbfb77a4bfd7 Mon Sep 17 00:00:00 2001 From: Jan Odvarko Date: Mon, 12 Mar 2018 08:10:39 +0100 Subject: [PATCH 05/50] Bug 1223726 - Customize response body interception; r=ochameau * Introduce pref for custom response body limit * Introduce pref for saving request/response bodies MozReview-Commit-ID: 7DrAU1did1a --HG-- extra : rebase_source : c6328f3ce8552b49caaca09489cf10c0685af58b --- .../netmonitor/test/browser_net_truncate.js | 4 ++-- devtools/client/preferences/devtools.js | 3 +++ .../webconsole/webconsole-connection-proxy.js | 8 +++++++- devtools/shared/webconsole/network-monitor.js | 19 ++++++++++--------- modules/libpref/init/all.js | 6 ++++++ 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/devtools/client/netmonitor/test/browser_net_truncate.js b/devtools/client/netmonitor/test/browser_net_truncate.js index 34cca60a69fa..83245b27d219 100644 --- a/devtools/client/netmonitor/test/browser_net_truncate.js +++ b/devtools/client/netmonitor/test/browser_net_truncate.js @@ -8,8 +8,8 @@ */ add_task(async function () { - let { RESPONSE_BODY_LIMIT } = require("devtools/shared/webconsole/network-monitor"); - let URL = EXAMPLE_URL + "sjs_truncate-test-server.sjs?limit=" + RESPONSE_BODY_LIMIT; + let limit = Services.prefs.getIntPref("devtools.netmonitor.responseBodyLimit"); + let URL = EXAMPLE_URL + "sjs_truncate-test-server.sjs?limit=" + limit; let { monitor, tab } = await initNetMonitor(URL); info("Starting test... "); diff --git a/devtools/client/preferences/devtools.js b/devtools/client/preferences/devtools.js index fa800694e2cb..d74aa32f33cc 100644 --- a/devtools/client/preferences/devtools.js +++ b/devtools/client/preferences/devtools.js @@ -165,6 +165,9 @@ pref("devtools.netmonitor.visibleColumns", "[\"status\",\"method\",\"file\",\"domain\",\"cause\",\"type\",\"transferred\",\"contentSize\",\"waterfall\"]" ); +// Save request/response bodies yes/no. +pref("devtools.netmonitor.saveRequestAndResponseBodies", true); + // The default Network monitor HAR export setting pref("devtools.netmonitor.har.defaultLogDir", ""); pref("devtools.netmonitor.har.defaultFileName", "Archive %date"); diff --git a/devtools/client/webconsole/webconsole-connection-proxy.js b/devtools/client/webconsole/webconsole-connection-proxy.js index cec613095d5f..f69cf66c64f8 100644 --- a/devtools/client/webconsole/webconsole-connection-proxy.js +++ b/devtools/client/webconsole/webconsole-connection-proxy.js @@ -208,9 +208,15 @@ WebConsoleConnectionProxy.prototype = { this.webConsoleClient = webConsoleClient; this._hasNativeConsoleAPI = response.nativeConsoleAPI; + let saveBodies = Services.prefs.getBoolPref( + "devtools.netmonitor.saveRequestAndResponseBodies"); + // There is no way to view response bodies from the Browser Console, so do // not waste the memory. - let saveBodies = !this.webConsoleFrame.isBrowserConsole; + if (this.webConsoleFrame.isBrowserConsole) { + saveBodies = false; + } + this.webConsoleFrame.setSaveRequestAndResponseBodies(saveBodies); this.webConsoleClient.on("networkEvent", this._onNetworkEvent); diff --git a/devtools/shared/webconsole/network-monitor.js b/devtools/shared/webconsole/network-monitor.js index 125ea34b3431..2efc5f9354d4 100644 --- a/devtools/shared/webconsole/network-monitor.js +++ b/devtools/shared/webconsole/network-monitor.js @@ -35,11 +35,6 @@ const HTTP_FOUND = 302; const HTTP_SEE_OTHER = 303; const HTTP_TEMPORARY_REDIRECT = 307; -// The maximum number of bytes a NetworkResponseListener can hold: 1 MB -const RESPONSE_BODY_LIMIT = 1048576; -// Exported for testing. -exports.RESPONSE_BODY_LIMIT = RESPONSE_BODY_LIMIT; - /** * Check if a given network request should be logged by a network monitor * based on the specified filters. @@ -279,13 +274,16 @@ function NetworkResponseListener(owner, httpActivity) { this.receivedData = ""; this.httpActivity = httpActivity; this.bodySize = 0; - // Indicates if the response had a size greater than RESPONSE_BODY_LIMIT. + // Indicates if the response had a size greater than response body limit. this.truncated = false; // Note that this is really only needed for the non-e10s case. // See bug 1309523. let channel = this.httpActivity.channel; this._wrappedNotificationCallbacks = channel.notificationCallbacks; channel.notificationCallbacks = this; + + this.responseBodyLimit = Services.prefs.getIntPref( + "devtools.netmonitor.responseBodyLimit"); } NetworkResponseListener.prototype = { @@ -397,7 +395,7 @@ NetworkResponseListener.prototype = { /** * Stores the received data, if request/response body logging is enabled. It * also does limit the number of stored bytes, based on the - * RESPONSE_BODY_LIMIT constant. + * `devtools.netmonitor.responseBodyLimit` pref. * * Learn more about nsIStreamListener at: * https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIStreamListener @@ -415,10 +413,13 @@ NetworkResponseListener.prototype = { this.bodySize += count; if (!this.httpActivity.discardResponseBody) { - if (this.receivedData.length < RESPONSE_BODY_LIMIT) { + let limit = Services.prefs.getIntPref("devtools.netmonitor.responseBodyLimit"); + if (this.receivedData.length < limit || limit == 0) { this.receivedData += NetworkHelper.convertToUnicode(data, request.contentCharset); - } else { + } + if (this.receivedData.length > limit && limit > 0) { + this.receivedData = this.receivedData.substr(0, limit); this.truncated = true; } } diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index b4be2188f459..c2171e2c53c2 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1113,6 +1113,12 @@ pref("devtools.debugger.force-local", true); // Block tools from seeing / interacting with certified apps pref("devtools.debugger.forbid-certified-apps", true); +// Limit for intercepted response bodies (1 MB) +// Possible values: +// 0 => the response body has no limit +// n => represents max number of bytes stored +pref("devtools.netmonitor.responseBodyLimit", 1048576); + // DevTools default color unit pref("devtools.defaultColorUnit", "authored"); From 0a7ee875450f4d4becd2ec83adb54845f5ef84ae Mon Sep 17 00:00:00 2001 From: Jan Odvarko Date: Mon, 12 Mar 2018 08:10:40 +0100 Subject: [PATCH 06/50] Bug 1223726 - Update tests; r=ochameau MozReview-Commit-ID: 3iokswH0ybw --HG-- extra : rebase_source : b12ca75d51a36b7554eed114bec39d30e9295a48 --- .../test/browser_net_har_copy_all_as_har.js | 63 ++++++++++++------- 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har.js b/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har.js index 80b2f97b34f1..8a3621b1d3aa 100644 --- a/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har.js +++ b/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har.js @@ -10,30 +10,12 @@ add_task(async function () { // Disable tcp fast open, because it is setting a response header indicator // (bug 1352274). TCP Fast Open is not present on all platforms therefore the // number of response headers will vary depending on the platform. - Services.prefs.setBoolPref("network.tcp.tcp_fastopen_enable", false); + await pushPref("network.tcp.tcp_fastopen_enable", false); let { tab, monitor } = await initNetMonitor(SIMPLE_URL); - info("Starting test... "); + info("Starting test..."); - let { connector, store, windowRequire } = monitor.panelWin; - let Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); - let RequestListContextMenu = windowRequire( - "devtools/client/netmonitor/src/widgets/RequestListContextMenu"); - let { getSortedRequests } = windowRequire( - "devtools/client/netmonitor/src/selectors/index"); - - store.dispatch(Actions.batchEnable(false)); - - let wait = waitForNetworkEvents(monitor, 1); - tab.linkedBrowser.reload(); - await wait; - - let contextMenu = new RequestListContextMenu({ connector }); - - await contextMenu.copyAllAsHar(getSortedRequests(store.getState())); - - let jsonString = SpecialPowers.getClipboardData("text/unicode"); - let har = JSON.parse(jsonString); + let har = await reloadAndCopyAllAsHar(tab, monitor); // Check out HAR log isnot(har.log, null, "The HAR log must exist"); @@ -60,5 +42,44 @@ add_task(async function () { "Check response body"); isnot(entry.timings, undefined, "Check timings"); + // Test response body limit (non zero). + await pushPref("devtools.netmonitor.responseBodyLimit", 10); + har = await reloadAndCopyAllAsHar(tab, monitor); + entry = har.log.entries[0]; + is(entry.response.content.text.length, 10, // eslint-disable-line + "Response body must be truncated"); + + // Test response body limit (zero). + await pushPref("devtools.netmonitor.responseBodyLimit", 0); + har = await reloadAndCopyAllAsHar(tab, monitor); + entry = har.log.entries[0]; + is(entry.response.content.text.length, 465, // eslint-disable-line + "Response body must not be truncated"); + return teardown(monitor); }); + +/** + * Reload the page and copy all as HAR. + */ +async function reloadAndCopyAllAsHar(tab, monitor) { + let { connector, store, windowRequire } = monitor.panelWin; + let Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); + let RequestListContextMenu = windowRequire( + "devtools/client/netmonitor/src/widgets/RequestListContextMenu"); + let { getSortedRequests } = windowRequire( + "devtools/client/netmonitor/src/selectors/index"); + + store.dispatch(Actions.batchEnable(false)); + + let wait = waitForNetworkEvents(monitor, 1); + tab.linkedBrowser.reload(); + await wait; + + let contextMenu = new RequestListContextMenu({ connector }); + + await contextMenu.copyAllAsHar(getSortedRequests(store.getState())); + + let jsonString = SpecialPowers.getClipboardData("text/unicode"); + return JSON.parse(jsonString); +} From cf3fc487d37571bd5e829a12f78d48235c1aab0d Mon Sep 17 00:00:00 2001 From: Jan Odvarko Date: Mon, 12 Mar 2018 10:59:21 +0100 Subject: [PATCH 07/50] Bug 1223726 - Update tests; r=jdescottes MozReview-Commit-ID: 6FR7W58WRg0 --HG-- extra : rebase_source : db75d8db16aa4358d515f885cf0f54aff5ec28fe --- .../test/browser_styleeditor_fetch-from-netmonitor.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/devtools/client/styleeditor/test/browser_styleeditor_fetch-from-netmonitor.js b/devtools/client/styleeditor/test/browser_styleeditor_fetch-from-netmonitor.js index 0689e68a45ea..7a643e65a0c0 100644 --- a/devtools/client/styleeditor/test/browser_styleeditor_fetch-from-netmonitor.js +++ b/devtools/client/styleeditor/test/browser_styleeditor_fetch-from-netmonitor.js @@ -34,6 +34,10 @@ add_task(function* () { yield ui.selectStyleSheet(ui.editors[1].styleSheet); yield ui.editors[1].getSourceEditor(); + // Wait till there is 5 requests in Netmonitor store. + // (i.e. the Styleeditor panel performed one request). + yield waitUntil(() => getSortedRequests(store.getState()).length == 5); + info("Checking Netmonitor contents."); let shortRequests = []; let longRequests = []; From 8b3e103464c100143c2556ab4f06e2e61a8d8724 Mon Sep 17 00:00:00 2001 From: Austin Lasher Date: Tue, 20 Feb 2018 23:31:09 -0500 Subject: [PATCH 08/50] Bug 1421563 - Remove TryOptimizeToImageLayer declaration; r=kechen,mattwoodrow TryOptimizeToImageLayer was renamed/repurposed in c0654f3b986d, but the old declaration was never removed. MozReview-Commit-ID: 52JJofv3u3t --HG-- extra : rebase_source : 959bee3f9c1bbab9f4b456fcfd4d8fe1ff1655f7 --- layout/painting/nsDisplayList.h | 1 - 1 file changed, 1 deletion(-) diff --git a/layout/painting/nsDisplayList.h b/layout/painting/nsDisplayList.h index dc3af5d26558..2b86db7894c1 100644 --- a/layout/painting/nsDisplayList.h +++ b/layout/painting/nsDisplayList.h @@ -3998,7 +3998,6 @@ protected: typedef class mozilla::layers::ImageLayer ImageLayer; bool CanBuildWebRenderDisplayItems(LayerManager* aManager); - bool TryOptimizeToImageLayer(LayerManager* aManager, nsDisplayListBuilder* aBuilder); nsRect GetBoundsInternal(nsDisplayListBuilder* aBuilder, nsIFrame* aFrameForBounds = nullptr); From e7bd29e8906c00e1c4c06d4dea60f9db61b8cc93 Mon Sep 17 00:00:00 2001 From: Ian Moody Date: Thu, 8 Feb 2018 19:03:31 +0000 Subject: [PATCH 09/50] Bug 1432636 - Switch XMLPrettyPrint to use HTML
instead of click handlers for expandables. r=ntim,peterv Also remove duplicate import from the XMLMonoPrint sheet (unnamed default sheets stay applied when switching to alternates, only named are unapplied). Additionally fix some regressions from bug 379683: * top-level collapsed and uncollapsible elements weren't monospaced in monospace style. * top-level uncollapsible elements weren't indented. * there was an extra space between PIs and their expander control. Based on prototype by bgrins. MozReview-Commit-ID: 2Pikm41FMWY --HG-- extra : rebase_source : a8fb7dd9f40a267e93d50342c51728dcc98c4918 --- dom/base/test/file_bug590812-ref.xhtml | 4 +- dom/xml/resources/XMLMonoPrint.css | 5 +- dom/xml/resources/XMLPrettyPrint.css | 34 +++++++----- dom/xml/resources/XMLPrettyPrint.xml | 20 +------ dom/xml/resources/XMLPrettyPrint.xsl | 74 +++++++++++++------------- 5 files changed, 63 insertions(+), 74 deletions(-) diff --git a/dom/base/test/file_bug590812-ref.xhtml b/dom/base/test/file_bug590812-ref.xhtml index dd0948b08aea..7309425fb4b8 100644 --- a/dom/base/test/file_bug590812-ref.xhtml +++ b/dom/base/test/file_bug590812-ref.xhtml @@ -1,3 +1,3 @@ -
<out>Here be sea hags</out>
diff --git a/dom/xml/resources/XMLMonoPrint.css b/dom/xml/resources/XMLMonoPrint.css index 598daba22b93..95875d0e5aa2 100644 --- a/dom/xml/resources/XMLMonoPrint.css +++ b/dom/xml/resources/XMLMonoPrint.css @@ -3,9 +3,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -@import url("chrome://global/content/xml/XMLPrettyPrint.css"); - -#top > .expander-open { +#tree, +.expandable-opening::-moz-list-bullet { font-family: monospace; white-space: pre; } diff --git a/dom/xml/resources/XMLPrettyPrint.css b/dom/xml/resources/XMLPrettyPrint.css index 13bb61e71532..50abee7d89ae 100644 --- a/dom/xml/resources/XMLPrettyPrint.css +++ b/dom/xml/resources/XMLPrettyPrint.css @@ -12,30 +12,36 @@ margin-bottom: 1em; } -.expander-content { - padding-left: 1em; +#tree, +.expandable-children { + margin-inline-start: 1em; } -.expander { - cursor: pointer; - -moz-user-select: none; - text-align: center; - vertical-align: top; - width: 1em; +.expandable-body { display: inline-block; - margin-left: -1em; } -#top > .expander-open, #top > .expander-closed { - margin-left: 1em; +.expandable-body[open] { + display: block; } -.expander-closed > .expander-content { - display: none; +.expandable-opening { + list-style: '+' outside; +} + +[open] > .expandable-opening { + list-style-type: '−'; +} + +.expandable-opening::-moz-list-bullet { + cursor: pointer; + padding-inline-end: 2px; + /* Don't want to inherit the styling from pi and comment elements */ + color: initial; + font: initial; } .comment { font-family: monospace; white-space: pre; } - diff --git a/dom/xml/resources/XMLPrettyPrint.xml b/dom/xml/resources/XMLPrettyPrint.xml index 522d37210ac4..9df399cb58c0 100644 --- a/dom/xml/resources/XMLPrettyPrint.xml +++ b/dom/xml/resources/XMLPrettyPrint.xml @@ -8,29 +8,11 @@ - + - - - - +
+ +
@@ -52,19 +54,23 @@ -
- +
+
+ + < + + + > + - < - - - > +
-
- - </ - - > +
+ + </ + + > +
@@ -92,15 +98,15 @@ -
- - - - <? - - -
- +
+
+ + <? + + +
+
+ ?>
@@ -115,23 +121,19 @@ -
- - - - <!-- - -
- -
- +
+
+ + <!-- + +
+ +
+
+ --> - +
- - -
-
From 630a574ba42058c3a41bc90dfbbac9e03db09a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 12 Mar 2018 07:12:13 -0400 Subject: [PATCH 10/50] servo: Merge #20274 - style: Make the generated bindings really be formatted (from emilio:moz-src); r=xidorn TOOLTOOL_DIR isn't passed down to the rust scripts it seems, per: https://treeherder.mozilla.org/#/jobs?repo=try&revision=46854db239166ab3a43d36c7a954debb56968eab Source-Repo: https://github.com/servo/servo Source-Revision: cdaa36df2d3113c44ed30a01d8e839ed23251d92 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 14597fa7341df9a16ab6a3fdc17a5ecd00ca6e6a --- servo/components/style/build_gecko.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servo/components/style/build_gecko.rs b/servo/components/style/build_gecko.rs index bf6ded11c341..eeb15c8e718a 100644 --- a/servo/components/style/build_gecko.rs +++ b/servo/components/style/build_gecko.rs @@ -207,7 +207,7 @@ mod bindings { let mut builder = Builder::default() .rust_target(RustTarget::Stable_1_0); let rustfmt_path = env::var_os("MOZ_AUTOMATION").and_then(|_| { - env::var_os("TOOLTOOL_DIR") + env::var_os("TOOLTOOL_DIR").or_else(|| env::var_os("MOZ_SRC")) }).map(PathBuf::from); builder = match rustfmt_path { From 4a083dee603daf5edbf6f5fbbe264a89b7be54ee Mon Sep 17 00:00:00 2001 From: Cosmin Sabou Date: Mon, 12 Mar 2018 14:51:37 +0200 Subject: [PATCH 11/50] Backed out 3 changesets (bug 1223726) for mochitest devtools failures on devtools/client/styleeditor/test/browser_styleeditor_fetch-from-netmonitor.js Backed out changeset 1a09e6c3c0a3 (bug 1223726) Backed out changeset 41da2897f549 (bug 1223726) Backed out changeset fa0a1e88a238 (bug 1223726) --- .../test/browser_net_har_copy_all_as_har.js | 63 +++++++------------ .../netmonitor/test/browser_net_truncate.js | 4 +- devtools/client/preferences/devtools.js | 3 - ...owser_styleeditor_fetch-from-netmonitor.js | 4 -- .../webconsole/webconsole-connection-proxy.js | 8 +-- devtools/shared/webconsole/network-monitor.js | 19 +++--- modules/libpref/init/all.js | 6 -- 7 files changed, 33 insertions(+), 74 deletions(-) diff --git a/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har.js b/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har.js index 8a3621b1d3aa..80b2f97b34f1 100644 --- a/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har.js +++ b/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har.js @@ -10,12 +10,30 @@ add_task(async function () { // Disable tcp fast open, because it is setting a response header indicator // (bug 1352274). TCP Fast Open is not present on all platforms therefore the // number of response headers will vary depending on the platform. - await pushPref("network.tcp.tcp_fastopen_enable", false); + Services.prefs.setBoolPref("network.tcp.tcp_fastopen_enable", false); let { tab, monitor } = await initNetMonitor(SIMPLE_URL); - info("Starting test..."); + info("Starting test... "); - let har = await reloadAndCopyAllAsHar(tab, monitor); + let { connector, store, windowRequire } = monitor.panelWin; + let Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); + let RequestListContextMenu = windowRequire( + "devtools/client/netmonitor/src/widgets/RequestListContextMenu"); + let { getSortedRequests } = windowRequire( + "devtools/client/netmonitor/src/selectors/index"); + + store.dispatch(Actions.batchEnable(false)); + + let wait = waitForNetworkEvents(monitor, 1); + tab.linkedBrowser.reload(); + await wait; + + let contextMenu = new RequestListContextMenu({ connector }); + + await contextMenu.copyAllAsHar(getSortedRequests(store.getState())); + + let jsonString = SpecialPowers.getClipboardData("text/unicode"); + let har = JSON.parse(jsonString); // Check out HAR log isnot(har.log, null, "The HAR log must exist"); @@ -42,44 +60,5 @@ add_task(async function () { "Check response body"); isnot(entry.timings, undefined, "Check timings"); - // Test response body limit (non zero). - await pushPref("devtools.netmonitor.responseBodyLimit", 10); - har = await reloadAndCopyAllAsHar(tab, monitor); - entry = har.log.entries[0]; - is(entry.response.content.text.length, 10, // eslint-disable-line - "Response body must be truncated"); - - // Test response body limit (zero). - await pushPref("devtools.netmonitor.responseBodyLimit", 0); - har = await reloadAndCopyAllAsHar(tab, monitor); - entry = har.log.entries[0]; - is(entry.response.content.text.length, 465, // eslint-disable-line - "Response body must not be truncated"); - return teardown(monitor); }); - -/** - * Reload the page and copy all as HAR. - */ -async function reloadAndCopyAllAsHar(tab, monitor) { - let { connector, store, windowRequire } = monitor.panelWin; - let Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); - let RequestListContextMenu = windowRequire( - "devtools/client/netmonitor/src/widgets/RequestListContextMenu"); - let { getSortedRequests } = windowRequire( - "devtools/client/netmonitor/src/selectors/index"); - - store.dispatch(Actions.batchEnable(false)); - - let wait = waitForNetworkEvents(monitor, 1); - tab.linkedBrowser.reload(); - await wait; - - let contextMenu = new RequestListContextMenu({ connector }); - - await contextMenu.copyAllAsHar(getSortedRequests(store.getState())); - - let jsonString = SpecialPowers.getClipboardData("text/unicode"); - return JSON.parse(jsonString); -} diff --git a/devtools/client/netmonitor/test/browser_net_truncate.js b/devtools/client/netmonitor/test/browser_net_truncate.js index 83245b27d219..34cca60a69fa 100644 --- a/devtools/client/netmonitor/test/browser_net_truncate.js +++ b/devtools/client/netmonitor/test/browser_net_truncate.js @@ -8,8 +8,8 @@ */ add_task(async function () { - let limit = Services.prefs.getIntPref("devtools.netmonitor.responseBodyLimit"); - let URL = EXAMPLE_URL + "sjs_truncate-test-server.sjs?limit=" + limit; + let { RESPONSE_BODY_LIMIT } = require("devtools/shared/webconsole/network-monitor"); + let URL = EXAMPLE_URL + "sjs_truncate-test-server.sjs?limit=" + RESPONSE_BODY_LIMIT; let { monitor, tab } = await initNetMonitor(URL); info("Starting test... "); diff --git a/devtools/client/preferences/devtools.js b/devtools/client/preferences/devtools.js index d74aa32f33cc..fa800694e2cb 100644 --- a/devtools/client/preferences/devtools.js +++ b/devtools/client/preferences/devtools.js @@ -165,9 +165,6 @@ pref("devtools.netmonitor.visibleColumns", "[\"status\",\"method\",\"file\",\"domain\",\"cause\",\"type\",\"transferred\",\"contentSize\",\"waterfall\"]" ); -// Save request/response bodies yes/no. -pref("devtools.netmonitor.saveRequestAndResponseBodies", true); - // The default Network monitor HAR export setting pref("devtools.netmonitor.har.defaultLogDir", ""); pref("devtools.netmonitor.har.defaultFileName", "Archive %date"); diff --git a/devtools/client/styleeditor/test/browser_styleeditor_fetch-from-netmonitor.js b/devtools/client/styleeditor/test/browser_styleeditor_fetch-from-netmonitor.js index 7a643e65a0c0..0689e68a45ea 100644 --- a/devtools/client/styleeditor/test/browser_styleeditor_fetch-from-netmonitor.js +++ b/devtools/client/styleeditor/test/browser_styleeditor_fetch-from-netmonitor.js @@ -34,10 +34,6 @@ add_task(function* () { yield ui.selectStyleSheet(ui.editors[1].styleSheet); yield ui.editors[1].getSourceEditor(); - // Wait till there is 5 requests in Netmonitor store. - // (i.e. the Styleeditor panel performed one request). - yield waitUntil(() => getSortedRequests(store.getState()).length == 5); - info("Checking Netmonitor contents."); let shortRequests = []; let longRequests = []; diff --git a/devtools/client/webconsole/webconsole-connection-proxy.js b/devtools/client/webconsole/webconsole-connection-proxy.js index f69cf66c64f8..cec613095d5f 100644 --- a/devtools/client/webconsole/webconsole-connection-proxy.js +++ b/devtools/client/webconsole/webconsole-connection-proxy.js @@ -208,15 +208,9 @@ WebConsoleConnectionProxy.prototype = { this.webConsoleClient = webConsoleClient; this._hasNativeConsoleAPI = response.nativeConsoleAPI; - let saveBodies = Services.prefs.getBoolPref( - "devtools.netmonitor.saveRequestAndResponseBodies"); - // There is no way to view response bodies from the Browser Console, so do // not waste the memory. - if (this.webConsoleFrame.isBrowserConsole) { - saveBodies = false; - } - + let saveBodies = !this.webConsoleFrame.isBrowserConsole; this.webConsoleFrame.setSaveRequestAndResponseBodies(saveBodies); this.webConsoleClient.on("networkEvent", this._onNetworkEvent); diff --git a/devtools/shared/webconsole/network-monitor.js b/devtools/shared/webconsole/network-monitor.js index 2efc5f9354d4..125ea34b3431 100644 --- a/devtools/shared/webconsole/network-monitor.js +++ b/devtools/shared/webconsole/network-monitor.js @@ -35,6 +35,11 @@ const HTTP_FOUND = 302; const HTTP_SEE_OTHER = 303; const HTTP_TEMPORARY_REDIRECT = 307; +// The maximum number of bytes a NetworkResponseListener can hold: 1 MB +const RESPONSE_BODY_LIMIT = 1048576; +// Exported for testing. +exports.RESPONSE_BODY_LIMIT = RESPONSE_BODY_LIMIT; + /** * Check if a given network request should be logged by a network monitor * based on the specified filters. @@ -274,16 +279,13 @@ function NetworkResponseListener(owner, httpActivity) { this.receivedData = ""; this.httpActivity = httpActivity; this.bodySize = 0; - // Indicates if the response had a size greater than response body limit. + // Indicates if the response had a size greater than RESPONSE_BODY_LIMIT. this.truncated = false; // Note that this is really only needed for the non-e10s case. // See bug 1309523. let channel = this.httpActivity.channel; this._wrappedNotificationCallbacks = channel.notificationCallbacks; channel.notificationCallbacks = this; - - this.responseBodyLimit = Services.prefs.getIntPref( - "devtools.netmonitor.responseBodyLimit"); } NetworkResponseListener.prototype = { @@ -395,7 +397,7 @@ NetworkResponseListener.prototype = { /** * Stores the received data, if request/response body logging is enabled. It * also does limit the number of stored bytes, based on the - * `devtools.netmonitor.responseBodyLimit` pref. + * RESPONSE_BODY_LIMIT constant. * * Learn more about nsIStreamListener at: * https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIStreamListener @@ -413,13 +415,10 @@ NetworkResponseListener.prototype = { this.bodySize += count; if (!this.httpActivity.discardResponseBody) { - let limit = Services.prefs.getIntPref("devtools.netmonitor.responseBodyLimit"); - if (this.receivedData.length < limit || limit == 0) { + if (this.receivedData.length < RESPONSE_BODY_LIMIT) { this.receivedData += NetworkHelper.convertToUnicode(data, request.contentCharset); - } - if (this.receivedData.length > limit && limit > 0) { - this.receivedData = this.receivedData.substr(0, limit); + } else { this.truncated = true; } } diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index c2171e2c53c2..b4be2188f459 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1113,12 +1113,6 @@ pref("devtools.debugger.force-local", true); // Block tools from seeing / interacting with certified apps pref("devtools.debugger.forbid-certified-apps", true); -// Limit for intercepted response bodies (1 MB) -// Possible values: -// 0 => the response body has no limit -// n => represents max number of bytes stored -pref("devtools.netmonitor.responseBodyLimit", 1048576); - // DevTools default color unit pref("devtools.defaultColorUnit", "authored"); From 1bb1ecf431193f9698e0ee090483c2ddca1535fc Mon Sep 17 00:00:00 2001 From: Amy Chan Date: Mon, 12 Mar 2018 03:31:48 -0700 Subject: [PATCH 12/50] Bug 1444325 Replaced promiseTopicObserved with TestUtils.topicObserved: r=johannh MozReview-Commit-ID: EwDv7OQRGzT --HG-- extra : rebase_source : 79623e3f256fe157307170221469b4ba9123842b --- .../test/popupNotifications/browser_popupNotification.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/browser/base/content/test/popupNotifications/browser_popupNotification.js b/browser/base/content/test/popupNotifications/browser_popupNotification.js index 813010978658..824c048a6a96 100644 --- a/browser/base/content/test/popupNotifications/browser_popupNotification.js +++ b/browser/base/content/test/popupNotifications/browser_popupNotification.js @@ -113,7 +113,7 @@ var tests = [ await BrowserTestUtils.browserLoaded(tab.linkedBrowser); isnot(gBrowser.selectedTab, tab, "new tab isn't selected"); wrongBrowserNotificationObject.browser = gBrowser.getBrowserForTab(tab); - let promiseTopic = promiseTopicObserved("PopupNotifications-backgroundShow"); + let promiseTopic = TestUtils.topicObserved("PopupNotifications-backgroundShow"); wrongBrowserNotification = showNotification(wrongBrowserNotificationObject); await promiseTopic; is(PopupNotifications.isPanelOpen, false, "panel isn't open"); @@ -147,7 +147,7 @@ var tests = [ // test that the removed notification isn't shown on browser re-select { id: "Test#6", async run() { - let promiseTopic = promiseTopicObserved("PopupNotifications-updateNotShowing"); + let promiseTopic = TestUtils.topicObserved("PopupNotifications-updateNotShowing"); gBrowser.selectedTab = gBrowser.tabs[gBrowser.tabs.length - 1]; await promiseTopic; is(PopupNotifications.isPanelOpen, false, "panel isn't open"); From e4b9aee52918cf2517bb220419dfb05926571669 Mon Sep 17 00:00:00 2001 From: Mike Ratcliffe Date: Fri, 9 Mar 2018 13:51:37 +0000 Subject: [PATCH 13/50] Bug 1444357 - Fix race conditions caused by duplicate store-objects-updated events r=ochameau This is in preparation for adding the rapid add/remove test from bug 1295761. Changes: - Added `tree.exists(item)` to fix an issue where `selectTreeItem()` was caled for an item that did not exist and then waited for an `store-objects-updated` event. It only ever received this event due to errors when writing tests. - Renamed `StorageUI.onUpdate()` to `StorageUI.onEdit()` and changed it's event name to `store-objects-edit`. - Changed tests to use `store-objects-edit` where appropriate. MozReview-Commit-ID: IAem8Penrf9 --HG-- extra : rebase_source : b818f8647958ad0688954fe5028f8d57aa119c33 --- devtools/client/shared/widgets/TreeWidget.js | 19 ++++++++++++++++ .../browser_storage_cookies_delete_all.js | 2 +- .../storage/test/browser_storage_delete.js | 2 +- .../test/browser_storage_delete_tree.js | 2 +- .../browser_storage_delete_usercontextid.js | 2 +- ...browser_storage_dynamic_updates_cookies.js | 19 ++++++---------- ...er_storage_dynamic_updates_localStorage.js | 8 +++---- ..._storage_dynamic_updates_sessionStorage.js | 7 +++--- .../test/browser_storage_indexeddb_delete.js | 3 +-- ...rowser_storage_indexeddb_delete_blocked.js | 4 ++-- devtools/client/storage/test/head.js | 10 +++++++-- devtools/client/storage/ui.js | 22 +++++++++---------- 12 files changed, 58 insertions(+), 42 deletions(-) diff --git a/devtools/client/shared/widgets/TreeWidget.js b/devtools/client/shared/widgets/TreeWidget.js index cc927b9c2c20..8678f6176989 100644 --- a/devtools/client/shared/widgets/TreeWidget.js +++ b/devtools/client/shared/widgets/TreeWidget.js @@ -272,6 +272,25 @@ TreeWidget.prototype = { this.setPlaceholderText(""); }, + /** + * Check if an item exists. + * + * @param {array} item + * The array of ids leading up to the item. + */ + exists: function (item) { + let bookmark = this.root; + + for (let id of item) { + if (bookmark.items.has(id)) { + bookmark = bookmark.items.get(id); + } else { + return false; + } + } + return true; + }, + /** * Removes the specified item and all of its child items from the tree. * diff --git a/devtools/client/storage/test/browser_storage_cookies_delete_all.js b/devtools/client/storage/test/browser_storage_cookies_delete_all.js index b8c0418f895d..6fc8bc2a9b2a 100644 --- a/devtools/client/storage/test/browser_storage_cookies_delete_all.js +++ b/devtools/client/storage/test/browser_storage_cookies_delete_all.js @@ -22,7 +22,7 @@ function* performDelete(store, rowName, action) { yield selectTreeItem(store); - let eventWait = gUI.once("store-objects-updated"); + let eventWait = gUI.once("store-objects-edit"); let cells = getRowCells(rowName, true); yield waitForContextMenu(contextMenu, cells.name, () => { diff --git a/devtools/client/storage/test/browser_storage_delete.js b/devtools/client/storage/test/browser_storage_delete.js index f154c6a6827c..4d02d8ac0d66 100644 --- a/devtools/client/storage/test/browser_storage_delete.js +++ b/devtools/client/storage/test/browser_storage_delete.js @@ -38,7 +38,7 @@ add_task(function* () { let row = getRowCells(rowName); ok(gUI.table.items.has(rowName), `There is a row '${rowName}' in ${treeItemName}`); - let eventWait = gUI.once("store-objects-updated"); + let eventWait = gUI.once("store-objects-edit"); yield waitForContextMenu(contextMenu, row[cellToClick], () => { info(`Opened context menu in ${treeItemName}, row '${rowName}'`); diff --git a/devtools/client/storage/test/browser_storage_delete_tree.js b/devtools/client/storage/test/browser_storage_delete_tree.js index 32fd410a0d84..fbd56166c2b5 100644 --- a/devtools/client/storage/test/browser_storage_delete_tree.js +++ b/devtools/client/storage/test/browser_storage_delete_tree.js @@ -50,7 +50,7 @@ add_task(function* () { yield selectTreeItem(store); let eventName = "store-objects-" + - (store[0] == "cookies" ? "updated" : "cleared"); + (store[0] == "cookies" ? "edit" : "cleared"); let eventWait = gUI.once(eventName); let selector = `[data-id='${JSON.stringify(store)}'] > .tree-widget-item`; diff --git a/devtools/client/storage/test/browser_storage_delete_usercontextid.js b/devtools/client/storage/test/browser_storage_delete_usercontextid.js index c9b84771b51d..f690bbee6b43 100644 --- a/devtools/client/storage/test/browser_storage_delete_usercontextid.js +++ b/devtools/client/storage/test/browser_storage_delete_usercontextid.js @@ -154,7 +154,7 @@ add_task(function* () { let row = getRowCells(rowName); ok(gUI.table.items.has(rowName), `There is a row '${rowName}' in ${treeItemName}`); - let eventWait = gUI.once("store-objects-updated"); + let eventWait = gUI.once("store-objects-edit"); yield waitForContextMenu(contextMenu, row[cellToClick], () => { info(`Opened context menu in ${treeItemName}, row '${rowName}'`); diff --git a/devtools/client/storage/test/browser_storage_dynamic_updates_cookies.js b/devtools/client/storage/test/browser_storage_dynamic_updates_cookies.js index b4ab388e8820..124f7f0f1284 100644 --- a/devtools/client/storage/test/browser_storage_dynamic_updates_cookies.js +++ b/devtools/client/storage/test/browser_storage_dynamic_updates_cookies.js @@ -53,8 +53,7 @@ add_task(function* () { checkCell(c1id, "value", "1.2.3.4.5.6.7"); gWindow.addCookie("c1", '{"foo": 4,"bar":6}', "/browser"); - yield gUI.once("sidebar-updated"); - yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-edit"); yield findVariableViewProperties(finalValue[0], false); yield findVariableViewProperties(finalValue[1], true); @@ -73,7 +72,7 @@ add_task(function* () { // Add a new entry gWindow.addCookie("c3", "booyeah"); - yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-edit"); yield checkState([ [ @@ -93,9 +92,7 @@ add_task(function* () { // Add another gWindow.addCookie("c4", "booyeah"); - // Wait once for update and another time for value fetching - yield gUI.once("store-objects-updated"); - yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-edit"); yield checkState([ [ @@ -117,8 +114,7 @@ add_task(function* () { // Removing cookies gWindow.removeCookie("c1", "/browser"); - yield gUI.once("sidebar-updated"); - yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-edit"); yield checkState([ [ @@ -141,7 +137,7 @@ add_task(function* () { // Keep deleting till no rows gWindow.removeCookie("c3"); - yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-edit"); yield checkState([ [ @@ -159,8 +155,7 @@ add_task(function* () { gWindow.removeCookie("c2", "/browser"); - yield gUI.once("sidebar-updated"); - yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-edit"); yield checkState([ [ @@ -177,7 +172,7 @@ add_task(function* () { gWindow.removeCookie("c4"); - yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-edit"); yield checkState([ [["cookies", "http://test1.example.org"], [ ]], diff --git a/devtools/client/storage/test/browser_storage_dynamic_updates_localStorage.js b/devtools/client/storage/test/browser_storage_dynamic_updates_localStorage.js index 6980e3e55444..576aadf56134 100644 --- a/devtools/client/storage/test/browser_storage_dynamic_updates_localStorage.js +++ b/devtools/client/storage/test/browser_storage_dynamic_updates_localStorage.js @@ -22,7 +22,7 @@ add_task(function* () { gWindow.localStorage.removeItem("ls4"); - yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-edit"); yield checkState([ [ @@ -33,8 +33,7 @@ add_task(function* () { gWindow.localStorage.setItem("ls4", "again"); - yield gUI.once("store-objects-updated"); - yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-edit"); yield checkState([ [ @@ -45,8 +44,7 @@ add_task(function* () { // Updating a row gWindow.localStorage.setItem("ls2", "ls2-changed"); - yield gUI.once("store-objects-updated"); - yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-edit"); checkCell("ls2", "value", "ls2-changed"); diff --git a/devtools/client/storage/test/browser_storage_dynamic_updates_sessionStorage.js b/devtools/client/storage/test/browser_storage_dynamic_updates_sessionStorage.js index bc2a2204cef9..4c07a2dd1e8d 100644 --- a/devtools/client/storage/test/browser_storage_dynamic_updates_sessionStorage.js +++ b/devtools/client/storage/test/browser_storage_dynamic_updates_sessionStorage.js @@ -22,8 +22,7 @@ add_task(function* () { gWindow.sessionStorage.setItem("ss4", "new-item"); - yield gUI.once("store-objects-updated"); - yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-edit"); yield checkState([ [ @@ -36,11 +35,11 @@ add_task(function* () { gWindow.sessionStorage.removeItem("ss3"); - yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-edit"); gWindow.sessionStorage.removeItem("ss1"); - yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-edit"); yield checkState([ [ diff --git a/devtools/client/storage/test/browser_storage_indexeddb_delete.js b/devtools/client/storage/test/browser_storage_indexeddb_delete.js index b4f5db7ed63e..16757a474c21 100644 --- a/devtools/client/storage/test/browser_storage_indexeddb_delete.js +++ b/devtools/client/storage/test/browser_storage_indexeddb_delete.js @@ -25,8 +25,7 @@ add_task(function* () { yield selectTreeItem(deletedDb); // Wait once for update and another time for value fetching - let eventWait = gUI.once("store-objects-updated").then( - () => gUI.once("store-objects-updated")); + let eventWait = gUI.once("store-objects-updated"); let selector = `[data-id='${JSON.stringify(deletedDb)}'] > .tree-widget-item`; let target = gPanelWindow.document.querySelector(selector); diff --git a/devtools/client/storage/test/browser_storage_indexeddb_delete_blocked.js b/devtools/client/storage/test/browser_storage_indexeddb_delete_blocked.js index b4c42bf288d0..9136bc44aa6a 100644 --- a/devtools/client/storage/test/browser_storage_indexeddb_delete_blocked.js +++ b/devtools/client/storage/test/browser_storage_indexeddb_delete_blocked.js @@ -28,7 +28,7 @@ add_task(function* () { [["indexedDB", "http://test1.example.org"], ["idb (default)"]] ]); - let eventWait = gUI.once("store-objects-updated"); + let eventWait = gUI.once("store-objects-edit"); info("telling content to close the db"); yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () { @@ -36,7 +36,7 @@ add_task(function* () { yield win.closeDb(); }); - info("waiting for store update events"); + info("waiting for store edit events"); yield eventWait; info("test state after real delete"); diff --git a/devtools/client/storage/test/head.js b/devtools/client/storage/test/head.js index 5d51c855c09b..57c2c6934a55 100644 --- a/devtools/client/storage/test/head.js +++ b/devtools/client/storage/test/head.js @@ -512,11 +512,17 @@ function matchVariablesViewProperty(prop, rule) { * The array id of the item in the tree */ function* selectTreeItem(ids) { - /* If this item is already selected, return */ if (gUI.tree.isSelected(ids)) { + info(`"${ids}" is already selected, returning.`); + return; + } + if (!gUI.tree.exists(ids)) { + info(`"${ids}" does not exist, returning.`); return; } + // The item exists but is not selected... select it. + info(`Selecting "${ids}".`); let updated = gUI.once("store-objects-updated"); gUI.tree.selectedItem = ids; yield updated; @@ -979,7 +985,7 @@ function* performAdd(store) { } let eventEdit = gUI.table.once("row-edit"); - let eventWait = gUI.once("store-objects-updated"); + let eventWait = gUI.once("store-objects-edit"); menuAdd.click(); diff --git a/devtools/client/storage/ui.js b/devtools/client/storage/ui.js index 51911630948e..109a14e17b47 100644 --- a/devtools/client/storage/ui.js +++ b/devtools/client/storage/ui.js @@ -141,8 +141,8 @@ class StorageUI { console.error(e); }); - this.onUpdate = this.onUpdate.bind(this); - this.front.on("stores-update", this.onUpdate); + this.onEdit = this.onEdit.bind(this); + this.front.on("stores-update", this.onEdit); this.onCleared = this.onCleared.bind(this); this.front.on("stores-cleared", this.onCleared); @@ -216,7 +216,7 @@ class StorageUI { this.table.off(TableWidget.EVENTS.CELL_EDIT, this.editItem); this.table.destroy(); - this.front.off("stores-update", this.onUpdate); + this.front.off("stores-update", this.onEdit); this.front.off("stores-cleared", this.onCleared); this._panelDoc.removeEventListener("keypress", this.handleKeypress); this.searchBox.removeEventListener("input", this.filterItems); @@ -401,7 +401,7 @@ class StorageUI { * of the changed store objects. This array is empty for deleted object * if the host was completely removed. */ - async onUpdate({ changed, added, deleted }) { + async onEdit({ changed, added, deleted }) { if (added) { await this.handleAddedItems(added); } @@ -421,14 +421,14 @@ class StorageUI { } if (added || deleted || changed) { - this.emit("store-objects-updated"); + this.emit("store-objects-edit"); } } /** - * Handle added items received by onUpdate + * Handle added items received by onEdit * - * @param {object} See onUpdate docs + * @param {object} See onEdit docs */ async handleAddedItems(added) { for (let type in added) { @@ -460,9 +460,9 @@ class StorageUI { } /** - * Handle deleted items received by onUpdate + * Handle deleted items received by onEdit * - * @param {object} See onUpdate docs + * @param {object} See onEdit docs */ async handleDeletedItems(deleted) { for (let type in deleted) { @@ -512,9 +512,9 @@ class StorageUI { } /** - * Handle changed items received by onUpdate + * Handle changed items received by onEdit * - * @param {object} See onUpdate docs + * @param {object} See onEdit docs */ async handleChangedItems(changed) { let [type, host, db, objectStore] = this.tree.selectedItem; From 28f08cc0dca853edae46358ccd52589aeac67cc6 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Wed, 7 Mar 2018 17:24:01 +0000 Subject: [PATCH 14/50] Bug 1443835 - Prevent modifications to the root folder via PlacesUtils.bookmarks.insert and PlacesUtils.bookmarks.update. r=mak MozReview-Commit-ID: KQjxc3PA2SY --HG-- extra : rebase_source : 1a6063f424271ac3bfdae23af25a4e8abdd71ac9 --- .../places/tests/browser/browser.ini | 1 - .../browser_0_library_left_pane_migration.js | 87 ---------- .../components/places/tests/chrome/chrome.ini | 1 - .../chrome/test_0_multiple_left_pane.xul | 78 --------- .../sync/tests/unit/test_bookmark_tracker.js | 125 -------------- .../components/places/BookmarkJSONUtils.jsm | 8 +- toolkit/components/places/Bookmarks.jsm | 5 +- .../test_417228-exclude-from-backup.js | 142 ---------------- .../bookmarks/test_417228-other-roots.js | 152 ------------------ .../tests/bookmarks/test_bookmarks_insert.js | 19 +++ .../tests/bookmarks/test_bookmarks_remove.js | 8 - .../tests/bookmarks/test_bookmarks_update.js | 32 +++- .../places/tests/bookmarks/xpcshell.ini | 2 - .../places/tests/queries/head_queries.js | 2 +- .../places/tests/sync/test_sync_utils.js | 79 --------- .../tests/unit/test_async_transactions.js | 46 +++--- 16 files changed, 83 insertions(+), 704 deletions(-) delete mode 100644 browser/components/places/tests/browser/browser_0_library_left_pane_migration.js delete mode 100644 browser/components/places/tests/chrome/test_0_multiple_left_pane.xul delete mode 100644 toolkit/components/places/tests/bookmarks/test_417228-exclude-from-backup.js delete mode 100644 toolkit/components/places/tests/bookmarks/test_417228-other-roots.js diff --git a/browser/components/places/tests/browser/browser.ini b/browser/components/places/tests/browser/browser.ini index 03fa30232f80..85e4c2c0badd 100644 --- a/browser/components/places/tests/browser/browser.ini +++ b/browser/components/places/tests/browser/browser.ini @@ -11,7 +11,6 @@ support-files = sidebarpanels_click_test_page.html keyword_form.html -[browser_0_library_left_pane_migration.js] [browser_addBookmarkForFrame.js] [browser_bookmark_add_tags.js] skip-if = (os == 'win' && ccov) # Bug 1423667 diff --git a/browser/components/places/tests/browser/browser_0_library_left_pane_migration.js b/browser/components/places/tests/browser/browser_0_library_left_pane_migration.js deleted file mode 100644 index 62909d8f7e5e..000000000000 --- a/browser/components/places/tests/browser/browser_0_library_left_pane_migration.js +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -/** - * Test we correctly migrate Library left pane to the latest version. - * Note: this test MUST be the first between browser chrome tests, or results - * of next tests could be unexpected due to PlacesUIUtils getters. - */ - -const TEST_URI = "http://www.mozilla.org/"; - -add_task(async function() { - ok(PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION > 0, - "Left pane version in chrome context, current version is: " + PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION ); - - // Check if we have any left pane folder already set, remove it eventually. - let leftPaneItems = PlacesUtils.annotations - .getItemsWithAnnotation(PlacesUIUtils.ORGANIZER_FOLDER_ANNO); - if (leftPaneItems.length > 0) { - // The left pane has already been created, touching it now would cause - // next tests to rely on wrong values (and possibly crash) - is(leftPaneItems.length, 1, "We correctly have only 1 left pane folder"); - // Check version. - let version = PlacesUtils.annotations.getItemAnnotation(leftPaneItems[0], - PlacesUIUtils.ORGANIZER_FOLDER_ANNO); - is(version, PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION, "Left pane version is actual"); - ok(true, "left pane has already been created, skipping test"); - return; - } - - // Create a fake left pane folder with an old version (current version - 1). - let folder = await PlacesUtils.bookmarks.insert({ - parentGuid: PlacesUtils.bookmarks.rootGuid, - index: PlacesUtils.bookmarks.DEFAULT_INDEX, - type: PlacesUtils.bookmarks.TYPE_FOLDER, - title: "" - }); - - let folderId = await PlacesUtils.promiseItemId(folder.guid); - PlacesUtils.annotations.setItemAnnotation(folderId, - PlacesUIUtils.ORGANIZER_FOLDER_ANNO, - PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION - 1, - 0, - PlacesUtils.annotations.EXPIRE_NEVER); - - // Check fake left pane root has been correctly created. - leftPaneItems = - PlacesUtils.annotations.getItemsWithAnnotation(PlacesUIUtils.ORGANIZER_FOLDER_ANNO); - is(leftPaneItems.length, 1, "We correctly have only 1 left pane folder"); - is(leftPaneItems[0], folderId, "left pane root itemId is correct"); - - // Check version. - let version = PlacesUtils.annotations.getItemAnnotation(folderId, - PlacesUIUtils.ORGANIZER_FOLDER_ANNO); - is(version, PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION - 1, "Left pane version correctly set"); - - // Open Library, this will upgrade our left pane version. - let organizer = await promiseLibrary(); - - // Check left pane. - ok(PlacesUIUtils.leftPaneFolderId > 0, "Left pane folder correctly created"); - leftPaneItems = - PlacesUtils.annotations.getItemsWithAnnotation(PlacesUIUtils.ORGANIZER_FOLDER_ANNO); - is(leftPaneItems.length, 1, "We correctly have only 1 left pane folder"); - let leftPaneRoot = leftPaneItems[0]; - is(leftPaneRoot, PlacesUIUtils.leftPaneFolderId, - "leftPaneFolderId getter has correct value"); - - // Check version has been upgraded. - version = PlacesUtils.annotations.getItemAnnotation(leftPaneRoot, - PlacesUIUtils.ORGANIZER_FOLDER_ANNO); - is(version, PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION, - "Left pane version has been correctly upgraded"); - - // Check left pane is populated. - organizer.PlacesOrganizer.selectLeftPaneBuiltIn("History"); - is(organizer.PlacesOrganizer._places.selectedNode.itemId, - PlacesUIUtils.leftPaneQueries.History, - "Library left pane is populated and working"); - - await promiseLibraryClosed(organizer); -}); diff --git a/browser/components/places/tests/chrome/chrome.ini b/browser/components/places/tests/chrome/chrome.ini index b07430313438..74747d72d50e 100644 --- a/browser/components/places/tests/chrome/chrome.ini +++ b/browser/components/places/tests/chrome/chrome.ini @@ -2,7 +2,6 @@ support-files = head.js [test_0_bug510634.xul] -[test_0_multiple_left_pane.xul] [test_bug1163447_selectItems_through_shortcut.xul] skip-if = (os == 'win' && ccov) # Bug 1423667 [test_bug427633_no_newfolder_if_noip.xul] diff --git a/browser/components/places/tests/chrome/test_0_multiple_left_pane.xul b/browser/components/places/tests/chrome/test_0_multiple_left_pane.xul deleted file mode 100644 index 9bf7c94d3478..000000000000 --- a/browser/components/places/tests/chrome/test_0_multiple_left_pane.xul +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/services/sync/tests/unit/test_bookmark_tracker.js b/services/sync/tests/unit/test_bookmark_tracker.js index 2ba7f852629c..d916b1775509 100644 --- a/services/sync/tests/unit/test_bookmark_tracker.js +++ b/services/sync/tests/unit/test_bookmark_tracker.js @@ -200,131 +200,6 @@ function setAnnoUnchecked(itemId, name, value, type) { ); } -add_task(async function test_leftPaneFolder() { - _("Ensure we never track left pane roots"); - - try { - await startTracking(); - - // Creates the organizer queries as a side effect. - let leftPaneId = PlacesUIUtils.maybeRebuildLeftPane(); - _(`Left pane root ID: ${leftPaneId}`); - - { - await PlacesTestUtils.promiseAsyncUpdates(); - let changes = await tracker.getChangedIDs(); - deepEqual(changes, {}, "New left pane queries should not be tracked"); - Assert.equal(tracker.score, SCORE_INCREMENT_XLARGE); - } - - _("Reset synced bookmarks to simulate a disconnect"); - await PlacesSyncUtils.bookmarks.reset(); - - { - await PlacesTestUtils.promiseAsyncUpdates(); - let changes = await tracker.getChangedIDs(); - deepEqual(Object.keys(changes).sort(), ["menu", "mobile", "toolbar", "unfiled"], - "Left pane queries should not be tracked after reset"); - Assert.equal(tracker.score, SCORE_INCREMENT_XLARGE); - await PlacesTestUtils.markBookmarksAsSynced(); - } - - // The following tests corrupt the left pane queries in different ways. - // `PlacesUIUtils.maybeRebuildLeftPane` will rebuild the entire root, but - // none of those changes should be tracked by Sync. - - _("Annotate unrelated folder as left pane root"); - { - let folder = await PlacesUtils.bookmarks.insert({ - parentGuid: PlacesUtils.bookmarks.rootGuid, - type: PlacesUtils.bookmarks.TYPE_FOLDER, - title: "Fake left pane root", - }); - let folderId = await PlacesUtils.promiseItemId(folder.guid); - await setAnnoUnchecked(folderId, PlacesUIUtils.ORGANIZER_FOLDER_ANNO, 0, - PlacesUtils.annotations.TYPE_INT32); - - leftPaneId = PlacesUIUtils.maybeRebuildLeftPane(); - _(`Left pane root ID after deleting unrelated folder: ${leftPaneId}`); - - await PlacesTestUtils.promiseAsyncUpdates(); - let changes = await tracker.getChangedIDs(); - deepEqual(changes, {}, - "Should not track left pane items after deleting unrelated folder"); - } - - _("Corrupt organizer left pane version"); - { - await setAnnoUnchecked(leftPaneId, PlacesUIUtils.ORGANIZER_FOLDER_ANNO, - -1, PlacesUtils.annotations.TYPE_INT32); - - leftPaneId = PlacesUIUtils.maybeRebuildLeftPane(); - _(`Left pane root ID after restoring version: ${leftPaneId}`); - - await PlacesTestUtils.promiseAsyncUpdates(); - let changes = await tracker.getChangedIDs(); - deepEqual(changes, {}, - "Should not track left pane items after restoring version"); - } - - _("Set left pane anno on nonexistent item"); - { - await setAnnoUnchecked(999, PlacesUIUtils.ORGANIZER_QUERY_ANNO, - "Tags", PlacesUtils.annotations.TYPE_STRING); - - leftPaneId = PlacesUIUtils.maybeRebuildLeftPane(); - _(`Left pane root ID after detecting nonexistent item: ${leftPaneId}`); - - await PlacesTestUtils.promiseAsyncUpdates(); - let changes = await tracker.getChangedIDs(); - deepEqual(changes, {}, - "Should not track left pane items after detecting nonexistent item"); - } - - _("Move query out of left pane root"); - { - let queryId = await PlacesUIUtils.leftPaneQueries.Downloads; - let queryGuid = await PlacesUtils.promiseItemGuid(queryId); - await PlacesUtils.bookmarks.update({ - guid: queryGuid, - parentGuid: PlacesUtils.bookmarks.rootGuid, - index: PlacesUtils.bookmarks.DEFAULT_INDEX, - }); - - leftPaneId = PlacesUIUtils.maybeRebuildLeftPane(); - _(`Left pane root ID after restoring moved query: ${leftPaneId}`); - - await PlacesTestUtils.promiseAsyncUpdates(); - let changes = await tracker.getChangedIDs(); - deepEqual(changes, {}, - "Should not track left pane items after restoring moved query"); - } - - _("Add duplicate query"); - { - let leftPaneGuid = await PlacesUtils.promiseItemGuid(leftPaneId); - let query = await PlacesUtils.bookmarks.insert({ - parentGuid: leftPaneGuid, - url: `place:folder=TAGS`, - }); - let queryId = await PlacesUtils.promiseItemId(query.guid); - await setAnnoUnchecked(queryId, PlacesUIUtils.ORGANIZER_QUERY_ANNO, - "Tags", PlacesUtils.annotations.TYPE_STRING); - - leftPaneId = PlacesUIUtils.maybeRebuildLeftPane(); - _(`Left pane root ID after removing dupe query: ${leftPaneId}`); - - await PlacesTestUtils.promiseAsyncUpdates(); - let changes = await tracker.getChangedIDs(); - deepEqual(changes, {}, - "Should not track left pane items after removing dupe query"); - } - } finally { - _("Clean up."); - await cleanup(); - } -}); - add_task(async function test_tracking() { _("Test starting and stopping the tracker"); diff --git a/toolkit/components/places/BookmarkJSONUtils.jsm b/toolkit/components/places/BookmarkJSONUtils.jsm index 6bfa865aec41..c9b90d3a501c 100644 --- a/toolkit/components/places/BookmarkJSONUtils.jsm +++ b/toolkit/components/places/BookmarkJSONUtils.jsm @@ -267,12 +267,10 @@ BookmarkImporter.prototype = { continue; } - // Places is moving away from supporting user-defined folders at the top - // of the tree, however, until we have a migration strategy we need to - // ensure any non-built-in folders are created (xref bug 1310299). + // Drop any roots whose guid we don't recognise - we don't support anything + // apart from the built-in roots. if (!PlacesUtils.bookmarks.userContentRoots.includes(node.guid)) { - node.parentGuid = PlacesUtils.bookmarks.rootGuid; - await PlacesUtils.bookmarks.insert(node); + continue; } await PlacesUtils.bookmarks.insertTree(node, { fixupOrSkipInvalidEntries: true }); diff --git a/toolkit/components/places/Bookmarks.jsm b/toolkit/components/places/Bookmarks.jsm index 072a87f8ea45..84668f54c5cd 100644 --- a/toolkit/components/places/Bookmarks.jsm +++ b/toolkit/components/places/Bookmarks.jsm @@ -241,7 +241,9 @@ var Bookmarks = Object.freeze({ index: { defaultValue: this.DEFAULT_INDEX }, url: { requiredIf: b => b.type == this.TYPE_BOOKMARK, validIf: b => b.type == this.TYPE_BOOKMARK }, - parentGuid: { required: true }, + parentGuid: { required: true, + // Inserting into the root folder is not allowed. + validIf: b => b.parentGuid != this.rootGuid }, title: { defaultValue: "", validIf: b => b.type == this.TYPE_BOOKMARK || b.type == this.TYPE_FOLDER || @@ -610,6 +612,7 @@ var Bookmarks = Object.freeze({ { guid: { required: true }, index: { requiredIf: b => b.hasOwnProperty("parentGuid"), validIf: b => b.index >= 0 || b.index == this.DEFAULT_INDEX }, + parentGuid: { validIf: b => b.parentGuid != this.rootGuid }, source: { defaultValue: this.SOURCES.DEFAULT } }); diff --git a/toolkit/components/places/tests/bookmarks/test_417228-exclude-from-backup.js b/toolkit/components/places/tests/bookmarks/test_417228-exclude-from-backup.js deleted file mode 100644 index 7be66c9f9d0e..000000000000 --- a/toolkit/components/places/tests/bookmarks/test_417228-exclude-from-backup.js +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// Menu, Toolbar, Unsorted, Tags, Mobile -const PLACES_ROOTS_COUNT = 5; - -/* - -Backup/restore tests example: - -var myTest = { - populate: function () { ... add bookmarks ... }, - validate: function () { ... query for your bookmarks ... } -} - -this.push(myTest); - -*/ - -var test = { - populate: function populate() { - // check initial size - var rootNode = PlacesUtils.getFolderContents(PlacesUtils.placesRootId, - false, false).root; - Assert.equal(rootNode.childCount, PLACES_ROOTS_COUNT ); - rootNode.containerOpen = false; - - var idx = PlacesUtils.bookmarks.DEFAULT_INDEX; - - // create a root to be restore - this._restoreRootTitle = "restore root"; - var restoreRootId = PlacesUtils.bookmarks - .createFolder(PlacesUtils.placesRootId, - this._restoreRootTitle, idx); - // add a test bookmark - this._restoreRootURI = uri("http://restore.uri"); - PlacesUtils.bookmarks.insertBookmark(restoreRootId, this._restoreRootURI, - idx, "restore uri"); - // add a test bookmark to be exclude - this._restoreRootExcludeURI = uri("http://exclude.uri"); - var exItemId = PlacesUtils.bookmarks - .insertBookmark(restoreRootId, - this._restoreRootExcludeURI, - idx, "exclude uri"); - // Annotate the bookmark for exclusion. - PlacesUtils.annotations.setItemAnnotation(exItemId, - PlacesUtils.EXCLUDE_FROM_BACKUP_ANNO, 1, 0, - PlacesUtils.annotations.EXPIRE_NEVER); - - // create a root to be exclude - this._excludeRootTitle = "exclude root"; - this._excludeRootId = PlacesUtils.bookmarks - .createFolder(PlacesUtils.placesRootId, - this._excludeRootTitle, idx); - // Annotate the root for exclusion. - PlacesUtils.annotations.setItemAnnotation(this._excludeRootId, - PlacesUtils.EXCLUDE_FROM_BACKUP_ANNO, 1, 0, - PlacesUtils.annotations.EXPIRE_NEVER); - // add a test bookmark exclude by exclusion of its parent - PlacesUtils.bookmarks.insertBookmark(this._excludeRootId, - this._restoreRootExcludeURI, - idx, "exclude uri"); - }, - - validate: function validate(aEmptyBookmarks) { - var rootNode = PlacesUtils.getFolderContents(PlacesUtils.placesRootId, - false, false).root; - - if (!aEmptyBookmarks) { - // since restore does not remove backup exclude items both - // roots should still exist. - Assert.equal(rootNode.childCount, PLACES_ROOTS_COUNT + 2); - // open exclude root and check it still contains one item - var restoreRootIndex = PLACES_ROOTS_COUNT; - var excludeRootIndex = PLACES_ROOTS_COUNT + 1; - var excludeRootNode = rootNode.getChild(excludeRootIndex); - Assert.equal(this._excludeRootTitle, excludeRootNode.title); - excludeRootNode.QueryInterface(Ci.nsINavHistoryQueryResultNode); - excludeRootNode.containerOpen = true; - Assert.equal(excludeRootNode.childCount, 1); - var excludeRootChildNode = excludeRootNode.getChild(0); - Assert.equal(excludeRootChildNode.uri, this._restoreRootExcludeURI.spec); - excludeRootNode.containerOpen = false; - } else { - // exclude root should not exist anymore - Assert.equal(rootNode.childCount, PLACES_ROOTS_COUNT + 1); - restoreRootIndex = PLACES_ROOTS_COUNT; - } - - var restoreRootNode = rootNode.getChild(restoreRootIndex); - Assert.equal(this._restoreRootTitle, restoreRootNode.title); - restoreRootNode.QueryInterface(Ci.nsINavHistoryQueryResultNode); - restoreRootNode.containerOpen = true; - Assert.equal(restoreRootNode.childCount, 1); - var restoreRootChildNode = restoreRootNode.getChild(0); - Assert.equal(restoreRootChildNode.uri, this._restoreRootURI.spec); - restoreRootNode.containerOpen = false; - - rootNode.containerOpen = false; - } -}; - -// make json file -var jsonFile; - -add_task(async function setup() { - jsonFile = OS.Path.join(OS.Constants.Path.profileDir, "bookmarks.json"); -}); - -add_task(async function test_export_import_excluded_file() { - // populate db - test.populate(); - - await BookmarkJSONUtils.exportToFile(jsonFile); - - // restore json file - info("Restoring json file"); - await BookmarkJSONUtils.importFromFile(jsonFile, true); - - // validate without removing all bookmarks - // restore do not remove backup exclude entries - info("Validating..."); - test.validate(false); -}); - -add_task(async function test_clearing_then_importing() { - // cleanup - await PlacesUtils.bookmarks.eraseEverything(); - // manually remove the excluded root - PlacesUtils.bookmarks.removeItem(test._excludeRootId); - // restore json file - await BookmarkJSONUtils.importFromFile(jsonFile, true); - - // validate after a complete bookmarks cleanup - test.validate(true); - - // clean up - await OS.File.remove(jsonFile); -}); diff --git a/toolkit/components/places/tests/bookmarks/test_417228-other-roots.js b/toolkit/components/places/tests/bookmarks/test_417228-other-roots.js deleted file mode 100644 index 9b87144e1ad3..000000000000 --- a/toolkit/components/places/tests/bookmarks/test_417228-other-roots.js +++ /dev/null @@ -1,152 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -var tests = []; - -/* - -Backup/restore tests example: - -var myTest = { - populate: function () { ... add bookmarks ... }, - validate: function () { ... query for your bookmarks ... } -} - -this.push(myTest); - -*/ - -tests.push({ - // Initialise something to avoid undefined property warnings in validate. - _litterTitle: "", - - async populate() { - // check initial size - var rootNode = PlacesUtils.getFolderContents(PlacesUtils.placesRootId, - false, false).root; - Assert.equal(rootNode.childCount, 5); - - // create a test root - this._folderTitle = "test folder"; - this._folderId = - PlacesUtils.bookmarks.createFolder(PlacesUtils.placesRootId, - this._folderTitle, - PlacesUtils.bookmarks.DEFAULT_INDEX); - Assert.equal(rootNode.childCount, 6); - - // add a tag - this._testURI = Services.io.newURI("http://test"); - this._tags = ["a", "b"]; - PlacesUtils.tagging.tagURI(this._testURI, this._tags); - - // add a child to each root, including our test root - await PlacesUtils.bookmarks.eraseEverything(); - this._roots = [PlacesUtils.bookmarksMenuFolderId, PlacesUtils.toolbarFolderId, - PlacesUtils.unfiledBookmarksFolderId, PlacesUtils.mobileFolderId, - this._folderId]; - - this._roots.forEach(aRootId => { - // add a test bookmark - PlacesUtils.bookmarks.insertBookmark(aRootId, this._testURI, - PlacesUtils.bookmarks.DEFAULT_INDEX, "test"); - }); - - // add a folder to exclude from replacing during restore - // this will still be present post-restore - var excludedFolderId = - PlacesUtils.bookmarks.createFolder(PlacesUtils.placesRootId, - "excluded", - PlacesUtils.bookmarks.DEFAULT_INDEX); - Assert.equal(rootNode.childCount, 7); - - // add a test bookmark to it - PlacesUtils.bookmarks.insertBookmark(excludedFolderId, this._testURI, - PlacesUtils.bookmarks.DEFAULT_INDEX, "test"); - }, - - inbetween: function inbetween() { - // add some items that should be removed by the restore - - // add a folder - this._litterTitle = "otter"; - PlacesUtils.bookmarks.createFolder(PlacesUtils.placesRootId, - this._litterTitle, 0); - - // add some tags - PlacesUtils.tagging.tagURI(this._testURI, ["c", "d"]); - }, - - validate: function validate() { - // validate tags restored - var tags = PlacesUtils.tagging.getTagsForURI(this._testURI); - // also validates that litter tags are gone - Assert.equal(this._tags.toString(), tags.toString()); - - var rootNode = PlacesUtils.getFolderContents(PlacesUtils.placesRootId, - false, false).root; - - // validate litter is gone - Assert.notEqual(rootNode.getChild(0).title, this._litterTitle); - - // test root count is the same - Assert.equal(rootNode.childCount, 7); - - var foundTestFolder = 0; - for (var i = 0; i < rootNode.childCount; i++) { - var node = rootNode.getChild(i); - - info("validating " + node.title); - if (node.itemId != PlacesUtils.tagsFolderId) { - if (node.title == this._folderTitle) { - // check the test folder's properties - Assert.equal(node.type, node.RESULT_TYPE_FOLDER); - Assert.equal(node.title, this._folderTitle); - foundTestFolder++; - } - - // test contents - node.QueryInterface(Ci.nsINavHistoryContainerResultNode).containerOpen = true; - Assert.equal(node.childCount, 1); - var child = node.getChild(0); - Assert.ok(Services.io.newURI(child.uri).equals(this._testURI)); - - // clean up - node.containerOpen = false; - } - } - Assert.equal(foundTestFolder, 1); - rootNode.containerOpen = false; - } -}); - -add_task(async function() { - // make json file - let jsonFile = OS.Path.join(OS.Constants.Path.profileDir, "bookmarks.json"); - - // populate db - for (let test of tests) { - await test.populate(); - // sanity - test.validate(); - } - - await BookmarkJSONUtils.exportToFile(jsonFile); - - tests.forEach(function(aTest) { - aTest.inbetween(); - }); - - // restore json file - await BookmarkJSONUtils.importFromFile(jsonFile, true); - - // validate - tests.forEach(function(aTest) { - aTest.validate(); - }); - - // clean up - await OS.File.remove(jsonFile); -}); diff --git a/toolkit/components/places/tests/bookmarks/test_bookmarks_insert.js b/toolkit/components/places/tests/bookmarks/test_bookmarks_insert.js index 2497f3387a06..98004575b049 100644 --- a/toolkit/components/places/tests/bookmarks/test_bookmarks_insert.js +++ b/toolkit/components/places/tests/bookmarks/test_bookmarks_insert.js @@ -91,6 +91,25 @@ add_task(async function invalid_properties_for_bookmark_type() { /Invalid value for property 'title'/); }); +add_task(async function test_insert_into_root_throws() { + Assert.throws(() => + PlacesUtils.bookmarks.insert({ + parentGuid: PlacesUtils.bookmarks.rootGuid, + url: "http://example.com", + }), + /Invalid value for property 'parentGuid'/, + "Should throw when inserting a bookmark into the root." + ); + Assert.throws(() => + PlacesUtils.bookmarks.insert({ + parentGuid: PlacesUtils.bookmarks.rootGuid, + type: PlacesUtils.bookmarks.TYPE_FOLDER, + }), + /Invalid value for property 'parentGuid'/, + "Should throw when inserting a folder into the root." + ); +}); + add_task(async function long_title_trim() { let longtitle = "a"; for (let i = 0; i < 4096; i++) { diff --git a/toolkit/components/places/tests/bookmarks/test_bookmarks_remove.js b/toolkit/components/places/tests/bookmarks/test_bookmarks_remove.js index e91790cf665b..c8e49a7fc482 100644 --- a/toolkit/components/places/tests/bookmarks/test_bookmarks_remove.js +++ b/toolkit/components/places/tests/bookmarks/test_bookmarks_remove.js @@ -71,14 +71,6 @@ add_task(async function remove_roots_fail() { } }); -add_task(async function remove_normal_folder_under_root_succeeds() { - let folder = await PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.rootGuid, - type: PlacesUtils.bookmarks.TYPE_FOLDER }); - checkBookmarkObject(folder); - await PlacesUtils.bookmarks.remove(folder); - Assert.strictEqual((await PlacesUtils.bookmarks.fetch(folder.guid)), null); -}); - add_task(async function remove_bookmark() { // When removing a bookmark we need to check the frecency. First we confirm // that there is a normal update when it is inserted. diff --git a/toolkit/components/places/tests/bookmarks/test_bookmarks_update.js b/toolkit/components/places/tests/bookmarks/test_bookmarks_update.js index 1636807cea47..6b2cf7bebe5e 100644 --- a/toolkit/components/places/tests/bookmarks/test_bookmarks_update.js +++ b/toolkit/components/places/tests/bookmarks/test_bookmarks_update.js @@ -88,7 +88,7 @@ add_task(async function move_roots_fail() { Assert.rejects(PlacesUtils.bookmarks.update({ guid, index: -1, - parentGuid: PlacesUtils.bookmarks.rootGuid, + parentGuid: PlacesUtils.bookmarks.unfiledGuid, }), /It's not possible to move Places root folders\./, `Should reject when attempting to move ${guid}`); } @@ -304,6 +304,36 @@ add_task(async function update_move_folder_into_descendant_throws() { } }); +add_task(async function update_move_into_root_folder_rejects() { + let folder = await PlacesUtils.bookmarks.insert({ + parentGuid: PlacesUtils.bookmarks.unfiledGuid, + type: PlacesUtils.bookmarks.TYPE_FOLDER + }); + let bm = await PlacesUtils.bookmarks.insert({ + parentGuid: PlacesUtils.bookmarks.unfiledGuid, + url: "http://example.com/", + type: PlacesUtils.bookmarks.TYPE_BOOKMARK + }); + + Assert.throws(() => + PlacesUtils.bookmarks.update({ + guid: bm.guid, + index: -1, + parentGuid: PlacesUtils.bookmarks.rootGuid, + }), /Invalid value for property 'parentGuid'/, + "Should reject when attempting to move a bookmark into the root" + ); + + Assert.throws(() => + PlacesUtils.bookmarks.update({ + guid: folder.guid, + index: -1, + parentGuid: PlacesUtils.bookmarks.rootGuid, + }), /Invalid value for property 'parentGuid'/, + "Should reject when attempting to move a bookmark into the root" + ); +}); + add_task(async function update_move() { let parent = await PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid, type: PlacesUtils.bookmarks.TYPE_FOLDER }) ; diff --git a/toolkit/components/places/tests/bookmarks/xpcshell.ini b/toolkit/components/places/tests/bookmarks/xpcshell.ini index 0eae4e601397..0dab0b23e22a 100644 --- a/toolkit/components/places/tests/bookmarks/xpcshell.ini +++ b/toolkit/components/places/tests/bookmarks/xpcshell.ini @@ -10,8 +10,6 @@ skip-if = toolkit == 'android' [test_393498.js] [test_395593.js] [test_405938_restore_queries.js] -[test_417228-exclude-from-backup.js] -[test_417228-other-roots.js] [test_424958-json-quoted-folders.js] [test_448584.js] [test_458683.js] diff --git a/toolkit/components/places/tests/queries/head_queries.js b/toolkit/components/places/tests/queries/head_queries.js index e9af7337b15a..645034f983ae 100644 --- a/toolkit/components/places/tests/queries/head_queries.js +++ b/toolkit/components/places/tests/queries/head_queries.js @@ -217,7 +217,7 @@ function queryData(obj) { this.isTag = obj.isTag ? obj.isTag : false; this.tagArray = obj.tagArray ? obj.tagArray : null; this.isLivemark = obj.isLivemark ? obj.isLivemark : false; - this.parentGuid = obj.parentGuid || PlacesUtils.bookmarks.rootGuid; + this.parentGuid = obj.parentGuid || PlacesUtils.bookmarks.unfiledGuid; this.feedURI = obj.feedURI ? obj.feedURI : ""; this.index = obj.index ? obj.index : PlacesUtils.bookmarks.DEFAULT_INDEX; this.isFolder = obj.isFolder ? obj.isFolder : false; diff --git a/toolkit/components/places/tests/sync/test_sync_utils.js b/toolkit/components/places/tests/sync/test_sync_utils.js index 0ce08dc22cdb..267dd182e712 100644 --- a/toolkit/components/places/tests/sync/test_sync_utils.js +++ b/toolkit/components/places/tests/sync/test_sync_utils.js @@ -2210,85 +2210,6 @@ add_task(async function test_pullChanges_restore_json_tracked() { await PlacesSyncUtils.bookmarks.reset(); }); -add_task(async function test_pullChanges_custom_roots() { - await ignoreChangedRoots(); - - info("Append items to Places root"); - let unsyncedGuids = await populateTree(PlacesUtils.bookmarks.rootGuid, { - kind: "folder", - title: "rootFolder", - children: [{ - kind: "bookmark", - title: "childBmk", - url: "https://example.com", - }, { - kind: "folder", - title: "childFolder", - children: [{ - kind: "bookmark", - title: "grandChildBmk", - url: "https://example.org", - }], - }], - }, { - kind: "bookmark", - title: "rootBmk", - url: "https://example.net", - }); - - info("Append items to menu"); - let syncedGuids = await populateTree(PlacesUtils.bookmarks.menuGuid, { - kind: "folder", - title: "childFolder", - children: [{ - kind: "bookmark", - title: "grandChildBmk", - url: "https://example.info", - }], - }); - - { - let newChanges = await PlacesSyncUtils.bookmarks.pullChanges(); - deepEqual(Object.keys(newChanges).sort(), ["menu", syncedGuids.childFolder, - syncedGuids.grandChildBmk].sort(), - "Pulling changes should ignore custom roots"); - await setChangesSynced(newChanges); - } - - info("Append sibling to custom root"); - { - let unsyncedSibling = await PlacesUtils.bookmarks.insert({ - parentGuid: unsyncedGuids.rootFolder, - url: "https://example.club", - }); - let changes = await PlacesSyncUtils.bookmarks.pullChanges(); - deepEqual(changes, {}, `Pulling changes should ignore unsynced sibling ${ - unsyncedSibling.guid}`); - } - - info("Remove custom root"); - { - await PlacesUtils.bookmarks.remove(unsyncedGuids.rootFolder); - let changes = await PlacesSyncUtils.bookmarks.pullChanges(); - deepEqual(changes, {}, "Removing custom root should not write tombstone"); - } - - info("Append sibling to menu"); - { - let syncedSibling = await PlacesUtils.bookmarks.insert({ - parentGuid: PlacesUtils.bookmarks.menuGuid, - url: "https://example.ninja", - }); - let changes = await PlacesSyncUtils.bookmarks.pullChanges(); - deepEqual(Object.keys(changes).sort(), ["menu", syncedSibling.guid].sort(), - "Pulling changes should track synced sibling and parent"); - await setChangesSynced(changes); - } - - await PlacesUtils.bookmarks.eraseEverything(); - await PlacesSyncUtils.bookmarks.reset(); -}); - add_task(async function test_pullChanges_tombstones() { await ignoreChangedRoots(); diff --git a/toolkit/components/places/tests/unit/test_async_transactions.js b/toolkit/components/places/tests/unit/test_async_transactions.js index d35caa59916a..3634443720c9 100644 --- a/toolkit/components/places/tests/unit/test_async_transactions.js +++ b/toolkit/components/places/tests/unit/test_async_transactions.js @@ -8,7 +8,6 @@ const bmsvc = PlacesUtils.bookmarks; const tagssvc = PlacesUtils.tagging; const annosvc = PlacesUtils.annotations; const PT = PlacesTransactions; -const rootGuid = PlacesUtils.bookmarks.rootGuid; const menuGuid = PlacesUtils.bookmarks.menuGuid; Cu.importGlobalProperties(["URL"]); @@ -514,7 +513,7 @@ add_task(async function test_new_folder_with_children() { }); add_task(async function test_new_bookmark() { - let bm_info = { parentGuid: rootGuid, + let bm_info = { parentGuid: PlacesUtils.bookmarks.unfiledGuid, url: NetUtil.newURI("http://test_create_item.com"), index: bmStartIndex, title: "Test creating an item" }; @@ -976,7 +975,7 @@ add_task(async function test_creating_and_removing_a_separator() { add_task(async function test_add_and_remove_livemark() { let createLivemarkTxn = PT.NewLivemark( { feedUrl: NetUtil.newURI("http://test.remove.livemark"), - parentGuid: rootGuid, + parentGuid: PlacesUtils.bookmarks.unfiledGuid, title: "Test Remove Livemark" }); let guid = await createLivemarkTxn.transact(); let originalInfo = await PlacesUtils.promiseBookmarksTree(guid); @@ -1018,7 +1017,7 @@ add_task(async function test_add_and_remove_livemark() { }); add_task(async function test_edit_title() { - let bm_info = { parentGuid: rootGuid, + let bm_info = { parentGuid: PlacesUtils.bookmarks.unfiledGuid, url: NetUtil.newURI("http://test_create_item.com"), title: "Original Title" }; @@ -1056,7 +1055,7 @@ add_task(async function test_edit_title() { add_task(async function test_edit_url() { let oldURI = NetUtil.newURI("http://old.test_editing_item_uri.com/"); let newURI = NetUtil.newURI("http://new.test_editing_item_uri.com/"); - let bm_info = { parentGuid: rootGuid, url: oldURI, tags: ["TestTag"] }; + let bm_info = { parentGuid: PlacesUtils.bookmarks.unfiledGuid, url: oldURI, tags: ["TestTag"] }; function ensureURIAndTags(aPreChangeURI, aPostChangeURI, aOLdURITagsPreserved) { ensureItemsChanged({ guid: bm_info.guid, property: "uri", @@ -1118,7 +1117,7 @@ add_task(async function test_edit_url() { }); add_task(async function test_edit_keyword() { - let bm_info = { parentGuid: rootGuid, + let bm_info = { parentGuid: PlacesUtils.bookmarks.unfiledGuid, url: NetUtil.newURI("http://test.edit.keyword") }; const KEYWORD = "test_keyword"; bm_info.guid = await PT.NewBookmark(bm_info).transact(); @@ -1162,7 +1161,7 @@ add_task(async function test_edit_keyword() { }); add_task(async function test_edit_keyword_null_postData() { - let bm_info = { parentGuid: rootGuid, + let bm_info = { parentGuid: PlacesUtils.bookmarks.unfiledGuid, url: NetUtil.newURI("http://test.edit.keyword") }; const KEYWORD = "test_keyword"; bm_info.guid = await PT.NewBookmark(bm_info).transact(); @@ -1206,7 +1205,7 @@ add_task(async function test_edit_keyword_null_postData() { }); add_task(async function test_edit_specific_keyword() { - let bm_info = { parentGuid: rootGuid, + let bm_info = { parentGuid: PlacesUtils.bookmarks.unfiledGuid, url: NetUtil.newURI("http://test.edit.keyword") }; bm_info.guid = await PT.NewBookmark(bm_info).transact(); function ensureKeywordChange(aCurrentKeyword = "", aPreviousKeyword = "") { @@ -1270,9 +1269,9 @@ add_task(async function test_edit_specific_keyword() { add_task(async function test_tag_uri() { // This also tests passing uri specs. let bm_info_a = { url: "http://bookmarked.uri", - parentGuid: rootGuid }; + parentGuid: PlacesUtils.bookmarks.unfiledGuid }; let bm_info_b = { url: NetUtil.newURI("http://bookmarked2.uri"), - parentGuid: rootGuid }; + parentGuid: PlacesUtils.bookmarks.unfiledGuid }; let unbookmarked_uri = NetUtil.newURI("http://un.bookmarked.uri"); await PT.batch(async function() { @@ -1338,10 +1337,10 @@ add_task(async function test_tag_uri() { add_task(async function test_untag_uri() { let bm_info_a = { url: NetUtil.newURI("http://bookmarked.uri"), - parentGuid: rootGuid, + parentGuid: PlacesUtils.bookmarks.unfiledGuid, tags: ["A", "B"] }; let bm_info_b = { url: NetUtil.newURI("http://bookmarked2.uri"), - parentGuid: rootGuid, + parentGuid: PlacesUtils.bookmarks.unfiledGuid, tag: "B" }; await PT.batch(async function() { @@ -1413,7 +1412,7 @@ add_task(async function test_untag_uri() { add_task(async function test_annotate() { let bm_info = { url: NetUtil.newURI("http://test.item.annotation"), - parentGuid: rootGuid }; + parentGuid: PlacesUtils.bookmarks.unfiledGuid }; let anno_info = { name: "TestAnno", value: "TestValue" }; function ensureAnnoState(aSet) { ensureAnnotationsSet(bm_info.guid, @@ -1558,7 +1557,7 @@ add_task(async function test_sort_folder_by_name() { add_task(async function test_livemark_txns() { let livemark_info = { feedUrl: NetUtil.newURI("http://test.feed.uri"), - parentGuid: rootGuid, + parentGuid: PlacesUtils.bookmarks.unfiledGuid, title: "Test Livemark" }; function ensureLivemarkAdded() { ensureItemsAdded({ guid: livemark_info.guid, @@ -1606,7 +1605,9 @@ add_task(async function test_livemark_txns() { add_task(async function test_copy() { async function duplicate_and_test(aOriginalGuid) { - let txn = PT.Copy({ guid: aOriginalGuid, newParentGuid: rootGuid }); + let txn = PT.Copy({ + guid: aOriginalGuid, newParentGuid: PlacesUtils.bookmarks.unfiledGuid + }); let duplicateGuid = await txn.transact(); let originalInfo = await PlacesUtils.promiseBookmarksTree(aOriginalGuid); let duplicateInfo = await PlacesUtils.promiseBookmarksTree(duplicateGuid); @@ -1645,12 +1646,15 @@ add_task(async function test_copy() { // Test duplicating leafs (bookmark, separator, empty folder) PT.NewBookmark({ url: new URL("http://test.item.duplicate"), - parentGuid: rootGuid, + parentGuid: PlacesUtils.bookmarks.unfiledGuid, annos: [{ name: "Anno", value: "AnnoValue"}] }); - let sepTxn = PT.NewSeparator({ parentGuid: rootGuid, index: 1 }); + let sepTxn = PT.NewSeparator({ + parentGuid: PlacesUtils.bookmarks.unfiledGuid, + index: 1 + }); let livemarkTxn = PT.NewLivemark( { feedUrl: new URL("http://test.feed.uri"), - parentGuid: rootGuid, + parentGuid: PlacesUtils.bookmarks.unfiledGuid, title: "Test Livemark", index: 1 }); let emptyFolderTxn = PT.NewFolder(createTestFolderInfo()); for (let txn of [livemarkTxn, sepTxn, emptyFolderTxn]) { @@ -1730,13 +1734,13 @@ add_task(async function test_copy_excluding_annotations() { let excluding_a_dupeGuid = await PT.Copy({ guid: folderGuid, - newParentGuid: rootGuid, + newParentGuid: PlacesUtils.bookmarks.unfiledGuid, excludingAnnotation: "a" }).transact(); await ensureAnnosSet(excluding_a_dupeGuid, "b", "c"); let excluding_ac_dupeGuid = await PT.Copy({ guid: folderGuid, - newParentGuid: rootGuid, + newParentGuid: PlacesUtils.bookmarks.unfiledGuid, excludingAnnotations: ["a", "c"] }).transact(); await ensureAnnosSet(excluding_ac_dupeGuid, "b"); @@ -1749,7 +1753,7 @@ add_task(async function test_copy_excluding_annotations() { add_task(async function test_invalid_uri_spec_throws() { Assert.throws(() => - PT.NewBookmark({ parentGuid: rootGuid, + PT.NewBookmark({ parentGuid: PlacesUtils.bookmarks.unfiledGuid, url: "invalid uri spec", title: "test bookmark" })); Assert.throws(() => From d7bfe2db7904a26bacac3570af944594ccd60416 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Thu, 8 Mar 2018 10:07:01 +0000 Subject: [PATCH 15/50] Bug 1443835 - Stop using Netutil.newURI everywhere in test_async_transactions.js. r=mak MozReview-Commit-ID: 3QOXMq8G1gP --HG-- extra : rebase_source : 5c5180fd3760fc43b470c7ac5b49602c545b5a26 --- .../tests/unit/test_async_transactions.js | 106 ++++++++++-------- 1 file changed, 57 insertions(+), 49 deletions(-) diff --git a/toolkit/components/places/tests/unit/test_async_transactions.js b/toolkit/components/places/tests/unit/test_async_transactions.js index 3634443720c9..079e9cf47b4b 100644 --- a/toolkit/components/places/tests/unit/test_async_transactions.js +++ b/toolkit/components/places/tests/unit/test_async_transactions.js @@ -180,7 +180,8 @@ function ensureItemsAdded(...items) { Assert.equal(info[propName], item[propName]); } if ("url" in item) - Assert.ok(info.url.equals(item.url)); + Assert.ok(info.url.equals(Services.io.newURI(item.url)), + "Should have the correct url"); } Assert.equal(observer.itemsAdded.size, expectedResultsCount, @@ -263,7 +264,7 @@ function ensureTimestampsUpdated(aGuid, aCheckDateAdded = false) { } function ensureTagsForURI(aURI, aTags) { - let tagsSet = tagssvc.getTagsForURI(aURI); + let tagsSet = tagssvc.getTagsForURI(Services.io.newURI(aURI)); Assert.equal(tagsSet.length, aTags.length); Assert.ok(aTags.every( t => tagsSet.includes(t))); } @@ -514,7 +515,7 @@ add_task(async function test_new_folder_with_children() { add_task(async function test_new_bookmark() { let bm_info = { parentGuid: PlacesUtils.bookmarks.unfiledGuid, - url: NetUtil.newURI("http://test_create_item.com"), + url: "http://test_create_item.com", index: bmStartIndex, title: "Test creating an item" }; @@ -552,7 +553,7 @@ add_task(async function test_new_bookmark() { add_task(async function test_merge_create_folder_and_item() { let folder_info = createTestFolderInfo(); - let bm_info = { url: NetUtil.newURI("http://test_create_item_to_folder.com"), + let bm_info = { url: "http://test_create_item_to_folder.com", title: "Test Bookmark", index: bmStartIndex }; @@ -590,9 +591,9 @@ add_task(async function test_merge_create_folder_and_item() { add_task(async function test_move_items_to_folder() { let folder_a_info = createTestFolderInfo("Folder A"); - let bkm_a_info = { url: new URL("http://test_move_items.com"), + let bkm_a_info = { url: "http://test_move_items.com", title: "Bookmark A" }; - let bkm_b_info = { url: NetUtil.newURI("http://test_move_items.com"), + let bkm_b_info = { url: "http://test_move_items.com", title: "Bookmark B" }; // Test moving items within the same folder. @@ -791,7 +792,7 @@ add_task(async function test_remove_folder() { }); add_task(async function test_add_and_remove_bookmarks_with_additional_info() { - const testURI = NetUtil.newURI("http://add.remove.tag"); + const testURI = "http://add.remove.tag"; const TAG_1 = "TestTag1"; const TAG_2 = "TestTag2"; const ANNO = { name: "TestAnno", value: "TestAnnoValue" }; @@ -974,7 +975,7 @@ add_task(async function test_creating_and_removing_a_separator() { add_task(async function test_add_and_remove_livemark() { let createLivemarkTxn = PT.NewLivemark( - { feedUrl: NetUtil.newURI("http://test.remove.livemark"), + { feedUrl: "http://test.remove.livemark", parentGuid: PlacesUtils.bookmarks.unfiledGuid, title: "Test Remove Livemark" }); let guid = await createLivemarkTxn.transact(); @@ -1017,9 +1018,11 @@ add_task(async function test_add_and_remove_livemark() { }); add_task(async function test_edit_title() { - let bm_info = { parentGuid: PlacesUtils.bookmarks.unfiledGuid, - url: NetUtil.newURI("http://test_create_item.com"), - title: "Original Title" }; + let bm_info = { + parentGuid: PlacesUtils.bookmarks.unfiledGuid, + url: "http://test_create_item.com", + title: "Original Title" + }; function ensureTitleChange(aCurrentTitle) { ensureItemsChanged({ guid: bm_info.guid, @@ -1053,13 +1056,13 @@ add_task(async function test_edit_title() { }); add_task(async function test_edit_url() { - let oldURI = NetUtil.newURI("http://old.test_editing_item_uri.com/"); - let newURI = NetUtil.newURI("http://new.test_editing_item_uri.com/"); + let oldURI = "http://old.test_editing_item_uri.com/"; + let newURI = "http://new.test_editing_item_uri.com/"; let bm_info = { parentGuid: PlacesUtils.bookmarks.unfiledGuid, url: oldURI, tags: ["TestTag"] }; function ensureURIAndTags(aPreChangeURI, aPostChangeURI, aOLdURITagsPreserved) { ensureItemsChanged({ guid: bm_info.guid, property: "uri", - newValue: aPostChangeURI.spec }); + newValue: aPostChangeURI }); ensureTagsForURI(aPostChangeURI, bm_info.tags); ensureTagsForURI(aPreChangeURI, aOLdURITagsPreserved ? bm_info.tags : []); } @@ -1118,7 +1121,7 @@ add_task(async function test_edit_url() { add_task(async function test_edit_keyword() { let bm_info = { parentGuid: PlacesUtils.bookmarks.unfiledGuid, - url: NetUtil.newURI("http://test.edit.keyword") }; + url: "http://test.edit.keyword/" }; const KEYWORD = "test_keyword"; bm_info.guid = await PT.NewBookmark(bm_info).transact(); function ensureKeywordChange(aCurrentKeyword = "") { @@ -1133,7 +1136,7 @@ add_task(async function test_edit_keyword() { await PT.EditKeyword({ guid: bm_info.guid, keyword: KEYWORD, postData: "postData" }).transact(); ensureKeywordChange(KEYWORD); let entry = await PlacesUtils.keywords.fetch(KEYWORD); - Assert.equal(entry.url.href, bm_info.url.spec); + Assert.equal(entry.url.href, bm_info.url); Assert.equal(entry.postData, "postData"); observer.reset(); @@ -1146,7 +1149,7 @@ add_task(async function test_edit_keyword() { await PT.redo(); ensureKeywordChange(KEYWORD); entry = await PlacesUtils.keywords.fetch(KEYWORD); - Assert.equal(entry.url.href, bm_info.url.spec); + Assert.equal(entry.url.href, bm_info.url); Assert.equal(entry.postData, "postData"); // Cleanup @@ -1162,7 +1165,7 @@ add_task(async function test_edit_keyword() { add_task(async function test_edit_keyword_null_postData() { let bm_info = { parentGuid: PlacesUtils.bookmarks.unfiledGuid, - url: NetUtil.newURI("http://test.edit.keyword") }; + url: "http://test.edit.keyword/" }; const KEYWORD = "test_keyword"; bm_info.guid = await PT.NewBookmark(bm_info).transact(); function ensureKeywordChange(aCurrentKeyword = "") { @@ -1177,7 +1180,7 @@ add_task(async function test_edit_keyword_null_postData() { await PT.EditKeyword({ guid: bm_info.guid, keyword: KEYWORD, postData: null }).transact(); ensureKeywordChange(KEYWORD); let entry = await PlacesUtils.keywords.fetch(KEYWORD); - Assert.equal(entry.url.href, bm_info.url.spec); + Assert.equal(entry.url.href, bm_info.url); Assert.equal(entry.postData, null); observer.reset(); @@ -1190,7 +1193,7 @@ add_task(async function test_edit_keyword_null_postData() { await PT.redo(); ensureKeywordChange(KEYWORD); entry = await PlacesUtils.keywords.fetch(KEYWORD); - Assert.equal(entry.url.href, bm_info.url.spec); + Assert.equal(entry.url.href, bm_info.url); Assert.equal(entry.postData, null); // Cleanup @@ -1206,7 +1209,7 @@ add_task(async function test_edit_keyword_null_postData() { add_task(async function test_edit_specific_keyword() { let bm_info = { parentGuid: PlacesUtils.bookmarks.unfiledGuid, - url: NetUtil.newURI("http://test.edit.keyword") }; + url: "http://test.edit.keyword/" }; bm_info.guid = await PT.NewBookmark(bm_info).transact(); function ensureKeywordChange(aCurrentKeyword = "", aPreviousKeyword = "") { ensureItemsChanged({ guid: bm_info.guid, @@ -1215,18 +1218,26 @@ add_task(async function test_edit_specific_keyword() { }); } - await PlacesUtils.keywords.insert({ keyword: "kw1", url: bm_info.url.spec, postData: "postData1" }); - await PlacesUtils.keywords.insert({ keyword: "kw2", url: bm_info.url.spec, postData: "postData2" }); + await PlacesUtils.keywords.insert({ + keyword: "kw1", + url: bm_info.url, + postData: "postData1" + }); + await PlacesUtils.keywords.insert({ + keyword: "kw2", + url: bm_info.url, + postData: "postData2" + }); bm_info.guid = await PT.NewBookmark(bm_info).transact(); observer.reset(); await PT.EditKeyword({ guid: bm_info.guid, keyword: "keyword", oldKeyword: "kw2" }).transact(); ensureKeywordChange("keyword", "kw2"); let entry = await PlacesUtils.keywords.fetch("kw1"); - Assert.equal(entry.url.href, bm_info.url.spec); + Assert.equal(entry.url.href, bm_info.url); Assert.equal(entry.postData, "postData1"); entry = await PlacesUtils.keywords.fetch("keyword"); - Assert.equal(entry.url.href, bm_info.url.spec); + Assert.equal(entry.url.href, bm_info.url); Assert.equal(entry.postData, "postData2"); entry = await PlacesUtils.keywords.fetch("kw2"); Assert.equal(entry, null); @@ -1235,10 +1246,10 @@ add_task(async function test_edit_specific_keyword() { await PT.undo(); ensureKeywordChange("kw2", "keyword"); entry = await PlacesUtils.keywords.fetch("kw1"); - Assert.equal(entry.url.href, bm_info.url.spec); + Assert.equal(entry.url.href, bm_info.url); Assert.equal(entry.postData, "postData1"); entry = await PlacesUtils.keywords.fetch("kw2"); - Assert.equal(entry.url.href, bm_info.url.spec); + Assert.equal(entry.url.href, bm_info.url); Assert.equal(entry.postData, "postData2"); entry = await PlacesUtils.keywords.fetch("keyword"); Assert.equal(entry, null); @@ -1247,10 +1258,10 @@ add_task(async function test_edit_specific_keyword() { await PT.redo(); ensureKeywordChange("keyword", "kw2"); entry = await PlacesUtils.keywords.fetch("kw1"); - Assert.equal(entry.url.href, bm_info.url.spec); + Assert.equal(entry.url.href, bm_info.url); Assert.equal(entry.postData, "postData1"); entry = await PlacesUtils.keywords.fetch("keyword"); - Assert.equal(entry.url.href, bm_info.url.spec); + Assert.equal(entry.url.href, bm_info.url); Assert.equal(entry.postData, "postData2"); entry = await PlacesUtils.keywords.fetch("kw2"); Assert.equal(entry, null); @@ -1270,9 +1281,9 @@ add_task(async function test_tag_uri() { // This also tests passing uri specs. let bm_info_a = { url: "http://bookmarked.uri", parentGuid: PlacesUtils.bookmarks.unfiledGuid }; - let bm_info_b = { url: NetUtil.newURI("http://bookmarked2.uri"), + let bm_info_b = { url: "http://bookmarked2.uri", parentGuid: PlacesUtils.bookmarks.unfiledGuid }; - let unbookmarked_uri = NetUtil.newURI("http://un.bookmarked.uri"); + let unbookmarked_uri = "http://un.bookmarked.uri"; await PT.batch(async function() { bm_info_a.guid = await PT.NewBookmark(bm_info_a).transact(); @@ -1283,9 +1294,6 @@ add_task(async function test_tag_uri() { let urls = "url" in aInfo ? [aInfo.url] : aInfo.urls; let tags = "tag" in aInfo ? [aInfo.tag] : aInfo.tags; - let ensureURI = url => typeof(url) == "string" ? NetUtil.newURI(url) : url; - urls = urls.map(ensureURI); - let tagWillAlsoBookmark = new Set(); for (let url of urls) { if (!(await bmsvc.fetch({ url }))) { @@ -1336,10 +1344,10 @@ add_task(async function test_tag_uri() { }); add_task(async function test_untag_uri() { - let bm_info_a = { url: NetUtil.newURI("http://bookmarked.uri"), + let bm_info_a = { url: "http://bookmarked.uri", parentGuid: PlacesUtils.bookmarks.unfiledGuid, tags: ["A", "B"] }; - let bm_info_b = { url: NetUtil.newURI("http://bookmarked2.uri"), + let bm_info_b = { url: "http://bookmarked2.uri", parentGuid: PlacesUtils.bookmarks.unfiledGuid, tag: "B" }; @@ -1352,7 +1360,7 @@ add_task(async function test_untag_uri() { async function doTest(aInfo) { let urls, tagsRemoved; - if (aInfo instanceof Ci.nsIURI) { + if (typeof(aInfo) == "string") { urls = [aInfo]; tagsRemoved = []; } else if (Array.isArray(aInfo)) { @@ -1365,7 +1373,7 @@ add_task(async function test_untag_uri() { let preRemovalTags = new Map(); for (let url of urls) { - preRemovalTags.set(url, tagssvc.getTagsForURI(url)); + preRemovalTags.set(url, tagssvc.getTagsForURI(Services.io.newURI(url))); } function ensureTagsSet() { @@ -1411,7 +1419,7 @@ add_task(async function test_untag_uri() { }); add_task(async function test_annotate() { - let bm_info = { url: NetUtil.newURI("http://test.item.annotation"), + let bm_info = { url: "http://test.item.annotation", parentGuid: PlacesUtils.bookmarks.unfiledGuid }; let anno_info = { name: "TestAnno", value: "TestValue" }; function ensureAnnoState(aSet) { @@ -1512,7 +1520,7 @@ add_task(async function test_annotate_multiple() { add_task(async function test_sort_folder_by_name() { let folder_info = createTestFolderInfo(); - let url = NetUtil.newURI("http://sort.by.name/"); + let url = "http://sort.by.name/"; let preSep = ["3", "2", "1"].map(i => ({ title: i, url })); let sep = {}; let postSep = ["c", "b", "a"].map(l => ({ title: l, url })); @@ -1556,7 +1564,7 @@ add_task(async function test_sort_folder_by_name() { add_task(async function test_livemark_txns() { let livemark_info = - { feedUrl: NetUtil.newURI("http://test.feed.uri"), + { feedUrl: "http://test.feed.uri/", parentGuid: PlacesUtils.bookmarks.unfiledGuid, title: "Test Livemark" }; function ensureLivemarkAdded() { @@ -1565,10 +1573,10 @@ add_task(async function test_livemark_txns() { parentGuid: livemark_info.parentGuid, itemType: bmsvc.TYPE_FOLDER }); let annos = [{ name: PlacesUtils.LMANNO_FEEDURI, - value: livemark_info.feedUrl.spec }]; + value: livemark_info.feedUrl }]; if ("siteUrl" in livemark_info) { annos.push({ name: PlacesUtils.LMANNO_SITEURI, - value: livemark_info.siteUrl.spec }); + value: livemark_info.siteUrl }); } ensureAnnotationsSet(livemark_info.guid, annos); } @@ -1595,7 +1603,7 @@ add_task(async function test_livemark_txns() { } await _testDoUndoRedoUndo(); - livemark_info.siteUrl = NetUtil.newURI("http://feed.site.uri"); + livemark_info.siteUrl = "http://feed.site.uri/"; await _testDoUndoRedoUndo(); // Cleanup @@ -1645,7 +1653,7 @@ add_task(async function test_copy() { }); // Test duplicating leafs (bookmark, separator, empty folder) - PT.NewBookmark({ url: new URL("http://test.item.duplicate"), + PT.NewBookmark({ url: "http://test.item.duplicate", parentGuid: PlacesUtils.bookmarks.unfiledGuid, annos: [{ name: "Anno", value: "AnnoValue"}] }); let sepTxn = PT.NewSeparator({ @@ -1653,7 +1661,7 @@ add_task(async function test_copy() { index: 1 }); let livemarkTxn = PT.NewLivemark( - { feedUrl: new URL("http://test.feed.uri"), + { feedUrl: "http://test.feed.uri", parentGuid: PlacesUtils.bookmarks.unfiledGuid, title: "Test Livemark", index: 1 }); let emptyFolderTxn = PT.NewFolder(createTestFolderInfo()); @@ -1669,12 +1677,12 @@ add_task(async function test_copy() { await PT.NewFolder({ parentGuid: folderGuid, title: "Nested Folder" }).transact(); // Insert a bookmark under the nested folder. - await PT.NewBookmark({ url: new URL("http://nested.nested.bookmark"), + await PT.NewBookmark({ url: "http://nested.nested.bookmark", parentGuid: nestedFolderGuid }).transact(); // Insert a separator below the nested folder await PT.NewSeparator({ parentGuid: folderGuid }).transact(); // And another bookmark. - await PT.NewBookmark({ url: new URL("http://nested.bookmark"), + await PT.NewBookmark({ url: "http://nested.bookmark", parentGuid: folderGuid }).transact(); return folderGuid; }); @@ -1816,7 +1824,7 @@ add_task(async function test_remove_multiple() { guids.push(folderGuid); let bmGuid = - await PT.NewBookmark({ url: new URL("http://test.bookmark.removed"), + await PT.NewBookmark({ url: "http://test.bookmark.removed", parentGuid: menuGuid }).transact(); guids.push(bmGuid); }); From 61992349bee2be155c30d7155dccf21cc9d9d813 Mon Sep 17 00:00:00 2001 From: Mike Ratcliffe Date: Fri, 9 Mar 2018 13:55:22 +0000 Subject: [PATCH 16/50] Bug 1444106 - Add test for rapid addition and removal of items in the storage inspector r=ochameau MozReview-Commit-ID: 5sM12SBiBSF --HG-- extra : rebase_source : 31140fa6c45471942131c9cf8bb8a78cdf226118 --- devtools/client/storage/test/browser.ini | 2 ++ ...r_storage_localstorage_rapid_add_remove.js | 34 +++++++++++++++++++ devtools/client/storage/test/head.js | 11 ++++++ .../client/storage/test/storage-blank.html | 9 +++++ 4 files changed, 56 insertions(+) create mode 100644 devtools/client/storage/test/browser_storage_localstorage_rapid_add_remove.js create mode 100644 devtools/client/storage/test/storage-blank.html diff --git a/devtools/client/storage/test/browser.ini b/devtools/client/storage/test/browser.ini index 582490788c55..8c5795ec3c62 100644 --- a/devtools/client/storage/test/browser.ini +++ b/devtools/client/storage/test/browser.ini @@ -2,6 +2,7 @@ tags = devtools subsuite = devtools support-files = + storage-blank.html storage-cache-error.html storage-complex-values.html storage-cookies.html @@ -55,6 +56,7 @@ tags = usercontextid [browser_storage_localstorage_add.js] [browser_storage_localstorage_edit.js] [browser_storage_localstorage_error.js] +[browser_storage_localstorage_rapid_add_remove.js] [browser_storage_overflow.js] [browser_storage_search.js] [browser_storage_search_keyboard_trap.js] diff --git a/devtools/client/storage/test/browser_storage_localstorage_rapid_add_remove.js b/devtools/client/storage/test/browser_storage_localstorage_rapid_add_remove.js new file mode 100644 index 000000000000..af3f8ca85387 --- /dev/null +++ b/devtools/client/storage/test/browser_storage_localstorage_rapid_add_remove.js @@ -0,0 +1,34 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* import-globals-from head.js */ + +// Basic test to check the rapid adding and removing of localStorage entries. + +"use strict"; + +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-blank.html"); + yield selectTreeItem(["localStorage", "http://test1.example.org"]); + + ok(isTableEmpty(), "Table empty on init"); + + for (let i = 0; i < 10; i++) { + yield addRemove(`test${i}`); + } + + yield finishTests(); +}); + +function* addRemove(name) { + yield ContentTask.spawn(gBrowser.selectedBrowser, name, innerName => { + content.localStorage.setItem(innerName, "true"); + content.localStorage.removeItem(innerName); + }); + + info("Waiting for store objects to be changed"); + yield gUI.once("store-objects-edit"); + + ok(isTableEmpty(), `Table empty after rapid add/remove of "${name}"`); +} diff --git a/devtools/client/storage/test/head.js b/devtools/client/storage/test/head.js index 57c2c6934a55..3355c077d69a 100644 --- a/devtools/client/storage/test/head.js +++ b/devtools/client/storage/test/head.js @@ -640,6 +640,17 @@ function getRowCells(id, includeHidden = false) { return cells; } +/** + * Check for an empty table. + */ +function isTableEmpty() { + let doc = gPanelWindow.document; + let table = gUI.table; + let cells = doc.querySelectorAll(".table-widget-column#" + table.uniqueId + + " .table-widget-cell"); + return cells.length === 0; +} + /** * Get available ids... useful for error reporting. */ diff --git a/devtools/client/storage/test/storage-blank.html b/devtools/client/storage/test/storage-blank.html new file mode 100644 index 000000000000..81342ed69028 --- /dev/null +++ b/devtools/client/storage/test/storage-blank.html @@ -0,0 +1,9 @@ + + + + + + +

storage-blank.html

+ + From 6b7caea7612f83df34208c6545208f902cc24644 Mon Sep 17 00:00:00 2001 From: Michael Ratcliffe Date: Fri, 9 Mar 2018 17:21:03 +0000 Subject: [PATCH 17/50] Bug 1444414 - Remove all CPOWs from storage inspector tests r=nchevobbe MozReview-Commit-ID: JGuYffnzXDb --HG-- extra : rebase_source : 8ad2094589934cef063f4a2d346ff0433f174158 --- ...browser_storage_dynamic_updates_cookies.js | 30 ++++++++++++++----- ...er_storage_dynamic_updates_localStorage.js | 22 ++++++++++++-- ..._storage_dynamic_updates_sessionStorage.js | 24 ++++++++++++--- devtools/client/storage/test/head.js | 9 ++---- 4 files changed, 64 insertions(+), 21 deletions(-) diff --git a/devtools/client/storage/test/browser_storage_dynamic_updates_cookies.js b/devtools/client/storage/test/browser_storage_dynamic_updates_cookies.js index 124f7f0f1284..de0e51b56c63 100644 --- a/devtools/client/storage/test/browser_storage_dynamic_updates_cookies.js +++ b/devtools/client/storage/test/browser_storage_dynamic_updates_cookies.js @@ -52,7 +52,7 @@ add_task(function* () { ]); checkCell(c1id, "value", "1.2.3.4.5.6.7"); - gWindow.addCookie("c1", '{"foo": 4,"bar":6}', "/browser"); + yield addCookie("c1", '{"foo": 4,"bar":6}', "/browser"); yield gUI.once("store-objects-edit"); yield findVariableViewProperties(finalValue[0], false); @@ -70,7 +70,7 @@ add_task(function* () { checkCell(c1id, "value", '{"foo": 4,"bar":6}'); // Add a new entry - gWindow.addCookie("c3", "booyeah"); + yield addCookie("c3", "booyeah"); yield gUI.once("store-objects-edit"); @@ -90,7 +90,7 @@ add_task(function* () { checkCell(c3id, "value", "booyeah"); // Add another - gWindow.addCookie("c4", "booyeah"); + yield addCookie("c4", "booyeah"); yield gUI.once("store-objects-edit"); @@ -112,7 +112,7 @@ add_task(function* () { checkCell(c4id, "value", "booyeah"); // Removing cookies - gWindow.removeCookie("c1", "/browser"); + yield removeCookie("c1", "/browser"); yield gUI.once("store-objects-edit"); @@ -135,7 +135,7 @@ add_task(function* () { yield findVariableViewProperties([{name: "c2", value: "foobar"}]); // Keep deleting till no rows - gWindow.removeCookie("c3"); + yield removeCookie("c3"); yield gUI.once("store-objects-edit"); @@ -153,7 +153,7 @@ add_task(function* () { // Check if next element's value is visible in sidebar yield findVariableViewProperties([{name: "c2", value: "foobar"}]); - gWindow.removeCookie("c2", "/browser"); + yield removeCookie("c2", "/browser"); yield gUI.once("store-objects-edit"); @@ -170,7 +170,7 @@ add_task(function* () { // Check if next element's value is visible in sidebar yield findVariableViewProperties([{name: "c4", value: "booyeah"}]); - gWindow.removeCookie("c4"); + yield removeCookie("c4"); yield gUI.once("store-objects-edit"); @@ -182,3 +182,19 @@ add_task(function* () { yield finishTests(); }); + +function* addCookie(name, value, path) { + yield ContentTask.spawn(gBrowser.selectedBrowser, [name, value, path], + ([nam, valu, pat]) => { + content.wrappedJSObject.addCookie(nam, valu, pat); + } + ); +} + +function* removeCookie(name, path) { + yield ContentTask.spawn(gBrowser.selectedBrowser, [name, path], + ([nam, pat]) => { + content.wrappedJSObject.removeCookie(nam, pat); + } + ); +} diff --git a/devtools/client/storage/test/browser_storage_dynamic_updates_localStorage.js b/devtools/client/storage/test/browser_storage_dynamic_updates_localStorage.js index 576aadf56134..074047e2c037 100644 --- a/devtools/client/storage/test/browser_storage_dynamic_updates_localStorage.js +++ b/devtools/client/storage/test/browser_storage_dynamic_updates_localStorage.js @@ -20,7 +20,7 @@ add_task(function* () { ], ]); - gWindow.localStorage.removeItem("ls4"); + yield removeLocalStorageItem("ls4"); yield gUI.once("store-objects-edit"); @@ -31,7 +31,7 @@ add_task(function* () { ], ]); - gWindow.localStorage.setItem("ls4", "again"); + yield setLocalStorageItem("ls4", "again"); yield gUI.once("store-objects-edit"); @@ -42,7 +42,7 @@ add_task(function* () { ], ]); // Updating a row - gWindow.localStorage.setItem("ls2", "ls2-changed"); + yield setLocalStorageItem("ls2", "ls2-changed"); yield gUI.once("store-objects-edit"); @@ -64,3 +64,19 @@ add_task(function* () { yield finishTests(); }); + +function* setLocalStorageItem(key, value) { + yield ContentTask.spawn(gBrowser.selectedBrowser, [key, value], + ([innerKey, innerValue]) => { + content.wrappedJSObject.localStorage.setItem(innerKey, innerValue); + } + ); +} + +function* removeLocalStorageItem(key) { + yield ContentTask.spawn(gBrowser.selectedBrowser, key, + innerKey => { + content.wrappedJSObject.localStorage.removeItem(innerKey); + } + ); +} diff --git a/devtools/client/storage/test/browser_storage_dynamic_updates_sessionStorage.js b/devtools/client/storage/test/browser_storage_dynamic_updates_sessionStorage.js index 4c07a2dd1e8d..75b0056c5ec3 100644 --- a/devtools/client/storage/test/browser_storage_dynamic_updates_sessionStorage.js +++ b/devtools/client/storage/test/browser_storage_dynamic_updates_sessionStorage.js @@ -20,7 +20,7 @@ add_task(function* () { ], ]); - gWindow.sessionStorage.setItem("ss4", "new-item"); + yield setSessionStorageItem("ss4", "new-item"); yield gUI.once("store-objects-edit"); @@ -33,11 +33,11 @@ add_task(function* () { // deleting item - gWindow.sessionStorage.removeItem("ss3"); + yield removeSessionStorageItem("ss3"); yield gUI.once("store-objects-edit"); - gWindow.sessionStorage.removeItem("ss1"); + yield removeSessionStorageItem("ss1"); yield gUI.once("store-objects-edit"); @@ -55,7 +55,7 @@ add_task(function* () { // Checking for correct value in sidebar before update yield findVariableViewProperties([{name: "ss2", value: "foobar"}]); - gWindow.sessionStorage.setItem("ss2", "changed=ss2"); + yield setSessionStorageItem("ss2", "changed=ss2"); yield gUI.once("sidebar-updated"); @@ -79,3 +79,19 @@ add_task(function* () { yield finishTests(); }); + +function* setSessionStorageItem(key, value) { + yield ContentTask.spawn(gBrowser.selectedBrowser, [key, value], + ([innerKey, innerValue]) => { + content.wrappedJSObject.sessionStorage.setItem(innerKey, innerValue); + } + ); +} + +function* removeSessionStorageItem(key) { + yield ContentTask.spawn(gBrowser.selectedBrowser, key, + innerKey => { + content.wrappedJSObject.sessionStorage.removeItem(innerKey); + } + ); +} diff --git a/devtools/client/storage/test/head.js b/devtools/client/storage/test/head.js index 3355c077d69a..0e7a44969c1a 100644 --- a/devtools/client/storage/test/head.js +++ b/devtools/client/storage/test/head.js @@ -30,7 +30,7 @@ const ALT_DOMAIN_SECURED = "https://sectest1.example.org:443/" + PATH; // devtools/client/storage/ui.js and devtools/server/tests/browser/head.js const SEPARATOR_GUID = "{9d414cc5-8319-0a04-0586-c0a6ae01670a}"; -var gToolbox, gPanelWindow, gWindow, gUI; +var gToolbox, gPanelWindow, gUI; // Services.prefs.setBoolPref(DUMPEMIT_PREF, true); // Services.prefs.setBoolPref(DEBUGGERLOG_PREF, true); @@ -38,7 +38,7 @@ var gToolbox, gPanelWindow, gWindow, gUI; Services.prefs.setBoolPref(STORAGE_PREF, true); Services.prefs.setBoolPref(CACHES_ON_HTTP_PREF, true); registerCleanupFunction(() => { - gToolbox = gPanelWindow = gWindow = gUI = null; + gToolbox = gPanelWindow = gUI = null; Services.prefs.clearUserPref(CACHES_ON_HTTP_PREF); Services.prefs.clearUserPref(DEBUGGERLOG_PREF); Services.prefs.clearUserPref(DOM_CACHE); @@ -57,9 +57,6 @@ registerCleanupFunction(() => { */ function* openTab(url, options = {}) { let tab = yield addTab(url, options); - let content = tab.linkedBrowser.contentWindowAsCPOW; - - gWindow = content.wrappedJSObject; // Setup the async storages in main window and for all its iframes yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () { @@ -219,8 +216,6 @@ function forceCollections() { * Cleans up and finishes the test */ function* finishTests() { - // Bug 1233497 makes it so that we can no longer yield CPOWs from Tasks. - // We work around this by calling clear() via a ContentTask instead. while (gBrowser.tabs.length > 1) { yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () { /** From 3ca71a66e9a9f36340d0c1ea3b4c0c07bac8e075 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Thu, 8 Mar 2018 15:32:06 +0000 Subject: [PATCH 18/50] Bug 1401129 - Restore datareporting.healthreport.about.reportUrl in automation tools. r=whimboo The datareporting.healthreport.about.reportUrl preference was removed in bug 1352497, but there are multiple automation tools in the tree that target out-of-tree release channels. This patch restores the preference with a note that it was removed in Firefox 59. MozReview-Commit-ID: Lg8bxoiIfxn --HG-- extra : rebase_source : ce3744baf37b30210239a5b840ee9fb1f7dc38f4 --- testing/geckodriver/src/prefs.rs | 3 ++- testing/marionette/client/marionette_driver/geckoinstance.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/testing/geckodriver/src/prefs.rs b/testing/geckodriver/src/prefs.rs index 407ed500a12e..6ce776567438 100644 --- a/testing/geckodriver/src/prefs.rs +++ b/testing/geckodriver/src/prefs.rs @@ -1,7 +1,7 @@ use mozprofile::preferences::Pref; lazy_static! { - pub static ref DEFAULT: [(&'static str, Pref); 78] = [ + pub static ref DEFAULT: [(&'static str, Pref); 79] = [ // Disable automatic downloading of new releases ("app.update.auto", Pref::new(false)), @@ -110,6 +110,7 @@ lazy_static! { // Do not show datareporting policy notifications which can // interfere with tests + ("datareporting.healthreport.about.reportUrl", Pref::new("http://%(server)s/dummy/abouthealthreport/")), // removed in Firefox 59 ("datareporting.healthreport.documentServerURI", Pref::new("http://%(server)s/dummy/healthreport/")), ("datareporting.healthreport.logging.consoleEnabled", Pref::new(false)), ("datareporting.healthreport.service.enabled", Pref::new(false)), diff --git a/testing/marionette/client/marionette_driver/geckoinstance.py b/testing/marionette/client/marionette_driver/geckoinstance.py index fe7524b7e19b..4e5f2947099c 100644 --- a/testing/marionette/client/marionette_driver/geckoinstance.py +++ b/testing/marionette/client/marionette_driver/geckoinstance.py @@ -33,6 +33,8 @@ class GeckoInstance(object): "apz.content_response_timeout": 60000, # Do not send Firefox health reports to the production server + # removed in Firefox 59 + "datareporting.healthreport.about.reportUrl": "http://%(server)s/dummy/abouthealthreport/", "datareporting.healthreport.documentServerURI": "http://%(server)s/dummy/healthreport/", # Do not show datareporting policy notifications which can interfer with tests From 77efd9020a7737e330d074b8065a7844215d4e54 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Thu, 8 Mar 2018 15:47:09 +0000 Subject: [PATCH 19/50] Bug 1401129 - Restore extensions.shield-recipe-client.api_url in automation tools. r=whimboo The extensions.shield-recipe-client.api_url preference was replaced with app.normandy.api_url in bug 1436113. There are multiple automation tools in the tree that target out-of-tree release channels and removing the old preference would break these. This patch re-adds the old preference with a note of when it was removed. MozReview-Commit-ID: HhTfRFkRQTC --HG-- extra : rebase_source : ec726c528b57e197a34e3e094c1c4bfe5d23da55 --- testing/geckodriver/src/prefs.rs | 8 ++++++-- .../client/marionette_driver/geckoinstance.py | 6 +++++- testing/marionette/components/marionette.js | 6 +++--- .../marionette_harness/tests/unit/test_prefs.py | 12 ++++++++++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/testing/geckodriver/src/prefs.rs b/testing/geckodriver/src/prefs.rs index 6ce776567438..d1d3d64043d9 100644 --- a/testing/geckodriver/src/prefs.rs +++ b/testing/geckodriver/src/prefs.rs @@ -1,7 +1,10 @@ use mozprofile::preferences::Pref; lazy_static! { - pub static ref DEFAULT: [(&'static str, Pref); 79] = [ + pub static ref DEFAULT: [(&'static str, Pref); 80] = [ + // Make sure Shield doesn't hit the network. + ("app.normandy.api_url", Pref::new("")), + // Disable automatic downloading of new releases ("app.update.auto", Pref::new(false)), @@ -145,7 +148,8 @@ lazy_static! { ("extensions.installDistroAddons", Pref::new(false)), // Make sure Shield doesn't hit the network. - ("app.normandy.api_url", Pref::new("")), + // Removed in Firefox 60. + ("extensions.shield-recipe-client.api_url", Pref::new("")), ("extensions.showMismatchUI", Pref::new(false)), diff --git a/testing/marionette/client/marionette_driver/geckoinstance.py b/testing/marionette/client/marionette_driver/geckoinstance.py index 4e5f2947099c..fa3ea8247db3 100644 --- a/testing/marionette/client/marionette_driver/geckoinstance.py +++ b/testing/marionette/client/marionette_driver/geckoinstance.py @@ -24,6 +24,9 @@ from . import errors class GeckoInstance(object): required_prefs = { + # Make sure Shield doesn't hit the network. + "app.normandy.api_url": "", + # Increase the APZ content response timeout in tests to 1 minute. # This is to accommodate the fact that test environments tends to be slower # than production environments (with the b2g emulator being the slowest of them @@ -55,7 +58,8 @@ class GeckoInstance(object): # Disable intalling any distribution add-ons "extensions.installDistroAddons": False, # Make sure Shield doesn't hit the network. - "app.normandy.api_url": "", + # Removed in Firefox 60. + "extensions.shield-recipe-client.api_url": "", "extensions.showMismatchUI": False, # Turn off extension updates so they don't bother tests "extensions.update.enabled": False, diff --git a/testing/marionette/components/marionette.js b/testing/marionette/components/marionette.js index 65b031c8556b..d89c3adb150c 100644 --- a/testing/marionette/components/marionette.js +++ b/testing/marionette/components/marionette.js @@ -54,6 +54,9 @@ const ENV_PRESERVE_PREFS = "MOZ_MARIONETTE_PREF_STATE_ACROSS_RESTARTS"; // are checked before Marionette initialises. const RECOMMENDED_PREFS = new Map([ + // Make sure Shield doesn't hit the network. + ["app.normandy.api_url", ""], + // Disable automatic downloading of new releases. // // This should also be set in the profile prior to starting Firefox, @@ -197,9 +200,6 @@ const RECOMMENDED_PREFS = new Map([ // Should be set in profile. ["extensions.installDistroAddons", false], - // Make sure Shield doesn't hit the network. - ["extensions.shield-recipe-client.api_url", ""], - ["extensions.showMismatchUI", false], // Turn off extension updates so they do not bother tests diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_prefs.py b/testing/marionette/harness/marionette_harness/tests/unit/test_prefs.py index 48f392450d62..2f12572d3e6a 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_prefs.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_prefs.py @@ -32,8 +32,16 @@ class TestPreferences(MarionetteTestCase): required_prefs = geckoinstance.GeckoInstance.required_prefs for key, value in required_prefs.iteritems(): - self.assertEqual(self.marionette.get_pref(key), value, - "Preference {} hasn't been set to {}".format(key, value)) + # The extensions.shield-recipe-client.* prefs branch + # is as of Firefox 60 migrated to app.normandy.*. + # + # This is a workaround that can be removed together + # with extensions.shield-recipe-client.api_url. + if key == "extensions.shield-recipe-client.api_url": + self.assertEqual(self.marionette.get_pref("app.normandy.api_url"), value) + else: + self.assertEqual(self.marionette.get_pref(key), value, + "Preference {} hasn't been set to {}".format(key, repr(value))) @skip_if_mobile("Only runnable with Firefox") def test_desktop_instance_preferences(self): From 33d987d48ad47a4013e6964d3279dfdd04670db4 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Mon, 12 Mar 2018 11:47:28 +0000 Subject: [PATCH 20/50] Bug 1401129 - Add peer review note to automation files. r=whimboo MozReview-Commit-ID: 47708JTKoro --HG-- extra : rebase_source : 234d2b84008937a6df8a36dcf05d341a0c4ae387 --- testing/geckodriver/src/prefs.rs | 7 +++++++ .../marionette/client/marionette_driver/geckoinstance.py | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/testing/geckodriver/src/prefs.rs b/testing/geckodriver/src/prefs.rs index d1d3d64043d9..d2dd0c2d36c8 100644 --- a/testing/geckodriver/src/prefs.rs +++ b/testing/geckodriver/src/prefs.rs @@ -1,5 +1,12 @@ use mozprofile::preferences::Pref; +// ALL CHANGES TO THIS FILE MUST HAVE REVIEW FROM A GECKODRIVER PEER! +// +// The Marionette Python client is used out-of-tree with release +// channel builds of Firefox. Removing a preference from this file +// will cause regressions, so please be careful and get review from +// a Testing :: Marionette peer before you make any changes to this file. + lazy_static! { pub static ref DEFAULT: [(&'static str, Pref); 80] = [ // Make sure Shield doesn't hit the network. diff --git a/testing/marionette/client/marionette_driver/geckoinstance.py b/testing/marionette/client/marionette_driver/geckoinstance.py index fa3ea8247db3..7c3780e8c570 100644 --- a/testing/marionette/client/marionette_driver/geckoinstance.py +++ b/testing/marionette/client/marionette_driver/geckoinstance.py @@ -22,6 +22,14 @@ from six import reraise from . import errors +# ALL CHANGES TO THIS FILE MUST HAVE REVIEW FROM A MARIONETTE PEER! +# +# The Marionette Python client is used out-of-tree with release +# channel builds of Firefox. Removing a preference from this file +# will cause regressions, so please be careful and get review from +# a Testing :: Marionette peer before you make any changes to this file. + + class GeckoInstance(object): required_prefs = { # Make sure Shield doesn't hit the network. From 7b875989b286162b43df83938318f81ddd033b3b Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Mon, 12 Mar 2018 11:48:18 +0000 Subject: [PATCH 21/50] Bug 1401129 - Release mozversion 0.1.3. r=whimboo MozReview-Commit-ID: JMUOjttq31L --HG-- extra : rebase_source : 188ea63b2a3aff99562df94bb7c4a9e164cfea54 --- Cargo.lock | 4 ++-- testing/mozbase/rust/mozversion/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4bfba0eb2f52..c0d81e99414f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -674,7 +674,7 @@ dependencies = [ "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "mozprofile 0.3.0", "mozrunner 0.5.0", - "mozversion 0.1.2", + "mozversion 0.1.3", "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1093,7 +1093,7 @@ dependencies = [ [[package]] name = "mozversion" -version = "0.1.2" +version = "0.1.3" dependencies = [ "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rust-ini 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/testing/mozbase/rust/mozversion/Cargo.toml b/testing/mozbase/rust/mozversion/Cargo.toml index 30daf0d0d82b..78308ae3d5db 100644 --- a/testing/mozbase/rust/mozversion/Cargo.toml +++ b/testing/mozbase/rust/mozversion/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mozversion" -version = "0.1.2" +version = "0.1.3" authors = ["James Graham "] description = "Utility for accessing Firefox version metadata" keywords = ["mozilla", "firefox"] From 6b09cf8df1874b5e5e3cb29dc4625d2c23e29d63 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Thu, 8 Mar 2018 14:26:10 +0000 Subject: [PATCH 22/50] Bug 1401129 - Release mozrunner 0.6.0. r=whimboo MozReview-Commit-ID: 2nljPi3HN5b --HG-- extra : rebase_source : 7e1cd2201937b5bb47fe81bcdbd6c1bc068b92b5 --- Cargo.lock | 4 ++-- testing/mozbase/rust/mozrunner/Cargo.toml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c0d81e99414f..c17a4386cd50 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -673,7 +673,7 @@ dependencies = [ "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "mozprofile 0.3.0", - "mozrunner 0.5.0", + "mozrunner 0.6.0", "mozversion 0.1.3", "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1084,7 +1084,7 @@ dependencies = [ [[package]] name = "mozrunner" -version = "0.5.0" +version = "0.6.0" dependencies = [ "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "mozprofile 0.3.0", diff --git a/testing/mozbase/rust/mozrunner/Cargo.toml b/testing/mozbase/rust/mozrunner/Cargo.toml index 41e3fb0b28ce..54a5a0469d59 100644 --- a/testing/mozbase/rust/mozrunner/Cargo.toml +++ b/testing/mozbase/rust/mozrunner/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "mozrunner" -version = "0.5.0" -authors = ["Mozilla Tools and Automation "] +version = "0.6.0" +authors = ["Mozilla"] description = "Library for starting Firefox binaries." repository = "https://hg.mozilla.org/mozilla-central/file/tip/testing/mozbase/rust/mozrunner" license = "MPL-2.0" From 4dcf6c50b71b9ad0d67db894e6bb600138a120b6 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Thu, 8 Mar 2018 16:05:08 +0000 Subject: [PATCH 23/50] Bug 1401129 - Release webdriver 0.35.0. r=whimboo MozReview-Commit-ID: lnoyZZbtcF --HG-- extra : rebase_source : c43d960f793cd3d3eed922ac8ebe31d9a0564d12 --- Cargo.lock | 4 ++-- testing/webdriver/Cargo.toml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c17a4386cd50..f749c08b7109 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -678,7 +678,7 @@ dependencies = [ "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "webdriver 0.34.0", + "webdriver 0.35.0", "zip 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1992,7 +1992,7 @@ dependencies = [ [[package]] name = "webdriver" -version = "0.34.0" +version = "0.35.0" dependencies = [ "cookie 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/testing/webdriver/Cargo.toml b/testing/webdriver/Cargo.toml index 97b4f86443fe..aa83640a8227 100644 --- a/testing/webdriver/Cargo.toml +++ b/testing/webdriver/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "webdriver" -version = "0.34.0" -authors = ["Mozilla "] +version = "0.35.0" +authors = ["Mozilla"] description = "Library implementing the wire protocol for the W3C WebDriver specification." keywords = ["webdriver", "browser", "automation", "protocol", "w3c"] documentation = "https://docs.rs/webdriver" @@ -16,5 +16,5 @@ log = "0.4" regex = "0.2" rustc-serialize = "0.3" time = "0.1" +unicode-segmentation = "1.1.0" url = "1" -unicode-segmentation = "1.1.0" \ No newline at end of file From 2dad6ae4c672fc1c8fb88452a619e355ed84ff22 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Thu, 8 Mar 2018 16:05:35 +0000 Subject: [PATCH 24/50] Bug 1401129 - Note changes for geckodriver 0.20.0 release. r=whimboo MozReview-Commit-ID: 1vb4nzpUlYD --HG-- extra : rebase_source : df910b9829a9a4cc1d8c5de5196b2c93fad61581 --- testing/geckodriver/CHANGES.md | 43 ++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/testing/geckodriver/CHANGES.md b/testing/geckodriver/CHANGES.md index 336eb5cba5f9..9f9dedc94382 100644 --- a/testing/geckodriver/CHANGES.md +++ b/testing/geckodriver/CHANGES.md @@ -3,12 +3,12 @@ Change log All notable changes to this program is documented in this file. -Unreleased ----------- +0.20.0 (2018-03-08) +------------------- ### Added -- New `--jsdebugger` flag to open the Browser Toolbox when Firefox +- New `--jsdebugger` flag to open the [Browser Toolbox] when Firefox launches. This is useful for debugging Marionette internals. - Introduced the temporary, boolean capability @@ -18,19 +18,35 @@ Unreleased ### Changed - HTTP status code for the [`StaleElementReference`] error changed - from 400 (Bad Request) to 404 (Not Found) + from 400 (Bad Request) to 404 (Not Found). - Backtraces from geckodriver no longer substitute for missing - Marionette stacktraces + Marionette stacktraces. -- `Delete Session` now allows Firefox to safely shutdown within 70s before - force-killing the process - -- Changed preference used to disable shield studies to `app.normandy.api_url`. +- [webdriver crate] upgraded to 0.35.0. ### Fixed -- Improved error messages for malformed capabilities +- The Firefox process is now given ample time to shut down, allowing + enough time for the Firefox shutdown hang monitor to kick in. + + Firefox has an integrated background monitor that observes + long-running threads during shutdown. These threads will be + killed after 63 seconds in the event of a hang. To allow Firefox + to shut down these threads on its own, geckodriver has to wait + that time and some additional seconds. + +- Grapheme clusters are now accepted as input for keyboard input + to actions. + + Input to the `value` field of the `keyDown` and `keyUp` action + primitives used to only accept single characters, which means + geckodriver would error when a valid grapheme cluster was sent in, + for example with the tamil nadu character U+0BA8 U+0BBF. + + Thanks to Greg Fraley for fixing this bug. + +- Improved error messages for malformed capability values. 0.19.1 (2017-10-30) @@ -793,9 +809,11 @@ and greater. [README]: https://github.com/mozilla/geckodriver/blob/master/README.md +[Browser Toolbox]: https://developer.mozilla.org/en-US/docs/Tools/Browser_Toolbox [`CloseWindowResponse`]: https://docs.rs/webdriver/newest/webdriver/response/struct.CloseWindowResponse.html [`CookieResponse`]: https://docs.rs/webdriver/newest/webdriver/response/struct.CookieResponse.html +[`DeleteSession`]: https://docs.rs/webdriver/newest/webdriver/command/enum.WebDriverCommand.html#variant.DeleteSession [`ElementClickIntercepted`]: https://docs.rs/webdriver/newest/webdriver/error/enum.ErrorStatus.html#variant.ElementClickIntercepted [`ElementNotInteractable`]: https://docs.rs/webdriver/newest/webdriver/error/enum.ErrorStatus.html#variant.ElementNotInteractable [`FullscreenWindow`]: https://docs.rs/webdriver/newest/webdriver/command/enum.WebDriverCommand.html#variant.FullscreenWindow @@ -821,15 +839,16 @@ and greater. [webdriver crate]: https://crates.io/crates/webdriver [Actions]: https://w3c.github.io/webdriver/webdriver-spec.html#actions +[Delete Session]: https://w3c.github.io/webdriver/webdriver-spec.html#delete-session [Element Click]: https://w3c.github.io/webdriver/webdriver-spec.html#element-click [Get Timeouts]: https://w3c.github.io/webdriver/webdriver-spec.html#get-timeouts -[Set Timeouts]: https://w3c.github.io/webdriver/webdriver-spec.html#set-timeouts [Get Window Rect]: https://w3c.github.io/webdriver/webdriver-spec.html#get-window-rect -[Set Window Rect]: https://w3c.github.io/webdriver/webdriver-spec.html#set-window-rect [insecure certificate]: https://w3c.github.io/webdriver/webdriver-spec.html#dfn-insecure-certificate [Minimize Window]: https://w3c.github.io/webdriver/webdriver-spec.html#minimize-window [New Session]: https://w3c.github.io/webdriver/webdriver-spec.html#new-session [Send Alert Text]: https://w3c.github.io/webdriver/webdriver-spec.html#send-alert-text +[Set Timeouts]: https://w3c.github.io/webdriver/webdriver-spec.html#set-timeouts +[Set Window Rect]: https://w3c.github.io/webdriver/webdriver-spec.html#set-window-rect [Status]: https://w3c.github.io/webdriver/webdriver-spec.html#status [Take Element Screenshot]: https://w3c.github.io/webdriver/webdriver-spec.html#take-element-screenshot [WebDriver errors]: https://w3c.github.io/webdriver/webdriver-spec.html#handling-errors From ea34c24a48f5a3a56b969f1b261710f70e72306d Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Thu, 8 Mar 2018 16:06:59 +0000 Subject: [PATCH 25/50] Bug 1401129 - Release geckodriver 0.20.0. r=whimboo MozReview-Commit-ID: Lip1pab8D0f --HG-- extra : rebase_source : 89fd332817e87cd0d7e45ed527d714237131e842 --- Cargo.lock | 2 +- testing/geckodriver/Cargo.toml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f749c08b7109..d437e04e3cf3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -665,7 +665,7 @@ dependencies = [ [[package]] name = "geckodriver" -version = "0.19.1" +version = "0.20.0" dependencies = [ "chrono 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/testing/geckodriver/Cargo.toml b/testing/geckodriver/Cargo.toml index 3d5a7063decf..3c70d6e7a093 100644 --- a/testing/geckodriver/Cargo.toml +++ b/testing/geckodriver/Cargo.toml @@ -1,7 +1,6 @@ [package] name = "geckodriver" -version = "0.19.1" -authors = ["Mozilla "] +version = "0.20.0" description = "Proxy for using WebDriver clients to interact with Gecko-based browsers." keywords = ["webdriver", "w3c", "httpd", "mozilla", "firefox"] repository = "https://hg.mozilla.org/mozilla-central/file/tip/testing/geckodriver" From 547748db6bba1d082d644f72c50b1d407df0d175 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Tue, 6 Mar 2018 17:47:15 +1100 Subject: [PATCH 26/50] Bug 1443392 - Send resize event when FRAMECHANGED flag is set even if the window isn't resized. r=jimm MozReview-Commit-ID: 9wpiFr9Tw9c --HG-- extra : rebase_source : e1f97df2afd9c76fba87684752662a78e9b851c9 --- widget/windows/nsWindow.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 52495d722136..c9baa8260cc7 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -6790,11 +6790,24 @@ void nsWindow::OnWindowPosChanged(WINDOWPOS* wp) return; } } + } - // Recalculate the width and height based on the client area for gecko events. - LayoutDeviceIntSize clientSize(newWidth, newHeight); + // Notify the widget listener for size change of client area for gecko + // events. This needs to be done when either window size is changed, + // or window frame is changed. They may not happen together. + // However, we don't invoke that for popup when window frame changes, + // because popups may trigger frame change before size change via + // {Set,Clear}ThemeRegion they invoke in Resize. That would make the + // code below call OnResize with a wrong client size first, which can + // lead to flickerling for some popups. + if (!(wp->flags & SWP_NOSIZE) || + ((wp->flags & SWP_FRAMECHANGED) && !IsPopup())) { + RECT r; + LayoutDeviceIntSize clientSize; if (::GetClientRect(mWnd, &r)) { clientSize = WinUtils::ToIntRect(r).Size(); + } else { + clientSize = mBounds.Size(); } // Send a gecko resize event OnResize(clientSize); From 34114150a6b99f8afd1815d6e345ba4f3efeaa15 Mon Sep 17 00:00:00 2001 From: Mike Conley Date: Wed, 31 Jan 2018 12:10:03 -0500 Subject: [PATCH 27/50] Bug 1423220 - Enable tab warming by default for Nightly builds. r=dao MozReview-Commit-ID: 8bz1U1WSzy5 --HG-- extra : rebase_source : f74a9b240c234d329f0e8d27ef6c4a84a4cc6de7 --- browser/app/profile/firefox.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 7e4816503435..4adfff98f013 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1541,8 +1541,12 @@ pref("browser.tabs.remote.desktopbehavior", true); // For speculatively warming up tabs to improve perceived // performance while using the async tab switcher. -// Disabled until bug 1397426 is fixed. +#if defined(NIGHTLY_BUILD) +pref("browser.tabs.remote.warmup.enabled", true); +#else pref("browser.tabs.remote.warmup.enabled", false); +#endif + pref("browser.tabs.remote.warmup.maxTabs", 3); pref("browser.tabs.remote.warmup.unloadDelayMs", 2000); From af806c4bab88a8d5f2056227aa5cb4c5f589b26c Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Sun, 11 Mar 2018 15:51:00 +0000 Subject: [PATCH 28/50] Bug 1444431 - Filter logs from familiar logging targets. r=jgraham geckodriver uses log 0.4, but it depends on a version of hyper that uses log 0.3. Previously this meant that geckodriver's logger could only see messages from crates using log 0.4, and had no access to messages from hyper or other crates using log 0.3. However, log 0.3.9 added interoperability so that programs built with a mix of log 0.3 and log 0.4 can again display messages from all crates. This patches geckodriver::logging to contain a whitelist of logged targets we care about. Currently this list includes geckodriver, mozprofile, mozrunner, mozversion, and webdriver. This will revert us to the behaviour prior to upgrading hyper to use log 0.3.9, and would be similar to the old implementation we had for filtering logs we had when geckodriver used slog. Thanks-to: Matt Brubeck MozReview-Commit-ID: 6Xj0k6VD1dQ --HG-- extra : rebase_source : 7a5aee1642b94516eedc1ca25b722e2868d0983b --- testing/geckodriver/src/logging.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/testing/geckodriver/src/logging.rs b/testing/geckodriver/src/logging.rs index f322994fe714..d9efd9ff7fc9 100644 --- a/testing/geckodriver/src/logging.rs +++ b/testing/geckodriver/src/logging.rs @@ -33,15 +33,20 @@ use std::fmt; use std::io; use std::io::Write; use std::str; -use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering}; +use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; static MAX_LOG_LEVEL: AtomicUsize = ATOMIC_USIZE_INIT; +const LOGGED_TARGETS: &'static [&'static str] = &[ + "geckodriver", + "mozprofile", + "mozrunner", + "mozversion", + "webdriver", +]; /// Logger levels from [Log.jsm]. /// -/// [Log.jsm]: -/// https://developer.mozilla.org/en/docs/Mozilla/JavaScript_code_modules/Log. -/// jsm +/// [Log.jsm]: https://developer.mozilla.org/en/docs/Mozilla/JavaScript_code_modules/Log.jsm #[repr(usize)] #[derive(Clone, Copy, Eq, Debug, Hash, PartialEq)] pub enum Level { @@ -134,7 +139,8 @@ struct Logger; impl log::Log for Logger { fn enabled(&self, meta: &log::Metadata) -> bool { - meta.level() <= log::max_level() + LOGGED_TARGETS.iter().any(|&x| meta.target().starts_with(x)) + && meta.level() <= log::max_level() } fn log(&self, record: &log::Record) { From c1c35dee0dd9a1e778b55d81ab15d7397e3df810 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Wed, 1 Mar 2017 15:41:43 +0900 Subject: [PATCH 29/50] Bug 1343451 - part 1: Declare (DOM|NS)_VK_PROCESSKEY for keyCode value during composition r=smaug When native key event is handled by IME, we should set keyCode to 0xE5 (229, VK_PROCESS of virtual keycode of Windows) for behaving same as the other browsers. This patch declares it same as other keyCode values. MozReview-Commit-ID: 666bB1qOEgv --HG-- extra : rebase_source : 8edcc49aab537240fb696b010e642848a6d439d4 --- dom/events/VirtualKeyCodeList.h | 3 +++ dom/webidl/KeyEvent.webidl | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/dom/events/VirtualKeyCodeList.h b/dom/events/VirtualKeyCodeList.h index 40615947ef8f..6660182fe7cd 100644 --- a/dom/events/VirtualKeyCodeList.h +++ b/dom/events/VirtualKeyCodeList.h @@ -212,6 +212,9 @@ DEFINE_VK_INTERNAL(_ALTGR) DEFINE_VK_INTERNAL(_WIN_ICO_HELP) DEFINE_VK_INTERNAL(_WIN_ICO_00) + +DEFINE_VK_INTERNAL(_PROCESSKEY) + DEFINE_VK_INTERNAL(_WIN_ICO_CLEAR) DEFINE_VK_INTERNAL(_WIN_OEM_RESET) DEFINE_VK_INTERNAL(_WIN_OEM_JUMP) diff --git a/dom/webidl/KeyEvent.webidl b/dom/webidl/KeyEvent.webidl index abb4b6a34285..6fd66afc21d9 100644 --- a/dom/webidl/KeyEvent.webidl +++ b/dom/webidl/KeyEvent.webidl @@ -195,6 +195,12 @@ interface KeyEvent // for compatibility with the other web browsers on Windows. const unsigned long DOM_VK_WIN_ICO_HELP = 0xE3; const unsigned long DOM_VK_WIN_ICO_00 = 0xE4; + + // IME processed key. + const unsigned long DOM_VK_PROCESSKEY = 0xE5; + + // OEM specific virtual keyCode of Windows should pass through DOM keyCode + // for compatibility with the other web browsers on Windows. const unsigned long DOM_VK_WIN_ICO_CLEAR = 0xE6; const unsigned long DOM_VK_WIN_OEM_RESET = 0xE9; const unsigned long DOM_VK_WIN_OEM_JUMP = 0xEA; From 2b972e10f7ae7a032cb385ef2daa8566f8a7afe2 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Wed, 1 Mar 2017 15:58:50 +0900 Subject: [PATCH 30/50] Bug 1343451 - part 2: KeyboardLayout and NativeKey should use native key code value to check if the key event was handled by IME r=m_kato On Windows, VK_PROCESSKEY key message is sent if the key event is handled by IME (in IMM mode or IMM-IME). Therefore, we can set WidgetKeyboardEvent::mKeyCode to NS_VK_PROCESSKEY and WidgetKeyboardEvent::mKeyNameIndex to KEY_NAME_INDEX_Process simply when we receive VK_PROCESSKEY. MozReview-Commit-ID: 9B8Q7rwfXYD --HG-- extra : rebase_source : a15105e3b6acf1f1911a8299911353dc4179e2c0 --- widget/NativeKeyToDOMKeyName.h | 3 +++ widget/tests/test_keycodes.xul | 4 ++-- widget/windows/KeyboardLayout.cpp | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/widget/NativeKeyToDOMKeyName.h b/widget/NativeKeyToDOMKeyName.h index db0d73da69aa..bfd5baa948b3 100644 --- a/widget/NativeKeyToDOMKeyName.h +++ b/widget/NativeKeyToDOMKeyName.h @@ -529,6 +529,9 @@ KEY_MAP_ANDROID (NonConvert, AKEYCODE_MUHENKAN) // PreviousCandidate KEY_MAP_GTK (PreviousCandidate, GDK_PreviousCandidate) // OADG 109, Mae Koho +// Process +KEY_MAP_WIN (Process, VK_PROCESSKEY) + // SingleCandidate KEY_MAP_GTK (SingleCandidate, GDK_SingleCandidate) diff --git a/widget/tests/test_keycodes.xul b/widget/tests/test_keycodes.xul index 7ac53d57e17c..694c8ef476ed 100644 --- a/widget/tests/test_keycodes.xul +++ b/widget/tests/test_keycodes.xul @@ -3023,10 +3023,10 @@ function* runKeyEventTests() const WIN_VK_PROCESSKEY_WITH_SC_A = WIN_VK_PROCESSKEY | 0x001E0000; yield testKey({layout:KEYBOARD_LAYOUT_EN_US, keyCode:WIN_VK_PROCESSKEY_WITH_SC_A, modifiers:{}, chars:"a"}, - ["a", "a", "Unidentified" /* TODO: Process */], "KeyA", 0 /* TODO: 0xE5 */, "a", SHOULD_DELIVER_ALL, KeyboardEvent.DOM_KEY_LOCATION_STANDARD); + ["a", "a", "Process"], "KeyA", KeyboardEvent.DOM_VK_PROCESSKEY, "a", SHOULD_DELIVER_ALL, KeyboardEvent.DOM_KEY_LOCATION_STANDARD); yield testKey({layout:KEYBOARD_LAYOUT_EN_US, keyCode:WIN_VK_PROCESSKEY_WITH_SC_A, modifiers:{altKey:1}, chars:"a"}, - ["a", "a", "Unidentified" /* TODO: Process */], "KeyA", 0 /* TODO: 0xE5 */, "a", SHOULD_DELIVER_ALL, KeyboardEvent.DOM_KEY_LOCATION_STANDARD); + ["a", "a", "Process"], "KeyA", KeyboardEvent.DOM_VK_PROCESSKEY, "a", SHOULD_DELIVER_ALL, KeyboardEvent.DOM_KEY_LOCATION_STANDARD); // US // Alphabet diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp index 947e914e4bef..2f7c43695f44 100644 --- a/widget/windows/KeyboardLayout.cpp +++ b/widget/windows/KeyboardLayout.cpp @@ -4805,7 +4805,7 @@ KeyboardLayout::ConvertNativeKeyCodeToDOMKeyCode(UINT aNativeKeyCode) const // VK_PROCESSKEY means IME already consumed the key event. case VK_PROCESSKEY: - return 0; + return NS_VK_PROCESSKEY; // VK_PACKET is generated by SendInput() API, we don't need to // care this message as key event. case VK_PACKET: From 099a9bedeea736c4b6450bdffff0483c51089fd9 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Thu, 22 Feb 2018 19:52:53 +0900 Subject: [PATCH 31/50] Bug 1343451 - part 3-1: Make KeymapWrapper::InitKeyEvent() mark given key event as "processed by IME" if it has been handled by IME r=m_kato For conforming UI Events spec, KeymapWrapper::InitKeyEvent() should initialize mKeyCode and mKeyNameIndex with NS_VK_PROCESSKEY and KEY_NAME_INDEX_Process if given keyboard event has already been handled by IME. For making it know if given keyboard event has been handled by IME, this patch adds additional bool argument to it and its callers. Note that this patch changes keyCode value and key value of "keydown" event if it's fired before "compositionstart" since Chromium does so on Linux. MozReview-Commit-ID: FC3tfyeeopU --HG-- extra : rebase_source : 9c88967b8e2a5539023deb1277ae8704418dfd0d --- widget/gtk/IMContextWrapper.cpp | 6 +++-- widget/gtk/nsGtkKeyUtils.cpp | 16 +++++++++----- widget/gtk/nsGtkKeyUtils.h | 4 +++- widget/gtk/nsWindow.cpp | 39 +++++++++++++++------------------ widget/gtk/nsWindow.h | 18 +++++++++++---- 5 files changed, 50 insertions(+), 33 deletions(-) diff --git a/widget/gtk/IMContextWrapper.cpp b/widget/gtk/IMContextWrapper.cpp index 33552fbe2c21..bb268da75dc2 100644 --- a/widget/gtk/IMContextWrapper.cpp +++ b/widget/gtk/IMContextWrapper.cpp @@ -1412,9 +1412,11 @@ IMContextWrapper::DispatchCompositionStart(GtkIMContext* aContext) // If this composition is started by a native keydown event, we need to // dispatch our keydown event here (before composition start). + // Note that make the preceding eKeyDown event marked as "processed + // by IME" for compatibility with Chromium. bool isCancelled; - mLastFocusedWindow->DispatchKeyDownEvent(mProcessingKeyEvent, - &isCancelled); + mLastFocusedWindow->DispatchKeyDownOrKeyUpEvent(mProcessingKeyEvent, + true, &isCancelled); MOZ_LOG(gGtkIMLog, LogLevel::Debug, ("0x%p DispatchCompositionStart(), preceding keydown event is " "dispatched", diff --git a/widget/gtk/nsGtkKeyUtils.cpp b/widget/gtk/nsGtkKeyUtils.cpp index a336c1ad6c92..6a02b9a1bc67 100644 --- a/widget/gtk/nsGtkKeyUtils.cpp +++ b/widget/gtk/nsGtkKeyUtils.cpp @@ -931,14 +931,19 @@ KeymapWrapper::ComputeDOMCodeNameIndex(const GdkEventKey* aGdkKeyEvent) /* static */ void KeymapWrapper::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent, - GdkEventKey* aGdkKeyEvent) + GdkEventKey* aGdkKeyEvent, + bool aIsProcessedByIME) { + MOZ_ASSERT(!aIsProcessedByIME || aKeyEvent.mMessage != eKeyPress, + "If the key event is handled by IME, keypress event shouldn't be fired"); + KeymapWrapper* keymapWrapper = GetInstance(); aKeyEvent.mCodeNameIndex = ComputeDOMCodeNameIndex(aGdkKeyEvent); MOZ_ASSERT(aKeyEvent.mCodeNameIndex != CODE_NAME_INDEX_USE_STRING); aKeyEvent.mKeyNameIndex = - keymapWrapper->ComputeDOMKeyNameIndex(aGdkKeyEvent); + aIsProcessedByIME ? KEY_NAME_INDEX_Process : + keymapWrapper->ComputeDOMKeyNameIndex(aGdkKeyEvent); if (aKeyEvent.mKeyNameIndex == KEY_NAME_INDEX_Unidentified) { uint32_t charCode = GetCharCodeFor(aGdkKeyEvent); if (!charCode) { @@ -951,10 +956,11 @@ KeymapWrapper::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent, AppendUCS4ToUTF16(charCode, aKeyEvent.mKeyValue); } } - aKeyEvent.mKeyCode = ComputeDOMKeyCode(aGdkKeyEvent); - if (aKeyEvent.mKeyNameIndex != KEY_NAME_INDEX_USE_STRING || - aKeyEvent.mMessage != eKeyPress) { + if (aIsProcessedByIME) { + aKeyEvent.mKeyCode = NS_VK_PROCESSKEY; + } else if (aKeyEvent.mKeyNameIndex != KEY_NAME_INDEX_USE_STRING || + aKeyEvent.mMessage != eKeyPress) { aKeyEvent.mKeyCode = ComputeDOMKeyCode(aGdkKeyEvent); } else { aKeyEvent.mKeyCode = 0; diff --git a/widget/gtk/nsGtkKeyUtils.h b/widget/gtk/nsGtkKeyUtils.h index 3dc8a4f6a936..a1b9e53f0daa 100644 --- a/widget/gtk/nsGtkKeyUtils.h +++ b/widget/gtk/nsGtkKeyUtils.h @@ -131,9 +131,11 @@ public: * @param aKeyEvent It's an WidgetKeyboardEvent which needs to be * initialized. * @param aGdkKeyEvent A native GDK key event. + * @param aIsProcessedByIME true if aGdkKeyEvent is handled by IME. */ static void InitKeyEvent(WidgetKeyboardEvent& aKeyEvent, - GdkEventKey* aGdkKeyEvent); + GdkEventKey* aGdkKeyEvent, + bool aIsProcessedByIME); /** * WillDispatchKeyboardEvent() is called via diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index dcbff364916b..ae342a557b6b 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -2937,13 +2937,15 @@ IsCtrlAltTab(GdkEventKey *aEvent) } bool -nsWindow::DispatchKeyDownEvent(GdkEventKey *aEvent, bool *aCancelled) +nsWindow::DispatchKeyDownOrKeyUpEvent(GdkEventKey* aEvent, + bool aIsProcessedByIME, + bool* aIsCancelled) { - NS_PRECONDITION(aCancelled, "aCancelled must not be null"); + MOZ_ASSERT(aIsCancelled, "aCancelled must not be null"); - *aCancelled = false; + *aIsCancelled = false; - if (IsCtrlAltTab(aEvent)) { + if (aEvent->type == GDK_KEY_PRESS && IsCtrlAltTab(aEvent)) { return false; } @@ -2953,13 +2955,14 @@ nsWindow::DispatchKeyDownEvent(GdkEventKey *aEvent, bool *aCancelled) return FALSE; } - WidgetKeyboardEvent keydownEvent(true, eKeyDown, this); - KeymapWrapper::InitKeyEvent(keydownEvent, aEvent); + EventMessage message = + aEvent->type == GDK_KEY_PRESS ? eKeyDown : eKeyUp; + WidgetKeyboardEvent keyEvent(true, message, this); + KeymapWrapper::InitKeyEvent(keyEvent, aEvent, aIsProcessedByIME); nsEventStatus status = nsEventStatus_eIgnore; bool dispatched = - dispatcher->DispatchKeyboardEvent(eKeyDown, keydownEvent, - status, aEvent); - *aCancelled = (status == nsEventStatus_eConsumeNoDefault); + dispatcher->DispatchKeyboardEvent(message, keyEvent, status, aEvent); + *aIsCancelled = (status == nsEventStatus_eConsumeNoDefault); return dispatched ? TRUE : FALSE; } @@ -3045,7 +3048,7 @@ nsWindow::OnKeyPressEvent(GdkEventKey *aEvent) // KEYDOWN -> KEYPRESS -> KEYUP -> KEYDOWN -> KEYPRESS -> KEYUP... bool isKeyDownCancelled = false; - if (DispatchKeyDownEvent(aEvent, &isKeyDownCancelled) && + if (DispatchKeyDownOrKeyUpEvent(aEvent, false, &isKeyDownCancelled) && (MOZ_UNLIKELY(mIsDestroyed) || isKeyDownCancelled)) { return TRUE; } @@ -3094,7 +3097,7 @@ nsWindow::OnKeyPressEvent(GdkEventKey *aEvent) } WidgetKeyboardEvent keypressEvent(true, eKeyPress, this); - KeymapWrapper::InitKeyEvent(keypressEvent, aEvent); + KeymapWrapper::InitKeyEvent(keypressEvent, aEvent, false); // before we dispatch a key, check if it's the context menu key. // If so, send a context menu key event instead. @@ -3178,7 +3181,7 @@ nsWindow::MaybeDispatchContextMenuEvent(const GdkEventKey* aEvent) } gboolean -nsWindow::OnKeyReleaseEvent(GdkEventKey *aEvent) +nsWindow::OnKeyReleaseEvent(GdkEventKey* aEvent) { LOGFOCUS(("OnKeyReleaseEvent [%p]\n", (void *)this)); @@ -3186,17 +3189,11 @@ nsWindow::OnKeyReleaseEvent(GdkEventKey *aEvent) return TRUE; } - RefPtr dispatcher = GetTextEventDispatcher(); - nsresult rv = dispatcher->BeginNativeInputTransaction(); - if (NS_WARN_IF(NS_FAILED(rv))) { - return false; + bool isCancelled = false; + if (NS_WARN_IF(!DispatchKeyDownOrKeyUpEvent(aEvent, false, &isCancelled))) { + return FALSE; } - WidgetKeyboardEvent keyupEvent(true, eKeyUp, this); - KeymapWrapper::InitKeyEvent(keyupEvent, aEvent); - nsEventStatus status = nsEventStatus_eIgnore; - dispatcher->DispatchKeyboardEvent(eKeyUp, keyupEvent, status, aEvent); - return TRUE; } diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h index 0d57c156f49f..e7ed6f47c044 100644 --- a/widget/gtk/nsWindow.h +++ b/widget/gtk/nsWindow.h @@ -278,10 +278,20 @@ public: guint aTime); static void UpdateDragStatus (GdkDragContext *aDragContext, nsIDragService *aDragService); - // If this dispatched the keydown event actually, this returns TRUE, - // otherwise, FALSE. - bool DispatchKeyDownEvent(GdkEventKey *aEvent, - bool *aIsCancelled); + /** + * DispatchKeyDownOrKeyUpEvent() dispatches eKeyDown or eKeyUp event. + * + * @param aEvent A native GDK_KEY_PRESS or GDK_KEY_RELEASE + * event. + * @param aProcessedByIME true if the event is handled by IME. + * @param aIsCancelled [Out] true if the default is prevented. + * @return true if eKeyDown event is actually dispatched. + * Otherwise, false. + */ + bool DispatchKeyDownOrKeyUpEvent(GdkEventKey* aEvent, + bool aProcessedByIME, + bool* aIsCancelled); + WidgetEventTime GetWidgetEventTime(guint32 aEventTime); mozilla::TimeStamp GetEventTimeStamp(guint32 aEventTime); mozilla::CurrentX11TimeGetter* GetCurrentTimeGetter(); From fd292edc43a4bb48567d47cc96d712777e9ae5cd Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Thu, 22 Feb 2018 20:56:08 +0900 Subject: [PATCH 32/50] Bug 1343451 - part 3-2: Make IMContextWrapper dispatch eKeyDown event or eKeyUp event if IME handles native key event but we have not dispatched DOM event for it yet r=m_kato Currently, IMContextWrapper doesn't dispatch eKeyDown event and eKeyUp event if it's handled by IME. However, for conforming to UI Events, it should not eat given keyboard events completely. This patch makes IMContextWrapper dispatches eKeyDown event or eKeyUp event before dispatching first event of composition events or content command event. MozReview-Commit-ID: H2jHpViTH5Q --HG-- extra : rebase_source : 4129620126a34e27af1503e7c4652bb09c7e9bb6 --- widget/gtk/IMContextWrapper.cpp | 239 ++++++++++++++++++++------------ widget/gtk/IMContextWrapper.h | 65 ++++++--- 2 files changed, 203 insertions(+), 101 deletions(-) diff --git a/widget/gtk/IMContextWrapper.cpp b/widget/gtk/IMContextWrapper.cpp index bb268da75dc2..ba64e3c25a9e 100644 --- a/widget/gtk/IMContextWrapper.cpp +++ b/widget/gtk/IMContextWrapper.cpp @@ -175,6 +175,8 @@ IMContextWrapper::IMContextWrapper(nsWindow* aOwnerWindow) , mProcessingKeyEvent(nullptr) , mCompositionState(eCompositionState_NotComposing) , mIsIMFocused(false) + , mFallbackToKeyEvent(false) + , mKeyboardEventWasDispatched(false) , mIsDeletingSurrounding(false) , mLayoutChanged(false) , mSetCursorPositionOnKeyEvent(true) @@ -484,7 +486,7 @@ IMContextWrapper::OnBlurWindow(nsWindow* aWindow) bool IMContextWrapper::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent, - bool aKeyDownEventWasSent /* = false */) + bool aKeyboardEventWasDispatched /* = false */) { NS_PRECONDITION(aEvent, "aEvent must be non-null"); @@ -494,10 +496,10 @@ IMContextWrapper::OnKeyEvent(nsWindow* aCaller, } MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("0x%p OnKeyEvent(aCaller=0x%p, aKeyDownEventWasSent=%s), " + ("0x%p OnKeyEvent(aCaller=0x%p, aKeyboardEventWasDispatched=%s), " "mCompositionState=%s, current context=0x%p, active context=0x%p, " "aEvent(0x%p): { type=%s, keyval=%s, unicode=0x%X }", - this, aCaller, ToChar(aKeyDownEventWasSent), + this, aCaller, ToChar(aKeyboardEventWasDispatched), GetCompositionStateName(), GetCurrentContext(), GetActiveContext(), aEvent, GetEventType(aEvent), gdk_keyval_name(aEvent->keyval), gdk_keyval_to_unicode(aEvent->keyval))); @@ -525,49 +527,51 @@ IMContextWrapper::OnKeyEvent(nsWindow* aCaller, mSetCursorPositionOnKeyEvent = false; } - mKeyDownEventWasSent = aKeyDownEventWasSent; - mFilterKeyEvent = true; + mKeyboardEventWasDispatched = aKeyboardEventWasDispatched; + mFallbackToKeyEvent = false; mProcessingKeyEvent = aEvent; gboolean isFiltered = gtk_im_context_filter_keypress(currentContext, aEvent); - mProcessingKeyEvent = nullptr; - // We filter the key event if the event was not committed (because - // it's probably part of a composition) or if the key event was - // committed _and_ changed. This way we still let key press - // events go through as simple key press events instead of - // composed characters. - bool filterThisEvent = isFiltered && mFilterKeyEvent; + // The caller of this shouldn't handle aEvent anymore if we've dispatched + // composition events or modified content with other events. + bool filterThisEvent = isFiltered && !mFallbackToKeyEvent; - if (IsComposingOnCurrentContext() && !isFiltered) { - if (aEvent->type == GDK_KEY_PRESS) { - if (!mDispatchedCompositionString.IsEmpty()) { - // If there is composition string, we shouldn't dispatch - // any keydown events during composition. - filterThisEvent = true; - } else { - // A Hangul input engine for SCIM doesn't emit preedit_end - // signal even when composition string becomes empty. On the - // other hand, we should allow to make composition with empty - // string for other languages because there *might* be such - // IM. For compromising this issue, we should dispatch - // compositionend event, however, we don't need to reset IM - // actually. - DispatchCompositionCommitEvent(currentContext, &EmptyString()); - filterThisEvent = false; - } - } else { - // Key release event may not be consumed by IM, however, we - // shouldn't dispatch any keyup event during composition. - filterThisEvent = true; - } + if (IsComposingOnCurrentContext() && !isFiltered && + aEvent->type == GDK_KEY_PRESS && + mDispatchedCompositionString.IsEmpty()) { + // A Hangul input engine for SCIM doesn't emit preedit_end + // signal even when composition string becomes empty. On the + // other hand, we should allow to make composition with empty + // string for other languages because there *might* be such + // IM. For compromising this issue, we should dispatch + // compositionend event, however, we don't need to reset IM + // actually. + // NOTE: Don't dispatch key events as "processed by IME" since + // we need to dispatch keyboard events as IME wasn't handled it. + mProcessingKeyEvent = nullptr; + DispatchCompositionCommitEvent(currentContext, &EmptyString()); + mProcessingKeyEvent = aEvent; + // In this case, even though we handle the keyboard event here, + // but we should dispatch keydown event as + filterThisEvent = false; } + // If IME handled the key event but we've not dispatched eKeyDown nor + // eKeyUp event yet, we need to dispatch here because the caller won't + // do it. + if (filterThisEvent) { + MaybeDispatchKeyEventAsProcessedByIME(); + // Be aware, the widget might have been gone here. + } + + mProcessingKeyEvent = nullptr; + MOZ_LOG(gGtkIMLog, LogLevel::Debug, ("0x%p OnKeyEvent(), succeeded, filterThisEvent=%s " - "(isFiltered=%s, mFilterKeyEvent=%s), mCompositionState=%s", + "(isFiltered=%s, mFallbackToKeyEvent=%s), mCompositionState=%s", this, ToChar(filterThisEvent), ToChar(isFiltered), - ToChar(mFilterKeyEvent), GetCompositionStateName())); + ToChar(mFallbackToKeyEvent), GetCompositionStateName())); return filterThisEvent; } @@ -1302,11 +1306,14 @@ IMContextWrapper::OnCommitCompositionNative(GtkIMContext* aContext, } // If IME doesn't change their keyevent that generated this commit, - // don't send it through XIM - just send it as a normal key press - // event. + // we should treat that IME didn't handle the key event because + // web applications want to receive "keydown" and "keypress" event + // in such case. // NOTE: While a key event is being handled, this might be caused on // current context. Otherwise, this may be caused on active context. - if (!IsComposingOn(aContext) && mProcessingKeyEvent && + if (!IsComposingOn(aContext) && + mProcessingKeyEvent && + mProcessingKeyEvent->type == GDK_KEY_PRESS && aContext == GetCurrentContext()) { char keyval_utf8[8]; /* should have at least 6 bytes of space */ gint keyval_utf8_len; @@ -1321,7 +1328,9 @@ IMContextWrapper::OnCommitCompositionNative(GtkIMContext* aContext, ("0x%p OnCommitCompositionNative(), " "we'll send normal key event", this)); - mFilterKeyEvent = false; + // In this case, eKeyDown and eKeyPress event should be dispatched + // by the caller of OnKeyEvent(). + mFallbackToKeyEvent = true; return; } } @@ -1355,6 +1364,65 @@ IMContextWrapper::GetCompositionString(GtkIMContext* aContext, g_free(preedit_string); } +bool +IMContextWrapper::MaybeDispatchKeyEventAsProcessedByIME() +{ + if (!mProcessingKeyEvent || mKeyboardEventWasDispatched || + !mLastFocusedWindow) { + return true; + } + + // A "keydown" or "keyup" event handler may change focus with the + // following event. In such case, we need to cancel this composition. + // So, we need to store IM context now because mComposingContext may be + // overwritten with different context if calling this method recursively. + // Note that we don't need to grab the context here because |context| + // will be used only for checking if it's same as mComposingContext. + GtkIMContext* oldCurrentContext = GetCurrentContext(); + GtkIMContext* oldComposingContext = mComposingContext; + + RefPtr lastFocusedWindow(mLastFocusedWindow); + mKeyboardEventWasDispatched = true; + + // FYI: We should ignore if default of preceding keydown or keyup event is + // prevented since even on the other browsers, web applications + // cannot cancel the following composition event. + // Spec bug: https://github.com/w3c/uievents/issues/180 + bool isCancelled; + lastFocusedWindow->DispatchKeyDownOrKeyUpEvent(mProcessingKeyEvent, true, + &isCancelled); + MOZ_LOG(gGtkIMLog, LogLevel::Debug, + ("0x%p MaybeDispatchKeyEventAsProcessedByIME(), keydown or keyup " + "event is dispatched", + this)); + if (lastFocusedWindow->IsDestroyed() || + lastFocusedWindow != mLastFocusedWindow) { + MOZ_LOG(gGtkIMLog, LogLevel::Warning, + ("0x%p MaybeDispatchKeyEventAsProcessedByIME(), Warning, the " + "focused widget was destroyed/changed by a key event", + this)); + return false; + } + + // If the dispatched keydown event caused moving focus and that also + // caused changing active context, we need to cancel composition here. + if (GetCurrentContext() != oldCurrentContext) { + MOZ_LOG(gGtkIMLog, LogLevel::Warning, + ("0x%p MaybeDispatchKeyEventAsProcessedByIME(), Warning, the key " + "event causes changing active IM context", + this)); + if (mComposingContext == oldComposingContext) { + // Only when the context is still composing, we should call + // ResetIME() here. Otherwise, it should've already been + // cleaned up. + ResetIME(); + } + return false; + } + + return true; +} + bool IMContextWrapper::DispatchCompositionStart(GtkIMContext* aContext) { @@ -1399,52 +1467,16 @@ IMContextWrapper::DispatchCompositionStart(GtkIMContext* aContext) mCompositionStart = mSelection.mOffset; mDispatchedCompositionString.Truncate(); - if (mProcessingKeyEvent && !mKeyDownEventWasSent && - mProcessingKeyEvent->type == GDK_KEY_PRESS) { - // A keydown event handler may change focus with the following keydown - // event. In such case, we need to cancel this composition. So, we - // need to store IM context now because mComposingContext may be - // overwritten with different context if calling this method - // recursively. - // Note that we don't need to grab the context here because |context| - // will be used only for checking if it's same as mComposingContext. - GtkIMContext* context = mComposingContext; - - // If this composition is started by a native keydown event, we need to - // dispatch our keydown event here (before composition start). - // Note that make the preceding eKeyDown event marked as "processed - // by IME" for compatibility with Chromium. - bool isCancelled; - mLastFocusedWindow->DispatchKeyDownOrKeyUpEvent(mProcessingKeyEvent, - true, &isCancelled); - MOZ_LOG(gGtkIMLog, LogLevel::Debug, - ("0x%p DispatchCompositionStart(), preceding keydown event is " - "dispatched", + // If this composition is started by a key press, we need to dispatch + // eKeyDown or eKeyUp event before dispatching eCompositionStart event. + // Note that dispatching a keyboard event which is marked as "processed + // by IME" is okay since Chromium also dispatches keyboard event as so. + if (!MaybeDispatchKeyEventAsProcessedByIME()) { + MOZ_LOG(gGtkIMLog, LogLevel::Warning, + ("0x%p DispatchCompositionStart(), Warning, " + "MaybeDispatchKeyEventAsProcessedByIME() returned false", this)); - if (lastFocusedWindow->IsDestroyed() || - lastFocusedWindow != mLastFocusedWindow) { - MOZ_LOG(gGtkIMLog, LogLevel::Warning, - ("0x%p DispatchCompositionStart(), Warning, the focused " - "widget was destroyed/changed by keydown event", - this)); - return false; - } - - // If the dispatched keydown event caused moving focus and that also - // caused changing active context, we need to cancel composition here. - if (GetCurrentContext() != context) { - MOZ_LOG(gGtkIMLog, LogLevel::Warning, - ("0x%p DispatchCompositionStart(), Warning, the preceding " - "keydown event causes changing active IM context", - this)); - if (mComposingContext == context) { - // Only when the context is still composing, we should call - // ResetIME() here. Otherwise, it should've already been - // cleaned up. - ResetIME(); - } - return false; - } + return false; } RefPtr dispatcher = GetTextEventDispatcher(); @@ -1502,6 +1534,15 @@ IMContextWrapper::DispatchCompositionChangeEvent( return false; } } + // If this composition string change caused by a key press, we need to + // dispatch eKeyDown or eKeyUp before dispatching eCompositionChange event. + else if (!MaybeDispatchKeyEventAsProcessedByIME()) { + MOZ_LOG(gGtkIMLog, LogLevel::Warning, + ("0x%p DispatchCompositionChangeEvent(), Warning, " + "MaybeDispatchKeyEventAsProcessedByIME() returned false", + this)); + return false; + } RefPtr dispatcher = GetTextEventDispatcher(); nsresult rv = dispatcher->BeginNativeInputTransaction(); @@ -1591,6 +1632,14 @@ IMContextWrapper::DispatchCompositionCommitEvent( return false; } + // TODO: We need special care to handle request to commit composition + // by content while we're committing composition because we have + // commit string information now but IME may not have composition + // anymore. Therefore, we may not be able to handle commit as + // expected. However, this is rare case because this situation + // never occurs with remote content. So, it's okay to fix this + // issue later. (Perhaps, TextEventDisptcher should do it for + // all platforms. E.g., creating WillCommitComposition()?) if (!IsComposing()) { if (!aCommitString || aCommitString->IsEmpty()) { MOZ_LOG(gGtkIMLog, LogLevel::Error, @@ -1607,6 +1656,16 @@ IMContextWrapper::DispatchCompositionCommitEvent( return false; } } + // If this commit caused by a key press, we need to dispatch eKeyDown or + // eKeyUp before dispatching composition events. + else if (!MaybeDispatchKeyEventAsProcessedByIME()) { + MOZ_LOG(gGtkIMLog, LogLevel::Warning, + ("0x%p DispatchCompositionCommitEvent(), Warning, " + "MaybeDispatchKeyEventAsProcessedByIME() returned false", + this)); + mCompositionState = eCompositionState_NotComposing; + return false; + } RefPtr dispatcher = GetTextEventDispatcher(); nsresult rv = dispatcher->BeginNativeInputTransaction(); @@ -2301,6 +2360,16 @@ IMContextWrapper::DeleteText(GtkIMContext* aContext, return NS_ERROR_FAILURE; } + // If this deleting text caused by a key press, we need to dispatch + // eKeyDown or eKeyUp before dispatching eContentCommandDelete event. + if (!MaybeDispatchKeyEventAsProcessedByIME()) { + MOZ_LOG(gGtkIMLog, LogLevel::Warning, + ("0x%p DeleteText(), Warning, " + "MaybeDispatchKeyEventAsProcessedByIME() returned false", + this)); + return NS_ERROR_FAILURE; + } + // Delete the selection WidgetContentCommandEvent contentCommandEvent(true, eContentCommandDelete, mLastFocusedWindow); diff --git a/widget/gtk/IMContextWrapper.h b/widget/gtk/IMContextWrapper.h index 17c758092410..241319cee9ea 100644 --- a/widget/gtk/IMContextWrapper.h +++ b/widget/gtk/IMContextWrapper.h @@ -65,13 +65,26 @@ public: void OnSelectionChange(nsWindow* aCaller, const IMENotification& aIMENotification); - // OnKeyEvent is called when aWindow gets a native key press event or a - // native key release event. If this returns TRUE, the key event was - // filtered by IME. Otherwise, this returns FALSE. - // NOTE: When the keypress event starts composition, this returns TRUE but - // this dispatches keydown event before compositionstart event. + /** + * OnKeyEvent() is called when aWindow gets a native key press event or a + * native key release event. If this returns true, the key event was + * filtered by IME. Otherwise, this returns false. + * NOTE: When the native key press event starts composition, this returns + * true but dispatches an eKeyDown event or eKeyUp event before + * dispatching composition events or content command event. + * + * @param aWindow A window on which user operate the + * key. + * @param aEvent A native key press or release + * event. + * @param aKeyboardEventWasDispatched true if eKeyDown or eKeyUp event + * for aEvent has already been + * dispatched. In this case, + * this class doesn't dispatch + * keyboard event anymore. + */ bool OnKeyEvent(nsWindow* aWindow, GdkEventKey* aEvent, - bool aKeyDownEventWasSent = false); + bool aKeyboardEventWasDispatched = false); // IME related nsIWidget methods. nsresult EndIMEComposition(nsWindow* aCaller); @@ -263,16 +276,20 @@ protected: // mIsIMFocused is set to TRUE when we call gtk_im_context_focus_in(). And // it's set to FALSE when we call gtk_im_context_focus_out(). bool mIsIMFocused; - // mFilterKeyEvent is used by OnKeyEvent(). If the commit event should - // be processed as simple key event, this is set to TRUE by the commit - // handler. - bool mFilterKeyEvent; - // mKeyDownEventWasSent is used by OnKeyEvent() and - // DispatchCompositionStart(). DispatchCompositionStart() dispatches - // a keydown event if the composition start is caused by a native - // keypress event. If this is true, the keydown event has been dispatched. - // Then, DispatchCompositionStart() doesn't dispatch keydown event. - bool mKeyDownEventWasSent; + // mFallbackToKeyEvent is set to false when this class starts to handle + // a native key event (at that time, mProcessingKeyEvent is set to the + // native event). If active IME just commits composition with a character + // which is produced by the key with current keyboard layout, this is set + // to true. + bool mFallbackToKeyEvent; + // mKeyboardEventWasDispatched is used by OnKeyEvent() and + // MaybeDispatchKeyEventAsProcessedByIME(). + // MaybeDispatchKeyEventAsProcessedByIME() dispatches an eKeyDown or + // eKeyUp event event if the composition is caused by a native + // key press event. If this is true, a keyboard event has been dispatched + // for the native event. If so, MaybeDispatchKeyEventAsProcessedByIME() + // won't dispatch keyboard event anymore. + bool mKeyboardEventWasDispatched; // mIsDeletingSurrounding is true while OnDeleteSurroundingNative() is // trying to delete the surrounding text. bool mIsDeletingSurrounding; @@ -443,11 +460,27 @@ protected: * Following methods dispatch gecko events. Then, the focused widget * can be destroyed, and also it can be stolen focus. If they returns * FALSE, callers cannot continue the composition. + * - MaybeDispatchKeyEventAsProcessedByIME * - DispatchCompositionStart * - DispatchCompositionChangeEvent * - DispatchCompositionCommitEvent */ + /** + * Dispatch an eKeyDown or eKeyUp event whose mKeyCode value is + * NS_VK_PROCESSKEY and mKeyNameIndex is KEY_NAME_INDEX_Process if + * mProcessingKeyEvent is not nullptr and mKeyboardEventWasDispatched is + * still false. If this dispatches a keyboard event, this sets + * mKeyboardEventWasDispatched to true. + * + * @return If the caller can continue to handle + * composition, returns true. Otherwise, + * false. For example, if focus is moved + * by dispatched keyboard event, returns + * false. + */ + bool MaybeDispatchKeyEventAsProcessedByIME(); + /** * Dispatches a composition start event. * From 2c2365305c9c602fa3ec6d29091101148e918170 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Fri, 23 Feb 2018 23:09:43 +0900 Subject: [PATCH 33/50] Bug 1343451 - part 4: Make TextInputHandler dispatches eKeyDown event with marking it as "processed by IME" r=m_kato First of all, TextInputHandler::HandleKeyDown() dispatches an eKeyDown event before sending IME. This is different behavior from Gecko on the other platforms and it means TextInputHandler does not know if the eKeyDown event will be handled by IME. Therefore, we need to make TextInputHandler dispatch an eKeyDown event dispatch when it needs to dispatch another event. Therefore, this patch makes TextInputHandler not dispatch an eKeyDown even from its HandleKeyDown() unless it's already has composition (because if it's already had composition, any eKeyDown event except modifier keys should be marked as "processed by IME" for compatibility with the other browsers). For dispatching eKeyDown event only once for a native keydown event, this patch implements TextInputHandlerBase::MaybeDispatchCurrentKeydownEvent() to check whether eKeyDown event has already been dispatched for the event and if it's not so, dispatches eKeyDown event. Note that on macOS, dead keys are implemented as IME. However, we need to treat dead keys as is. Therefore, if current keydown event is a dead keydown event, MaybeDispatchCurrentKeydownEvent() should NOT mark dispatching eKeyDown event and its following eKeyDown event as "processed by IME". MozReview-Commit-ID: 7epk8wdAznd --HG-- extra : rebase_source : 4f4e23a8cc5005d8f0da3c35910eba30f8777e6b --- widget/cocoa/TextInputHandler.h | 47 +++- widget/cocoa/TextInputHandler.mm | 431 +++++++++++++++++++++++++------ 2 files changed, 400 insertions(+), 78 deletions(-) diff --git a/widget/cocoa/TextInputHandler.h b/widget/cocoa/TextInputHandler.h index 1e41c3752822..74e8fec9c581 100644 --- a/widget/cocoa/TextInputHandler.h +++ b/widget/cocoa/TextInputHandler.h @@ -243,6 +243,9 @@ public: * dispatch a Gecko key event. * @param aKeyEvent The result -- a Gecko key event initialized * from the native key event. + * @param aIsProcessedByIME true if aNativeKeyEvent has been handled + * by IME (but except if the composition was + * started with dead key). * @param aInsertString If caller expects that the event will cause * a character to be input (say in an editor), * the caller should set this. Otherwise, @@ -251,6 +254,7 @@ public: * characters of aNativeKeyEvent. */ void InitKeyEvent(NSEvent *aNativeKeyEvent, WidgetKeyboardEvent& aKeyEvent, + bool aIsProcessedByIME, const nsAString *aInsertString = nullptr); /** @@ -303,6 +307,15 @@ public: static CodeNameIndex ComputeGeckoCodeNameIndex(UInt32 aNativeKeyCode, UInt32 aKbType); + /** + * TranslateToChar() checks if aNativeKeyEvent is a dead key. + * + * @param aNativeKeyEvent A native key event. + * @return Returns true if the key event is a dead key + * event. Otherwise, false. + */ + bool IsDeadKey(NSEvent* aNativeKeyEvent); + protected: /** * TranslateToString() computes the inputted text from the native keyCode, @@ -343,7 +356,7 @@ protected: * @param aKbType A native Keyboard Type value. Typically, * this is a result of ::LMGetKbdType(). * @return Returns true if the key with specified - * modifier state isa dead key. Otherwise, + * modifier state is a dead key. Otherwise, * false. */ bool IsDeadKey(UInt32 aKeyCode, UInt32 aModifiers, UInt32 aKbType); @@ -433,6 +446,9 @@ public: * dispatch a Gecko key event. * @param aKeyEvent The result -- a Gecko key event initialized * from the native key event. + * @param aIsProcessedByIME true if aNativeKeyEvent has been handled + * by IME (but except if the composition was + * started with dead key). * @param aInsertString If caller expects that the event will cause * a character to be input (say in an editor), * the caller should set this. Otherwise, @@ -441,6 +457,7 @@ public: * characters of aNativeKeyEvent. */ void InitKeyEvent(NSEvent *aNativeKeyEvent, WidgetKeyboardEvent& aKeyEvent, + bool aIsProcessedByIME, const nsAString *aInsertString = nullptr); /** @@ -552,6 +569,8 @@ protected: // Unique id associated with a keydown / keypress event. It's ok if this // wraps over long periods. uint32_t mUniqueId; + // Whether keydown event was dispatched for mKeyEvent. + bool mKeyDownDispatched; // Whether keydown event was consumed by web contents or chrome contents. bool mKeyDownHandled; // Whether keypress event was dispatched for mKeyEvent. @@ -604,6 +623,7 @@ protected: } mInsertString = nullptr; mInsertedString.Truncate(); + mKeyDownDispatched = false; mKeyDownHandled = false; mKeyPressDispatched = false; mKeyPressHandled = false; @@ -617,6 +637,11 @@ protected: mCompositionDispatched; } + bool CanDispatchKeyDownEvent() const + { + return !mKeyDownDispatched; + } + bool CanDispatchKeyPressEvent() const { return !mKeyPressDispatched && !IsDefaultPrevented(); @@ -765,7 +790,8 @@ protected: } void InitKeyEvent(TextInputHandlerBase* aHandler, - WidgetKeyboardEvent& aKeyEvent); + WidgetKeyboardEvent& aKeyEvent, + bool aIsProcessedByIME); /** * GetUnhandledString() returns characters of the event which have not been @@ -1059,6 +1085,7 @@ public: NSRange MarkedRange(); bool IsIMEComposing() { return mIsIMEComposing; } + bool IsDeadKeyComposing() { return mIsDeadKeyComposing; } bool IsIMEOpened(); bool IsIMEEnabled() { return mIsIMEEnabled; } bool IsASCIICapableOnly() { return mIsASCIICapableOnly; } @@ -1112,6 +1139,19 @@ protected: void InsertTextAsCommittingComposition(NSAttributedString* aAttrString, NSRange* aReplacementRange); + /** + * MaybeDispatchCurrentKeydownEvent() dispatches eKeyDown event for current + * key event. If eKeyDown for current key event has already been dispatched, + * this does nothing. + * + * @param aIsProcessedByIME true if current key event is handled by IME. + * @return true if the caller can continue to handle + * current key event. Otherwise, false. E.g., + * focus is moved, the widget has been destroyed + * or something. + */ + bool MaybeDispatchCurrentKeydownEvent(bool aIsProcessedByIME); + private: // If mIsIMEComposing is true, the composition string is stored here. NSString* mIMECompositionString; @@ -1125,6 +1165,9 @@ private: mozilla::WritingMode mWritingMode; bool mIsIMEComposing; + // If the composition started with dead key, mIsDeadKeyComposing is set to + // true. + bool mIsDeadKeyComposing; bool mIsIMEEnabled; bool mIsASCIICapableOnly; bool mIgnoreIMECommit; diff --git a/widget/cocoa/TextInputHandler.mm b/widget/cocoa/TextInputHandler.mm index 106ef0e91f52..eb2057a85a08 100644 --- a/widget/cocoa/TextInputHandler.mm +++ b/widget/cocoa/TextInputHandler.mm @@ -399,6 +399,84 @@ TISInputSourceWrapper::TranslateToChar(UInt32 aKeyCode, UInt32 aModifiers, return static_cast(str.CharAt(0)); } +bool +TISInputSourceWrapper::IsDeadKey(NSEvent* aNativeKeyEvent) +{ + if ([[aNativeKeyEvent characters] length]) { + return false; + } + + // Assmue that if control key or command key is pressed, it's not a dead key. + NSUInteger cocoaState = [aNativeKeyEvent modifierFlags]; + if (cocoaState & (NSControlKeyMask | NSCommandKeyMask)) { + return false; + } + + UInt32 nativeKeyCode = [aNativeKeyEvent keyCode]; + switch (nativeKeyCode) { + case kVK_ANSI_A: + case kVK_ANSI_B: + case kVK_ANSI_C: + case kVK_ANSI_D: + case kVK_ANSI_E: + case kVK_ANSI_F: + case kVK_ANSI_G: + case kVK_ANSI_H: + case kVK_ANSI_I: + case kVK_ANSI_J: + case kVK_ANSI_K: + case kVK_ANSI_L: + case kVK_ANSI_M: + case kVK_ANSI_N: + case kVK_ANSI_O: + case kVK_ANSI_P: + case kVK_ANSI_Q: + case kVK_ANSI_R: + case kVK_ANSI_S: + case kVK_ANSI_T: + case kVK_ANSI_U: + case kVK_ANSI_V: + case kVK_ANSI_W: + case kVK_ANSI_X: + case kVK_ANSI_Y: + case kVK_ANSI_Z: + case kVK_ANSI_1: + case kVK_ANSI_2: + case kVK_ANSI_3: + case kVK_ANSI_4: + case kVK_ANSI_5: + case kVK_ANSI_6: + case kVK_ANSI_7: + case kVK_ANSI_8: + case kVK_ANSI_9: + case kVK_ANSI_0: + case kVK_ANSI_Equal: + case kVK_ANSI_Minus: + case kVK_ANSI_RightBracket: + case kVK_ANSI_LeftBracket: + case kVK_ANSI_Quote: + case kVK_ANSI_Semicolon: + case kVK_ANSI_Backslash: + case kVK_ANSI_Comma: + case kVK_ANSI_Slash: + case kVK_ANSI_Period: + case kVK_ANSI_Grave: + case kVK_JIS_Yen: + case kVK_JIS_Underscore: + break; + default: + // Let's assume that dead key can be only a printable key in standard + // position. + return false; + } + + // If TranslateToChar() returns non-zero value, that means that + // the key may input a character with different dead key state. + UInt32 kbType = GetKbdType(); + UInt32 carbonState = nsCocoaUtils::ConvertToCarbonModifier(cocoaState); + return IsDeadKey(nativeKeyCode, carbonState, kbType); +} + bool TISInputSourceWrapper::IsDeadKey(UInt32 aKeyCode, UInt32 aModifiers, @@ -906,17 +984,25 @@ TISInputSourceWrapper::ComputeInsertStringForCharCode( void TISInputSourceWrapper::InitKeyEvent(NSEvent *aNativeKeyEvent, WidgetKeyboardEvent& aKeyEvent, + bool aIsProcessedByIME, const nsAString *aInsertString) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; + MOZ_ASSERT(!aIsProcessedByIME || aKeyEvent.mMessage != eKeyPress, + "eKeyPress event should not be marked as proccessed by IME"); + MOZ_LOG(gLog, LogLevel::Info, ("%p TISInputSourceWrapper::InitKeyEvent, aNativeKeyEvent=%p, " - "aKeyEvent.mMessage=%s, aInsertString=%p, IsOpenedIMEMode()=%s", - this, aNativeKeyEvent, GetGeckoKeyEventType(aKeyEvent), aInsertString, + "aKeyEvent.mMessage=%s, aProcessedByIME=%s, aInsertString=%p, " + "IsOpenedIMEMode()=%s", + this, aNativeKeyEvent, GetGeckoKeyEventType(aKeyEvent), + TrueOrFalse(aIsProcessedByIME), aInsertString, TrueOrFalse(IsOpenedIMEMode()))); - NS_ENSURE_TRUE(aNativeKeyEvent, ); + if (NS_WARN_IF(!aNativeKeyEvent)) { + return; + } nsCocoaUtils::InitInputEvent(aKeyEvent, aNativeKeyEvent); @@ -945,8 +1031,18 @@ TISInputSourceWrapper::InitKeyEvent(NSEvent *aNativeKeyEvent, UInt32 kbType = GetKbdType(); UInt32 nativeKeyCode = [aNativeKeyEvent keyCode]; + // macOS handles dead key as IME. If the key is first key press of dead + // key, we should use KEY_NAME_INDEX_Dead for first (dead) key event. + // So, if aIsProcessedByIME is true, it may be dead key. Let's check + // if current key event is a dead key's keydown event. + bool isProcessedByIME = + aIsProcessedByIME && + !TISInputSourceWrapper::CurrentInputSource().IsDeadKey(aNativeKeyEvent); + aKeyEvent.mKeyCode = - ComputeGeckoKeyCode(nativeKeyCode, kbType, aKeyEvent.IsMeta()); + isProcessedByIME ? + NS_VK_PROCESSKEY : + ComputeGeckoKeyCode(nativeKeyCode, kbType, aKeyEvent.IsMeta()); switch (nativeKeyCode) { case kVK_Command: @@ -999,7 +1095,9 @@ TISInputSourceWrapper::InitKeyEvent(NSEvent *aNativeKeyEvent, this, OnOrOff(aKeyEvent.IsShift()), OnOrOff(aKeyEvent.IsControl()), OnOrOff(aKeyEvent.IsAlt()), OnOrOff(aKeyEvent.IsMeta()))); - if (IsPrintableKeyEvent(aNativeKeyEvent)) { + if (isProcessedByIME) { + aKeyEvent.mKeyNameIndex = KEY_NAME_INDEX_Process; + } else if (IsPrintableKeyEvent(aNativeKeyEvent)) { aKeyEvent.mKeyNameIndex = KEY_NAME_INDEX_USE_STRING; // If insertText calls this method, let's use the string. if (aInsertString && !aInsertString->IsEmpty() && @@ -1628,7 +1726,7 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent, } WidgetKeyboardEvent imeEvent(true, eKeyDown, widget); - currentKeyEvent->InitKeyEvent(this, imeEvent); + currentKeyEvent->InitKeyEvent(this, imeEvent, false); imeEvent.mPluginTextEventString.Assign(committed); nsEventStatus status = nsEventStatus_eIgnore; mDispatcher->DispatchKeyboardEvent(eKeyDown, imeEvent, status, @@ -1637,50 +1735,18 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent, return true; } - NSResponder* firstResponder = [[mView window] firstResponder]; + RefPtr kungFuDeathGrip(this); - nsresult rv = mDispatcher->BeginNativeInputTransaction(); - if (NS_WARN_IF(NS_FAILED(rv))) { - MOZ_LOG(gLog, LogLevel::Error, - ("%p IMEInputHandler::HandleKeyDownEvent, " - "FAILED, due to BeginNativeInputTransaction() failure " - "at dispatching keydown for ordinal cases", this)); + // When we're already in a composition, we need always to mark the eKeyDown + // event as "processed by IME". So, let's dispatch eKeyDown event here in + // such case. + if (IsIMEComposing() && !MaybeDispatchCurrentKeydownEvent(true)) { + MOZ_LOG(gLog, LogLevel::Info, + ("%p IMEInputHandler::HandleKeyDownEvent, eKeyDown caused focus move or " + "something and canceling the composition", this)); return false; } - WidgetKeyboardEvent keydownEvent(true, eKeyDown, widget); - currentKeyEvent->InitKeyEvent(this, keydownEvent); - - nsEventStatus status = nsEventStatus_eIgnore; - mDispatcher->DispatchKeyboardEvent(eKeyDown, keydownEvent, status, - currentKeyEvent); - currentKeyEvent->mKeyDownHandled = - (status == nsEventStatus_eConsumeNoDefault); - - if (Destroyed()) { - MOZ_LOG(gLog, LogLevel::Info, - ("%p TextInputHandler::HandleKeyDownEvent, " - "widget was destroyed by keydown event", this)); - return currentKeyEvent->IsDefaultPrevented(); - } - - // The key down event may have shifted the focus, in which - // case we should not fire the key press. - // XXX This is a special code only on Cocoa widget, why is this needed? - if (firstResponder != [[mView window] firstResponder]) { - MOZ_LOG(gLog, LogLevel::Info, - ("%p TextInputHandler::HandleKeyDownEvent, " - "view lost focus by keydown event", this)); - return currentKeyEvent->IsDefaultPrevented(); - } - - if (currentKeyEvent->IsDefaultPrevented()) { - MOZ_LOG(gLog, LogLevel::Info, - ("%p TextInputHandler::HandleKeyDownEvent, " - "keydown event's default is prevented", this)); - return true; - } - // Let Cocoa interpret the key events, caching IsIMEComposing first. bool wasComposing = IsIMEComposing(); bool interpretKeyEventsCalled = false; @@ -1710,9 +1776,33 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent, "IsIMEComposing()=%s", this, TrueOrFalse(wasComposing), TrueOrFalse(IsIMEComposing()))); + if (currentKeyEvent->CanDispatchKeyDownEvent()) { + // Dispatch eKeyDown event if nobody has dispatched it yet. + // NOTE: Although reaching here means that the native keydown event may + // not be handled by IME. However, we cannot know if it is. + // For example, Japanese IME of Apple shows candidate window for + // typing window. They, you can switch the sort order with Tab key. + // However, when you choose "Symbol" of the sort order, there may + // be no candiate words. In this case, IME handles the Tab key + // actually, but we cannot know it because composition string is + // not updated. So, let's mark eKeyDown event as "processed by IME" + // when there is composition string. This is same as Chrome. + MOZ_LOG(gLog, LogLevel::Info, + ("%p TextInputHandler::HandleKeyDownEvent, trying to dispatch eKeyDown " + "event since it's not yet dispatched", + this)); + if (!MaybeDispatchCurrentKeydownEvent(IsIMEComposing())) { + return true; // treat the eKeydDown event as consumed. + } + MOZ_LOG(gLog, LogLevel::Info, + ("%p TextInputHandler::HandleKeyDownEvent, eKeyDown event has been " + "dispatched", + this)); + } + if (currentKeyEvent->CanDispatchKeyPressEvent() && !wasComposing && !IsIMEComposing()) { - rv = mDispatcher->BeginNativeInputTransaction(); + nsresult rv = mDispatcher->BeginNativeInputTransaction(); if (NS_WARN_IF(NS_FAILED(rv))) { MOZ_LOG(gLog, LogLevel::Error, ("%p IMEInputHandler::HandleKeyDownEvent, " @@ -1722,7 +1812,7 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent, } WidgetKeyboardEvent keypressEvent(true, eKeyPress, widget); - currentKeyEvent->InitKeyEvent(this, keypressEvent); + currentKeyEvent->InitKeyEvent(this, keypressEvent, false); // If we called interpretKeyEvents and this isn't normal character input // then IME probably ate the event for some reason. We do not want to @@ -1737,6 +1827,11 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent, // our default action for this key. if (!(interpretKeyEventsCalled && IsNormalCharInputtingEvent(keypressEvent))) { + MOZ_LOG(gLog, LogLevel::Info, + ("%p TextInputHandler::HandleKeyDownEvent, trying to dispatch " + "eKeyPress event since it's not yet dispatched", + this)); + nsEventStatus status = nsEventStatus_eIgnore; currentKeyEvent->mKeyPressDispatched = mDispatcher->MaybeDispatchKeypressEvents(keypressEvent, status, currentKeyEvent); @@ -1744,7 +1839,8 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent, (status == nsEventStatus_eConsumeNoDefault); currentKeyEvent->mKeyPressDispatched = true; MOZ_LOG(gLog, LogLevel::Info, - ("%p TextInputHandler::HandleKeyDownEvent, keypress event dispatched", + ("%p TextInputHandler::HandleKeyDownEvent, eKeyPress event has been " + "dispatched", this)); } } @@ -1798,8 +1894,10 @@ TextInputHandler::HandleKeyUpEvent(NSEvent* aNativeEvent) return; } + // Neither Chrome for macOS nor Safari marks "keyup" event as "processed by + // IME" even during composition. So, let's follow this behavior. WidgetKeyboardEvent keyupEvent(true, eKeyUp, mWidget); - InitKeyEvent(aNativeEvent, keyupEvent); + InitKeyEvent(aNativeEvent, keyupEvent, false); KeyEventState currentKeyEvent(aNativeEvent); nsEventStatus status = nsEventStatus_eIgnore; @@ -2143,7 +2241,7 @@ TextInputHandler::DispatchKeyEventForFlagsChanged(NSEvent* aNativeEvent, GetKeyNameForNativeKeyCode([aNativeEvent keyCode]), [aNativeEvent keyCode], TrueOrFalse(aDispatchKeyDown), TrueOrFalse(IsIMEComposing()))); - if ([aNativeEvent type] != NSFlagsChanged || IsIMEComposing()) { + if ([aNativeEvent type] != NSFlagsChanged) { return; } @@ -2157,9 +2255,11 @@ TextInputHandler::DispatchKeyEventForFlagsChanged(NSEvent* aNativeEvent, EventMessage message = aDispatchKeyDown ? eKeyDown : eKeyUp; - // Fire a key event. + // Fire a key event for the modifier key. Note that even if modifier key + // is pressed during composition, we shouldn't mark the keyboard event as + // "processed by IME" since neither Chrome for macOS nor Safari does it. WidgetKeyboardEvent keyEvent(true, message, mWidget); - InitKeyEvent(aNativeEvent, keyEvent); + InitKeyEvent(aNativeEvent, keyEvent, false); // Attach a plugin event, in case keyEvent gets dispatched to a plugin. Only // one field is needed -- the type. The other fields can be constructed as @@ -2195,13 +2295,16 @@ TextInputHandler::InsertText(NSAttributedString* aAttrString, ("%p TextInputHandler::InsertText, aAttrString=\"%s\", " "aReplacementRange=%p { location=%lu, length=%lu }, " "IsIMEComposing()=%s, " - "keyevent=%p, keydownHandled=%s, keypressDispatched=%s, " + "keyevent=%p, keydownDispatched=%s, " + "keydownHandled=%s, keypressDispatched=%s, " "causedOtherKeyEvents=%s, compositionDispatched=%s", this, GetCharacters([aAttrString string]), aReplacementRange, static_cast(aReplacementRange ? aReplacementRange->location : 0), static_cast(aReplacementRange ? aReplacementRange->length : 0), TrueOrFalse(IsIMEComposing()), currentKeyEvent ? currentKeyEvent->mKeyEvent : nullptr, + currentKeyEvent ? + TrueOrFalse(currentKeyEvent->mKeyDownDispatched) : "N/A", currentKeyEvent ? TrueOrFalse(currentKeyEvent->mKeyDownHandled) : "N/A", currentKeyEvent ? @@ -2253,8 +2356,21 @@ TextInputHandler::InsertText(NSAttributedString* aAttrString, if (!currentKeyEvent) { return; } - // Delete the selected range. + + // When current keydown event causes this empty text input, let's + // dispatch eKeyDown event before any other events. Note that if we're + // in a composition, we've already dispatched eKeyDown event from + // TextInputHandler::HandleKeyDownEvent(). + // XXX Should we mark this eKeyDown event as "processed by IME"? RefPtr kungFuDeathGrip(this); + if (!IsIMEComposing() && !MaybeDispatchCurrentKeydownEvent(false)) { + MOZ_LOG(gLog, LogLevel::Info, + ("%p IMEInputHandler::InsertText, eKeyDown caused focus move or " + "something and canceling the composition", this)); + return; + } + + // Delete the selected range. WidgetContentCommandEvent deleteCommandEvent(true, eContentCommandDelete, mWidget); DispatchEvent(deleteCommandEvent); @@ -2303,13 +2419,23 @@ TextInputHandler::InsertText(NSAttributedString* aAttrString, return; } + // This is the normal path to input a character when you press a key. + // Let's dispatch eKeyDown event now. + RefPtr kungFuDeathGrip(this); + if (!MaybeDispatchCurrentKeydownEvent(false)) { + MOZ_LOG(gLog, LogLevel::Info, + ("%p IMEInputHandler::InsertText, eKeyDown caused focus move or " + "something and canceling the composition", this)); + return; + } + // XXX Shouldn't we hold mDispatcher instead of mWidget? RefPtr widget(mWidget); nsresult rv = mDispatcher->BeginNativeInputTransaction(); if (NS_WARN_IF(NS_FAILED(rv))) { - MOZ_LOG(gLog, LogLevel::Error, - ("%p IMEInputHandler::HandleKeyUpEvent, " - "FAILED, due to BeginNativeInputTransaction() failure", this)); + MOZ_LOG(gLog, LogLevel::Error, + ("%p IMEInputHandler::InsertText, " + "FAILED, due to BeginNativeInputTransaction() failure", this)); return; } @@ -2325,7 +2451,7 @@ TextInputHandler::InsertText(NSAttributedString* aAttrString, // the input string. if (currentKeyEvent) { - currentKeyEvent->InitKeyEvent(this, keypressEvent); + currentKeyEvent->InitKeyEvent(this, keypressEvent, false); } else { nsCocoaUtils::InitInputEvent(keypressEvent, static_cast(nullptr)); keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_USE_STRING; @@ -2391,6 +2517,18 @@ TextInputHandler::HandleCommand(Command aCommand) return false; } + // When current keydown event causes this command, let's dispatch + // eKeyDown event before any other events. Note that if we're in a + // composition, we've already dispatched eKeyDown event from + // TextInputHandler::HandleKeyDownEvent(). + RefPtr kungFuDeathGrip(this); + if (!IsIMEComposing() && !MaybeDispatchCurrentKeydownEvent(false)) { + MOZ_LOG(gLog, LogLevel::Info, + ("%p IMEInputHandler::SetMarkedText, eKeyDown caused focus move or " + "something and canceling the composition", this)); + return false; + } + // If it's in composition, we cannot dispatch keypress event. // Therefore, we should use different approach or give up to handle // the command. @@ -2487,7 +2625,7 @@ TextInputHandler::HandleCommand(Command aCommand) if (!dispatchFakeKeyPress) { // If we're acutally handling a key press, we should dispatch // the keypress event as-is. - currentKeyEvent->InitKeyEvent(this, keypressEvent); + currentKeyEvent->InitKeyEvent(this, keypressEvent, false); } else { // Otherwise, we should dispatch "fake" keypress event. // However, for making it possible to compute edit commands, we need to @@ -2753,11 +2891,15 @@ TextInputHandler::DoCommandBySelector(const char* aSelector) MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::DoCommandBySelector, aSelector=\"%s\", " - "Destroyed()=%s, keydownHandled=%s, keypressHandled=%s, " - "causedOtherKeyEvents=%s", + "Destroyed()=%s, keydownDispatched=%s, keydownHandled=%s, " + "keypressDispatched=%s, keypressHandled=%s, causedOtherKeyEvents=%s", this, aSelector ? aSelector : "", TrueOrFalse(Destroyed()), + currentKeyEvent ? + TrueOrFalse(currentKeyEvent->mKeyDownDispatched) : "N/A", currentKeyEvent ? TrueOrFalse(currentKeyEvent->mKeyDownHandled) : "N/A", + currentKeyEvent ? + TrueOrFalse(currentKeyEvent->mKeyPressDispatched) : "N/A", currentKeyEvent ? TrueOrFalse(currentKeyEvent->mKeyPressHandled) : "N/A", currentKeyEvent ? @@ -2769,6 +2911,18 @@ TextInputHandler::DoCommandBySelector(const char* aSelector) return Destroyed(); } + // When current keydown event causes this command, let's dispatch + // eKeyDown event before any other events. Note that if we're in a + // composition, we've already dispatched eKeyDown event from + // TextInputHandler::HandleKeyDownEvent(). + RefPtr kungFuDeathGrip(this); + if (!IsIMEComposing() && !MaybeDispatchCurrentKeydownEvent(false)) { + MOZ_LOG(gLog, LogLevel::Info, + ("%p IMEInputHandler::SetMarkedText, eKeyDown caused focus move or " + "something and canceling the composition", this)); + return true; + } + // If the key operation causes this command, should dispatch a keypress // event. // XXX This must be worng. Even if this command is caused by the key @@ -2786,7 +2940,7 @@ TextInputHandler::DoCommandBySelector(const char* aSelector) } WidgetKeyboardEvent keypressEvent(true, eKeyPress, widget); - currentKeyEvent->InitKeyEvent(this, keypressEvent); + currentKeyEvent->InitKeyEvent(this, keypressEvent, false); nsEventStatus status = nsEventStatus_eIgnore; currentKeyEvent->mKeyPressDispatched = @@ -3399,6 +3553,11 @@ IMEInputHandler::DispatchCompositionStartEvent() NS_ASSERTION(!mIsIMEComposing, "There is a composition already"); mIsIMEComposing = true; + KeyEventState* currentKeyEvent = GetCurrentKeyEvent(); + mIsDeadKeyComposing = + currentKeyEvent && currentKeyEvent->mKeyEvent && + TISInputSourceWrapper::CurrentInputSource(). + IsDeadKey(currentKeyEvent->mKeyEvent); nsEventStatus status; rv = mDispatcher->StartComposition(status); @@ -3549,7 +3708,7 @@ IMEInputHandler::DispatchCompositionCommitEvent(const nsAString* aCommitString) } } - mIsIMEComposing = false; + mIsIMEComposing = mIsDeadKeyComposing = false; mIMECompositionStart = UINT32_MAX; if (mIMECompositionString) { [mIMECompositionString release]; @@ -3568,6 +3727,89 @@ IMEInputHandler::DispatchCompositionCommitEvent(const nsAString* aCommitString) NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false); } +bool +IMEInputHandler::MaybeDispatchCurrentKeydownEvent(bool aIsProcessedByIME) +{ + NS_OBJC_BEGIN_TRY_ABORT_BLOCK; + + if (Destroyed()) { + return false; + } + MOZ_ASSERT(mWidget); + + KeyEventState* currentKeyEvent = GetCurrentKeyEvent(); + if (!currentKeyEvent || + !currentKeyEvent->CanDispatchKeyDownEvent()) { + return true; + } + + NSEvent* nativeEvent = currentKeyEvent->mKeyEvent; + if (NS_WARN_IF(!nativeEvent) || + [nativeEvent type] != NSKeyDown) { + return true; + } + + MOZ_LOG(gLog, LogLevel::Info, + ("%p IMEInputHandler::MaybeDispatchKeydownEvent, aIsProcessedByIME=%s " + "currentKeyEvent={ mKeyEvent(%p)={ type=%s, keyCode=%s (0x%X) } }, " + "aIsProcesedBy=%s, IsDeadKeyComposing()=%s", + this, TrueOrFalse(aIsProcessedByIME), nativeEvent, + GetNativeKeyEventType(nativeEvent), + GetKeyNameForNativeKeyCode([nativeEvent keyCode]), [nativeEvent keyCode], + TrueOrFalse(IsIMEComposing()), TrueOrFalse(IsDeadKeyComposing()))); + + RefPtr kungFuDeathGrip(this); + RefPtr dispatcher(mDispatcher); + nsresult rv = dispatcher->BeginNativeInputTransaction(); + if (NS_WARN_IF(NS_FAILED(rv))) { + MOZ_LOG(gLog, LogLevel::Error, + ("%p IMEInputHandler::DispatchKeyEventForFlagsChanged, " + "FAILED, due to BeginNativeInputTransaction() failure", this)); + return false; + } + + NSResponder* firstResponder = [[mView window] firstResponder]; + + // Mark currentKeyEvent as "dispatched eKeyDown event" and actually do it. + currentKeyEvent->mKeyDownDispatched = true; + + RefPtr widget(mWidget); + + WidgetKeyboardEvent keydownEvent(true, eKeyDown, widget); + // Don't mark the eKeyDown event as "processed by IME" if the composition + // is started with dead key. + currentKeyEvent->InitKeyEvent(this, keydownEvent, + aIsProcessedByIME && !IsDeadKeyComposing()); + + nsEventStatus status = nsEventStatus_eIgnore; + dispatcher->DispatchKeyboardEvent(eKeyDown, keydownEvent, status, + currentKeyEvent); + currentKeyEvent->mKeyDownHandled = + (status == nsEventStatus_eConsumeNoDefault); + + if (Destroyed()) { + MOZ_LOG(gLog, LogLevel::Info, + ("%p IMEInputHandler::MaybeDispatchKeydownEvent, " + "widget was destroyed by keydown event", this)); + return false; + } + + // The key down event may have shifted the focus, in which case, we should + // not continue to handle current key sequence and let's commit current + // composition. + if (firstResponder != [[mView window] firstResponder]) { + MOZ_LOG(gLog, LogLevel::Info, + ("%p IMEInputHandler::MaybeDispatchKeydownEvent, " + "view lost focus by keydown event", this)); + CommitIMEComposition(); + return false; + } + + return true; + + NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false); +} + void IMEInputHandler::InsertTextAsCommittingComposition( NSAttributedString* aAttrString, @@ -3596,6 +3838,22 @@ IMEInputHandler::InsertTextAsCommittingComposition( return; } + // When current keydown event causes this text input, let's dispatch + // eKeyDown event before any other events. Note that if we're in a + // composition, we've already dispatched eKeyDown event from + // TextInputHandler::HandleKeyDownEvent(). + // XXX Should we mark the eKeyDown event as "processed by IME"? + // However, if the key causes two or more Unicode characters as + // UTF-16 string, this is used. So, perhaps, we need to improve + // HandleKeyDownEvent() before do that. + RefPtr kungFuDeathGrip(this); + if (!IsIMEComposing() && !MaybeDispatchCurrentKeydownEvent(false)) { + MOZ_LOG(gLog, LogLevel::Info, + ("%p IMEInputHandler::InsertTextAsCommittingComposition, eKeyDown " + "caused focus move or something and canceling the composition", this)); + return; + } + // First, commit current composition with the latest composition string if the // replacement range is different from marked range. if (IsIMEComposing() && aReplacementRange && @@ -3610,8 +3868,6 @@ IMEInputHandler::InsertTextAsCommittingComposition( } } - RefPtr kungFuDeathGrip(this); - nsString str; nsCocoaUtils::GetStringForNSString([aAttrString string], str); @@ -3658,7 +3914,8 @@ IMEInputHandler::SetMarkedText(NSAttributedString* aAttrString, "aReplacementRange=%p { location=%lu, length=%lu }, " "Destroyed()=%s, IsIMEComposing()=%s, " "mMarkedRange={ location=%lu, length=%lu }, keyevent=%p, " - "keydownHandled=%s, keypressDispatched=%s, causedOtherKeyEvents=%s, " + "keydownDispatched=%s, keydownHandled=%s, " + "keypressDispatched=%s, causedOtherKeyEvents=%s, " "compositionDispatched=%s", this, GetCharacters([aAttrString string]), static_cast(aSelectedRange.location), @@ -3669,6 +3926,8 @@ IMEInputHandler::SetMarkedText(NSAttributedString* aAttrString, static_cast(mMarkedRange.location), static_cast(mMarkedRange.length), currentKeyEvent ? currentKeyEvent->mKeyEvent : nullptr, + currentKeyEvent ? + TrueOrFalse(currentKeyEvent->mKeyDownDispatched) : "N/A", currentKeyEvent ? TrueOrFalse(currentKeyEvent->mKeyDownHandled) : "N/A", currentKeyEvent ? @@ -3678,19 +3937,32 @@ IMEInputHandler::SetMarkedText(NSAttributedString* aAttrString, currentKeyEvent ? TrueOrFalse(currentKeyEvent->mCompositionDispatched) : "N/A")); + RefPtr kungFuDeathGrip(this); + // If SetMarkedText() is called during handling a key press, that means that // the key event caused this composition. So, keypress event shouldn't // be dispatched later, let's mark the key event causing composition event. if (currentKeyEvent) { currentKeyEvent->mCompositionDispatched = true; + + // When current keydown event causes this text input, let's dispatch + // eKeyDown event before any other events. Note that if we're in a + // composition, we've already dispatched eKeyDown event from + // TextInputHandler::HandleKeyDownEvent(). On the other hand, if we're + // not in composition, the key event starts new composition. So, we + // need to mark the eKeyDown event as "processed by IME". + if (!IsIMEComposing() && !MaybeDispatchCurrentKeydownEvent(true)) { + MOZ_LOG(gLog, LogLevel::Info, + ("%p IMEInputHandler::SetMarkedText, eKeyDown caused focus move or " + "something and canceling the composition", this)); + return; + } } if (Destroyed()) { return; } - RefPtr kungFuDeathGrip(this); - // First, commit current composition with the latest composition string if the // replacement range is different from marked range. if (IsIMEComposing() && aReplacementRange && @@ -4147,6 +4419,7 @@ IMEInputHandler::IMEInputHandler(nsChildView* aWidget, , mIMECompositionString(nullptr) , mIMECompositionStart(UINT32_MAX) , mIsIMEComposing(false) + , mIsDeadKeyComposing(false) , mIsIMEEnabled(true) , mIsASCIICapableOnly(false) , mIgnoreIMECommit(false) @@ -4305,13 +4578,15 @@ IMEInputHandler::CommitIMEComposition() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - if (!IsIMEComposing()) - return; - MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::CommitIMEComposition, mIMECompositionString=%s", this, GetCharacters(mIMECompositionString))); + // If this is called before dispatching eCompositionStart, IsIMEComposing() + // returns false. Even in such case, we need to commit composition *in* + // IME if this is called by preceding eKeyDown event of eCompositionStart. + // So, we need to call KillIMEComposition() even when IsIMEComposing() + // returns false. KillIMEComposition(); if (!IsIMEComposing()) @@ -4585,6 +4860,7 @@ TextInputHandlerBase::DispatchEvent(WidgetGUIEvent& aEvent) void TextInputHandlerBase::InitKeyEvent(NSEvent *aNativeKeyEvent, WidgetKeyboardEvent& aKeyEvent, + bool aIsProcessedByIME, const nsAString* aInsertString) { NS_ASSERTION(aNativeKeyEvent, "aNativeKeyEvent must not be NULL"); @@ -4592,11 +4868,12 @@ TextInputHandlerBase::InitKeyEvent(NSEvent *aNativeKeyEvent, if (mKeyboardOverride.mOverrideEnabled) { TISInputSourceWrapper tis; tis.InitByLayoutID(mKeyboardOverride.mKeyboardLayout, true); - tis.InitKeyEvent(aNativeKeyEvent, aKeyEvent, aInsertString); + tis.InitKeyEvent(aNativeKeyEvent, aKeyEvent, aIsProcessedByIME, + aInsertString); return; } TISInputSourceWrapper::CurrentInputSource(). - InitKeyEvent(aNativeKeyEvent, aKeyEvent, aInsertString); + InitKeyEvent(aNativeKeyEvent, aKeyEvent, aIsProcessedByIME, aInsertString); } nsresult @@ -4889,7 +5166,8 @@ TextInputHandlerBase::EnsureSecureEventInputDisabled() void TextInputHandlerBase::KeyEventState::InitKeyEvent( TextInputHandlerBase* aHandler, - WidgetKeyboardEvent& aKeyEvent) + WidgetKeyboardEvent& aKeyEvent, + bool aIsProcessedByIME) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; @@ -4919,7 +5197,8 @@ TextInputHandlerBase::KeyEventState::InitKeyEvent( } aKeyEvent.mUniqueId = mUniqueId; - aHandler->InitKeyEvent(nativeEvent, aKeyEvent, mInsertString); + aHandler->InitKeyEvent(nativeEvent, aKeyEvent, aIsProcessedByIME, + mInsertString); NS_OBJC_END_TRY_ABORT_BLOCK; } From bb10e7fbe9772827d1236bed3243ac110f96f6cf Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Tue, 27 Feb 2018 17:24:35 +0900 Subject: [PATCH 34/50] Bug 1343451 - part 5: Make GeckoEditableSupport dispatch dummy eKeyDown and eKeyUp event during composition always r=jchen On Android, GeckoEditableSupport has already dispatched eKeyDown event and eKeyUp event even during composition. I.e., the pref which will be enabled by bug 354358 has already been set to true only on Android. On the other hand, GeckoEditableSupport does not dispatch them if content listens to "input", "compositionstart", "compositionupdate" or "compositionend". So, different from the other platforms, we cannot test this behind pref ("dom.keyboardevent.dispatch_during_composition") even in Nightly. Therefore, this patch enables new behavior only when it's Nightly build or early Beta. And sets mKeyCode and mKeyNameIndex of the dummy KeyboardEvents to NS_VK_PROCESSKEY and KEY_NAME_INDEX_Process. MozReview-Commit-ID: Fuy0Ir2xiO5 --HG-- extra : rebase_source : fade31954eaa1be8b7592977095ba8aebdd75104 --- widget/android/GeckoEditableSupport.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/widget/android/GeckoEditableSupport.cpp b/widget/android/GeckoEditableSupport.cpp index 78be01395f2e..3c3517e9d0c8 100644 --- a/widget/android/GeckoEditableSupport.cpp +++ b/widget/android/GeckoEditableSupport.cpp @@ -668,7 +668,6 @@ GeckoEditableSupport::OnKeyEvent(int32_t aAction, int32_t aKeyCode, /* * Send dummy key events for pages that are unaware of input events, * to provide web compatibility for pages that depend on key events. - * Our dummy key events have 0 as the keycode. */ void GeckoEditableSupport::SendIMEDummyKeyEvent(nsIWidget* aWidget, EventMessage msg) @@ -678,7 +677,12 @@ GeckoEditableSupport::SendIMEDummyKeyEvent(nsIWidget* aWidget, EventMessage msg) WidgetKeyboardEvent event(true, msg, aWidget); event.mTime = PR_Now() / 1000; - MOZ_ASSERT(event.mKeyCode == 0); + // TODO: If we can know scan code of the key event which caused replacing + // composition string, we should set mCodeNameIndex here. Then, + // we should rename this method because it becomes not a "dummy" + // keyboard event. + event.mKeyCode = NS_VK_PROCESSKEY; + event.mKeyNameIndex = KEY_NAME_INDEX_Process; NS_ENSURE_SUCCESS_VOID(BeginInputTransaction(mDispatcher)); mDispatcher->DispatchKeyboardEvent(msg, event, status); } @@ -1027,12 +1031,19 @@ GeckoEditableSupport::OnImeReplaceText(int32_t aStart, int32_t aEnd, AddIMETextChange(dummyChange); } + // Until fixing bug 354358 in release channel, we should always ignore + // "intl.ime.hack.on_ime_unaware_apps.fire_key_events_for_composition" + // pref in Nightly and early Beta for testing new regressions. +#ifndef EARLY_BETA_OR_EARLIER if (mInputContext.mMayBeIMEUnaware) { +#endif // #ifndef EARLY_BETA_OR_EARLIER SendIMEDummyKeyEvent(widget, eKeyDown); if (!mDispatcher || widget->Destroyed()) { return; } +#ifndef EARLY_BETA_OR_EARLIER } +#endif // #ifndef EARLY_BETA_OR_EARLIER if (composing) { mDispatcher->SetPendingComposition(string, mIMERanges); @@ -1046,10 +1057,18 @@ GeckoEditableSupport::OnImeReplaceText(int32_t aStart, int32_t aEnd, return; } + // XXX This works fine if user inputs with virtual keyboard. However, + // if user inputs with hardware keyboard, keyup event may come later. + // So, perhaps, we need to record actual keyboard events before + // this replacement of composition string. +#ifndef EARLY_BETA_OR_EARLIER if (mInputContext.mMayBeIMEUnaware) { +#endif // #ifndef EARLY_BETA_OR_EARLIER SendIMEDummyKeyEvent(widget, eKeyUp); // Widget may be destroyed after dispatching the above event. +#ifndef EARLY_BETA_OR_EARLIER } +#endif // #ifndef EARLY_BETA_OR_EARLIER } void From 54fa5bc374b4b43f1a89daaaa1b9cb42c32ab19b Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Mon, 12 Mar 2018 09:23:52 -0400 Subject: [PATCH 35/50] servo: Merge #20216 - Switch from servo/angle to the mozangle crate (from servo:mozangle); r=emilio https://github.com/servo/mozangle Source-Repo: https://github.com/servo/servo Source-Revision: 345c373192a30329c2c4f70631ab0792fc348f7d --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 231fb02d47d97c6a8b437eeb36121fc78570a0ef --- servo/Cargo.lock | 37 ++++++------ servo/components/script/Cargo.toml | 2 +- servo/components/script/dom/webglprogram.rs | 64 ++++++++++++++++++--- servo/components/script/dom/webglshader.rs | 4 +- servo/components/script/lib.rs | 2 +- 5 files changed, 81 insertions(+), 28 deletions(-) diff --git a/servo/Cargo.lock b/servo/Cargo.lock index cbf5c1a79734..cee5f39c1a82 100644 --- a/servo/Cargo.lock +++ b/servo/Cargo.lock @@ -26,15 +26,6 @@ name = "android_injected_glue" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "angle" -version = "0.5.0" -source = "git+https://github.com/servo/angle?branch=servo#1599c1d067b4ccbe502f660181d08d49d69e26eb" -dependencies = [ - "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "ansi_term" version = "0.10.2" @@ -312,8 +303,11 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.1" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "cexpr" @@ -395,7 +389,7 @@ name = "cmake" version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1332,7 +1326,7 @@ name = "jemalloc-sys" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1579,7 +1573,7 @@ name = "libz-sys" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1791,6 +1785,15 @@ name = "mitochondria" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "mozangle" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "mozjs" version = "0.1.11" @@ -2066,7 +2069,7 @@ name = "openssl-sys" version = "0.9.22" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2423,7 +2426,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "script" version = "0.0.1" dependencies = [ - "angle 0.5.0 (git+https://github.com/servo/angle?branch=servo)", "app_units 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "audio-video-metadata 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2460,6 +2462,7 @@ dependencies = [ "mime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "mime_guess 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "mozangle 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "mozjs 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", @@ -3693,7 +3696,6 @@ dependencies = [ "checksum alloc-no-stdlib 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b21f6ad9c9957eb5d70c3dee16d31c092b3cab339628f821766b05e6833d72b8" "checksum android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" "checksum android_injected_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "80b9e34fcbf29c0563547cb2ecce9b49504597cad6166769b1e4efb45c6c2951" -"checksum angle 0.5.0 (git+https://github.com/servo/angle?branch=servo)" = "" "checksum ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455" "checksum antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5" "checksum app_units 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c4720c83543de184d9f6add2fdb8e8031543497b8506620884c16e125b493c09" @@ -3721,7 +3723,7 @@ dependencies = [ "checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23" "checksum bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c129aff112dcc562970abb69e2508b40850dd24c274761bb50fb8a0067ba6c27" "checksum caseless 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3261638034d9db4f94a666ebb16494846341ae5a8456c05c1616d66980cf39a" -"checksum cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c674f0870e3dbd4105184ea035acb1c32c8ae69939c9e228d2b11bbfe29efad" +"checksum cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "9be26b24e988625409b19736d130f0c7d224f01d06454b5f81d8d23d6c1a618f" "checksum cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "393a5f0088efbe41f9d1fcd062f24e83c278608420e62109feb2c8abee07de7d" "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" "checksum cgl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "86765cb42c2a2c497e142af72517c1b4d7ae5bb2f25dfa77a5c69642f2342d89" @@ -3839,6 +3841,7 @@ dependencies = [ "checksum mio 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9e965267d4d58496fc4f740e9861118367f13570cadf66316ed2c3f2f14d87c7" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9de3eca27871df31c33b807f834b94ef7d000956f57aa25c5aed9c5f0aae8f6f" +"checksum mozangle 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4d916e4f2d39a00eeeb082ceb7c63c741e7c9d4f7915945f9225ae5e3b284092" "checksum mozjs 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "199f707066bf05b559ef6e46741c20e4f7bca8ae3a9c9d953d728dbb840f4eaa" "checksum mozjs_sys 0.50.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e61a792a125b1364c5ec50255ed8343ce02dc56098f8868dd209d472c8de006a" "checksum mp3-metadata 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ab5f1d2693586420208d1200ce5a51cd44726f055b635176188137aff42c7de" diff --git a/servo/components/script/Cargo.toml b/servo/components/script/Cargo.toml index 3db7e6970113..a82a10df5ff6 100644 --- a/servo/components/script/Cargo.toml +++ b/servo/components/script/Cargo.toml @@ -99,4 +99,4 @@ webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]} webvr_traits = {path = "../webvr_traits"} [target.'cfg(not(target_os = "ios"))'.dependencies] -angle = {git = "https://github.com/servo/angle", branch = "servo"} +mozangle = "0.1" diff --git a/servo/components/script/dom/webglprogram.rs b/servo/components/script/dom/webglprogram.rs index 98b788fc2ae9..f08c40f55004 100644 --- a/servo/components/script/dom/webglprogram.rs +++ b/servo/components/script/dom/webglprogram.rs @@ -31,6 +31,46 @@ pub struct WebGLProgram { renderer: WebGLMsgSender, } +/// ANGLE adds a `_u` prefix to variable names: +/// +/// https://chromium.googlesource.com/angle/angle/+/855d964bd0d05f6b2cb303f625506cf53d37e94f +/// +/// To avoid hard-coding this we would need to use the `sh::GetAttributes` and `sh::GetUniforms` +/// API to look up the `x.name` and `x.mappedName` members, +/// then build a data structure for bi-directional lookup (so either linear scan or two hashmaps). +/// Even then, this would probably only support plain variable names like "foo". +/// Strings passed to e.g. `GetUniformLocation` can be expressions like "foo[0].bar", +/// with the mapping for that "bar" name in yet another part of ANGLE’s API. +const ANGLE_NAME_PREFIX: &'static str = "_u"; + +fn to_name_in_compiled_shader(s: &str) -> String { + map_dot_separated(s, |s, mapped| { + mapped.push_str(ANGLE_NAME_PREFIX); + mapped.push_str(s); + }) +} + +fn from_name_in_compiled_shader(s: &str) -> String { + map_dot_separated(s, |s, mapped| { + mapped.push_str(if s.starts_with(ANGLE_NAME_PREFIX) { + &s[ANGLE_NAME_PREFIX.len()..] + } else { + s + }) + }) +} + +fn map_dot_separated(s: &str, f: F) -> String { + let mut iter = s.split('.'); + let mut mapped = String::new(); + f(iter.next().unwrap(), &mut mapped); + for s in iter { + mapped.push('.'); + f(s, &mut mapped); + } + mapped +} + impl WebGLProgram { fn new_inherited(renderer: WebGLMsgSender, id: WebGLProgramId) @@ -213,8 +253,10 @@ impl WebGLProgram { return Err(WebGLError::InvalidOperation); } + let name = to_name_in_compiled_shader(&name); + self.renderer - .send(WebGLCommand::BindAttribLocation(self.id, index, String::from(name))) + .send(WebGLCommand::BindAttribLocation(self.id, index, name)) .unwrap(); Ok(()) } @@ -228,8 +270,10 @@ impl WebGLProgram { .send(WebGLCommand::GetActiveUniform(self.id, index, sender)) .unwrap(); - receiver.recv().unwrap().map(|(size, ty, name)| - WebGLActiveInfo::new(self.global().as_window(), size, ty, DOMString::from(name))) + receiver.recv().unwrap().map(|(size, ty, name)| { + let name = DOMString::from(from_name_in_compiled_shader(&name)); + WebGLActiveInfo::new(self.global().as_window(), size, ty, name) + }) } /// glGetActiveAttrib @@ -242,8 +286,10 @@ impl WebGLProgram { .send(WebGLCommand::GetActiveAttrib(self.id, index, sender)) .unwrap(); - receiver.recv().unwrap().map(|(size, ty, name)| - WebGLActiveInfo::new(self.global().as_window(), size, ty, DOMString::from(name))) + receiver.recv().unwrap().map(|(size, ty, name)| { + let name = DOMString::from(from_name_in_compiled_shader(&name)); + WebGLActiveInfo::new(self.global().as_window(), size, ty, name) + }) } /// glGetAttribLocation @@ -264,9 +310,11 @@ impl WebGLProgram { return Ok(None); } + let name = to_name_in_compiled_shader(&name); + let (sender, receiver) = webgl_channel().unwrap(); self.renderer - .send(WebGLCommand::GetAttribLocation(self.id, String::from(name), sender)) + .send(WebGLCommand::GetAttribLocation(self.id, name, sender)) .unwrap(); Ok(receiver.recv().unwrap()) } @@ -285,9 +333,11 @@ impl WebGLProgram { return Ok(None); } + let name = to_name_in_compiled_shader(&name); + let (sender, receiver) = webgl_channel().unwrap(); self.renderer - .send(WebGLCommand::GetUniformLocation(self.id, String::from(name), sender)) + .send(WebGLCommand::GetUniformLocation(self.id, name, sender)) .unwrap(); Ok(receiver.recv().unwrap()) } diff --git a/servo/components/script/dom/webglshader.rs b/servo/components/script/dom/webglshader.rs index 7d69cb5d56cf..2a6504be5068 100644 --- a/servo/components/script/dom/webglshader.rs +++ b/servo/components/script/dom/webglshader.rs @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl -use angle::hl::{BuiltInResources, Output, ShaderValidator}; use canvas_traits::webgl::{WebGLSLVersion, WebGLVersion}; use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLMsgSender, WebGLParameter, WebGLResult, WebGLShaderId}; use dom::bindings::cell::DomRefCell; @@ -16,6 +15,7 @@ use dom::webgl_extensions::ext::oesstandardderivatives::OESStandardDerivatives; use dom::webglobject::WebGLObject; use dom::window::Window; use dom_struct::dom_struct; +use mozangle::shaders::{BuiltInResources, Output, ShaderValidator}; use std::cell::Cell; use std::sync::{ONCE_INIT, Once}; @@ -47,7 +47,7 @@ impl WebGLShader { id: WebGLShaderId, shader_type: u32) -> WebGLShader { - GLSLANG_INITIALIZATION.call_once(|| ::angle::hl::initialize().unwrap()); + GLSLANG_INITIALIZATION.call_once(|| ::mozangle::shaders::initialize().unwrap()); WebGLShader { webgl_object: WebGLObject::new_inherited(), id: id, diff --git a/servo/components/script/lib.rs b/servo/components/script/lib.rs index e28bf016e55b..bccfda96fdb2 100644 --- a/servo/components/script/lib.rs +++ b/servo/components/script/lib.rs @@ -21,7 +21,6 @@ #![plugin(script_plugins)] #![cfg_attr(not(feature = "unrooted_must_root_lint"), allow(unknown_lints))] -extern crate angle; extern crate app_units; extern crate audio_video_metadata; extern crate base64; @@ -64,6 +63,7 @@ extern crate metrics; extern crate mime; extern crate mime_guess; extern crate mitochondria; +extern crate mozangle; #[macro_use] extern crate mozjs as js; extern crate msg; From 91f3b91ea814023cff4192a2983abead204daf9c Mon Sep 17 00:00:00 2001 From: Cosmin Sabou Date: Mon, 12 Mar 2018 16:57:12 +0200 Subject: [PATCH 36/50] Backed out changeset adf758d8cff9 (bug 1423220) for frequent mochitest browser chrome failures on dom/base/test/browser_bug1303838.js --- browser/app/profile/firefox.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 4adfff98f013..7e4816503435 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1541,12 +1541,8 @@ pref("browser.tabs.remote.desktopbehavior", true); // For speculatively warming up tabs to improve perceived // performance while using the async tab switcher. -#if defined(NIGHTLY_BUILD) -pref("browser.tabs.remote.warmup.enabled", true); -#else +// Disabled until bug 1397426 is fixed. pref("browser.tabs.remote.warmup.enabled", false); -#endif - pref("browser.tabs.remote.warmup.maxTabs", 3); pref("browser.tabs.remote.warmup.unloadDelayMs", 2000); From 174a52929908026380dbcca4f1bef14e3f988628 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 12 Mar 2018 12:28:00 +0100 Subject: [PATCH 37/50] Bug 1444852 - nsIFrame::BuildDisplayListForChild Remove the init step as the result is unused r=miko MozReview-Commit-ID: G07Fwu1aw0M --HG-- extra : rebase_source : 0732665c062587c813ec7002704d23006ee33ccf --- layout/generic/nsFrame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index da7e31278f9e..76bf9bc11c54 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -3741,7 +3741,7 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder, nsDisplayList list; nsDisplayList extraPositionedDescendants; - const ActiveScrolledRoot* wrapListASR = aBuilder->CurrentActiveScrolledRoot(); + const ActiveScrolledRoot* wrapListASR; bool canSkipWrapList = false; if (isStackingContext) { if (effects->mMixBlendMode != NS_STYLE_BLEND_NORMAL) { From 6976f22495398de887b8bcfa6220dcfbaee4e71e Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Mon, 12 Mar 2018 10:32:52 -0400 Subject: [PATCH 38/50] servo: Merge #20277 - Enable /webvr/ tests (from servo:test-webvr); r=jdm Source-Repo: https://github.com/servo/servo Source-Revision: 5feb13ac66eb256db8ef41d75ddf9c6c4e0ecd54 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 6012f487e04de9e484147daa05702650a8ff36ce --- servo/components/script/dom/webidls/VR.webidl | 1 + 1 file changed, 1 insertion(+) diff --git a/servo/components/script/dom/webidls/VR.webidl b/servo/components/script/dom/webidls/VR.webidl index af256286523f..a1092cdb7343 100644 --- a/servo/components/script/dom/webidls/VR.webidl +++ b/servo/components/script/dom/webidls/VR.webidl @@ -5,6 +5,7 @@ // https://w3c.github.io/webvr/#interface-navigator [NoInterfaceObject] interface VR { + [Pref="dom.webvr.enabled"] Promise> getDisplays(); //readonly attribute FrozenArray activeVRDisplays; }; From a41a01a61f75991a406eb7c595af2f577ed3252b Mon Sep 17 00:00:00 2001 From: Gabriele Svelto Date: Mon, 12 Mar 2018 14:31:05 +0100 Subject: [PATCH 39/50] Bug 1444881 - Make |mach bootstrap| use the latest version of Oracle's JDK when bootstrapping Fennec on Gentoo; r=nalexander MozReview-Commit-ID: BnRJC95sSEr --HG-- extra : rebase_source : 82db88a83191f7e837c000d3701df8b3ee941259 --- python/mozboot/mozboot/gentoo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/mozboot/mozboot/gentoo.py b/python/mozboot/mozboot/gentoo.py index 5a1cdbcae35f..2d4dda27694a 100644 --- a/python/mozboot/mozboot/gentoo.py +++ b/python/mozboot/mozboot/gentoo.py @@ -62,7 +62,7 @@ class GentooBootstrapper(StyloInstall, BaseBootstrapper): # configuration files and doing so without user supervision is dangerous self.run_as_root(['emerge', '--noreplace', '--quiet', '--autounmask-continue', '--ask', - '=dev-java/oracle-jdk-bin-1.8.0.162']) + '=dev-java/oracle-jdk-bin-1.8.0.162-r1']) from mozboot import android android.ensure_android('linux', artifact_mode=artifact_mode, From a1b559f2fa36e1ff542288758d889179470b1254 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Mon, 12 Mar 2018 12:33:32 +0000 Subject: [PATCH 40/50] Bug 1444599 - Fix opening bookmark folders from the sidebar by middle/ctrl/cmd clicking. r=mak MozReview-Commit-ID: 4B611oRaCOH --HG-- extra : rebase_source : d94fe366e4545bc79a6ff900f34cbb437221cc77 --- .../components/places/content/sidebarUtils.js | 2 +- .../places/tests/browser/browser.ini | 2 + .../browser/browser_sidebar_open_bookmarks.js | 68 +++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 browser/components/places/tests/browser/browser_sidebar_open_bookmarks.js diff --git a/browser/components/places/content/sidebarUtils.js b/browser/components/places/content/sidebarUtils.js index ec4760cc7196..1ed41de7ea3f 100644 --- a/browser/components/places/content/sidebarUtils.js +++ b/browser/components/places/content/sidebarUtils.js @@ -43,7 +43,7 @@ var SidebarUtils = { var openInTabs = isContainer && (aEvent.button == 1 || (aEvent.button == 0 && modifKey)) && - PlacesUtils.hasChildURIs(tbo.view.nodeForTreeIndex(cell.row)); + PlacesUtils.hasChildURIs(aTree.view.nodeForTreeIndex(cell.row)); if (aEvent.button == 0 && isContainer && !openInTabs) { tbo.view.toggleOpenState(cell.row); diff --git a/browser/components/places/tests/browser/browser.ini b/browser/components/places/tests/browser/browser.ini index 85e4c2c0badd..cfc8d90adbce 100644 --- a/browser/components/places/tests/browser/browser.ini +++ b/browser/components/places/tests/browser/browser.ini @@ -103,6 +103,8 @@ skip-if = (os == 'win' && ccov) # Bug 1423667 [browser_remove_bookmarks.js] skip-if = (os == 'win' && ccov) # Bug 1423667 subsuite = clipboard +[browser_sidebar_open_bookmarks.js] +skip-if = (os == 'win' && ccov) # Bug 1423667 [browser_sidebarpanels_click.js] skip-if = (os == 'win' && ccov) || (os == "mac" && debug) # Bug 1423667 [browser_sort_in_library.js] diff --git a/browser/components/places/tests/browser/browser_sidebar_open_bookmarks.js b/browser/components/places/tests/browser/browser_sidebar_open_bookmarks.js new file mode 100644 index 000000000000..9ded308a301d --- /dev/null +++ b/browser/components/places/tests/browser/browser_sidebar_open_bookmarks.js @@ -0,0 +1,68 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +var gBms; + +add_task(async function setup() { + gBms = await PlacesUtils.bookmarks.insertTree({ + guid: PlacesUtils.bookmarks.unfiledGuid, + children: [{ + title: "bm1", + url: "about:buildconfig" + }, { + title: "bm2", + url: "about:mozilla", + }] + }); + + registerCleanupFunction(async () => { + await PlacesUtils.bookmarks.eraseEverything(); + }); +}); + +add_task(async function test_open_bookmark_from_sidebar() { + let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser); + + await withSidebarTree("bookmarks", async (tree) => { + tree.selectItems([gBms[0].guid]); + + let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, + false, gBms[0].url + ); + + tree.controller.doCommand("placesCmd_open"); + + await loadedPromise; + + // An assert to make the test happy. + Assert.ok(true, "The bookmark was loaded successfully."); + }); + + await BrowserTestUtils.removeTab(tab); +}); + +add_task(async function test_open_bookmark_folder_from_sidebar() { + await withSidebarTree("bookmarks", async (tree) => { + tree.selectItems([PlacesUtils.bookmarks.virtualUnfiledGuid]); + + Assert.equal(tree.view.selection.getRangeCount(), 1, + "Should only have one range selected"); + + let loadedPromises = []; + + for (let bm of gBms) { + loadedPromises.push(BrowserTestUtils.waitForNewTab(gBrowser, + bm.url, false, true)); + } + + synthesizeClickOnSelectedTreeCell(tree, {button: 1}); + + let tabs = await Promise.all(loadedPromises); + + for (let tab of tabs) { + await BrowserTestUtils.removeTab(tab); + } + }); +}); From 462b445081e488be51afdfd103f039610ae44f7c Mon Sep 17 00:00:00 2001 From: Cosmin Sabou Date: Mon, 12 Mar 2018 18:07:46 +0200 Subject: [PATCH 41/50] Backed out 6 changesets (bug 1343451) for mochitest android perma failures on testInputConnection. Backed out changeset e07105d9698e (bug 1343451) Backed out changeset dc4a2a5932c3 (bug 1343451) Backed out changeset 9561ed261d04 (bug 1343451) Backed out changeset 84a5ec921442 (bug 1343451) Backed out changeset b34d48936db8 (bug 1343451) Backed out changeset 4dce7ab14f71 (bug 1343451) --- dom/events/VirtualKeyCodeList.h | 3 - dom/webidl/KeyEvent.webidl | 6 - widget/NativeKeyToDOMKeyName.h | 3 - widget/android/GeckoEditableSupport.cpp | 23 +- widget/cocoa/TextInputHandler.h | 47 +-- widget/cocoa/TextInputHandler.mm | 431 +++++------------------- widget/gtk/IMContextWrapper.cpp | 241 +++++-------- widget/gtk/IMContextWrapper.h | 65 +--- widget/gtk/nsGtkKeyUtils.cpp | 16 +- widget/gtk/nsGtkKeyUtils.h | 4 +- widget/gtk/nsWindow.cpp | 39 ++- widget/gtk/nsWindow.h | 18 +- widget/tests/test_keycodes.xul | 4 +- widget/windows/KeyboardLayout.cpp | 2 +- 14 files changed, 215 insertions(+), 687 deletions(-) diff --git a/dom/events/VirtualKeyCodeList.h b/dom/events/VirtualKeyCodeList.h index 6660182fe7cd..40615947ef8f 100644 --- a/dom/events/VirtualKeyCodeList.h +++ b/dom/events/VirtualKeyCodeList.h @@ -212,9 +212,6 @@ DEFINE_VK_INTERNAL(_ALTGR) DEFINE_VK_INTERNAL(_WIN_ICO_HELP) DEFINE_VK_INTERNAL(_WIN_ICO_00) - -DEFINE_VK_INTERNAL(_PROCESSKEY) - DEFINE_VK_INTERNAL(_WIN_ICO_CLEAR) DEFINE_VK_INTERNAL(_WIN_OEM_RESET) DEFINE_VK_INTERNAL(_WIN_OEM_JUMP) diff --git a/dom/webidl/KeyEvent.webidl b/dom/webidl/KeyEvent.webidl index 6fd66afc21d9..abb4b6a34285 100644 --- a/dom/webidl/KeyEvent.webidl +++ b/dom/webidl/KeyEvent.webidl @@ -195,12 +195,6 @@ interface KeyEvent // for compatibility with the other web browsers on Windows. const unsigned long DOM_VK_WIN_ICO_HELP = 0xE3; const unsigned long DOM_VK_WIN_ICO_00 = 0xE4; - - // IME processed key. - const unsigned long DOM_VK_PROCESSKEY = 0xE5; - - // OEM specific virtual keyCode of Windows should pass through DOM keyCode - // for compatibility with the other web browsers on Windows. const unsigned long DOM_VK_WIN_ICO_CLEAR = 0xE6; const unsigned long DOM_VK_WIN_OEM_RESET = 0xE9; const unsigned long DOM_VK_WIN_OEM_JUMP = 0xEA; diff --git a/widget/NativeKeyToDOMKeyName.h b/widget/NativeKeyToDOMKeyName.h index bfd5baa948b3..db0d73da69aa 100644 --- a/widget/NativeKeyToDOMKeyName.h +++ b/widget/NativeKeyToDOMKeyName.h @@ -529,9 +529,6 @@ KEY_MAP_ANDROID (NonConvert, AKEYCODE_MUHENKAN) // PreviousCandidate KEY_MAP_GTK (PreviousCandidate, GDK_PreviousCandidate) // OADG 109, Mae Koho -// Process -KEY_MAP_WIN (Process, VK_PROCESSKEY) - // SingleCandidate KEY_MAP_GTK (SingleCandidate, GDK_SingleCandidate) diff --git a/widget/android/GeckoEditableSupport.cpp b/widget/android/GeckoEditableSupport.cpp index 3c3517e9d0c8..78be01395f2e 100644 --- a/widget/android/GeckoEditableSupport.cpp +++ b/widget/android/GeckoEditableSupport.cpp @@ -668,6 +668,7 @@ GeckoEditableSupport::OnKeyEvent(int32_t aAction, int32_t aKeyCode, /* * Send dummy key events for pages that are unaware of input events, * to provide web compatibility for pages that depend on key events. + * Our dummy key events have 0 as the keycode. */ void GeckoEditableSupport::SendIMEDummyKeyEvent(nsIWidget* aWidget, EventMessage msg) @@ -677,12 +678,7 @@ GeckoEditableSupport::SendIMEDummyKeyEvent(nsIWidget* aWidget, EventMessage msg) WidgetKeyboardEvent event(true, msg, aWidget); event.mTime = PR_Now() / 1000; - // TODO: If we can know scan code of the key event which caused replacing - // composition string, we should set mCodeNameIndex here. Then, - // we should rename this method because it becomes not a "dummy" - // keyboard event. - event.mKeyCode = NS_VK_PROCESSKEY; - event.mKeyNameIndex = KEY_NAME_INDEX_Process; + MOZ_ASSERT(event.mKeyCode == 0); NS_ENSURE_SUCCESS_VOID(BeginInputTransaction(mDispatcher)); mDispatcher->DispatchKeyboardEvent(msg, event, status); } @@ -1031,19 +1027,12 @@ GeckoEditableSupport::OnImeReplaceText(int32_t aStart, int32_t aEnd, AddIMETextChange(dummyChange); } - // Until fixing bug 354358 in release channel, we should always ignore - // "intl.ime.hack.on_ime_unaware_apps.fire_key_events_for_composition" - // pref in Nightly and early Beta for testing new regressions. -#ifndef EARLY_BETA_OR_EARLIER if (mInputContext.mMayBeIMEUnaware) { -#endif // #ifndef EARLY_BETA_OR_EARLIER SendIMEDummyKeyEvent(widget, eKeyDown); if (!mDispatcher || widget->Destroyed()) { return; } -#ifndef EARLY_BETA_OR_EARLIER } -#endif // #ifndef EARLY_BETA_OR_EARLIER if (composing) { mDispatcher->SetPendingComposition(string, mIMERanges); @@ -1057,18 +1046,10 @@ GeckoEditableSupport::OnImeReplaceText(int32_t aStart, int32_t aEnd, return; } - // XXX This works fine if user inputs with virtual keyboard. However, - // if user inputs with hardware keyboard, keyup event may come later. - // So, perhaps, we need to record actual keyboard events before - // this replacement of composition string. -#ifndef EARLY_BETA_OR_EARLIER if (mInputContext.mMayBeIMEUnaware) { -#endif // #ifndef EARLY_BETA_OR_EARLIER SendIMEDummyKeyEvent(widget, eKeyUp); // Widget may be destroyed after dispatching the above event. -#ifndef EARLY_BETA_OR_EARLIER } -#endif // #ifndef EARLY_BETA_OR_EARLIER } void diff --git a/widget/cocoa/TextInputHandler.h b/widget/cocoa/TextInputHandler.h index 74e8fec9c581..1e41c3752822 100644 --- a/widget/cocoa/TextInputHandler.h +++ b/widget/cocoa/TextInputHandler.h @@ -243,9 +243,6 @@ public: * dispatch a Gecko key event. * @param aKeyEvent The result -- a Gecko key event initialized * from the native key event. - * @param aIsProcessedByIME true if aNativeKeyEvent has been handled - * by IME (but except if the composition was - * started with dead key). * @param aInsertString If caller expects that the event will cause * a character to be input (say in an editor), * the caller should set this. Otherwise, @@ -254,7 +251,6 @@ public: * characters of aNativeKeyEvent. */ void InitKeyEvent(NSEvent *aNativeKeyEvent, WidgetKeyboardEvent& aKeyEvent, - bool aIsProcessedByIME, const nsAString *aInsertString = nullptr); /** @@ -307,15 +303,6 @@ public: static CodeNameIndex ComputeGeckoCodeNameIndex(UInt32 aNativeKeyCode, UInt32 aKbType); - /** - * TranslateToChar() checks if aNativeKeyEvent is a dead key. - * - * @param aNativeKeyEvent A native key event. - * @return Returns true if the key event is a dead key - * event. Otherwise, false. - */ - bool IsDeadKey(NSEvent* aNativeKeyEvent); - protected: /** * TranslateToString() computes the inputted text from the native keyCode, @@ -356,7 +343,7 @@ protected: * @param aKbType A native Keyboard Type value. Typically, * this is a result of ::LMGetKbdType(). * @return Returns true if the key with specified - * modifier state is a dead key. Otherwise, + * modifier state isa dead key. Otherwise, * false. */ bool IsDeadKey(UInt32 aKeyCode, UInt32 aModifiers, UInt32 aKbType); @@ -446,9 +433,6 @@ public: * dispatch a Gecko key event. * @param aKeyEvent The result -- a Gecko key event initialized * from the native key event. - * @param aIsProcessedByIME true if aNativeKeyEvent has been handled - * by IME (but except if the composition was - * started with dead key). * @param aInsertString If caller expects that the event will cause * a character to be input (say in an editor), * the caller should set this. Otherwise, @@ -457,7 +441,6 @@ public: * characters of aNativeKeyEvent. */ void InitKeyEvent(NSEvent *aNativeKeyEvent, WidgetKeyboardEvent& aKeyEvent, - bool aIsProcessedByIME, const nsAString *aInsertString = nullptr); /** @@ -569,8 +552,6 @@ protected: // Unique id associated with a keydown / keypress event. It's ok if this // wraps over long periods. uint32_t mUniqueId; - // Whether keydown event was dispatched for mKeyEvent. - bool mKeyDownDispatched; // Whether keydown event was consumed by web contents or chrome contents. bool mKeyDownHandled; // Whether keypress event was dispatched for mKeyEvent. @@ -623,7 +604,6 @@ protected: } mInsertString = nullptr; mInsertedString.Truncate(); - mKeyDownDispatched = false; mKeyDownHandled = false; mKeyPressDispatched = false; mKeyPressHandled = false; @@ -637,11 +617,6 @@ protected: mCompositionDispatched; } - bool CanDispatchKeyDownEvent() const - { - return !mKeyDownDispatched; - } - bool CanDispatchKeyPressEvent() const { return !mKeyPressDispatched && !IsDefaultPrevented(); @@ -790,8 +765,7 @@ protected: } void InitKeyEvent(TextInputHandlerBase* aHandler, - WidgetKeyboardEvent& aKeyEvent, - bool aIsProcessedByIME); + WidgetKeyboardEvent& aKeyEvent); /** * GetUnhandledString() returns characters of the event which have not been @@ -1085,7 +1059,6 @@ public: NSRange MarkedRange(); bool IsIMEComposing() { return mIsIMEComposing; } - bool IsDeadKeyComposing() { return mIsDeadKeyComposing; } bool IsIMEOpened(); bool IsIMEEnabled() { return mIsIMEEnabled; } bool IsASCIICapableOnly() { return mIsASCIICapableOnly; } @@ -1139,19 +1112,6 @@ protected: void InsertTextAsCommittingComposition(NSAttributedString* aAttrString, NSRange* aReplacementRange); - /** - * MaybeDispatchCurrentKeydownEvent() dispatches eKeyDown event for current - * key event. If eKeyDown for current key event has already been dispatched, - * this does nothing. - * - * @param aIsProcessedByIME true if current key event is handled by IME. - * @return true if the caller can continue to handle - * current key event. Otherwise, false. E.g., - * focus is moved, the widget has been destroyed - * or something. - */ - bool MaybeDispatchCurrentKeydownEvent(bool aIsProcessedByIME); - private: // If mIsIMEComposing is true, the composition string is stored here. NSString* mIMECompositionString; @@ -1165,9 +1125,6 @@ private: mozilla::WritingMode mWritingMode; bool mIsIMEComposing; - // If the composition started with dead key, mIsDeadKeyComposing is set to - // true. - bool mIsDeadKeyComposing; bool mIsIMEEnabled; bool mIsASCIICapableOnly; bool mIgnoreIMECommit; diff --git a/widget/cocoa/TextInputHandler.mm b/widget/cocoa/TextInputHandler.mm index eb2057a85a08..106ef0e91f52 100644 --- a/widget/cocoa/TextInputHandler.mm +++ b/widget/cocoa/TextInputHandler.mm @@ -399,84 +399,6 @@ TISInputSourceWrapper::TranslateToChar(UInt32 aKeyCode, UInt32 aModifiers, return static_cast(str.CharAt(0)); } -bool -TISInputSourceWrapper::IsDeadKey(NSEvent* aNativeKeyEvent) -{ - if ([[aNativeKeyEvent characters] length]) { - return false; - } - - // Assmue that if control key or command key is pressed, it's not a dead key. - NSUInteger cocoaState = [aNativeKeyEvent modifierFlags]; - if (cocoaState & (NSControlKeyMask | NSCommandKeyMask)) { - return false; - } - - UInt32 nativeKeyCode = [aNativeKeyEvent keyCode]; - switch (nativeKeyCode) { - case kVK_ANSI_A: - case kVK_ANSI_B: - case kVK_ANSI_C: - case kVK_ANSI_D: - case kVK_ANSI_E: - case kVK_ANSI_F: - case kVK_ANSI_G: - case kVK_ANSI_H: - case kVK_ANSI_I: - case kVK_ANSI_J: - case kVK_ANSI_K: - case kVK_ANSI_L: - case kVK_ANSI_M: - case kVK_ANSI_N: - case kVK_ANSI_O: - case kVK_ANSI_P: - case kVK_ANSI_Q: - case kVK_ANSI_R: - case kVK_ANSI_S: - case kVK_ANSI_T: - case kVK_ANSI_U: - case kVK_ANSI_V: - case kVK_ANSI_W: - case kVK_ANSI_X: - case kVK_ANSI_Y: - case kVK_ANSI_Z: - case kVK_ANSI_1: - case kVK_ANSI_2: - case kVK_ANSI_3: - case kVK_ANSI_4: - case kVK_ANSI_5: - case kVK_ANSI_6: - case kVK_ANSI_7: - case kVK_ANSI_8: - case kVK_ANSI_9: - case kVK_ANSI_0: - case kVK_ANSI_Equal: - case kVK_ANSI_Minus: - case kVK_ANSI_RightBracket: - case kVK_ANSI_LeftBracket: - case kVK_ANSI_Quote: - case kVK_ANSI_Semicolon: - case kVK_ANSI_Backslash: - case kVK_ANSI_Comma: - case kVK_ANSI_Slash: - case kVK_ANSI_Period: - case kVK_ANSI_Grave: - case kVK_JIS_Yen: - case kVK_JIS_Underscore: - break; - default: - // Let's assume that dead key can be only a printable key in standard - // position. - return false; - } - - // If TranslateToChar() returns non-zero value, that means that - // the key may input a character with different dead key state. - UInt32 kbType = GetKbdType(); - UInt32 carbonState = nsCocoaUtils::ConvertToCarbonModifier(cocoaState); - return IsDeadKey(nativeKeyCode, carbonState, kbType); -} - bool TISInputSourceWrapper::IsDeadKey(UInt32 aKeyCode, UInt32 aModifiers, @@ -984,25 +906,17 @@ TISInputSourceWrapper::ComputeInsertStringForCharCode( void TISInputSourceWrapper::InitKeyEvent(NSEvent *aNativeKeyEvent, WidgetKeyboardEvent& aKeyEvent, - bool aIsProcessedByIME, const nsAString *aInsertString) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - MOZ_ASSERT(!aIsProcessedByIME || aKeyEvent.mMessage != eKeyPress, - "eKeyPress event should not be marked as proccessed by IME"); - MOZ_LOG(gLog, LogLevel::Info, ("%p TISInputSourceWrapper::InitKeyEvent, aNativeKeyEvent=%p, " - "aKeyEvent.mMessage=%s, aProcessedByIME=%s, aInsertString=%p, " - "IsOpenedIMEMode()=%s", - this, aNativeKeyEvent, GetGeckoKeyEventType(aKeyEvent), - TrueOrFalse(aIsProcessedByIME), aInsertString, + "aKeyEvent.mMessage=%s, aInsertString=%p, IsOpenedIMEMode()=%s", + this, aNativeKeyEvent, GetGeckoKeyEventType(aKeyEvent), aInsertString, TrueOrFalse(IsOpenedIMEMode()))); - if (NS_WARN_IF(!aNativeKeyEvent)) { - return; - } + NS_ENSURE_TRUE(aNativeKeyEvent, ); nsCocoaUtils::InitInputEvent(aKeyEvent, aNativeKeyEvent); @@ -1031,18 +945,8 @@ TISInputSourceWrapper::InitKeyEvent(NSEvent *aNativeKeyEvent, UInt32 kbType = GetKbdType(); UInt32 nativeKeyCode = [aNativeKeyEvent keyCode]; - // macOS handles dead key as IME. If the key is first key press of dead - // key, we should use KEY_NAME_INDEX_Dead for first (dead) key event. - // So, if aIsProcessedByIME is true, it may be dead key. Let's check - // if current key event is a dead key's keydown event. - bool isProcessedByIME = - aIsProcessedByIME && - !TISInputSourceWrapper::CurrentInputSource().IsDeadKey(aNativeKeyEvent); - aKeyEvent.mKeyCode = - isProcessedByIME ? - NS_VK_PROCESSKEY : - ComputeGeckoKeyCode(nativeKeyCode, kbType, aKeyEvent.IsMeta()); + ComputeGeckoKeyCode(nativeKeyCode, kbType, aKeyEvent.IsMeta()); switch (nativeKeyCode) { case kVK_Command: @@ -1095,9 +999,7 @@ TISInputSourceWrapper::InitKeyEvent(NSEvent *aNativeKeyEvent, this, OnOrOff(aKeyEvent.IsShift()), OnOrOff(aKeyEvent.IsControl()), OnOrOff(aKeyEvent.IsAlt()), OnOrOff(aKeyEvent.IsMeta()))); - if (isProcessedByIME) { - aKeyEvent.mKeyNameIndex = KEY_NAME_INDEX_Process; - } else if (IsPrintableKeyEvent(aNativeKeyEvent)) { + if (IsPrintableKeyEvent(aNativeKeyEvent)) { aKeyEvent.mKeyNameIndex = KEY_NAME_INDEX_USE_STRING; // If insertText calls this method, let's use the string. if (aInsertString && !aInsertString->IsEmpty() && @@ -1726,7 +1628,7 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent, } WidgetKeyboardEvent imeEvent(true, eKeyDown, widget); - currentKeyEvent->InitKeyEvent(this, imeEvent, false); + currentKeyEvent->InitKeyEvent(this, imeEvent); imeEvent.mPluginTextEventString.Assign(committed); nsEventStatus status = nsEventStatus_eIgnore; mDispatcher->DispatchKeyboardEvent(eKeyDown, imeEvent, status, @@ -1735,18 +1637,50 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent, return true; } - RefPtr kungFuDeathGrip(this); + NSResponder* firstResponder = [[mView window] firstResponder]; - // When we're already in a composition, we need always to mark the eKeyDown - // event as "processed by IME". So, let's dispatch eKeyDown event here in - // such case. - if (IsIMEComposing() && !MaybeDispatchCurrentKeydownEvent(true)) { - MOZ_LOG(gLog, LogLevel::Info, - ("%p IMEInputHandler::HandleKeyDownEvent, eKeyDown caused focus move or " - "something and canceling the composition", this)); + nsresult rv = mDispatcher->BeginNativeInputTransaction(); + if (NS_WARN_IF(NS_FAILED(rv))) { + MOZ_LOG(gLog, LogLevel::Error, + ("%p IMEInputHandler::HandleKeyDownEvent, " + "FAILED, due to BeginNativeInputTransaction() failure " + "at dispatching keydown for ordinal cases", this)); return false; } + WidgetKeyboardEvent keydownEvent(true, eKeyDown, widget); + currentKeyEvent->InitKeyEvent(this, keydownEvent); + + nsEventStatus status = nsEventStatus_eIgnore; + mDispatcher->DispatchKeyboardEvent(eKeyDown, keydownEvent, status, + currentKeyEvent); + currentKeyEvent->mKeyDownHandled = + (status == nsEventStatus_eConsumeNoDefault); + + if (Destroyed()) { + MOZ_LOG(gLog, LogLevel::Info, + ("%p TextInputHandler::HandleKeyDownEvent, " + "widget was destroyed by keydown event", this)); + return currentKeyEvent->IsDefaultPrevented(); + } + + // The key down event may have shifted the focus, in which + // case we should not fire the key press. + // XXX This is a special code only on Cocoa widget, why is this needed? + if (firstResponder != [[mView window] firstResponder]) { + MOZ_LOG(gLog, LogLevel::Info, + ("%p TextInputHandler::HandleKeyDownEvent, " + "view lost focus by keydown event", this)); + return currentKeyEvent->IsDefaultPrevented(); + } + + if (currentKeyEvent->IsDefaultPrevented()) { + MOZ_LOG(gLog, LogLevel::Info, + ("%p TextInputHandler::HandleKeyDownEvent, " + "keydown event's default is prevented", this)); + return true; + } + // Let Cocoa interpret the key events, caching IsIMEComposing first. bool wasComposing = IsIMEComposing(); bool interpretKeyEventsCalled = false; @@ -1776,33 +1710,9 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent, "IsIMEComposing()=%s", this, TrueOrFalse(wasComposing), TrueOrFalse(IsIMEComposing()))); - if (currentKeyEvent->CanDispatchKeyDownEvent()) { - // Dispatch eKeyDown event if nobody has dispatched it yet. - // NOTE: Although reaching here means that the native keydown event may - // not be handled by IME. However, we cannot know if it is. - // For example, Japanese IME of Apple shows candidate window for - // typing window. They, you can switch the sort order with Tab key. - // However, when you choose "Symbol" of the sort order, there may - // be no candiate words. In this case, IME handles the Tab key - // actually, but we cannot know it because composition string is - // not updated. So, let's mark eKeyDown event as "processed by IME" - // when there is composition string. This is same as Chrome. - MOZ_LOG(gLog, LogLevel::Info, - ("%p TextInputHandler::HandleKeyDownEvent, trying to dispatch eKeyDown " - "event since it's not yet dispatched", - this)); - if (!MaybeDispatchCurrentKeydownEvent(IsIMEComposing())) { - return true; // treat the eKeydDown event as consumed. - } - MOZ_LOG(gLog, LogLevel::Info, - ("%p TextInputHandler::HandleKeyDownEvent, eKeyDown event has been " - "dispatched", - this)); - } - if (currentKeyEvent->CanDispatchKeyPressEvent() && !wasComposing && !IsIMEComposing()) { - nsresult rv = mDispatcher->BeginNativeInputTransaction(); + rv = mDispatcher->BeginNativeInputTransaction(); if (NS_WARN_IF(NS_FAILED(rv))) { MOZ_LOG(gLog, LogLevel::Error, ("%p IMEInputHandler::HandleKeyDownEvent, " @@ -1812,7 +1722,7 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent, } WidgetKeyboardEvent keypressEvent(true, eKeyPress, widget); - currentKeyEvent->InitKeyEvent(this, keypressEvent, false); + currentKeyEvent->InitKeyEvent(this, keypressEvent); // If we called interpretKeyEvents and this isn't normal character input // then IME probably ate the event for some reason. We do not want to @@ -1827,11 +1737,6 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent, // our default action for this key. if (!(interpretKeyEventsCalled && IsNormalCharInputtingEvent(keypressEvent))) { - MOZ_LOG(gLog, LogLevel::Info, - ("%p TextInputHandler::HandleKeyDownEvent, trying to dispatch " - "eKeyPress event since it's not yet dispatched", - this)); - nsEventStatus status = nsEventStatus_eIgnore; currentKeyEvent->mKeyPressDispatched = mDispatcher->MaybeDispatchKeypressEvents(keypressEvent, status, currentKeyEvent); @@ -1839,8 +1744,7 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent, (status == nsEventStatus_eConsumeNoDefault); currentKeyEvent->mKeyPressDispatched = true; MOZ_LOG(gLog, LogLevel::Info, - ("%p TextInputHandler::HandleKeyDownEvent, eKeyPress event has been " - "dispatched", + ("%p TextInputHandler::HandleKeyDownEvent, keypress event dispatched", this)); } } @@ -1894,10 +1798,8 @@ TextInputHandler::HandleKeyUpEvent(NSEvent* aNativeEvent) return; } - // Neither Chrome for macOS nor Safari marks "keyup" event as "processed by - // IME" even during composition. So, let's follow this behavior. WidgetKeyboardEvent keyupEvent(true, eKeyUp, mWidget); - InitKeyEvent(aNativeEvent, keyupEvent, false); + InitKeyEvent(aNativeEvent, keyupEvent); KeyEventState currentKeyEvent(aNativeEvent); nsEventStatus status = nsEventStatus_eIgnore; @@ -2241,7 +2143,7 @@ TextInputHandler::DispatchKeyEventForFlagsChanged(NSEvent* aNativeEvent, GetKeyNameForNativeKeyCode([aNativeEvent keyCode]), [aNativeEvent keyCode], TrueOrFalse(aDispatchKeyDown), TrueOrFalse(IsIMEComposing()))); - if ([aNativeEvent type] != NSFlagsChanged) { + if ([aNativeEvent type] != NSFlagsChanged || IsIMEComposing()) { return; } @@ -2255,11 +2157,9 @@ TextInputHandler::DispatchKeyEventForFlagsChanged(NSEvent* aNativeEvent, EventMessage message = aDispatchKeyDown ? eKeyDown : eKeyUp; - // Fire a key event for the modifier key. Note that even if modifier key - // is pressed during composition, we shouldn't mark the keyboard event as - // "processed by IME" since neither Chrome for macOS nor Safari does it. + // Fire a key event. WidgetKeyboardEvent keyEvent(true, message, mWidget); - InitKeyEvent(aNativeEvent, keyEvent, false); + InitKeyEvent(aNativeEvent, keyEvent); // Attach a plugin event, in case keyEvent gets dispatched to a plugin. Only // one field is needed -- the type. The other fields can be constructed as @@ -2295,16 +2195,13 @@ TextInputHandler::InsertText(NSAttributedString* aAttrString, ("%p TextInputHandler::InsertText, aAttrString=\"%s\", " "aReplacementRange=%p { location=%lu, length=%lu }, " "IsIMEComposing()=%s, " - "keyevent=%p, keydownDispatched=%s, " - "keydownHandled=%s, keypressDispatched=%s, " + "keyevent=%p, keydownHandled=%s, keypressDispatched=%s, " "causedOtherKeyEvents=%s, compositionDispatched=%s", this, GetCharacters([aAttrString string]), aReplacementRange, static_cast(aReplacementRange ? aReplacementRange->location : 0), static_cast(aReplacementRange ? aReplacementRange->length : 0), TrueOrFalse(IsIMEComposing()), currentKeyEvent ? currentKeyEvent->mKeyEvent : nullptr, - currentKeyEvent ? - TrueOrFalse(currentKeyEvent->mKeyDownDispatched) : "N/A", currentKeyEvent ? TrueOrFalse(currentKeyEvent->mKeyDownHandled) : "N/A", currentKeyEvent ? @@ -2356,21 +2253,8 @@ TextInputHandler::InsertText(NSAttributedString* aAttrString, if (!currentKeyEvent) { return; } - - // When current keydown event causes this empty text input, let's - // dispatch eKeyDown event before any other events. Note that if we're - // in a composition, we've already dispatched eKeyDown event from - // TextInputHandler::HandleKeyDownEvent(). - // XXX Should we mark this eKeyDown event as "processed by IME"? - RefPtr kungFuDeathGrip(this); - if (!IsIMEComposing() && !MaybeDispatchCurrentKeydownEvent(false)) { - MOZ_LOG(gLog, LogLevel::Info, - ("%p IMEInputHandler::InsertText, eKeyDown caused focus move or " - "something and canceling the composition", this)); - return; - } - // Delete the selected range. + RefPtr kungFuDeathGrip(this); WidgetContentCommandEvent deleteCommandEvent(true, eContentCommandDelete, mWidget); DispatchEvent(deleteCommandEvent); @@ -2419,23 +2303,13 @@ TextInputHandler::InsertText(NSAttributedString* aAttrString, return; } - // This is the normal path to input a character when you press a key. - // Let's dispatch eKeyDown event now. - RefPtr kungFuDeathGrip(this); - if (!MaybeDispatchCurrentKeydownEvent(false)) { - MOZ_LOG(gLog, LogLevel::Info, - ("%p IMEInputHandler::InsertText, eKeyDown caused focus move or " - "something and canceling the composition", this)); - return; - } - // XXX Shouldn't we hold mDispatcher instead of mWidget? RefPtr widget(mWidget); nsresult rv = mDispatcher->BeginNativeInputTransaction(); if (NS_WARN_IF(NS_FAILED(rv))) { - MOZ_LOG(gLog, LogLevel::Error, - ("%p IMEInputHandler::InsertText, " - "FAILED, due to BeginNativeInputTransaction() failure", this)); + MOZ_LOG(gLog, LogLevel::Error, + ("%p IMEInputHandler::HandleKeyUpEvent, " + "FAILED, due to BeginNativeInputTransaction() failure", this)); return; } @@ -2451,7 +2325,7 @@ TextInputHandler::InsertText(NSAttributedString* aAttrString, // the input string. if (currentKeyEvent) { - currentKeyEvent->InitKeyEvent(this, keypressEvent, false); + currentKeyEvent->InitKeyEvent(this, keypressEvent); } else { nsCocoaUtils::InitInputEvent(keypressEvent, static_cast(nullptr)); keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_USE_STRING; @@ -2517,18 +2391,6 @@ TextInputHandler::HandleCommand(Command aCommand) return false; } - // When current keydown event causes this command, let's dispatch - // eKeyDown event before any other events. Note that if we're in a - // composition, we've already dispatched eKeyDown event from - // TextInputHandler::HandleKeyDownEvent(). - RefPtr kungFuDeathGrip(this); - if (!IsIMEComposing() && !MaybeDispatchCurrentKeydownEvent(false)) { - MOZ_LOG(gLog, LogLevel::Info, - ("%p IMEInputHandler::SetMarkedText, eKeyDown caused focus move or " - "something and canceling the composition", this)); - return false; - } - // If it's in composition, we cannot dispatch keypress event. // Therefore, we should use different approach or give up to handle // the command. @@ -2625,7 +2487,7 @@ TextInputHandler::HandleCommand(Command aCommand) if (!dispatchFakeKeyPress) { // If we're acutally handling a key press, we should dispatch // the keypress event as-is. - currentKeyEvent->InitKeyEvent(this, keypressEvent, false); + currentKeyEvent->InitKeyEvent(this, keypressEvent); } else { // Otherwise, we should dispatch "fake" keypress event. // However, for making it possible to compute edit commands, we need to @@ -2891,15 +2753,11 @@ TextInputHandler::DoCommandBySelector(const char* aSelector) MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::DoCommandBySelector, aSelector=\"%s\", " - "Destroyed()=%s, keydownDispatched=%s, keydownHandled=%s, " - "keypressDispatched=%s, keypressHandled=%s, causedOtherKeyEvents=%s", + "Destroyed()=%s, keydownHandled=%s, keypressHandled=%s, " + "causedOtherKeyEvents=%s", this, aSelector ? aSelector : "", TrueOrFalse(Destroyed()), - currentKeyEvent ? - TrueOrFalse(currentKeyEvent->mKeyDownDispatched) : "N/A", currentKeyEvent ? TrueOrFalse(currentKeyEvent->mKeyDownHandled) : "N/A", - currentKeyEvent ? - TrueOrFalse(currentKeyEvent->mKeyPressDispatched) : "N/A", currentKeyEvent ? TrueOrFalse(currentKeyEvent->mKeyPressHandled) : "N/A", currentKeyEvent ? @@ -2911,18 +2769,6 @@ TextInputHandler::DoCommandBySelector(const char* aSelector) return Destroyed(); } - // When current keydown event causes this command, let's dispatch - // eKeyDown event before any other events. Note that if we're in a - // composition, we've already dispatched eKeyDown event from - // TextInputHandler::HandleKeyDownEvent(). - RefPtr kungFuDeathGrip(this); - if (!IsIMEComposing() && !MaybeDispatchCurrentKeydownEvent(false)) { - MOZ_LOG(gLog, LogLevel::Info, - ("%p IMEInputHandler::SetMarkedText, eKeyDown caused focus move or " - "something and canceling the composition", this)); - return true; - } - // If the key operation causes this command, should dispatch a keypress // event. // XXX This must be worng. Even if this command is caused by the key @@ -2940,7 +2786,7 @@ TextInputHandler::DoCommandBySelector(const char* aSelector) } WidgetKeyboardEvent keypressEvent(true, eKeyPress, widget); - currentKeyEvent->InitKeyEvent(this, keypressEvent, false); + currentKeyEvent->InitKeyEvent(this, keypressEvent); nsEventStatus status = nsEventStatus_eIgnore; currentKeyEvent->mKeyPressDispatched = @@ -3553,11 +3399,6 @@ IMEInputHandler::DispatchCompositionStartEvent() NS_ASSERTION(!mIsIMEComposing, "There is a composition already"); mIsIMEComposing = true; - KeyEventState* currentKeyEvent = GetCurrentKeyEvent(); - mIsDeadKeyComposing = - currentKeyEvent && currentKeyEvent->mKeyEvent && - TISInputSourceWrapper::CurrentInputSource(). - IsDeadKey(currentKeyEvent->mKeyEvent); nsEventStatus status; rv = mDispatcher->StartComposition(status); @@ -3708,7 +3549,7 @@ IMEInputHandler::DispatchCompositionCommitEvent(const nsAString* aCommitString) } } - mIsIMEComposing = mIsDeadKeyComposing = false; + mIsIMEComposing = false; mIMECompositionStart = UINT32_MAX; if (mIMECompositionString) { [mIMECompositionString release]; @@ -3727,89 +3568,6 @@ IMEInputHandler::DispatchCompositionCommitEvent(const nsAString* aCommitString) NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false); } -bool -IMEInputHandler::MaybeDispatchCurrentKeydownEvent(bool aIsProcessedByIME) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - - if (Destroyed()) { - return false; - } - MOZ_ASSERT(mWidget); - - KeyEventState* currentKeyEvent = GetCurrentKeyEvent(); - if (!currentKeyEvent || - !currentKeyEvent->CanDispatchKeyDownEvent()) { - return true; - } - - NSEvent* nativeEvent = currentKeyEvent->mKeyEvent; - if (NS_WARN_IF(!nativeEvent) || - [nativeEvent type] != NSKeyDown) { - return true; - } - - MOZ_LOG(gLog, LogLevel::Info, - ("%p IMEInputHandler::MaybeDispatchKeydownEvent, aIsProcessedByIME=%s " - "currentKeyEvent={ mKeyEvent(%p)={ type=%s, keyCode=%s (0x%X) } }, " - "aIsProcesedBy=%s, IsDeadKeyComposing()=%s", - this, TrueOrFalse(aIsProcessedByIME), nativeEvent, - GetNativeKeyEventType(nativeEvent), - GetKeyNameForNativeKeyCode([nativeEvent keyCode]), [nativeEvent keyCode], - TrueOrFalse(IsIMEComposing()), TrueOrFalse(IsDeadKeyComposing()))); - - RefPtr kungFuDeathGrip(this); - RefPtr dispatcher(mDispatcher); - nsresult rv = dispatcher->BeginNativeInputTransaction(); - if (NS_WARN_IF(NS_FAILED(rv))) { - MOZ_LOG(gLog, LogLevel::Error, - ("%p IMEInputHandler::DispatchKeyEventForFlagsChanged, " - "FAILED, due to BeginNativeInputTransaction() failure", this)); - return false; - } - - NSResponder* firstResponder = [[mView window] firstResponder]; - - // Mark currentKeyEvent as "dispatched eKeyDown event" and actually do it. - currentKeyEvent->mKeyDownDispatched = true; - - RefPtr widget(mWidget); - - WidgetKeyboardEvent keydownEvent(true, eKeyDown, widget); - // Don't mark the eKeyDown event as "processed by IME" if the composition - // is started with dead key. - currentKeyEvent->InitKeyEvent(this, keydownEvent, - aIsProcessedByIME && !IsDeadKeyComposing()); - - nsEventStatus status = nsEventStatus_eIgnore; - dispatcher->DispatchKeyboardEvent(eKeyDown, keydownEvent, status, - currentKeyEvent); - currentKeyEvent->mKeyDownHandled = - (status == nsEventStatus_eConsumeNoDefault); - - if (Destroyed()) { - MOZ_LOG(gLog, LogLevel::Info, - ("%p IMEInputHandler::MaybeDispatchKeydownEvent, " - "widget was destroyed by keydown event", this)); - return false; - } - - // The key down event may have shifted the focus, in which case, we should - // not continue to handle current key sequence and let's commit current - // composition. - if (firstResponder != [[mView window] firstResponder]) { - MOZ_LOG(gLog, LogLevel::Info, - ("%p IMEInputHandler::MaybeDispatchKeydownEvent, " - "view lost focus by keydown event", this)); - CommitIMEComposition(); - return false; - } - - return true; - - NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false); -} - void IMEInputHandler::InsertTextAsCommittingComposition( NSAttributedString* aAttrString, @@ -3838,22 +3596,6 @@ IMEInputHandler::InsertTextAsCommittingComposition( return; } - // When current keydown event causes this text input, let's dispatch - // eKeyDown event before any other events. Note that if we're in a - // composition, we've already dispatched eKeyDown event from - // TextInputHandler::HandleKeyDownEvent(). - // XXX Should we mark the eKeyDown event as "processed by IME"? - // However, if the key causes two or more Unicode characters as - // UTF-16 string, this is used. So, perhaps, we need to improve - // HandleKeyDownEvent() before do that. - RefPtr kungFuDeathGrip(this); - if (!IsIMEComposing() && !MaybeDispatchCurrentKeydownEvent(false)) { - MOZ_LOG(gLog, LogLevel::Info, - ("%p IMEInputHandler::InsertTextAsCommittingComposition, eKeyDown " - "caused focus move or something and canceling the composition", this)); - return; - } - // First, commit current composition with the latest composition string if the // replacement range is different from marked range. if (IsIMEComposing() && aReplacementRange && @@ -3868,6 +3610,8 @@ IMEInputHandler::InsertTextAsCommittingComposition( } } + RefPtr kungFuDeathGrip(this); + nsString str; nsCocoaUtils::GetStringForNSString([aAttrString string], str); @@ -3914,8 +3658,7 @@ IMEInputHandler::SetMarkedText(NSAttributedString* aAttrString, "aReplacementRange=%p { location=%lu, length=%lu }, " "Destroyed()=%s, IsIMEComposing()=%s, " "mMarkedRange={ location=%lu, length=%lu }, keyevent=%p, " - "keydownDispatched=%s, keydownHandled=%s, " - "keypressDispatched=%s, causedOtherKeyEvents=%s, " + "keydownHandled=%s, keypressDispatched=%s, causedOtherKeyEvents=%s, " "compositionDispatched=%s", this, GetCharacters([aAttrString string]), static_cast(aSelectedRange.location), @@ -3926,8 +3669,6 @@ IMEInputHandler::SetMarkedText(NSAttributedString* aAttrString, static_cast(mMarkedRange.location), static_cast(mMarkedRange.length), currentKeyEvent ? currentKeyEvent->mKeyEvent : nullptr, - currentKeyEvent ? - TrueOrFalse(currentKeyEvent->mKeyDownDispatched) : "N/A", currentKeyEvent ? TrueOrFalse(currentKeyEvent->mKeyDownHandled) : "N/A", currentKeyEvent ? @@ -3937,32 +3678,19 @@ IMEInputHandler::SetMarkedText(NSAttributedString* aAttrString, currentKeyEvent ? TrueOrFalse(currentKeyEvent->mCompositionDispatched) : "N/A")); - RefPtr kungFuDeathGrip(this); - // If SetMarkedText() is called during handling a key press, that means that // the key event caused this composition. So, keypress event shouldn't // be dispatched later, let's mark the key event causing composition event. if (currentKeyEvent) { currentKeyEvent->mCompositionDispatched = true; - - // When current keydown event causes this text input, let's dispatch - // eKeyDown event before any other events. Note that if we're in a - // composition, we've already dispatched eKeyDown event from - // TextInputHandler::HandleKeyDownEvent(). On the other hand, if we're - // not in composition, the key event starts new composition. So, we - // need to mark the eKeyDown event as "processed by IME". - if (!IsIMEComposing() && !MaybeDispatchCurrentKeydownEvent(true)) { - MOZ_LOG(gLog, LogLevel::Info, - ("%p IMEInputHandler::SetMarkedText, eKeyDown caused focus move or " - "something and canceling the composition", this)); - return; - } } if (Destroyed()) { return; } + RefPtr kungFuDeathGrip(this); + // First, commit current composition with the latest composition string if the // replacement range is different from marked range. if (IsIMEComposing() && aReplacementRange && @@ -4419,7 +4147,6 @@ IMEInputHandler::IMEInputHandler(nsChildView* aWidget, , mIMECompositionString(nullptr) , mIMECompositionStart(UINT32_MAX) , mIsIMEComposing(false) - , mIsDeadKeyComposing(false) , mIsIMEEnabled(true) , mIsASCIICapableOnly(false) , mIgnoreIMECommit(false) @@ -4578,15 +4305,13 @@ IMEInputHandler::CommitIMEComposition() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; + if (!IsIMEComposing()) + return; + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::CommitIMEComposition, mIMECompositionString=%s", this, GetCharacters(mIMECompositionString))); - // If this is called before dispatching eCompositionStart, IsIMEComposing() - // returns false. Even in such case, we need to commit composition *in* - // IME if this is called by preceding eKeyDown event of eCompositionStart. - // So, we need to call KillIMEComposition() even when IsIMEComposing() - // returns false. KillIMEComposition(); if (!IsIMEComposing()) @@ -4860,7 +4585,6 @@ TextInputHandlerBase::DispatchEvent(WidgetGUIEvent& aEvent) void TextInputHandlerBase::InitKeyEvent(NSEvent *aNativeKeyEvent, WidgetKeyboardEvent& aKeyEvent, - bool aIsProcessedByIME, const nsAString* aInsertString) { NS_ASSERTION(aNativeKeyEvent, "aNativeKeyEvent must not be NULL"); @@ -4868,12 +4592,11 @@ TextInputHandlerBase::InitKeyEvent(NSEvent *aNativeKeyEvent, if (mKeyboardOverride.mOverrideEnabled) { TISInputSourceWrapper tis; tis.InitByLayoutID(mKeyboardOverride.mKeyboardLayout, true); - tis.InitKeyEvent(aNativeKeyEvent, aKeyEvent, aIsProcessedByIME, - aInsertString); + tis.InitKeyEvent(aNativeKeyEvent, aKeyEvent, aInsertString); return; } TISInputSourceWrapper::CurrentInputSource(). - InitKeyEvent(aNativeKeyEvent, aKeyEvent, aIsProcessedByIME, aInsertString); + InitKeyEvent(aNativeKeyEvent, aKeyEvent, aInsertString); } nsresult @@ -5166,8 +4889,7 @@ TextInputHandlerBase::EnsureSecureEventInputDisabled() void TextInputHandlerBase::KeyEventState::InitKeyEvent( TextInputHandlerBase* aHandler, - WidgetKeyboardEvent& aKeyEvent, - bool aIsProcessedByIME) + WidgetKeyboardEvent& aKeyEvent) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; @@ -5197,8 +4919,7 @@ TextInputHandlerBase::KeyEventState::InitKeyEvent( } aKeyEvent.mUniqueId = mUniqueId; - aHandler->InitKeyEvent(nativeEvent, aKeyEvent, aIsProcessedByIME, - mInsertString); + aHandler->InitKeyEvent(nativeEvent, aKeyEvent, mInsertString); NS_OBJC_END_TRY_ABORT_BLOCK; } diff --git a/widget/gtk/IMContextWrapper.cpp b/widget/gtk/IMContextWrapper.cpp index ba64e3c25a9e..33552fbe2c21 100644 --- a/widget/gtk/IMContextWrapper.cpp +++ b/widget/gtk/IMContextWrapper.cpp @@ -175,8 +175,6 @@ IMContextWrapper::IMContextWrapper(nsWindow* aOwnerWindow) , mProcessingKeyEvent(nullptr) , mCompositionState(eCompositionState_NotComposing) , mIsIMFocused(false) - , mFallbackToKeyEvent(false) - , mKeyboardEventWasDispatched(false) , mIsDeletingSurrounding(false) , mLayoutChanged(false) , mSetCursorPositionOnKeyEvent(true) @@ -486,7 +484,7 @@ IMContextWrapper::OnBlurWindow(nsWindow* aWindow) bool IMContextWrapper::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent, - bool aKeyboardEventWasDispatched /* = false */) + bool aKeyDownEventWasSent /* = false */) { NS_PRECONDITION(aEvent, "aEvent must be non-null"); @@ -496,10 +494,10 @@ IMContextWrapper::OnKeyEvent(nsWindow* aCaller, } MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("0x%p OnKeyEvent(aCaller=0x%p, aKeyboardEventWasDispatched=%s), " + ("0x%p OnKeyEvent(aCaller=0x%p, aKeyDownEventWasSent=%s), " "mCompositionState=%s, current context=0x%p, active context=0x%p, " "aEvent(0x%p): { type=%s, keyval=%s, unicode=0x%X }", - this, aCaller, ToChar(aKeyboardEventWasDispatched), + this, aCaller, ToChar(aKeyDownEventWasSent), GetCompositionStateName(), GetCurrentContext(), GetActiveContext(), aEvent, GetEventType(aEvent), gdk_keyval_name(aEvent->keyval), gdk_keyval_to_unicode(aEvent->keyval))); @@ -527,51 +525,49 @@ IMContextWrapper::OnKeyEvent(nsWindow* aCaller, mSetCursorPositionOnKeyEvent = false; } - mKeyboardEventWasDispatched = aKeyboardEventWasDispatched; - mFallbackToKeyEvent = false; + mKeyDownEventWasSent = aKeyDownEventWasSent; + mFilterKeyEvent = true; mProcessingKeyEvent = aEvent; gboolean isFiltered = gtk_im_context_filter_keypress(currentContext, aEvent); - - // The caller of this shouldn't handle aEvent anymore if we've dispatched - // composition events or modified content with other events. - bool filterThisEvent = isFiltered && !mFallbackToKeyEvent; - - if (IsComposingOnCurrentContext() && !isFiltered && - aEvent->type == GDK_KEY_PRESS && - mDispatchedCompositionString.IsEmpty()) { - // A Hangul input engine for SCIM doesn't emit preedit_end - // signal even when composition string becomes empty. On the - // other hand, we should allow to make composition with empty - // string for other languages because there *might* be such - // IM. For compromising this issue, we should dispatch - // compositionend event, however, we don't need to reset IM - // actually. - // NOTE: Don't dispatch key events as "processed by IME" since - // we need to dispatch keyboard events as IME wasn't handled it. - mProcessingKeyEvent = nullptr; - DispatchCompositionCommitEvent(currentContext, &EmptyString()); - mProcessingKeyEvent = aEvent; - // In this case, even though we handle the keyboard event here, - // but we should dispatch keydown event as - filterThisEvent = false; - } - - // If IME handled the key event but we've not dispatched eKeyDown nor - // eKeyUp event yet, we need to dispatch here because the caller won't - // do it. - if (filterThisEvent) { - MaybeDispatchKeyEventAsProcessedByIME(); - // Be aware, the widget might have been gone here. - } - mProcessingKeyEvent = nullptr; + // We filter the key event if the event was not committed (because + // it's probably part of a composition) or if the key event was + // committed _and_ changed. This way we still let key press + // events go through as simple key press events instead of + // composed characters. + bool filterThisEvent = isFiltered && mFilterKeyEvent; + + if (IsComposingOnCurrentContext() && !isFiltered) { + if (aEvent->type == GDK_KEY_PRESS) { + if (!mDispatchedCompositionString.IsEmpty()) { + // If there is composition string, we shouldn't dispatch + // any keydown events during composition. + filterThisEvent = true; + } else { + // A Hangul input engine for SCIM doesn't emit preedit_end + // signal even when composition string becomes empty. On the + // other hand, we should allow to make composition with empty + // string for other languages because there *might* be such + // IM. For compromising this issue, we should dispatch + // compositionend event, however, we don't need to reset IM + // actually. + DispatchCompositionCommitEvent(currentContext, &EmptyString()); + filterThisEvent = false; + } + } else { + // Key release event may not be consumed by IM, however, we + // shouldn't dispatch any keyup event during composition. + filterThisEvent = true; + } + } + MOZ_LOG(gGtkIMLog, LogLevel::Debug, ("0x%p OnKeyEvent(), succeeded, filterThisEvent=%s " - "(isFiltered=%s, mFallbackToKeyEvent=%s), mCompositionState=%s", + "(isFiltered=%s, mFilterKeyEvent=%s), mCompositionState=%s", this, ToChar(filterThisEvent), ToChar(isFiltered), - ToChar(mFallbackToKeyEvent), GetCompositionStateName())); + ToChar(mFilterKeyEvent), GetCompositionStateName())); return filterThisEvent; } @@ -1306,14 +1302,11 @@ IMContextWrapper::OnCommitCompositionNative(GtkIMContext* aContext, } // If IME doesn't change their keyevent that generated this commit, - // we should treat that IME didn't handle the key event because - // web applications want to receive "keydown" and "keypress" event - // in such case. + // don't send it through XIM - just send it as a normal key press + // event. // NOTE: While a key event is being handled, this might be caused on // current context. Otherwise, this may be caused on active context. - if (!IsComposingOn(aContext) && - mProcessingKeyEvent && - mProcessingKeyEvent->type == GDK_KEY_PRESS && + if (!IsComposingOn(aContext) && mProcessingKeyEvent && aContext == GetCurrentContext()) { char keyval_utf8[8]; /* should have at least 6 bytes of space */ gint keyval_utf8_len; @@ -1328,9 +1321,7 @@ IMContextWrapper::OnCommitCompositionNative(GtkIMContext* aContext, ("0x%p OnCommitCompositionNative(), " "we'll send normal key event", this)); - // In this case, eKeyDown and eKeyPress event should be dispatched - // by the caller of OnKeyEvent(). - mFallbackToKeyEvent = true; + mFilterKeyEvent = false; return; } } @@ -1364,65 +1355,6 @@ IMContextWrapper::GetCompositionString(GtkIMContext* aContext, g_free(preedit_string); } -bool -IMContextWrapper::MaybeDispatchKeyEventAsProcessedByIME() -{ - if (!mProcessingKeyEvent || mKeyboardEventWasDispatched || - !mLastFocusedWindow) { - return true; - } - - // A "keydown" or "keyup" event handler may change focus with the - // following event. In such case, we need to cancel this composition. - // So, we need to store IM context now because mComposingContext may be - // overwritten with different context if calling this method recursively. - // Note that we don't need to grab the context here because |context| - // will be used only for checking if it's same as mComposingContext. - GtkIMContext* oldCurrentContext = GetCurrentContext(); - GtkIMContext* oldComposingContext = mComposingContext; - - RefPtr lastFocusedWindow(mLastFocusedWindow); - mKeyboardEventWasDispatched = true; - - // FYI: We should ignore if default of preceding keydown or keyup event is - // prevented since even on the other browsers, web applications - // cannot cancel the following composition event. - // Spec bug: https://github.com/w3c/uievents/issues/180 - bool isCancelled; - lastFocusedWindow->DispatchKeyDownOrKeyUpEvent(mProcessingKeyEvent, true, - &isCancelled); - MOZ_LOG(gGtkIMLog, LogLevel::Debug, - ("0x%p MaybeDispatchKeyEventAsProcessedByIME(), keydown or keyup " - "event is dispatched", - this)); - if (lastFocusedWindow->IsDestroyed() || - lastFocusedWindow != mLastFocusedWindow) { - MOZ_LOG(gGtkIMLog, LogLevel::Warning, - ("0x%p MaybeDispatchKeyEventAsProcessedByIME(), Warning, the " - "focused widget was destroyed/changed by a key event", - this)); - return false; - } - - // If the dispatched keydown event caused moving focus and that also - // caused changing active context, we need to cancel composition here. - if (GetCurrentContext() != oldCurrentContext) { - MOZ_LOG(gGtkIMLog, LogLevel::Warning, - ("0x%p MaybeDispatchKeyEventAsProcessedByIME(), Warning, the key " - "event causes changing active IM context", - this)); - if (mComposingContext == oldComposingContext) { - // Only when the context is still composing, we should call - // ResetIME() here. Otherwise, it should've already been - // cleaned up. - ResetIME(); - } - return false; - } - - return true; -} - bool IMContextWrapper::DispatchCompositionStart(GtkIMContext* aContext) { @@ -1467,16 +1399,50 @@ IMContextWrapper::DispatchCompositionStart(GtkIMContext* aContext) mCompositionStart = mSelection.mOffset; mDispatchedCompositionString.Truncate(); - // If this composition is started by a key press, we need to dispatch - // eKeyDown or eKeyUp event before dispatching eCompositionStart event. - // Note that dispatching a keyboard event which is marked as "processed - // by IME" is okay since Chromium also dispatches keyboard event as so. - if (!MaybeDispatchKeyEventAsProcessedByIME()) { - MOZ_LOG(gGtkIMLog, LogLevel::Warning, - ("0x%p DispatchCompositionStart(), Warning, " - "MaybeDispatchKeyEventAsProcessedByIME() returned false", + if (mProcessingKeyEvent && !mKeyDownEventWasSent && + mProcessingKeyEvent->type == GDK_KEY_PRESS) { + // A keydown event handler may change focus with the following keydown + // event. In such case, we need to cancel this composition. So, we + // need to store IM context now because mComposingContext may be + // overwritten with different context if calling this method + // recursively. + // Note that we don't need to grab the context here because |context| + // will be used only for checking if it's same as mComposingContext. + GtkIMContext* context = mComposingContext; + + // If this composition is started by a native keydown event, we need to + // dispatch our keydown event here (before composition start). + bool isCancelled; + mLastFocusedWindow->DispatchKeyDownEvent(mProcessingKeyEvent, + &isCancelled); + MOZ_LOG(gGtkIMLog, LogLevel::Debug, + ("0x%p DispatchCompositionStart(), preceding keydown event is " + "dispatched", this)); - return false; + if (lastFocusedWindow->IsDestroyed() || + lastFocusedWindow != mLastFocusedWindow) { + MOZ_LOG(gGtkIMLog, LogLevel::Warning, + ("0x%p DispatchCompositionStart(), Warning, the focused " + "widget was destroyed/changed by keydown event", + this)); + return false; + } + + // If the dispatched keydown event caused moving focus and that also + // caused changing active context, we need to cancel composition here. + if (GetCurrentContext() != context) { + MOZ_LOG(gGtkIMLog, LogLevel::Warning, + ("0x%p DispatchCompositionStart(), Warning, the preceding " + "keydown event causes changing active IM context", + this)); + if (mComposingContext == context) { + // Only when the context is still composing, we should call + // ResetIME() here. Otherwise, it should've already been + // cleaned up. + ResetIME(); + } + return false; + } } RefPtr dispatcher = GetTextEventDispatcher(); @@ -1534,15 +1500,6 @@ IMContextWrapper::DispatchCompositionChangeEvent( return false; } } - // If this composition string change caused by a key press, we need to - // dispatch eKeyDown or eKeyUp before dispatching eCompositionChange event. - else if (!MaybeDispatchKeyEventAsProcessedByIME()) { - MOZ_LOG(gGtkIMLog, LogLevel::Warning, - ("0x%p DispatchCompositionChangeEvent(), Warning, " - "MaybeDispatchKeyEventAsProcessedByIME() returned false", - this)); - return false; - } RefPtr dispatcher = GetTextEventDispatcher(); nsresult rv = dispatcher->BeginNativeInputTransaction(); @@ -1632,14 +1589,6 @@ IMContextWrapper::DispatchCompositionCommitEvent( return false; } - // TODO: We need special care to handle request to commit composition - // by content while we're committing composition because we have - // commit string information now but IME may not have composition - // anymore. Therefore, we may not be able to handle commit as - // expected. However, this is rare case because this situation - // never occurs with remote content. So, it's okay to fix this - // issue later. (Perhaps, TextEventDisptcher should do it for - // all platforms. E.g., creating WillCommitComposition()?) if (!IsComposing()) { if (!aCommitString || aCommitString->IsEmpty()) { MOZ_LOG(gGtkIMLog, LogLevel::Error, @@ -1656,16 +1605,6 @@ IMContextWrapper::DispatchCompositionCommitEvent( return false; } } - // If this commit caused by a key press, we need to dispatch eKeyDown or - // eKeyUp before dispatching composition events. - else if (!MaybeDispatchKeyEventAsProcessedByIME()) { - MOZ_LOG(gGtkIMLog, LogLevel::Warning, - ("0x%p DispatchCompositionCommitEvent(), Warning, " - "MaybeDispatchKeyEventAsProcessedByIME() returned false", - this)); - mCompositionState = eCompositionState_NotComposing; - return false; - } RefPtr dispatcher = GetTextEventDispatcher(); nsresult rv = dispatcher->BeginNativeInputTransaction(); @@ -2360,16 +2299,6 @@ IMContextWrapper::DeleteText(GtkIMContext* aContext, return NS_ERROR_FAILURE; } - // If this deleting text caused by a key press, we need to dispatch - // eKeyDown or eKeyUp before dispatching eContentCommandDelete event. - if (!MaybeDispatchKeyEventAsProcessedByIME()) { - MOZ_LOG(gGtkIMLog, LogLevel::Warning, - ("0x%p DeleteText(), Warning, " - "MaybeDispatchKeyEventAsProcessedByIME() returned false", - this)); - return NS_ERROR_FAILURE; - } - // Delete the selection WidgetContentCommandEvent contentCommandEvent(true, eContentCommandDelete, mLastFocusedWindow); diff --git a/widget/gtk/IMContextWrapper.h b/widget/gtk/IMContextWrapper.h index 241319cee9ea..17c758092410 100644 --- a/widget/gtk/IMContextWrapper.h +++ b/widget/gtk/IMContextWrapper.h @@ -65,26 +65,13 @@ public: void OnSelectionChange(nsWindow* aCaller, const IMENotification& aIMENotification); - /** - * OnKeyEvent() is called when aWindow gets a native key press event or a - * native key release event. If this returns true, the key event was - * filtered by IME. Otherwise, this returns false. - * NOTE: When the native key press event starts composition, this returns - * true but dispatches an eKeyDown event or eKeyUp event before - * dispatching composition events or content command event. - * - * @param aWindow A window on which user operate the - * key. - * @param aEvent A native key press or release - * event. - * @param aKeyboardEventWasDispatched true if eKeyDown or eKeyUp event - * for aEvent has already been - * dispatched. In this case, - * this class doesn't dispatch - * keyboard event anymore. - */ + // OnKeyEvent is called when aWindow gets a native key press event or a + // native key release event. If this returns TRUE, the key event was + // filtered by IME. Otherwise, this returns FALSE. + // NOTE: When the keypress event starts composition, this returns TRUE but + // this dispatches keydown event before compositionstart event. bool OnKeyEvent(nsWindow* aWindow, GdkEventKey* aEvent, - bool aKeyboardEventWasDispatched = false); + bool aKeyDownEventWasSent = false); // IME related nsIWidget methods. nsresult EndIMEComposition(nsWindow* aCaller); @@ -276,20 +263,16 @@ protected: // mIsIMFocused is set to TRUE when we call gtk_im_context_focus_in(). And // it's set to FALSE when we call gtk_im_context_focus_out(). bool mIsIMFocused; - // mFallbackToKeyEvent is set to false when this class starts to handle - // a native key event (at that time, mProcessingKeyEvent is set to the - // native event). If active IME just commits composition with a character - // which is produced by the key with current keyboard layout, this is set - // to true. - bool mFallbackToKeyEvent; - // mKeyboardEventWasDispatched is used by OnKeyEvent() and - // MaybeDispatchKeyEventAsProcessedByIME(). - // MaybeDispatchKeyEventAsProcessedByIME() dispatches an eKeyDown or - // eKeyUp event event if the composition is caused by a native - // key press event. If this is true, a keyboard event has been dispatched - // for the native event. If so, MaybeDispatchKeyEventAsProcessedByIME() - // won't dispatch keyboard event anymore. - bool mKeyboardEventWasDispatched; + // mFilterKeyEvent is used by OnKeyEvent(). If the commit event should + // be processed as simple key event, this is set to TRUE by the commit + // handler. + bool mFilterKeyEvent; + // mKeyDownEventWasSent is used by OnKeyEvent() and + // DispatchCompositionStart(). DispatchCompositionStart() dispatches + // a keydown event if the composition start is caused by a native + // keypress event. If this is true, the keydown event has been dispatched. + // Then, DispatchCompositionStart() doesn't dispatch keydown event. + bool mKeyDownEventWasSent; // mIsDeletingSurrounding is true while OnDeleteSurroundingNative() is // trying to delete the surrounding text. bool mIsDeletingSurrounding; @@ -460,27 +443,11 @@ protected: * Following methods dispatch gecko events. Then, the focused widget * can be destroyed, and also it can be stolen focus. If they returns * FALSE, callers cannot continue the composition. - * - MaybeDispatchKeyEventAsProcessedByIME * - DispatchCompositionStart * - DispatchCompositionChangeEvent * - DispatchCompositionCommitEvent */ - /** - * Dispatch an eKeyDown or eKeyUp event whose mKeyCode value is - * NS_VK_PROCESSKEY and mKeyNameIndex is KEY_NAME_INDEX_Process if - * mProcessingKeyEvent is not nullptr and mKeyboardEventWasDispatched is - * still false. If this dispatches a keyboard event, this sets - * mKeyboardEventWasDispatched to true. - * - * @return If the caller can continue to handle - * composition, returns true. Otherwise, - * false. For example, if focus is moved - * by dispatched keyboard event, returns - * false. - */ - bool MaybeDispatchKeyEventAsProcessedByIME(); - /** * Dispatches a composition start event. * diff --git a/widget/gtk/nsGtkKeyUtils.cpp b/widget/gtk/nsGtkKeyUtils.cpp index 6a02b9a1bc67..a336c1ad6c92 100644 --- a/widget/gtk/nsGtkKeyUtils.cpp +++ b/widget/gtk/nsGtkKeyUtils.cpp @@ -931,19 +931,14 @@ KeymapWrapper::ComputeDOMCodeNameIndex(const GdkEventKey* aGdkKeyEvent) /* static */ void KeymapWrapper::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent, - GdkEventKey* aGdkKeyEvent, - bool aIsProcessedByIME) + GdkEventKey* aGdkKeyEvent) { - MOZ_ASSERT(!aIsProcessedByIME || aKeyEvent.mMessage != eKeyPress, - "If the key event is handled by IME, keypress event shouldn't be fired"); - KeymapWrapper* keymapWrapper = GetInstance(); aKeyEvent.mCodeNameIndex = ComputeDOMCodeNameIndex(aGdkKeyEvent); MOZ_ASSERT(aKeyEvent.mCodeNameIndex != CODE_NAME_INDEX_USE_STRING); aKeyEvent.mKeyNameIndex = - aIsProcessedByIME ? KEY_NAME_INDEX_Process : - keymapWrapper->ComputeDOMKeyNameIndex(aGdkKeyEvent); + keymapWrapper->ComputeDOMKeyNameIndex(aGdkKeyEvent); if (aKeyEvent.mKeyNameIndex == KEY_NAME_INDEX_Unidentified) { uint32_t charCode = GetCharCodeFor(aGdkKeyEvent); if (!charCode) { @@ -956,11 +951,10 @@ KeymapWrapper::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent, AppendUCS4ToUTF16(charCode, aKeyEvent.mKeyValue); } } + aKeyEvent.mKeyCode = ComputeDOMKeyCode(aGdkKeyEvent); - if (aIsProcessedByIME) { - aKeyEvent.mKeyCode = NS_VK_PROCESSKEY; - } else if (aKeyEvent.mKeyNameIndex != KEY_NAME_INDEX_USE_STRING || - aKeyEvent.mMessage != eKeyPress) { + if (aKeyEvent.mKeyNameIndex != KEY_NAME_INDEX_USE_STRING || + aKeyEvent.mMessage != eKeyPress) { aKeyEvent.mKeyCode = ComputeDOMKeyCode(aGdkKeyEvent); } else { aKeyEvent.mKeyCode = 0; diff --git a/widget/gtk/nsGtkKeyUtils.h b/widget/gtk/nsGtkKeyUtils.h index a1b9e53f0daa..3dc8a4f6a936 100644 --- a/widget/gtk/nsGtkKeyUtils.h +++ b/widget/gtk/nsGtkKeyUtils.h @@ -131,11 +131,9 @@ public: * @param aKeyEvent It's an WidgetKeyboardEvent which needs to be * initialized. * @param aGdkKeyEvent A native GDK key event. - * @param aIsProcessedByIME true if aGdkKeyEvent is handled by IME. */ static void InitKeyEvent(WidgetKeyboardEvent& aKeyEvent, - GdkEventKey* aGdkKeyEvent, - bool aIsProcessedByIME); + GdkEventKey* aGdkKeyEvent); /** * WillDispatchKeyboardEvent() is called via diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index ae342a557b6b..dcbff364916b 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -2937,15 +2937,13 @@ IsCtrlAltTab(GdkEventKey *aEvent) } bool -nsWindow::DispatchKeyDownOrKeyUpEvent(GdkEventKey* aEvent, - bool aIsProcessedByIME, - bool* aIsCancelled) +nsWindow::DispatchKeyDownEvent(GdkEventKey *aEvent, bool *aCancelled) { - MOZ_ASSERT(aIsCancelled, "aCancelled must not be null"); + NS_PRECONDITION(aCancelled, "aCancelled must not be null"); - *aIsCancelled = false; + *aCancelled = false; - if (aEvent->type == GDK_KEY_PRESS && IsCtrlAltTab(aEvent)) { + if (IsCtrlAltTab(aEvent)) { return false; } @@ -2955,14 +2953,13 @@ nsWindow::DispatchKeyDownOrKeyUpEvent(GdkEventKey* aEvent, return FALSE; } - EventMessage message = - aEvent->type == GDK_KEY_PRESS ? eKeyDown : eKeyUp; - WidgetKeyboardEvent keyEvent(true, message, this); - KeymapWrapper::InitKeyEvent(keyEvent, aEvent, aIsProcessedByIME); + WidgetKeyboardEvent keydownEvent(true, eKeyDown, this); + KeymapWrapper::InitKeyEvent(keydownEvent, aEvent); nsEventStatus status = nsEventStatus_eIgnore; bool dispatched = - dispatcher->DispatchKeyboardEvent(message, keyEvent, status, aEvent); - *aIsCancelled = (status == nsEventStatus_eConsumeNoDefault); + dispatcher->DispatchKeyboardEvent(eKeyDown, keydownEvent, + status, aEvent); + *aCancelled = (status == nsEventStatus_eConsumeNoDefault); return dispatched ? TRUE : FALSE; } @@ -3048,7 +3045,7 @@ nsWindow::OnKeyPressEvent(GdkEventKey *aEvent) // KEYDOWN -> KEYPRESS -> KEYUP -> KEYDOWN -> KEYPRESS -> KEYUP... bool isKeyDownCancelled = false; - if (DispatchKeyDownOrKeyUpEvent(aEvent, false, &isKeyDownCancelled) && + if (DispatchKeyDownEvent(aEvent, &isKeyDownCancelled) && (MOZ_UNLIKELY(mIsDestroyed) || isKeyDownCancelled)) { return TRUE; } @@ -3097,7 +3094,7 @@ nsWindow::OnKeyPressEvent(GdkEventKey *aEvent) } WidgetKeyboardEvent keypressEvent(true, eKeyPress, this); - KeymapWrapper::InitKeyEvent(keypressEvent, aEvent, false); + KeymapWrapper::InitKeyEvent(keypressEvent, aEvent); // before we dispatch a key, check if it's the context menu key. // If so, send a context menu key event instead. @@ -3181,7 +3178,7 @@ nsWindow::MaybeDispatchContextMenuEvent(const GdkEventKey* aEvent) } gboolean -nsWindow::OnKeyReleaseEvent(GdkEventKey* aEvent) +nsWindow::OnKeyReleaseEvent(GdkEventKey *aEvent) { LOGFOCUS(("OnKeyReleaseEvent [%p]\n", (void *)this)); @@ -3189,11 +3186,17 @@ nsWindow::OnKeyReleaseEvent(GdkEventKey* aEvent) return TRUE; } - bool isCancelled = false; - if (NS_WARN_IF(!DispatchKeyDownOrKeyUpEvent(aEvent, false, &isCancelled))) { - return FALSE; + RefPtr dispatcher = GetTextEventDispatcher(); + nsresult rv = dispatcher->BeginNativeInputTransaction(); + if (NS_WARN_IF(NS_FAILED(rv))) { + return false; } + WidgetKeyboardEvent keyupEvent(true, eKeyUp, this); + KeymapWrapper::InitKeyEvent(keyupEvent, aEvent); + nsEventStatus status = nsEventStatus_eIgnore; + dispatcher->DispatchKeyboardEvent(eKeyUp, keyupEvent, status, aEvent); + return TRUE; } diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h index e7ed6f47c044..0d57c156f49f 100644 --- a/widget/gtk/nsWindow.h +++ b/widget/gtk/nsWindow.h @@ -278,20 +278,10 @@ public: guint aTime); static void UpdateDragStatus (GdkDragContext *aDragContext, nsIDragService *aDragService); - /** - * DispatchKeyDownOrKeyUpEvent() dispatches eKeyDown or eKeyUp event. - * - * @param aEvent A native GDK_KEY_PRESS or GDK_KEY_RELEASE - * event. - * @param aProcessedByIME true if the event is handled by IME. - * @param aIsCancelled [Out] true if the default is prevented. - * @return true if eKeyDown event is actually dispatched. - * Otherwise, false. - */ - bool DispatchKeyDownOrKeyUpEvent(GdkEventKey* aEvent, - bool aProcessedByIME, - bool* aIsCancelled); - + // If this dispatched the keydown event actually, this returns TRUE, + // otherwise, FALSE. + bool DispatchKeyDownEvent(GdkEventKey *aEvent, + bool *aIsCancelled); WidgetEventTime GetWidgetEventTime(guint32 aEventTime); mozilla::TimeStamp GetEventTimeStamp(guint32 aEventTime); mozilla::CurrentX11TimeGetter* GetCurrentTimeGetter(); diff --git a/widget/tests/test_keycodes.xul b/widget/tests/test_keycodes.xul index 694c8ef476ed..7ac53d57e17c 100644 --- a/widget/tests/test_keycodes.xul +++ b/widget/tests/test_keycodes.xul @@ -3023,10 +3023,10 @@ function* runKeyEventTests() const WIN_VK_PROCESSKEY_WITH_SC_A = WIN_VK_PROCESSKEY | 0x001E0000; yield testKey({layout:KEYBOARD_LAYOUT_EN_US, keyCode:WIN_VK_PROCESSKEY_WITH_SC_A, modifiers:{}, chars:"a"}, - ["a", "a", "Process"], "KeyA", KeyboardEvent.DOM_VK_PROCESSKEY, "a", SHOULD_DELIVER_ALL, KeyboardEvent.DOM_KEY_LOCATION_STANDARD); + ["a", "a", "Unidentified" /* TODO: Process */], "KeyA", 0 /* TODO: 0xE5 */, "a", SHOULD_DELIVER_ALL, KeyboardEvent.DOM_KEY_LOCATION_STANDARD); yield testKey({layout:KEYBOARD_LAYOUT_EN_US, keyCode:WIN_VK_PROCESSKEY_WITH_SC_A, modifiers:{altKey:1}, chars:"a"}, - ["a", "a", "Process"], "KeyA", KeyboardEvent.DOM_VK_PROCESSKEY, "a", SHOULD_DELIVER_ALL, KeyboardEvent.DOM_KEY_LOCATION_STANDARD); + ["a", "a", "Unidentified" /* TODO: Process */], "KeyA", 0 /* TODO: 0xE5 */, "a", SHOULD_DELIVER_ALL, KeyboardEvent.DOM_KEY_LOCATION_STANDARD); // US // Alphabet diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp index 2f7c43695f44..947e914e4bef 100644 --- a/widget/windows/KeyboardLayout.cpp +++ b/widget/windows/KeyboardLayout.cpp @@ -4805,7 +4805,7 @@ KeyboardLayout::ConvertNativeKeyCodeToDOMKeyCode(UINT aNativeKeyCode) const // VK_PROCESSKEY means IME already consumed the key event. case VK_PROCESSKEY: - return NS_VK_PROCESSKEY; + return 0; // VK_PACKET is generated by SendInput() API, we don't need to // care this message as key event. case VK_PACKET: From 399b4424de28bd11a6b2ccabc478a7d80d258b57 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 8 Mar 2018 10:51:42 +0100 Subject: [PATCH 42/50] Bug 1444048 - Codespell: ignore the ignored typos by moving to quiet-level=4 r=standard8 MozReview-Commit-ID: HpIOkKh6SQQ --HG-- extra : rebase_source : 9d53382d86bb877f4d030a1b9bda30fda2acceb8 --- tools/lint/spell/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/lint/spell/__init__.py b/tools/lint/spell/__init__.py index c870511b465a..7ed5739b3625 100644 --- a/tools/lint/spell/__init__.py +++ b/tools/lint/spell/__init__.py @@ -103,7 +103,9 @@ def lint(paths, config, fix=None, **lintargs): # Silence some warnings: # 1: disable warnings about wrong encoding # 2: disable warnings about binary file - '--quiet-level=3', + # 4: shut down warnings about automatic fixes + # that were disabled in dictionary. + '--quiet-level=4', ] # Disabled for now because of From e0a0eed1653a58d145acdcbfe642fcd3c2e939b8 Mon Sep 17 00:00:00 2001 From: ffxbld Date: Mon, 12 Mar 2018 13:18:08 +0000 Subject: [PATCH 43/50] No bug - Tagging mozilla-central fdd1a0082c71673239fc2f3a6a93de889c07a1be with FIREFOX_NIGHTLY_60_END a=release DONTBUILD CLOSED TREE --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 549ffebb494e..dbe7fa766956 100644 --- a/.hgtags +++ b/.hgtags @@ -140,3 +140,4 @@ f7e9777221a34f9f23c2e4933307eb38b621b679 FIREFOX_NIGHTLY_57_END 1f91961bb79ad06fd4caef9e5dfd546afd5bf42c FIREFOX_NIGHTLY_58_END 5faab9e619901b1513fd4ca137747231be550def FIREFOX_NIGHTLY_59_END e33efdb3e1517d521deb949de3fcd6d9946ea440 FIREFOX_BETA_60_BASE +fdd1a0082c71673239fc2f3a6a93de889c07a1be FIREFOX_NIGHTLY_60_END From 99df6dad057b94c2ac4d8b12f7b0b3a7fdf25d04 Mon Sep 17 00:00:00 2001 From: ffxbld Date: Mon, 12 Mar 2018 13:20:48 +0000 Subject: [PATCH 44/50] Update configs. IGNORE BROKEN CHANGESETS CLOSED TREE NO BUG a=release ba=release --- CLOBBER | 2 +- browser/config/version.txt | 2 +- browser/config/version_display.txt | 2 +- config/milestone.txt | 2 +- services/sync/modules/constants.js | 2 +- xpcom/components/Module.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CLOBBER b/CLOBBER index 131c577db7c0..d4cdfaff33de 100644 --- a/CLOBBER +++ b/CLOBBER @@ -22,4 +22,4 @@ # changes to stick? As of bug 928195, this shouldn't be necessary! Please # don't change CLOBBER for WebIDL changes any more. -Bug 1443983: Removing addoncompat.manifest requires clobber. +Merge day clobber \ No newline at end of file diff --git a/browser/config/version.txt b/browser/config/version.txt index f391c39cf0e9..72814c166863 100644 --- a/browser/config/version.txt +++ b/browser/config/version.txt @@ -1 +1 @@ -60.0a1 +61.0a1 diff --git a/browser/config/version_display.txt b/browser/config/version_display.txt index f391c39cf0e9..72814c166863 100644 --- a/browser/config/version_display.txt +++ b/browser/config/version_display.txt @@ -1 +1 @@ -60.0a1 +61.0a1 diff --git a/config/milestone.txt b/config/milestone.txt index 91e46a9e3f2a..afde1c4c75dc 100644 --- a/config/milestone.txt +++ b/config/milestone.txt @@ -10,4 +10,4 @@ # hardcoded milestones in the tree from these two files. #-------------------------------------------------------- -60.0a1 +61.0a1 diff --git a/services/sync/modules/constants.js b/services/sync/modules/constants.js index 61a04f3785c7..3aed541fd368 100644 --- a/services/sync/modules/constants.js +++ b/services/sync/modules/constants.js @@ -8,7 +8,7 @@ for (let [key, val] of Object.entries({ // Don't manually modify this line, as it is automatically replaced on merge day // by the gecko_migration.py script. -WEAVE_VERSION: "1.62.0", +WEAVE_VERSION: "1.63.0", // Sync Server API version that the client supports. SYNC_API_VERSION: "1.5", diff --git a/xpcom/components/Module.h b/xpcom/components/Module.h index 24b7d510830f..374d1323f132 100644 --- a/xpcom/components/Module.h +++ b/xpcom/components/Module.h @@ -22,7 +22,7 @@ namespace mozilla { */ struct Module { - static const unsigned int kVersion = 60; + static const unsigned int kVersion = 61; struct CIDEntry; From 6c4226352cb8ae93904f602f852f587268d97588 Mon Sep 17 00:00:00 2001 From: Cosmin Sabou Date: Mon, 12 Mar 2018 18:25:35 +0200 Subject: [PATCH 45/50] Backed out changeset cc9ebc5403e2 (bug 1444048) for linting opt failures on /builds/worker/checkouts/gecko/tools/lint/spell/__init__.py --- tools/lint/spell/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/lint/spell/__init__.py b/tools/lint/spell/__init__.py index 7ed5739b3625..c870511b465a 100644 --- a/tools/lint/spell/__init__.py +++ b/tools/lint/spell/__init__.py @@ -103,9 +103,7 @@ def lint(paths, config, fix=None, **lintargs): # Silence some warnings: # 1: disable warnings about wrong encoding # 2: disable warnings about binary file - # 4: shut down warnings about automatic fixes - # that were disabled in dictionary. - '--quiet-level=4', + '--quiet-level=3', ] # Disabled for now because of From 34f58199be4d31c9c9f035cb7ec3273712b95826 Mon Sep 17 00:00:00 2001 From: ffxbld Date: Mon, 12 Mar 2018 12:54:26 -0700 Subject: [PATCH 46/50] No bug, Automated HSTS preload list update from host bld-linux64-spot-302 - a=hsts-update --- security/manager/ssl/nsSTSPreloadList.errors | 294 +++++++++---------- security/manager/ssl/nsSTSPreloadList.inc | 120 ++++---- 2 files changed, 187 insertions(+), 227 deletions(-) diff --git a/security/manager/ssl/nsSTSPreloadList.errors b/security/manager/ssl/nsSTSPreloadList.errors index 0dcd2892b771..2daa50386c4f 100644 --- a/security/manager/ssl/nsSTSPreloadList.errors +++ b/security/manager/ssl/nsSTSPreloadList.errors @@ -45,6 +45,7 @@ 4loc.us: could not connect to host 4web-hosting.com: could not connect to host 5000yz.com: could not connect to host +517vpn.cn: could not connect to host 52kb1.com: could not connect to host 52neptune.com: could not connect to host 5ece.de: could not connect to host @@ -85,7 +86,9 @@ acwcerts.co.uk: could not connect to host ad-disruptio.fr: could not connect to host adamcoffee.net: could not connect to host adamdixon.co.uk: could not connect to host +addcrazy.com: could not connect to host adec-emsa.ae: could not connect to host +adrianajewelry.my: could not connect to host adult.properties: could not connect to host advaithnikhi.ml: could not connect to host advaithnikhi.tk: could not connect to host @@ -102,8 +105,6 @@ agowa338.de: could not connect to host agrilinks.org: could not connect to host ahelos.tk: could not connect to host ahlz.sk: could not connect to host -aibaoyou.com: could not connect to host -aid-web.ch: could not connect to host aikenorganics.com: could not connect to host aim-consultants.com: could not connect to host airclass.com: could not connect to host @@ -155,7 +156,6 @@ andronika.net: could not connect to host anecuni-club.com: could not connect to host anecuni-rec.com: could not connect to host angrydragonproductions.com: could not connect to host -animojis.es: could not connect to host anitube-nocookie.ch: could not connect to host anivar.net: could not connect to host annetaan.fi: could not connect to host @@ -168,7 +168,6 @@ appdrinks.com: could not connect to host apple.ax: could not connect to host apps4all.sytes.net: could not connect to host apptoutou.com: could not connect to host -appzoojoo.be: could not connect to host aqqrate.com: could not connect to host area3.org: could not connect to host arent.kz: could not connect to host @@ -194,12 +193,14 @@ assindia.nl: could not connect to host asthon.cn: could not connect to host astrath.net: could not connect to host astrea-voetbal-groningen.nl: could not connect to host +asuhe.win: could not connect to host asuhe.xyz: could not connect to host async.be: could not connect to host at1.co: could not connect to host athi.pl: could not connect to host atigerseye.com: could not connect to host atlas-5.site: could not connect to host +attendantdesign.com: could not connect to host attilagyorffy.com: could not connect to host aufmerksamkeitsstudie.com: could not connect to host augix.net: could not connect to host @@ -215,11 +216,10 @@ autosearch.me: could not connect to host autostock.me: could not connect to host autostop-occasions.be: could not connect to host avdelivers.com: could not connect to host -avernis.de: could not connect to host -avi9526.pp.ua: could not connect to host avmo.pw: could not connect to host avonlearningcampus.com: could not connect to host avso.pw: could not connect to host +avxo.pw: could not connect to host awan.tech: could not connect to host awei.pub: could not connect to host awf0.xyz: could not connect to host @@ -231,6 +231,7 @@ babelfisch.eu: could not connect to host bacimg.com: could not connect to host badbee.cc: could not connect to host bailbondsaffordable.com: could not connect to host +baldur.cc: could not connect to host balonmano.co: could not connect to host bandally.net: could not connect to host bandarifamily.com: could not connect to host @@ -246,6 +247,7 @@ bbwteens.org: could not connect to host bcnet.com.hk: could not connect to host bcradio.org: could not connect to host bcrook.com: could not connect to host +bcvps.com: could not connect to host bdsmxxxpics.com: could not connect to host beamitapp.com: could not connect to host beasel.biz: could not connect to host @@ -278,6 +280,7 @@ bfrailwayclub.cf: could not connect to host bianinapiccanovias.com: could not connect to host bichonmaltes.com.br: could not connect to host bigerbio.com: could not connect to host +bildschirmflackern.de: could not connect to host billigpoker.dk: could not connect to host billpro.com.au: could not connect to host binam.center: could not connect to host @@ -286,7 +289,6 @@ binimo.com: could not connect to host biou.me: could not connect to host biovalue.eu: could not connect to host bip.gov.sa: could not connect to host -biscoint.io: could not connect to host biscuits-rec.com: could not connect to host biscuits-shop.com: could not connect to host biswas.me: could not connect to host @@ -323,7 +325,6 @@ bombsquad.studio: could not connect to host bonesserver.com: could not connect to host bonobo.cz: could not connect to host bookreport.ga: could not connect to host -booter.es: could not connect to host boozinyan.com: could not connect to host borchers-media.de: could not connect to host borisbesemer.com: could not connect to host @@ -349,8 +350,10 @@ bsalyzer.com: could not connect to host bsktweetup.info: could not connect to host bslim-e-boutique.com: could not connect to host bsuess.de: could not connect to host +btcp.space: could not connect to host buck.com: could not connect to host buenotour.ru: could not connect to host +buffalodrinkinggame.beer: could not connect to host bugsmashed.com: could not connect to host bugtrack.co.uk: could not connect to host buka.jp: could not connect to host @@ -365,6 +368,7 @@ buyharpoon.com: could not connect to host buyhealth.shop: could not connect to host buyingsellingflorida.com: could not connect to host buyshoe.org: could not connect to host +buywood.shop: could not connect to host bvexplained.co.uk: could not connect to host bxdev.me: could not connect to host by1898.com: could not connect to host @@ -377,7 +381,6 @@ cafesg.net: could not connect to host caipai.fm: could not connect to host cal.goip.de: could not connect to host calculatoaresecondhand.xyz: could not connect to host -calebmorris.com: could not connect to host callabs.net: could not connect to host calleveryday.com: could not connect to host callsigns.ca: could not connect to host @@ -405,11 +408,9 @@ cdmon.tech: could not connect to host cdnk39.com: could not connect to host cee.io: could not connect to host cegfw.com: could not connect to host -celuliteonline.com: could not connect to host cencalvia.org: could not connect to host centos.pub: could not connect to host centrallead.net: could not connect to host -centrationgame.com: could not connect to host centrolavoro.org: could not connect to host cgtx.us: could not connect to host challengeskins.com: could not connect to host @@ -419,7 +420,6 @@ channellife.asia: could not connect to host chaouby.com: could not connect to host charge.co: could not connect to host charmyadesara.com: could not connect to host -charta-digitale-vernetzung.de: could not connect to host cheah.xyz: could not connect to host cheesefusion.com: could not connect to host chez-janine.de: could not connect to host @@ -451,6 +451,7 @@ clickclock.cc: could not connect to host clintonbloodworth.com: could not connect to host cloudberlin.goip.de: could not connect to host cloudbleed.info: could not connect to host +cloudfiles.at: could not connect to host cloudimproved.com: could not connect to host cloudwarez.xyz: could not connect to host clownish.co.il: could not connect to host @@ -470,7 +471,6 @@ coccinellaskitchen.de: could not connect to host coccinellaskitchen.it: could not connect to host codeloop.pw: could not connect to host codenlife.xyz: could not connect to host -codeofhonor.tech: could not connect to host codercross.com: could not connect to host coderhangout.com: could not connect to host codewiz.xyz: could not connect to host @@ -481,6 +481,7 @@ collins.kg: could not connect to host coloppe.com: could not connect to host com-in.de: could not connect to host com.cc: could not connect to host +comalia.com: could not connect to host combatshield.cz: could not connect to host comicrelief.com: could not connect to host communityflow.info: could not connect to host @@ -504,8 +505,8 @@ cosplayer.com: could not connect to host cotta.dk: could not connect to host coumoul.fr: could not connect to host cpaneltips.com: could not connect to host -crackcat.de: could not connect to host crackslut.eu: could not connect to host +craftination.net: could not connect to host crashsec.com: could not connect to host credential.eu: could not connect to host cristianhares.com: could not connect to host @@ -524,7 +525,6 @@ cselzer.com: could not connect to host csgo77.com: could not connect to host csilies.de: could not connect to host cspeti.hu: could not connect to host -ctj.im: could not connect to host cunha.be: could not connect to host cuni-cuni-club.com: could not connect to host cuni-rec.com: could not connect to host @@ -559,6 +559,7 @@ dashboard.yt: could not connect to host data-detox.com: could not connect to host datastream.re: could not connect to host datorb.com: could not connect to host +davetempleton.com: could not connect to host davidgreig.uk: could not connect to host davidscherzer.at: could not connect to host davidstuff.net: could not connect to host @@ -580,6 +581,7 @@ decoyrouting.com: could not connect to host dedietrich-asia.com: could not connect to host deepcreampie.com: could not connect to host deeps.cat: could not connect to host +delfic.org: could not connect to host deloittequant.com: could not connect to host depedtayo.ph: could not connect to host derchris.me: could not connect to host @@ -592,13 +594,11 @@ detecte.ch: could not connect to host detectefuite.ch: could not connect to host devdesco.com: could not connect to host developersclub.website: could not connect to host -devonsawatzky.ca: could not connect to host devops.moe: could not connect to host dezintranet.com: could not connect to host dhl-smart.ch: could not connect to host dhub.xyz: could not connect to host dhxxls.com: could not connect to host -dibiphp.com: could not connect to host diceduels.com: could not connect to host dick.red: could not connect to host didierlaumen.be: could not connect to host @@ -635,7 +635,6 @@ diz.in.ua: could not connect to host djul.net: could not connect to host dlouwrink.nl: could not connect to host dlyl888.com: could not connect to host -dn3s.me: could not connect to host dna.li: could not connect to host dnfc.rocks: could not connect to host dnmaze.com: could not connect to host @@ -651,6 +650,7 @@ domainoo.com: could not connect to host domengrad.ru: could not connect to host domfee.com: could not connect to host dongkexue.com: could not connect to host +donovand.info: could not connect to host doopdidoop.com: could not connect to host dougferris.id.au: could not connect to host doyoulyft.com: could not connect to host @@ -759,6 +759,7 @@ exceptionalservices.us: could not connect to host exo.do: could not connect to host exteriorservices.io: could not connect to host eytosh.net: could not connect to host +eztvtorrent.com: could not connect to host f1bigpicture.com: could not connect to host f8842.com: could not connect to host faber.org.ru: could not connect to host @@ -824,6 +825,7 @@ flow.su: could not connect to host flucky.xyz: could not connect to host flugplatz-edvc.de: could not connect to host flyingdoggy.net: could not connect to host +flyingrub.me: could not connect to host focalforest.com: could not connect to host fojing.com: could not connect to host foodserve.in: could not connect to host @@ -869,12 +871,10 @@ fun99.cc: could not connect to host funksteckdosen24.de: could not connect to host funoverip.net: could not connect to host funspins.com: could not connect to host -furnishedproperty.com.au: could not connect to host futos.de: could not connect to host futuresonline.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 116" data: no] fuzoku-sodan.com: could not connect to host fyol.pw: could not connect to host -fysiotherapierossum.nl: could not connect to host g01.in.ua: could not connect to host g1jeu.com: could not connect to host gaasuper6.com: could not connect to host @@ -892,6 +892,7 @@ garage-door.pro: could not connect to host gasbarkenora.com: could not connect to host gasnews.net: could not connect to host gautham.pro: could not connect to host +gay-jays.com: could not connect to host gayforgenji.com: could not connect to host gaygeeks.de: could not connect to host gc.net: could not connect to host @@ -1024,6 +1025,7 @@ heavenlysmokenc.com: could not connect to host heisenberg.co: could not connect to host hejsupport.se: could not connect to host hellofilters.com: could not connect to host +hellomouse.cf: could not connect to host hellomouse.tk: could not connect to host helpantiaging.com: could not connect to host helpekwendenihospital.com: could not connect to host @@ -1068,6 +1070,7 @@ hozinga.de: could not connect to host hr98.tk: could not connect to host hserver.top: could not connect to host httptest.net: could not connect to host +huangguancq.com: could not connect to host huangzenghao.cn: could not connect to host huangzenghao.com: could not connect to host hudingyuan.cn: could not connect to host @@ -1079,7 +1082,6 @@ huongquynh.com: could not connect to host huwjones.me: could not connect to host huzurmetal.net: could not connect to host hydrante.ch: could not connect to host -hydronyx.me: could not connect to host hyper-matrix.org: could not connect to host hyperactive.am: could not connect to host hypotecnicentrum.cz: could not connect to host @@ -1092,6 +1094,7 @@ iamsoareyou.se: could not connect to host ibron.co: could not connect to host ibsafrica.co.za: could not connect to host ibsglobal.co.za: could not connect to host +icasnetwork.com: could not connect to host iceloch.com: could not connect to host ictpro.info: could not connect to host icusignature.com: could not connect to host @@ -1109,7 +1112,6 @@ igamingforums.com: could not connect to host ihatethissh.it: could not connect to host iideaz.org: could not connect to host iilin.com: could not connect to host -iiong.com: could not connect to host iirii.com: could not connect to host ikenmeyer.com: could not connect to host ikenmeyer.eu: could not connect to host @@ -1135,7 +1137,6 @@ inexpensivecomputers.net: could not connect to host informatik.zone: could not connect to host infoworm.org: could not connect to host infruction.com: could not connect to host -injust.eu.org: could not connect to host injust.me: could not connect to host innovativebuildingsolutions.co.za: could not connect to host innovativeideaz.org: could not connect to host @@ -1202,7 +1203,6 @@ jecho.cn: could not connect to host jeffersonregan.org: could not connect to host jens.hk: could not connect to host jerrypau.ca: could not connect to host -jeva.nl: could not connect to host jhburton.co.uk: could not connect to host jiangzm.com: could not connect to host jianyuan.pro: could not connect to host @@ -1216,7 +1216,6 @@ joetyson.io: could not connect to host johntomasowa.com: could not connect to host jonathansanchez.pro: could not connect to host jonfor.net: could not connect to host -jonpads.com: could not connect to host jooto.com: could not connect to host josc.com.au: could not connect to host joshharkema.com: could not connect to host @@ -1233,6 +1232,7 @@ just-pools.co.za: could not connect to host justinharrison.ca: could not connect to host justzz.xyz: could not connect to host juventusmania1897.com: could not connect to host +jzbk.org: could not connect to host k33k00.com: could not connect to host kabus.org: could not connect to host kaika-facilitymanagement.de: could not connect to host @@ -1251,12 +1251,12 @@ katyusha.net: could not connect to host kawaiiku.com: could not connect to host kawaiiku.de: could not connect to host kaydan.io: could not connect to host +kb3.net: could not connect to host kearney.io: could not connect to host kellyandantony.com: could not connect to host kelm.me: could not connect to host kermadec.com: could not connect to host keshausconsulting.com: could not connect to host -kevinbowers.me: could not connect to host kevindekoninck.com: could not connect to host kevinfoley.cc: could not connect to host kevinfoley.org: could not connect to host @@ -1293,6 +1293,7 @@ kopfsalat.eu: could not connect to host koppelvlak.net: could not connect to host kotitesti.fi: could not connect to host kotorimusic.ga: could not connect to host +kottur.is: could not connect to host kozmik.co: could not connect to host krag.be: could not connect to host krampus-fischamend.at: could not connect to host @@ -1301,6 +1302,7 @@ ksero.center: could not connect to host ktube.yt: could not connect to host kubusadvocaten.nl: could not connect to host kuko-crews.org: could not connect to host +kupiec.eu.org: could not connect to host kwikmed.eu: could not connect to host kwipi.com: could not connect to host kyberna.xyz: could not connect to host @@ -1330,6 +1332,7 @@ latemodern.com: could not connect to host lathamlabs.com: could not connect to host lathamlabs.net: could not connect to host lathamlabs.org: could not connect to host +lazerus.net: could not connect to host lazulu.com: could not connect to host lbarrios.es: could not connect to host lbrls.tk: could not connect to host @@ -1352,7 +1355,6 @@ leifdreizler.com: could not connect to host lenkunz.me: could not connect to host leolana.com: could not connect to host leonardcamacho.me: could not connect to host -leonhooijer.nl: could not connect to host lerlivros.online: could not connect to host lescomptoirsdepierrot.com: could not connect to host lesdouceursdeliyana.com: could not connect to host @@ -1365,12 +1367,6 @@ lheinrich.org: could not connect to host lhsj28.com: could not connect to host lhsj68.com: could not connect to host lhsj78.com: could not connect to host -lianye1.cc: could not connect to host -lianye2.cc: could not connect to host -lianye3.cc: could not connect to host -lianye4.cc: could not connect to host -lianye5.cc: could not connect to host -lianye6.cc: could not connect to host liaozheqi.cn: could not connect to host libertas-tech.com: could not connect to host librisulibri.it: could not connect to host @@ -1393,7 +1389,6 @@ lisieuxarquitetura.com.br: could not connect to host lissabon.guide: could not connect to host litcomphonors.com: could not connect to host littlelundgrenladies.com: could not connect to host -litvideoserver.de: could not connect to host liukang.tech: could not connect to host llvm.us: could not connect to host loanstreet.be: could not connect to host @@ -1403,7 +1398,6 @@ locker3.com: could not connect to host locksport.org.nz: could not connect to host logcat.info: could not connect to host logic8.ml: could not connect to host -logicchen.com: could not connect to host logimagine.com: could not connect to host lolicon.eu: could not connect to host lookyman.net: could not connect to host @@ -1439,7 +1433,6 @@ maartenterpstra.xyz: could not connect to host madeintucson.org: could not connect to host madnetwork.org: could not connect to host madusecurity.com: could not connect to host -magicball.co: could not connect to host magnacumlaude.co: could not connect to host mahansexcavating.com: could not connect to host maik-mahlow.de: could not connect to host @@ -1474,7 +1467,6 @@ mathijskingma.nl: could not connect to host matrix.ac: could not connect to host matthewtester.com: could not connect to host matthey.nl: could not connect to host -max-moeglich.de: could not connect to host maybeul.com: could not connect to host maynardnetworks.com: could not connect to host mazternet.ru: could not connect to host @@ -1490,7 +1482,6 @@ mckinley1.com: could not connect to host mcsa-usa.org: could not connect to host mcsnovatamabayan.com: could not connect to host me-dc.com: could not connect to host -meadowfen.farm: could not connect to host meathealth.com: could not connect to host mecanicadom.com: could not connect to host mediadandy.com: could not connect to host @@ -1509,24 +1500,22 @@ memepasmal.org: could not connect to host menchez.me: could not connect to host menzaijia.com: could not connect to host mercanix.co.uk: could not connect to host -mes10doigts.ovh: could not connect to host metaether.net: could not connect to host metrix-money-ptc.com: could not connect to host metrix.design: could not connect to host mexior.nl: could not connect to host meyeraviation.com: could not connect to host -mhjuma.com: could not connect to host michaelcullen.name: could not connect to host michaelkuchta.me: could not connect to host michaelsulzer.com: could not connect to host michaelsulzer.eu: could not connect to host -michaelzomer.com: could not connect to host michasfahrschule.com: could not connect to host microblading.pe: could not connect to host microlinks.org: could not connect to host mieterschutzkartei.de: could not connect to host mikeybot.com: could not connect to host millionairessecrets.com: could not connect to host +minantavla.se: could not connect to host mingy.ddns.net: could not connect to host mingyueli.com: could not connect to host minimaliston.com: could not connect to host @@ -1536,7 +1525,6 @@ misconfigured.io: could not connect to host missycosmeticos.com.br: could not connect to host miyako-kyoto.jp: could not connect to host mkfs.fr: could not connect to host -mkhsoft.eu: could not connect to host mkp-deutschland.de: could not connect to host mkplay.io: could not connect to host mmilog.hu: could not connect to host @@ -1603,7 +1591,6 @@ my-dick.ru: could not connect to host my-dns.co.il: could not connect to host my-floor.com: could not connect to host mycamda.com: could not connect to host -mycareersfuture.sg: could not connect to host myfappening.org: could not connect to host myfunworld.de: could not connect to host mygreatjob.eu: could not connect to host @@ -1653,8 +1640,7 @@ nienfun.com: could not connect to host nikksno.io: could not connect to host nikobradshaw.com: could not connect to host nikolasbradshaw.com: could not connect to host -ninreiei.jp: could not connect to host -ninux.ch: could not connect to host +ninofink.com: could not connect to host niouininon.eu: could not connect to host nirada.info: could not connect to host nishikino-maki.com: could not connect to host @@ -1663,6 +1649,7 @@ nocs.cn: could not connect to host nodelab-it.de: could not connect to host nodeselect.com: could not connect to host noelblog.ga: could not connect to host +noelssanssoucipensacola.com: could not connect to host noisebridge.social: could not connect to host nolimits.net.nz: could not connect to host nonemu.ninja: could not connect to host @@ -1700,6 +1687,7 @@ olgui.net: could not connect to host oliverspringer.eu: could not connect to host oneazcu.com: could not connect to host onewebdev.info: could not connect to host +onix.eu.com: could not connect to host onsennuie.fr: could not connect to host onsite4u.de: could not connect to host onstud.com: could not connect to host @@ -1712,7 +1700,6 @@ orangekey.tk: could not connect to host oranges.tokyo: could not connect to host oranic.com: could not connect to host oricejoc.com: could not connect to host -osacrypt.studio: could not connect to host oscarmashauri.com: could not connect to host oscsdp.cz: could not connect to host oshell.me: could not connect to host @@ -1754,8 +1741,8 @@ pcvirusclear.com: could not connect to host pear2pear.de: could not connect to host peerless.ae: could not connect to host peirong.me: could not connect to host -pelletizermill.com: could not connect to host pemagrid.org: could not connect to host +pengi.me: could not connect to host pengisatelier.net: could not connect to host pepper.dog: could not connect to host persjrp.ca: could not connect to host @@ -1772,6 +1759,7 @@ phillippi.me: could not connect to host photographyforchange.com: could not connect to host photographyforchange.org: could not connect to host photops.fr: could not connect to host +photosoftware.nl: could not connect to host phuong.faith: could not connect to host pianetaottica.eu: could not connect to host pianetaottica.info: could not connect to host @@ -1780,7 +1768,6 @@ picone.com.au: could not connect to host picotronic.de: could not connect to host picsandtours.com: could not connect to host pierrejeansuau.fr: could not connect to host -pietawittermans.nl: could not connect to host pieterhordijk.com: could not connect to host pimspage.nl: could not connect to host pinebaylibrary.org: could not connect to host @@ -1794,12 +1781,12 @@ plaasprodukte.com: could not connect to host planbox.info: could not connect to host planningexcellence.com.au: could not connect to host playsharp.com: could not connect to host -playsource.co: could not connect to host please-deny.me: could not connect to host plexi.dyndns.tv: could not connect to host plussizereviews.com: could not connect to host pmbremer.de: could not connect to host pogs.us: could not connect to host +pointagri.com: could not connect to host polit.im: could not connect to host pookl.com: could not connect to host poolinstallers.co.za: could not connect to host @@ -1807,12 +1794,10 @@ popkins.cf: could not connect to host popkins.ga: could not connect to host popkins.gq: could not connect to host popkins.tk: could not connect to host -pornbay.org: could not connect to host pornblog.org: could not connect to host porschen.fr: could not connect to host port.social: could not connect to host portalisapres.cl: could not connect to host -posobota.cz: could not connect to host posters.win: could not connect to host potbar.com: could not connect to host potbox.com: could not connect to host @@ -1865,7 +1850,6 @@ psyk.yt: could not connect to host publimepa.it: could not connect to host pugilares.com.pl: could not connect to host puhe.se: could not connect to host -puikheid.nl: could not connect to host pwdgen.net: could not connect to host pwntr.com: could not connect to host pyjiaoyi.cf: could not connect to host @@ -1887,8 +1871,10 @@ racasdecachorro.org: could not connect to host rackblue.com: could not connect to host radartatska.se: could not connect to host rainbin.com: could not connect to host +randomquotesapp.com: could not connect to host rangsmo.se: could not connect to host ranos.org: could not connect to host +raphrfg.com: could not connect to host ravengergaming.net: could not connect to host ravse.dk: could not connect to host raycarruthersphotography.co.uk: could not connect to host @@ -1919,17 +1905,16 @@ reismil.ch: could not connect to host relatic.net: could not connect to host relsak.cz: could not connect to host renemayrhofer.com: could not connect to host -rentbrowser.com: could not connect to host report-incident.de: could not connect to host reposaarenkuva.fi: could not connect to host reqognize.com: could not connect to host research.md: could not connect to host resoundpro.ca: could not connect to host +restioson.me: could not connect to host reth.ch: could not connect to host retube.ga: could not connect to host reucon.com: could not connect to host reykjavik.guide: could not connect to host -rhodes.ml: could not connect to host ribopierre.fr: could not connect to host riceglue.com: could not connect to host richardb.me: could not connect to host @@ -1937,6 +1922,7 @@ richeza.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERRO righteousendeavour.com: could not connect to host riversideauto.net: could not connect to host riverstyxgame.com: could not connect to host +rmstudio.tw: could not connect to host roave.com: could not connect to host robi-net.it: could not connect to host robomonkey.org: could not connect to host @@ -1965,11 +1951,10 @@ rtc.fun: could not connect to host rubbix.net: could not connect to host rubendv.be: could not connect to host ruhr3.de: could not connect to host -ruja.dk: could not connect to host +run-forrest.run: could not connect to host runcarina.com: could not connect to host rundumcolumn.xyz: could not connect to host -runschrauger.com: could not connect to host -ruobr.ru: could not connect to host +rushball.net: could not connect to host ruurdboomsma.nl: could not connect to host rzegroup.com: could not connect to host s0923.com: could not connect to host @@ -1979,7 +1964,6 @@ safedevice.net: could not connect to host safejourney.education: could not connect to host saferedirectlink.com: could not connect to host sagemontchurch.org: could not connect to host -sahkotyot.eu: could not connect to host sallysubs.com: could not connect to host salzamt.tk: could not connect to host samaritan.tech: could not connect to host @@ -2004,19 +1988,12 @@ scalaire.fr: could not connect to host schaafenstrasse.koeln: could not connect to host schmidttulskie.de: could not connect to host schnapke.name: could not connect to host -schrauger.com: could not connect to host -schrauger.info: could not connect to host -schrauger.net: could not connect to host -schrauger.org: could not connect to host -schrauger.run: could not connect to host -schraugerrun.com: could not connect to host schul-bar.de: could not connect to host scib.tk: could not connect to host sciencemonster.co.uk: could not connect to host scintillating.stream: could not connect to host scitopia.me: could not connect to host scm-2017.org: could not connect to host -scootfleet.com: could not connect to host scottainslie.me.uk: could not connect to host scripthost.org: could not connect to host scriptjunkie.us: could not connect to host @@ -2036,7 +2013,6 @@ securitysoapbox.com: could not connect to host securitytalk.pl: could not connect to host securon.io: could not connect to host securoswiss.ch: could not connect to host -seeclop.ch: could not connect to host seefirm.com: could not connect to host seen.life: could not connect to host selent.me: could not connect to host @@ -2083,7 +2059,6 @@ sikatehtaat.fi: could not connect to host siku.pro: could not connect to host silqueskineyeserum.com: could not connect to host silverback.is: could not connect to host -silviamacallister.com: could not connect to host silvistefi.com: could not connect to host simhaf.cf: could not connect to host simonschmitt.ch: could not connect to host @@ -2163,10 +2138,6 @@ staticisnoise.com: could not connect to host statusbot.io: could not connect to host steffi-in-australien.com: could not connect to host stellarium-gornergrat.ch: could not connect to host -stephenschrauger.com: could not connect to host -stephenschrauger.info: could not connect to host -stephenschrauger.net: could not connect to host -stephenschrauger.org: could not connect to host stevengoodpaster.com: could not connect to host stickswag.cf: could not connect to host stikonas.eu: could not connect to host @@ -2177,10 +2148,8 @@ stonemanbrasil.com.br: could not connect to host stopakwardhandshakes.org: could not connect to host store10.de: could not connect to host stpip.com: could not connect to host -streamer.tips: could not connect to host streams.dyndns.org: could not connect to host stressfreehousehold.com: could not connect to host -sturge.co.uk: could not connect to host stylle.me: could not connect to host subrain.com: could not connect to host sudo.im: could not connect to host @@ -2218,8 +2187,6 @@ syncmylife.net: could not connect to host synergisticsoccer.com: could not connect to host sysert.tv: could not connect to host system12.pl: could not connect to host -systematic-momo.com: could not connect to host -systematic-momo.dk: could not connect to host szunia.com: could not connect to host t3rror.net: could not connect to host tab.watch: could not connect to host @@ -2257,13 +2224,11 @@ terra-x.net: could not connect to host terrax.net: could not connect to host testadron.com: could not connect to host testovaci.ml: could not connect to host -texy.info: could not connect to host tgod.co: could not connect to host tgtv.tn: could not connect to host thai.land: could not connect to host thaigirls.xyz: could not connect to host thatgudstuff.com: could not connect to host -the-digitale.com: could not connect to host the-earth-yui.net: could not connect to host the-finance-blog.com: could not connect to host the-gist.io: could not connect to host @@ -2282,6 +2247,7 @@ theprincegame.com: could not connect to host theprivacysolution.com: could not connect to host thequillmagazine.org: could not connect to host thermique.ch: could not connect to host +thesecondsposts.com: could not connect to host thesehighsandlows.com: could not connect to host theserver201.tk: could not connect to host thetapirsmouth.com: could not connect to host @@ -2337,6 +2303,7 @@ transappealrights.com: could not connect to host transcendmotor.sg: could not connect to host transmithe.net: could not connect to host travotion.com: could not connect to host +tree0.xyz: could not connect to host treker.us: could not connect to host triageo.com.au: could not connect to host tristanfarkas.one: could not connect to host @@ -2402,6 +2369,7 @@ valecnatechnika.cz: could not connect to host valenhub.com: could not connect to host valenhub.es: could not connect to host valis.sx: could not connect to host +valkor.pro: could not connect to host vamosfalardesaude.pt: could not connect to host vanderstraeten.dynv6.net: could not connect to host vapemania.eu: could not connect to host @@ -2410,7 +2378,6 @@ variable.agency: could not connect to host vayaport.com: could not connect to host vconcept.ch: could not connect to host vconcept.me: could not connect to host -vdanker.net: could not connect to host vectro.me: could not connect to host velasense.com: could not connect to host velen.io: could not connect to host @@ -2430,7 +2397,6 @@ villasenor.online: could not connect to host vimeosucks.nyc: could not connect to host vinesauce.info: could not connect to host vinetalk.net: could not connect to host -vinogradovka.com: could not connect to host viosey.com: could not connect to host vipnettikasinoklubi.com: could not connect to host visiongamestudios.com: could not connect to host @@ -2470,6 +2436,7 @@ wanda98.com: could not connect to host warcraftjournal.org: could not connect to host warlions.info: could not connect to host warp-radio.com: could not connect to host +warp-radio.tv: could not connect to host wassim.is: could not connect to host watashi.bid: could not connect to host watchstyle.com: could not connect to host @@ -2478,7 +2445,6 @@ waxdramatic.com: could not connect to host we.serveftp.net: could not connect to host weareincognito.org: could not connect to host webart-factory.de: could not connect to host -webbson.net: could not connect to host webhackspro.com: could not connect to host webnetmail4u.com: could not connect to host webproject.rocks: could not connect to host @@ -2534,7 +2500,6 @@ workemy.com: could not connect to host workwithgo.com: could not connect to host worldfree4.org: could not connect to host wormholevpn.net: could not connect to host -wowhelp.it: could not connect to host wp-fastsearch.de: could not connect to host wp-stack.pro: could not connect to host wp6.pw: could not connect to host @@ -2563,6 +2528,7 @@ xn--t8j2a3042d.xyz: could not connect to host xn--tda.ml: could not connect to host xn--thorme-6uaf.ca: could not connect to host xn--vck8crc010pu14e.biz: could not connect to host +xn--y8j2eb5631a4qf5n0h.com: could not connect to host xn--yj8h0m.ws: could not connect to host xn--ykrp42k.com: could not connect to host xpwn.cz: could not connect to host @@ -2576,7 +2542,6 @@ yabrt.cn: could not connect to host yahoo.ax: could not connect to host yarchives.jp: could not connect to host yaucy.win: could not connect to host -ybresson.com: could not connect to host yd.io: could not connect to host yellowcar.website: could not connect to host yemalu.com: could not connect to host @@ -2598,7 +2563,6 @@ yoticonnections.com: could not connect to host yotilabs.com: could not connect to host yourznc.com: could not connect to host yousite.by: could not connect to host -yoyoost.duckdns.org: could not connect to host yude.ml: could not connect to host yum.beer: could not connect to host yux.fr: could not connect to host @@ -2608,9 +2572,9 @@ zachbolinger.com: could not connect to host zaoext.com: could not connect to host zbchen.com: could not connect to host zbp.at: could not connect to host -zeitzer-turngala.de: could not connect to host zeloz.xyz: could not connect to host zenghx.tk: could not connect to host +zenlogic.com: could not connect to host zero-x-baadf00d.com: could not connect to host zerocool.io: could not connect to host zerosource.net: could not connect to host @@ -2625,14 +2589,10 @@ zmk.fr: could not connect to host zobraz.cz: could not connect to host zohar.shop: could not connect to host zokster.net: could not connect to host -zolokar.xyz: could not connect to host zonemaster.fr: could not connect to host -zonemaster.net: could not connect to host -zoological-gardens.eu: could not connect to host zorz.info: could not connect to host zudomc.me: could not connect to host zuehlcke.de: could not connect to host -zulu7.com: could not connect to host zuviel.space: could not connect to host zypr.pw: could not connect to host zyx.im: could not connect to host @@ -2643,7 +2603,7 @@ zzw.ca: could not connect to host 0005aa.com: could not connect to host 007sascha.de: did not receive HSTS header 020wifi.nl: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 116" data: no] -0222aa.com: did not receive HSTS header +0222aa.com: could not connect to host 02dl.net: did not receive HSTS header 040fit.nl: did not receive HSTS header 048.ag: could not connect to host @@ -2681,8 +2641,6 @@ zzw.ca: could not connect to host 127011-networks.ch: did not receive HSTS header 12vpn.org: could not connect to host 12vpnchina.com: could not connect to host -1391kj.com: did not receive HSTS header -1395kj.com: did not receive HSTS header 1396.cc: did not receive HSTS header 1536.cf: could not connect to host 163pwd.com: could not connect to host @@ -2695,7 +2653,6 @@ zzw.ca: could not connect to host 188trafalgar.ca: did not receive HSTS header 195gm.com: could not connect to host 1a-jva.de: could not connect to host -1a-werkstattgeraete.de: did not receive HSTS header 1atic.com: could not connect to host 1co-jp.net: did not receive HSTS header 1cover.com: could not connect to host @@ -2866,6 +2823,7 @@ access-sofia.org: did not receive HSTS header accommodation-berry.com.au: max-age too low: 300 accountradar.com: max-age too low: 86400 accounts-p.com: could not connect to host +aceadvisory.biz: did not receive HSTS header acgmoon.org: did not receive HSTS header acheirj.com.br: could not connect to host acheritage.co.uk: did not receive HSTS header @@ -2947,6 +2905,7 @@ agatheetraphael.fr: could not connect to host agbremen.de: did not receive HSTS header agentseeker.ca: could not connect to host agevio.com: could not connect to host +agonswim.com: did not receive HSTS header agrias.com.br: did not receive HSTS header agrimap.com: did not receive HSTS header agro-id.gov.ua: did not receive HSTS header @@ -2985,7 +2944,7 @@ akselimedia.fi: did not receive HSTS header akstudentsfirst.org: could not connect to host aktivist.in: did not receive HSTS header al-shami.net: could not connect to host -alair.cn: could not connect to host +alair.cn: did not receive HSTS header alanlee.net: could not connect to host alanrickmanflipstable.com: could not connect to host alariel.de: did not receive HSTS header @@ -3139,7 +3098,6 @@ annahmeschluss.de: did not receive HSTS header annarbor.group: did not receive HSTS header annsbouncycastles.com: did not receive HSTS header anomaly.ws: did not receive HSTS header -anonboards.com: did not receive HSTS header anonymo.co.uk: could not connect to host anonymo.uk: could not connect to host anonymousstatecollegelulzsec.com: could not connect to host @@ -3178,6 +3136,7 @@ aperture-laboratories.science: did not receive HSTS header api.mega.co.nz: could not connect to host apibot.de: could not connect to host apis.world: could not connect to host +apl2bits.net: did not receive HSTS header apmg-certified.com: did not receive HSTS header apmg-cyber.com: did not receive HSTS header apnakliyat.com: did not receive HSTS header @@ -3201,6 +3160,7 @@ apps-for-fishing.com: could not connect to host appsbystudio.co.uk: did not receive HSTS header appsdash.io: could not connect to host appuro.com: did not receive HSTS header +appzoojoo.be: did not receive HSTS header aquariumaccessories.shop: did not receive HSTS header aquilalab.com: could not connect to host arabdigitalexpression.org: did not receive HSTS header @@ -3244,7 +3204,6 @@ arrowfunction.com: could not connect to host ars-design.net: could not connect to host art2web.net: could not connect to host artartefatos.com.br: could not connect to host -artbytik.ru: did not receive HSTS header artegusto.ru: did not receive HSTS header arterienundvenen.ch: did not receive HSTS header artesupra.com: did not receive HSTS header @@ -3337,6 +3296,7 @@ authoritynutrition.com: did not receive HSTS header auto-serwis.zgorzelec.pl: could not connect to host auto3d.cn: could not connect to host auto4trade.nl: could not connect to host +autoauctionsvirginia.com: did not receive HSTS header autobedarf.net: did not receive HSTS header autodeploy.it: could not connect to host autoecolebudget.ch: did not receive HSTS header @@ -3573,7 +3533,6 @@ biaoqingfuhao.net: did not receive HSTS header biaoqingfuhao.org: did not receive HSTS header biapinheiro.com.br: max-age too low: 5184000 biblerhymes.com: did not receive HSTS header -bichines.es: did not receive HSTS header bidon.ca: did not receive HSTS header bieberium.de: could not connect to host biego.cn: did not receive HSTS header @@ -3637,7 +3596,6 @@ bitrage.de: could not connect to host bitraum.io: could not connect to host bitsafe.systems: did not receive HSTS header bitvigor.com: could not connect to host -bitwrought.net: could not connect to host bivsi.com: could not connect to host bizcms.com: did not receive HSTS header bizon.sk: did not receive HSTS header @@ -3730,7 +3688,7 @@ bootikexpress.fr: did not receive HSTS header borderlinegroup.com: could not connect to host boringsecurity.net: could not connect to host boris.one: did not receive HSTS header -borisavstankovic.rs: could not connect to host +borisavstankovic.rs: did not receive HSTS header borrelioz.com: did not receive HSTS header borscheid-wenig.com: did not receive HSTS header boschee.net: could not connect to host @@ -3813,6 +3771,7 @@ bubulazy.com: did not receive HSTS header buch-cuber.de: max-age too low: 0 buchheld.at: did not receive HSTS header bucket.tk: could not connect to host +buckmulligans.com: did not receive HSTS header budgetthostels.nl: did not receive HSTS header budskap.eu: did not receive HSTS header buenosairesestetica.com.ar: could not connect to host @@ -3897,6 +3856,7 @@ bypro.xyz: could not connect to host bysymphony.com: max-age too low: 0 byte.chat: did not receive HSTS header byte.wtf: did not receive HSTS header +byte128.com: did not receive HSTS header bytesatwork.eu: could not connect to host bytesund.biz: could not connect to host byurudraw.pics: could not connect to host @@ -3906,6 +3866,7 @@ c2lab.net: did not receive HSTS header c3-compose.com: could not connect to host c3b.info: could not connect to host c3ie.com: did not receive HSTS header +ca-terminal-multiservices.fr: did not receive HSTS header cabsites.com: could not connect to host cabusar.fr: did not receive HSTS header caconnect.org: could not connect to host @@ -4001,7 +3962,6 @@ cavedevs.de: could not connect to host cavedroid.xyz: could not connect to host cavern.tv: did not receive HSTS header cayafashion.de: did not receive HSTS header -cayounglab.co.jp: did not receive HSTS header cbengineeringinc.com: max-age too low: 86400 cbhq.net: could not connect to host ccblog.de: did not receive HSTS header @@ -4038,7 +3998,6 @@ cevrimici.com: could not connect to host cfcnexus.org: could not connect to host cfcproperties.com: did not receive HSTS header cfetengineering.com: could not connect to host -cfo.gov: did not receive HSTS header cfoitplaybook.com: could not connect to host cganx.org: could not connect to host cgerstner.eu: did not receive HSTS header @@ -4053,7 +4012,7 @@ changetip.com: did not receive HSTS header channyc.com: did not receive HSTS header chanshiyu.com: did not receive HSTS header chaos.fail: could not connect to host -chaoswebs.net: did not receive HSTS header +chaoswebs.net: could not connect to host charityclear.com: did not receive HSTS header charitystreet.co.uk: could not connect to host charliemcneive.com: did not receive HSTS header @@ -4107,7 +4066,7 @@ chrisbrown.id.au: could not connect to host chrisfaber.com: could not connect to host chriskirchner.de: did not receive HSTS header chriskyrouac.com: could not connect to host -chrisopperwall.com: could not connect to host +chrisopperwall.com: did not receive HSTS header chrisself.xyz: could not connect to host christiaandruif.nl: could not connect to host christianbro.gq: could not connect to host @@ -4203,6 +4162,7 @@ clounix.online: could not connect to host clovissantos.com: could not connect to host clowde.in: could not connect to host clownaroundbouncycastles.co.uk: did not receive HSTS header +clsimplex.com: did not receive HSTS header club-adulti.ro: did not receive HSTS header clubalfa.it: did not receive HSTS header clubcall.com: did not receive HSTS header @@ -4316,8 +4276,6 @@ consciousbranding.org.au: could not connect to host consciousbrands.net.au: could not connect to host console.python.org: did not receive HSTS header console.support: did not receive HSTS header -consultorcr.net: could not connect to host -consumerfiles.com: did not receive HSTS header contactbig.com: did not receive HSTS header contaimo.com: did not receive HSTS header container-lion.com: did not receive HSTS header @@ -4341,6 +4299,7 @@ cor-ser.es: could not connect to host coralproject.net: did not receive HSTS header coralrosado.com.br: did not receive HSTS header coramcdaniel.com: did not receive HSTS header +corbax.com: did not receive HSTS header corderoscleaning.com: did not receive HSTS header cordial-restaurant.com: did not receive HSTS header core.mx: could not connect to host @@ -4362,6 +4321,7 @@ correctpaardbatterijnietje.nl: did not receive HSTS header corruption-mc.net: could not connect to host corruption-rsps.net: could not connect to host corruption-server.net: could not connect to host +cosmeticasimple.com: did not receive HSTS header cosmoluziluminacion.com: did not receive HSTS header costow.club: could not connect to host coughlan.de: did not receive HSTS header @@ -4380,7 +4340,6 @@ crackingking.com: did not receive HSTS header craftbeerbarn.co.uk: could not connect to host craftedge.xyz: could not connect to host craftmain.eu: could not connect to host -cranems.com.ua: could not connect to host cranioschule.com: did not receive HSTS header crate.io: did not receive HSTS header cravelyrics.com: could not connect to host @@ -4427,6 +4386,7 @@ cryptojar.io: did not receive HSTS header cryptolab.pro: could not connect to host cryptolab.tk: could not connect to host cryptopartyatx.org: could not connect to host +cryptophobia.nl: did not receive HSTS header cryptopush.com: did not receive HSTS header crysadm.com: could not connect to host crystalclassics.co.uk: did not receive HSTS header @@ -4590,7 +4550,7 @@ dctxf.com: did not receive HSTS header dcuofriends.net: could not connect to host dcurt.is: did not receive HSTS header dcw.io: did not receive HSTS header -ddatsh.com: did not receive HSTS header +ddatsh.com: could not connect to host deadsoul.net: max-age too low: 0 debank.tv: did not receive HSTS header debatch.se: could not connect to host @@ -4680,10 +4640,11 @@ devlux.ch: did not receive HSTS header devmsg.com: did not receive HSTS header devnsec.com: could not connect to host devnull.team: could not connect to host -devopps.me: could not connect to host +devopps.me: did not receive HSTS header devopsconnected.com: could not connect to host devtub.com: did not receive HSTS header devuan.org: did not receive HSTS header +dewebwerf.nl: did not receive HSTS header dewin.io: could not connect to host dfnet.ml: did not receive HSTS header dfrance.com.br: did not receive HSTS header @@ -4873,7 +4834,6 @@ drinknaturespower.com: could not connect to host drinkvabeer.com: could not connect to host drishti.guru: could not connect to host drivercopilot.com: could not connect to host -drkmtrx.xyz: did not receive HSTS header drlazarina.net: did not receive HSTS header droidboss.com: did not receive HSTS header droncentrum.pl: could not connect to host @@ -4912,7 +4872,6 @@ dunea.nl: did not receive HSTS header duole30.com: did not receive HSTS header duongpho.com: did not receive HSTS header duskopy.top: could not connect to host -dutchessuganda.com: did not receive HSTS header dutchrank.com: did not receive HSTS header duuu.ch: could not connect to host duyao.de: max-age too low: 86400 @@ -4941,7 +4900,6 @@ eagle-aluminum.com: did not receive HSTS header eam-gmbh.com: did not receive HSTS header earga.sm: could not connect to host earlybirdsnacks.com: could not connect to host -earmarks.gov: did not receive HSTS header earthrise16.com: could not connect to host easthokkaido-5airport.jp: did not receive HSTS header easychiller.org: could not connect to host @@ -5026,7 +4984,7 @@ ehito.ovh: could not connect to host ehrenamt-skpfcw.de: could not connect to host eicfood.com: could not connect to host eidolonhost.com: did not receive HSTS header -eifelindex.de: could not connect to host +eifelindex.de: did not receive HSTS header eigo.work: could not connect to host eimanavicius.lt: did not receive HSTS header ekbanden.nl: could not connect to host @@ -5071,7 +5029,7 @@ email2rss.net: could not connect to host emanatepixels.com: could not connect to host emanga.su: did not receive HSTS header embroidered-stuff.com: could not connect to host -emeldi-commerce.com: could not connect to host +emeldi-commerce.com: max-age too low: 0 emesolutions.net: did not receive HSTS header emiele.com.br: could not connect to host emilyhorsman.com: did not receive HSTS header @@ -5243,7 +5201,7 @@ evilnerd.de: did not receive HSTS header evilsay.com: could not connect to host evin.ml: could not connect to host evites.me: could not connect to host -evoludis.net: could not connect to host +evoludis.net: did not receive HSTS header evomon.com: could not connect to host evossd.tk: could not connect to host evowl.com: could not connect to host @@ -5390,7 +5348,7 @@ fikt.space: could not connect to host filebox.moe: could not connect to host filemeal.com: did not receive HSTS header filey.co.uk: did not receive HSTS header -filidorwiese.nl: did not receive HSTS header +fillmysuitca.se: did not receive HSTS header filmesubtitrate2017.online: could not connect to host filo.xyz: did not receive HSTS header filoitoupediou.gr: did not receive HSTS header @@ -5659,6 +5617,7 @@ galletasgabi.com.mx: max-age too low: 86400 galoisvpn.xyz: could not connect to host gambitcloud.net: could not connect to host game.yt: did not receive HSTS header +gamebits.net: did not receive HSTS header gamecave.de: could not connect to host gamechasm.com: could not connect to host gameclue.jp: did not receive HSTS header @@ -5802,7 +5761,6 @@ gizzo.sk: could not connect to host glasslikes.com: did not receive HSTS header glbg.eu: did not receive HSTS header glentakahashi.com: could not connect to host -glittersjabloon.nl: did not receive HSTS header glitzmirror.com: could not connect to host globalado.com: could not connect to host globalbridge-japan.com: did not receive HSTS header @@ -5815,7 +5773,6 @@ glotter.com: did not receive HSTS header gloucesterphotographer.com: did not receive HSTS header glubbforum.de: did not receive HSTS header glws.org: did not receive HSTS header -gm-assicurazioni.it: did not receive HSTS header gmat.ovh: could not connect to host gmoes.at: could not connect to host go.ax: did not receive HSTS header @@ -5858,6 +5815,7 @@ gopokego.cz: could not connect to host gorgiaxx.com: could not connect to host gorilla-gym.site: could not connect to host gorillow.com: could not connect to host +gosharewood.com: did not receive HSTS header goshop.cz: did not receive HSTS header gostream.asia: could not connect to host gotgenes.com: could not connect to host @@ -5885,7 +5843,6 @@ gracesofgrief.com: could not connect to host grachtenpandverkopen.nl: could not connect to host grafitec.ru: did not receive HSTS header grana.com: did not receive HSTS header -grandefratellonews.com: could not connect to host grandlinecsk.ru: did not receive HSTS header grandmascookieblog.com: did not receive HSTS header grantedby.me: max-age too low: 0 @@ -5913,7 +5870,7 @@ greenvpn.pro: did not receive HSTS header gregorytlee.me: could not connect to host grekland.guide: could not connect to host gremots.com: could not connect to host -grendel.no: did not receive HSTS header +grendel.no: could not connect to host greplin.com: could not connect to host gresb.com: did not receive HSTS header gretchelizartistry.com: did not receive HSTS header @@ -6000,7 +5957,6 @@ habbotalk.nl: could not connect to host hablemosdetecnologia.com.ve: could not connect to host hac30.com: could not connect to host hack.li: could not connect to host -hackanders.com: did not receive HSTS header hacker8.cn: did not receive HSTS header hackercat.ninja: did not receive HSTS header hackerco.com: did not receive HSTS header @@ -6110,7 +6066,7 @@ hcs-company.com: did not receive HSTS header hcs-company.nl: did not receive HSTS header hdrboundless.com: could not connect to host hdritalyphotos.com: did not receive HSTS header -hdserver.info: did not receive HSTS header +hdserver.info: could not connect to host hdsmigrationtool.com: could not connect to host hduin.xyz: could not connect to host head-shop.lt: could not connect to host @@ -6267,7 +6223,7 @@ howrandom.org: could not connect to host howtocuremysciatica.com: could not connect to host hpepub.asia: could not connect to host hpepub.com: did not receive HSTS header -hpepub.org: did not receive HSTS header +hpepub.org: could not connect to host hppub.info: could not connect to host hppub.org: could not connect to host hppub.site: could not connect to host @@ -6439,7 +6395,7 @@ inbox.li: did not receive HSTS header incendiary-arts.com: could not connect to host inche-ali.com: did not receive HSTS header inchomatic.com: did not receive HSTS header -inderagamono.net: did not receive HSTS header +inderagamono.net: could not connect to host indiecert.net: could not connect to host indiemods.com: could not connect to host indien.guide: could not connect to host @@ -6535,7 +6491,6 @@ invictusmc.uk: could not connect to host invinsec.cloud: did not receive HSTS header inviosolutions.com: max-age too low: 0 invite24.pro: could not connect to host -invitethemhome.com: did not receive HSTS header iodice.org: did not receive HSTS header iolife.dk: could not connect to host ionas-law.ro: did not receive HSTS header @@ -6549,6 +6504,7 @@ ipbill.org.uk: could not connect to host ipfp.pl: did not receive HSTS header iplife.cn: could not connect to host ipmimagazine.com: did not receive HSTS header +ipo-times.com: did not receive HSTS header iprice.co.id: did not receive HSTS header iprice.hk: did not receive HSTS header iprice.my: did not receive HSTS header @@ -6569,8 +6525,9 @@ iranianlawschool.com: could not connect to host iraqidinar.org: did not receive HSTS header irazimina.ru: did not receive HSTS header irccloud.com: did not receive HSTS header +ircmett.de: did not receive HSTS header irelandesign.com: could not connect to host -irisdina.de: did not receive HSTS header +irisdina.de: could not connect to host irland.guide: could not connect to host irmtrudjurke.de: did not receive HSTS header irstaxforumsonline.com: did not receive HSTS header @@ -6602,7 +6559,6 @@ istaspirtslietas.lv: did not receive HSTS header it-cave.com: could not connect to host it-go.net: did not receive HSTS header it-schwerin.de: could not connect to host -itdashboard.gov: did not receive HSTS header itechgeek.com: max-age too low: 0 items.lv: did not receive HSTS header itemton.com: could not connect to host @@ -6610,6 +6566,7 @@ itfaq.nl: did not receive HSTS header itfensi.net: did not receive HSTS header ithakama.com: did not receive HSTS header ithakama.cz: did not receive HSTS header +itilo.de: did not receive HSTS header itinsight.hu: did not receive HSTS header itos.asia: did not receive HSTS header itos.pl: did not receive HSTS header @@ -6746,7 +6703,6 @@ jesuisformidable.nl: could not connect to host jesuslucas.com: did not receive HSTS header jet-code.com: could not connect to host jetaprices.com: max-age too low: 0 -jetflex.de: did not receive HSTS header jetlagphotography.com: could not connect to host jeton.com: did not receive HSTS header jetsetcharge.com: could not connect to host @@ -6762,7 +6718,7 @@ jhejderup.me: could not connect to host jia1hao.com: could not connect to host jiaidu.com: could not connect to host jiangzequn.com: could not connect to host -jianjiantv.com: did not receive HSTS header +jianjiantv.com: could not connect to host jichi.me: could not connect to host jief.me: did not receive HSTS header jikken.de: could not connect to host @@ -6775,6 +6731,7 @@ jimmycn.com: could not connect to host jingyuesi.com: could not connect to host jinmaguoji.com: could not connect to host jinshavip.com: could not connect to host +jiosongs.com: did not receive HSTS header jira.com: did not receive HSTS header jirav.io: could not connect to host jisaku-homepage.com: did not receive HSTS header @@ -6845,6 +6802,7 @@ jsg-technologies.de: did not receive HSTS header jualautoclave.com: did not receive HSTS header jualssh.com: could not connect to host juandesouza.com: did not receive HSTS header +juiced.gs: did not receive HSTS header juka.pp.ua: could not connect to host juliamweber.de: could not connect to host julian-kipka.de: did not receive HSTS header @@ -6872,7 +6830,7 @@ justnaw.co.uk: could not connect to host justudin.com: did not receive HSTS header justwood.cz: did not receive HSTS header jutella.de: did not receive HSTS header -juul.xyz: did not receive HSTS header +juul.xyz: could not connect to host juvenex.co: could not connect to host juwairen.cn: could not connect to host jvoice.net: could not connect to host @@ -6964,6 +6922,7 @@ kermadec.blog: could not connect to host kermadec.net: could not connect to host kernl.us: did not receive HSTS header keskeces.com: did not receive HSTS header +kevinbowers.me: did not receive HSTS header kevinbusse.de: did not receive HSTS header kevinroebert.de: did not receive HSTS header keymaster.lookout.com: did not receive HSTS header @@ -6971,7 +6930,7 @@ kfbrussels.be: could not connect to host kg-rating.com: could not connect to host kgxtech.com: max-age too low: 2592000 khaganat.net: did not receive HSTS header -ki-on.net: could not connect to host +ki-on.net: did not receive HSTS header kialo.com: did not receive HSTS header kickass-proxies.org: could not connect to host kickass.al: could not connect to host @@ -7027,7 +6986,6 @@ kiwiirc.com: max-age too low: 5256000 kiyo.space: could not connect to host kizil.net: could not connect to host kj1391.com: did not receive HSTS header -kj1397.com: did not receive HSTS header kjaermaxi.me: did not receive HSTS header kjg-bachrain.de: could not connect to host klas.or.id: did not receive HSTS header @@ -7145,6 +7103,7 @@ kzjnet.com: could not connect to host l-rickroll-i.pw: could not connect to host la-flora-negra.de: could not connect to host la-grande-jaugue.fr: did not receive HSTS header +la-maison.eu: did not receive HSTS header la-retraite-info.com: did not receive HSTS header la-serendipite.fr: did not receive HSTS header labaia.info: could not connect to host @@ -7170,6 +7129,7 @@ laf.in.net: could not connect to host lagalerievirtuelle.fr: did not receive HSTS header lagier.xyz: could not connect to host lagoza.name: could not connect to host +laguinguette.fr: did not receive HSTS header lainchan.org: did not receive HSTS header laisashop.com.br: could not connect to host lamaland.ru: did not receive HSTS header @@ -7265,6 +7225,7 @@ leonmahler.consulting: did not receive HSTS header leopold.email: could not connect to host leopotamgroup.com: could not connect to host lepont.pl: could not connect to host +leponton-lorient.fr: did not receive HSTS header leppis-it.de: did not receive HSTS header lerasenglish.com: max-age too low: 0 lerner.moscow: did not receive HSTS header @@ -7356,6 +7317,7 @@ linuxforyou.com: could not connect to host linuxgeek.ro: could not connect to host linuxmint.cz: could not connect to host linuxmonitoring.net: did not receive HSTS header +lipo.lol: did not receive HSTS header liquid.solutions: did not receive HSTS header liquorsanthe.in: could not connect to host lisaco.de: could not connect to host @@ -7428,7 +7390,7 @@ lostinsecurity.com: could not connect to host lostinweb.eu: could not connect to host lothai.re: did not receive HSTS header lothuytinhsi.com: could not connect to host -lotos-ag.ch: could not connect to host +lotos-ag.ch: did not receive HSTS header lotsencafe.de: did not receive HSTS header lotuscloud.org: could not connect to host louduniverse.net: did not receive HSTS header @@ -7473,6 +7435,7 @@ lumi.do: did not receive HSTS header lunarift.com: could not connect to host lunarrift.net: could not connect to host luneta.nearbuysystems.com: could not connect to host +lunix.io: did not receive HSTS header luno.io: could not connect to host luody.info: could not connect to host luoe.ml: could not connect to host @@ -7634,6 +7597,7 @@ markusabraham.com: did not receive HSTS header markusweimar.de: did not receive HSTS header marlen.cz: did not receive HSTS header marleyresort.com: did not receive HSTS header +maroc-bivouac.com: did not receive HSTS header marriottvetcareers.com: could not connect to host marshut.net: could not connect to host martensson.io: did not receive HSTS header @@ -7648,6 +7612,7 @@ martinp.no: could not connect to host martinreed.net: did not receive HSTS header martinrogalla.com: did not receive HSTS header marumagic.com: did not receive HSTS header +marvinkeller.de: did not receive HSTS header marykshoup.com: did not receive HSTS header masa-yoga.com: did not receive HSTS header masa.li: could not connect to host @@ -7697,7 +7662,6 @@ maurus-automation.de: did not receive HSTS header mausi.co: did not receive HSTS header mavisang.cf: could not connect to host mawe.red: could not connect to host -max.gov: did not receive HSTS header maxima.at: did not receive HSTS header maximov.space: could not connect to host maxmachine.ind.br: could not connect to host @@ -7733,6 +7697,7 @@ mediafinancelab.org: did not receive HSTS header mediamag.am: max-age too low: 0 mediawikicn.org: could not connect to host medienservice-fritz.de: did not receive HSTS header +medifab.online: did not receive HSTS header medirich.co: could not connect to host meditek-dv.ru: could not connect to host mediterenopmaandag.nl: did not receive HSTS header @@ -7848,7 +7813,6 @@ mijnkredietpaspoort.nl: could not connect to host mikadesign.se: did not receive HSTS header mikaelemilsson.net: did not receive HSTS header mikeburns.com: could not connect to host -mikedugan.org: did not receive HSTS header mikeg.de: did not receive HSTS header mikek.work: did not receive HSTS header mikeology.org: could not connect to host @@ -7977,6 +7941,7 @@ moitur.com: could not connect to host mojizuri.jp: max-age too low: 86400 mols.me: did not receive HSTS header molun.net: did not receive HSTS header +momfulfilled.com: did not receive HSTS header mommel.com: could not connect to host mommelonline.de: could not connect to host momoka.moe: could not connect to host @@ -8030,6 +7995,7 @@ motionfreight.com: could not connect to host motionpicturesolutions.com: did not receive HSTS header motorcheck.ie: did not receive HSTS header motoroilinfo.com: did not receive HSTS header +motorsportdiesel.com: did not receive HSTS header motransportinfo.com: did not receive HSTS header mottvd.com: could not connect to host moudicat.com: max-age too low: 6307200 @@ -8046,9 +8012,8 @@ mozoa.net: could not connect to host mp3donusturucu.com: did not receive HSTS header mp3donusturucu.net: did not receive HSTS header mp3juices.is: could not connect to host -mpintaamalabanna.it: did not receive HSTS header mpkossen.com: did not receive HSTS header -mqas.net: could not connect to host +mqas.net: did not receive HSTS header mr-hosting.com: could not connect to host mrawe.com: could not connect to host mrdani.net: could not connect to host @@ -8060,7 +8025,7 @@ mrning.com: did not receive HSTS header mrnonz.com: max-age too low: 0 mrparker.pw: could not connect to host mrpopat.in: did not receive HSTS header -mrs-shop.com: could not connect to host +mrs-shop.com: did not receive HSTS header mrsbairds.com: max-age too low: 86400 msc-seereisen.net: max-age too low: 0 mstd.tokyo: did not receive HSTS header @@ -8213,6 +8178,7 @@ naudles.me: could not connect to host nav.jobs: could not connect to host naval.tf: could not connect to host navjobs.com: did not receive HSTS header +nay.moe: did not receive HSTS header nbb.io: could not connect to host nbg-ha.de: could not connect to host ncc60205.info: could not connect to host @@ -8237,7 +8203,7 @@ nemovement.org: could not connect to host neoani.me: did not receive HSTS header neofelhz.space: could not connect to host neonisi.com: could not connect to host -neonnuke.tech: did not receive HSTS header +neonnuke.tech: could not connect to host neosolution.ca: did not receive HSTS header nephy.jp: could not connect to host nepustil.net: could not connect to host @@ -8491,7 +8457,7 @@ offshoremarineparts.com: did not receive HSTS header oficinadocelular.com.br: could not connect to host ofo2.com: did not receive HSTS header oganek.ie: could not connect to host -oganime.com: did not receive HSTS header +oganime.com: could not connect to host ogogoshop.com: could not connect to host ohm2013.org: did not receive HSTS header ohsocool.org: did not receive HSTS header @@ -8546,7 +8512,6 @@ onlinecompliance.org: did not receive HSTS header onlinedemo.hu: could not connect to host onlinedeposit.us: could not connect to host onlinekasino.de: did not receive HSTS header -onlinepokerspelen.be: did not receive HSTS header onlinepollsph.com: could not connect to host onlineschadestaat.nl: did not receive HSTS header onlinespielothek.com: did not receive HSTS header @@ -8656,7 +8621,7 @@ ovuscloud.de: could not connect to host ovvy.net: did not receive HSTS header owncloud.help: could not connect to host ownmovies.fr: could not connect to host -oxro.co: did not receive HSTS header +oxro.co: could not connect to host oxygaming.com: did not receive HSTS header oxygenabsorbers.com: did not receive HSTS header oxymc.com: did not receive HSTS header @@ -8698,7 +8663,7 @@ panni.me: could not connect to host panoranordic.net: could not connect to host pansu.space: could not connect to host pants-off.xyz: could not connect to host -pantsu.cat: could not connect to host +pantsu.cat: did not receive HSTS header papalytics.com: could not connect to host papeda.net: could not connect to host papelariadante.com.br: could not connect to host @@ -8711,6 +8676,7 @@ parabhairavayoga.com: max-age too low: 0 paragon.edu: did not receive HSTS header parent5446.us: could not connect to host parentmail.co.uk: did not receive HSTS header +parfum-baza.ru: did not receive HSTS header paris-cyber.fr: did not receive HSTS header parisvox.info: did not receive HSTS header parithy.net: could not connect to host @@ -8732,6 +8698,7 @@ partyvan.moe: could not connect to host partyvan.nl: could not connect to host partyvan.se: could not connect to host pascalchristen.ch: did not receive HSTS header +pascaline-jouis.fr: did not receive HSTS header passumpsicbank.com: did not receive HSTS header passwd.io: could not connect to host passwordbox.com: did not receive HSTS header @@ -8762,7 +8729,6 @@ pay.gigahost.dk: did not receive HSTS header payclixpayments.com: did not receive HSTS header payfreez.com: could not connect to host payload.tech: could not connect to host -paymentaccuracy.gov: did not receive HSTS header payments-reference.org: could not connect to host payroll.ch: could not connect to host paytwopay.com: could not connect to host @@ -8915,6 +8881,7 @@ pixelcode.com.au: could not connect to host pixelhero.co.uk: did not receive HSTS header pixi.chat: could not connect to host pixi.me: did not receive HSTS header +pixiv.cat: did not receive HSTS header pizzadoc.ch: could not connect to host pjbet.mg: did not receive HSTS header pkautodesign.com: did not receive HSTS header @@ -9121,6 +9088,7 @@ psicologoforensebarcelona.com: did not receive HSTS header pstudio.me: did not receive HSTS header psw.academy: could not connect to host psw.consulting: could not connect to host +psylab.cc: did not receive HSTS header ptn.moscow: could not connect to host ptonet.com: could not connect to host ptrujillo.com: did not receive HSTS header @@ -9516,7 +9484,6 @@ rugstorene.co.uk: did not receive HSTS header ruig.jp: could not connect to host ruitershoponline.nl: did not receive HSTS header rumoterra.com.br: could not connect to host -rumplesinflatables.co.uk: did not receive HSTS header runawebinar.nl: could not connect to host runhardt.eu: did not receive HSTS header runtl.com: did not receive HSTS header @@ -9574,7 +9541,7 @@ sampoznay.ru: did not receive HSTS header samraskauskas.com: could not connect to host samsen.club: could not connect to host sanasalud.org: could not connect to host -sanatfilan.com: did not receive HSTS header +sanatfilan.com: could not connect to host sandviks.com: did not receive HSTS header sanguoxiu.com: could not connect to host sanhei.ch: did not receive HSTS header @@ -9626,7 +9593,7 @@ savvysuit.com: did not receive HSTS header sawamura-rental.com: did not receive HSTS header say-hanabi.com: could not connect to host sayhanabi.com: could not connect to host -sazima.ru: did not receive HSTS header +sazima.ru: could not connect to host sbobetfun.com: could not connect to host sbox-archives.com: could not connect to host sby.de: did not receive HSTS header @@ -9643,6 +9610,7 @@ schnell-abnehmen.tips: did not receive HSTS header schnell-gold.com: could not connect to host scholl.io: could not connect to host schooltrends.co.uk: did not receive HSTS header +schraugerrun.com: did not receive HSTS header schreiber-netzwerk.eu: did not receive HSTS header schreibnacht.de: did not receive HSTS header schrikdraad.net: did not receive HSTS header @@ -9757,7 +9725,6 @@ semaf.at: max-age too low: 86400 semantheme.fr: did not receive HSTS header semen3325.xyz: could not connect to host semenkovich.com: did not receive HSTS header -semjonov.de: did not receive HSTS header semps-servers.de: could not connect to host sendash.com: could not connect to host sendmeback.de: did not receive HSTS header @@ -9837,7 +9804,7 @@ shawnbsmith.me: did not receive HSTS header shawnh.net: could not connect to host shellsec.pw: did not receive HSTS header shep.co.il: did not receive HSTS header -sheratan.web.id: could not connect to host +sheratan.web.id: did not receive HSTS header shereallyheals.com: did not receive HSTS header shervik.ga: could not connect to host shg-pornographieabhaengigkeit.de: did not receive HSTS header @@ -9905,7 +9872,7 @@ simfri.com: could not connect to host simnovo.net: did not receive HSTS header simobilklub.si: could not connect to host simod.org: could not connect to host -simon-pokorny.com: did not receive HSTS header +simon-pokorny.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 116" data: no] simon.butcher.name: max-age too low: 2629743 simongong.net: did not receive HSTS header simonsaxon.com: did not receive HSTS header @@ -9997,7 +9964,6 @@ smallshopit.com: did not receive HSTS header smart-mirror.de: did not receive HSTS header smart-ov.nl: could not connect to host smartbuyelectric.com: could not connect to host -smartcleaningcenter.nl: did not receive HSTS header smartcoin.com.br: could not connect to host smartfon4you.ru: max-age too low: 0 smarthomedna.com: did not receive HSTS header @@ -10121,6 +10087,7 @@ speculor.net: could not connect to host spedition-transport-umzug.de: did not receive HSTS header speed-mailer.com: could not connect to host speedcounter.net: did not receive HSTS header +speeds.vip: did not receive HSTS header speedway.com.pl: did not receive HSTS header speedy.lt: max-age too low: 0 speedyprep.com: did not receive HSTS header @@ -10194,7 +10161,6 @@ stargatepartners.com: did not receive HSTS header starmusic.ga: could not connect to host startuponcloud.com: max-age too low: 2678400 stash.ai: did not receive HSTS header -stassi.ch: did not receive HSTS header state-sponsored-actors.net: could not connect to host statementinsertsforless.com: did not receive HSTS header stateofexception.io: could not connect to host @@ -10230,7 +10196,8 @@ stillblackhat.id: could not connect to host stinkytrashhound.com: could not connect to host stirlingpoon.net: could not connect to host stirlingpoon.xyz: could not connect to host -stitthappens.com: did not receive HSTS header +stitthappens.com: could not connect to host +stjohnsc.com: did not receive HSTS header stkbn.com: could not connect to host stkeverneparishcouncil.org.uk: did not receive HSTS header stl.news: did not receive HSTS header @@ -10447,7 +10414,6 @@ tavoittaja.fi: did not receive HSTS header tavopica.lt: did not receive HSTS header taxaudit.com: did not receive HSTS header taxbench.com: could not connect to host -taxi-24std.de: did not receive HSTS header taxsnaps.co.nz: did not receive HSTS header tazj.in: did not receive HSTS header tazz.in: could not connect to host @@ -10697,6 +10663,7 @@ tickreport.com: did not receive HSTS header ticktock.today: did not receive HSTS header tictactux.de: could not connect to host tidmore.us: could not connect to host +tie-online.org: did not receive HSTS header tiendschuurstraat.nl: could not connect to host tiensnet.com: could not connect to host tierrarp.com: could not connect to host @@ -10706,7 +10673,7 @@ tikutiku.pl: could not connect to host tildebot.com: could not connect to host tilient.eu: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 116" data: no] tilikum.io: did not receive HSTS header -tilkah.com.au: did not receive HSTS header +tilkah.com.au: could not connect to host tillcraft.com: could not connect to host timbeilby.com: could not connect to host timbuktutimber.com: did not receive HSTS header @@ -10745,6 +10712,7 @@ tjeckien.guide: could not connect to host tkappertjedemetamorfose.nl: could not connect to host tkarstens.de: did not receive HSTS header tkonstantopoulos.tk: could not connect to host +tlach.cz: did not receive HSTS header tlcdn.net: could not connect to host tlo.hosting: could not connect to host tlo.link: could not connect to host @@ -10844,7 +10812,7 @@ tpms4u.at: did not receive HSTS header tppdebate.org: did not receive HSTS header tracetracker.com: did not receive HSTS header tracker-gps.ch: could not connect to host -trackingstream.com: did not receive HSTS header +trackingstream.com: could not connect to host trackmeet.io: did not receive HSTS header tracktivity.com.au: could not connect to host trade-smart.ru: could not connect to host @@ -11004,6 +10972,7 @@ ugisgutless.com: could not connect to host ugo.ninja: could not connect to host ugosadventures.com: could not connect to host uhm.io: did not receive HSTS header +uitslagensoftware.nl: did not receive HSTS header ukas.com: did not receive HSTS header ukdropshipment.co.uk: did not receive HSTS header ukdropshipment.com: did not receive HSTS header @@ -11112,7 +11081,6 @@ usercare.com: did not receive HSTS header userify.com: max-age too low: 0 uslab.io: could not connect to host usr.nz: did not receive HSTS header -ustr.gov: did not receive HSTS header utilitronium-shockwave.com: could not connect to host utleieplassen.no: could not connect to host utopiagalaxy.space: could not connect to host @@ -11131,7 +11099,7 @@ uyym.com: could not connect to host uzmandroid.com: could not connect to host uzmandroid.net: could not connect to host uzmandroid.top: could not connect to host -v-desk.ga: could not connect to host +v-desk.ga: did not receive HSTS header v0rtex.xyz: could not connect to host v0tti.com: could not connect to host v12.co.uk: did not receive HSTS header @@ -11262,6 +11230,7 @@ vincentkooijman.at: did not receive HSTS header vincentkooijman.nl: could not connect to host vinciconps4.it: could not connect to host viniferawineclub.com: did not receive HSTS header +vinogradovka.com: did not receive HSTS header vinsetchampagne.fr: did not receive HSTS header vintageheartcoffee.com: max-age too low: 0 vio.no: did not receive HSTS header @@ -11272,7 +11241,7 @@ viplentes.com.br: did not receive HSTS header vipmusic.ga: could not connect to host viral8.jp: could not connect to host virginiacrimeanalysisnetwork.org: did not receive HSTS header -virtualstrongbox.ca: could not connect to host +virtualstrongbox.ca: did not receive HSTS header visanhigia.com: could not connect to host viserproject.com: did not receive HSTS header vision-painting.com: did not receive HSTS header @@ -11289,7 +11258,6 @@ vitsoft.by: did not receive HSTS header vitta.me: did not receive HSTS header viva-french.com: did not receive HSTS header vivasports.com.br: could not connect to host -vivianmaier.cn: did not receive HSTS header vivocloud.com: could not connect to host vivremoinscher.fr: did not receive HSTS header vizeat.com: did not receive HSTS header @@ -11301,9 +11269,7 @@ voicesuk.co.uk: did not receive HSTS header voidserv.net: could not connect to host volbyzive.cz: did not receive HSTS header volcrado.com: did not receive HSTS header -voliere-info.nl: did not receive HSTS header volkden.com: could not connect to host -volkerwesselswave.nl: did not receive HSTS header voltotc.com: did not receive HSTS header vonavy-cukor.sk: could not connect to host vonavycukor.sk: could not connect to host @@ -11376,6 +11342,7 @@ wapt.fr: did not receive HSTS header warandpeace.xyz: could not connect to host wardsegers.be: did not receive HSTS header warehost.de: did not receive HSTS header +warekit.io: did not receive HSTS header warhistoryonline.com: did not receive HSTS header warped.com: did not receive HSTS header warrencreative.com: did not receive HSTS header @@ -11451,6 +11418,8 @@ weddingibiza.nl: could not connect to host wedotrains.club: did not receive HSTS header weekly.fyi: could not connect to host wegenaer.nl: could not connect to host +weicn.org: did not receive HSTS header +weightreviews.com: did not receive HSTS header weirdesigns.com: did not receive HSTS header weiyuz.com: max-age too low: 6585555 welkers.org: could not connect to host @@ -11505,6 +11474,7 @@ wholesomeharvestbread.com: max-age too low: 86400 whoshotya.de: did not receive HSTS header whysuck.com: could not connect to host wibruje.pl: did not receive HSTS header +wideinfo.org: did not receive HSTS header widenews.org: did not receive HSTS header wienholding.at: max-age too low: 0 wieninternational.at: did not receive HSTS header @@ -11577,6 +11547,8 @@ woodworkertip.com: did not receive HSTS header woording.com: could not connect to host wootton95.com: could not connect to host wooviet.com: could not connect to host +worcesterdance.org: did not receive HSTS header +wordbits.net: did not receive HSTS header work-and-jockel.de: did not receive HSTS header workfone.io: did not receive HSTS header workingclassmedia.com: did not receive HSTS header @@ -11694,6 +11666,7 @@ ximage.me: did not receive HSTS header ximens.me: could not connect to host xinbiji.cn: could not connect to host xinghuokeji.xin: could not connect to host +xingiahanvisa.net: did not receive HSTS header xisa.it: could not connect to host xivpn.com: could not connect to host xiyu.moe: did not receive HSTS header @@ -11940,6 +11913,7 @@ zohar.link: could not connect to host zollihood.ch: did not receive HSTS header zolotoy-standart.com.ua: did not receive HSTS header zomiac.pp.ua: could not connect to host +zonadebolsa.es: did not receive HSTS header zoneminder.com: did not receive HSTS header zoners.si: did not receive HSTS header zonky.io: could not connect to host diff --git a/security/manager/ssl/nsSTSPreloadList.inc b/security/manager/ssl/nsSTSPreloadList.inc index 87653350dfa7..2ef1f3b8c915 100644 --- a/security/manager/ssl/nsSTSPreloadList.inc +++ b/security/manager/ssl/nsSTSPreloadList.inc @@ -8,7 +8,7 @@ /*****************************************************************************/ #include -const PRTime gPreloadListExpirationTime = INT64_C(1531684123172000); +const PRTime gPreloadListExpirationTime = INT64_C(1531770672720000); %% 0-1.party, 1 0.me.uk, 1 @@ -178,6 +178,8 @@ const PRTime gPreloadListExpirationTime = INT64_C(1531684123172000); 1359826938.rsc.cdn77.org, 1 135vv.com, 1 13826145000.com, 1 +1391kj.com, 1 +1395kj.com, 1 1396.net, 1 13th-dover.uk, 1 1453914078.rsc.cdn77.org, 1 @@ -228,6 +230,7 @@ const PRTime gPreloadListExpirationTime = INT64_C(1531684123172000); 19hundert84.de, 1 1a-diamantscheiben.de, 1 1a-vermessung.at, 1 +1a-werkstattgeraete.de, 1 1aim.com, 1 1cover.co.nz, 1 1cover.com.au, 1 @@ -881,7 +884,6 @@ accudraftpaintbooths.com, 1 accuritconsulting.com, 1 accuritpresence.com, 1 accwing.com, 1 -aceadvisory.biz, 1 aceanswering.com, 1 acecerts.co.uk, 1 acecolleges.edu.au, 1 @@ -1246,7 +1248,6 @@ agiley.se, 1 agilob.net, 1 aging.gov, 1 agingstop.net, 1 -agonswim.com, 0 agoodmind.com, 1 agoravm.tk, 1 agoravox.fr, 1 @@ -2098,6 +2099,7 @@ annuaire-photographe.fr, 0 anohana.org, 1 anojan.com, 1 anon-next.de, 1 +anonboards.com, 1 anoncom.net, 1 anoneko.com, 1 anongoth.pl, 1 @@ -2247,7 +2249,6 @@ apk.li, 1 apk4fun.com, 1 apkoyunlar.club, 1 apkriver.com, 1 -apl2bits.net, 1 aplikaceproandroid.cz, 1 aplis-online.de, 0 aplpackaging.co.uk, 1 @@ -2323,7 +2324,6 @@ apptoutou.com, 1 appuals.com, 1 appui-de-fenetre.fr, 1 appveyor.com, 1 -appzoojoo.be, 1 aprefix.com, 1 apretatuercas.es, 1 aprovpn.com, 1 @@ -2419,7 +2419,7 @@ arenns.com, 1 arent.kz, 1 arenzanaphotography.com, 1 areqgaming.com, 1 -ares-trading.de, 0 +ares-trading.de, 1 arethsu.se, 1 arfad.ch, 1 arg.zone, 1 @@ -2511,6 +2511,7 @@ arsk1.com, 1 art-et-culture.ch, 1 artansoft.com, 1 artboja.com, 1 +artbytik.ru, 1 artdeco-photo.com, 1 artea.ga, 1 arteaga.co.uk, 1 @@ -2890,7 +2891,6 @@ auto-anleitung.de, 1 auto-motor-i-sport.pl, 1 auto-plus.tn, 1 autoauctionsohio.com, 1 -autoauctionsvirginia.com, 1 autobedrijfschalkoort.nl, 1 autoclean-plus.ch, 1 autocmall.com, 1 @@ -4029,6 +4029,7 @@ biboumail.fr, 1 bibuch.com, 1 bicecontracting.com, 1 bicha.net, 1 +bichines.es, 1 bichonfrise.com.br, 1 bichonmaltes.com.br, 1 bicranial.io, 1 @@ -4304,6 +4305,7 @@ bituptick.com, 1 bitvegas.com, 1 bitvest.io, 1 bitwolk.nl, 1 +bitwrought.net, 1 bitxel.com.co, 1 bityes.org, 1 biurokarier.edu.pl, 1 @@ -5223,7 +5225,6 @@ bubhub.io, 1 buch-angucken.de, 1 buchverlag-scholz.de, 1 buck.com, 1 -buckmulligans.com, 1 buckypaper.com, 1 budaev-shop.ru, 1 buddhismus.net, 1 @@ -5439,7 +5440,6 @@ byronwade.com, 1 byrtz.de, 1 bysb.net, 1 byte-time.com, 1 -byte128.com, 1 bytearts.net, 1 bytebucket.org, 1 bytecode.no, 1 @@ -5488,7 +5488,6 @@ c4539.com, 1 c4k3.net, 1 c7dn.com, 1 ca-key.de, 1 -ca-terminal-multiservices.fr, 1 ca.gparent.org, 1 ca.search.yahoo.com, 0 ca5.de, 1 @@ -5932,6 +5931,7 @@ cave-reynard.ch, 1 cavevinsdefrance.fr, 1 cavzodiaco.com.br, 1 caylercapital.com, 1 +cayounglab.co.jp, 1 cazaviajes.es, 1 cazes.info, 1 cb-crochet.com, 1 @@ -6106,6 +6106,7 @@ cfan.space, 1 cfh.com, 1 cfneia.org, 1 cfno.org, 1 +cfo.gov, 1 cfpa-formation.fr, 1 cfsh.tk, 1 cftcarouge.com, 1 @@ -6617,7 +6618,7 @@ cirugiasplasticas.com.mx, 1 cirujanooral.com, 1 cirurgicagervasio.com.br, 1 cirurgicalucena.com.br, 1 -ciscodude.net, 1 +ciscodude.net, 0 cisoaid.com, 1 ciss.ltd, 1 cisy.me, 1 @@ -6846,7 +6847,6 @@ clownish.co.il, 1 cloxy.com, 1 clr3.com, 1 clsimage.com, 1 -clsimplex.com, 1 clsoft.ch, 1 clu-in.org, 1 club-duomo.com, 1 @@ -7320,9 +7320,11 @@ constructive.men, 1 consul.io, 1 consultcelerity.com, 1 consultingroupitaly.com, 1 +consultorcr.net, 1 consultpetkov.com, 1 consumer.gov, 1 consumeractionlawgroup.com, 1 +consumerfiles.com, 1 consumersentinel.gov, 1 consumidor.gov, 1 consuwijzer.nl, 1 @@ -7402,7 +7404,6 @@ copycrafter.net, 1 copypoison.com, 1 copyright-watch.org, 1 copytrack.com, 1 -corbax.com, 1 corbi.net.au, 1 corbinhesse.com, 1 cordeydesign.ch, 1 @@ -7466,7 +7467,6 @@ cosirex.com, 1 coslinker.com, 1 cosmechic.fr, 1 cosmeticappraisal.com, 1 -cosmeticasimple.com, 1 cosmeticos-naturales.com, 1 cosmeticosdelivery.com.br, 1 cosmeticosnet.com.br, 1 @@ -7580,6 +7580,7 @@ craigsimpson.scot, 1 craigwfox.com, 1 cralarm.de, 1 crandall.io, 1 +cranems.com.ua, 1 cranesafe.com, 1 cranforddental.com, 1 crapouill.es, 1 @@ -7774,7 +7775,6 @@ cryptoparty.at, 1 cryptoparty.dk, 1 cryptopartynewcastle.org, 1 cryptopartyutah.org, 1 -cryptophobia.nl, 0 cryptorival.com, 1 cryptoseb.pw, 1 cryptoshot.pw, 1 @@ -7813,7 +7813,7 @@ csmainframe.com, 1 csokolade.hu, 1 csp.ch, 1 cspeti.hu, 1 -cspvalidator.org, 0 +cspvalidator.org, 1 csru.net, 1 css.direct, 1 css.net, 1 @@ -8410,7 +8410,7 @@ dawoud.org, 1 dawson-floridavilla.co.uk, 1 day-peak.com, 1 daylightpirates.org, 1 -dayman.net, 0 +dayman.net, 1 days.one, 1 daysoftheyear.com, 1 db-sanity.com, 1 @@ -8878,7 +8878,6 @@ devzero.io, 1 dewaard.de, 1 dewalch.net, 1 dewapress.com, 1 -dewebwerf.nl, 1 dewinter.com, 1 dexalo.de, 1 dezeregio.nl, 1 @@ -9440,7 +9439,7 @@ domytermpaper.com, 1 domythesis.net, 1 domyzitrka.cz, 1 donabeneko.jp, 1 -donateaday.net, 0 +donateaday.net, 1 donfelino.tk, 0 dongkexue.com, 1 dongxuwang.com, 1 @@ -9678,6 +9677,7 @@ drjenafernandez.com, 1 drjoe.ca, 1 drjuanitacollier.com, 1 drkhsh.at, 1 +drkmtrx.xyz, 1 drlangsdon.com, 1 drmayakato.com, 1 drmcdaniel.com, 1 @@ -9849,6 +9849,7 @@ dustygroove.com, 1 dustyspokesbnb.ca, 1 dutch.desi, 1 dutch1.nl, 1 +dutchessuganda.com, 1 dutchrank.nl, 1 dutchwanderers.nl, 1 dutchweballiance.nl, 1 @@ -9978,6 +9979,7 @@ eames-clayton.us, 1 eapestudioweb.com, 1 earl.org.uk, 1 earlyyearshub.com, 1 +earmarks.gov, 1 earn.com, 1 earth-people.org, 1 earthsystemprediction.gov, 1 @@ -11982,13 +11984,13 @@ filhin.es, 1 filhodohomem.com, 1 filhomes.ph, 1 fili.org, 1 +filidorwiese.nl, 1 filingsmadeeasy.com, 1 filip-prochazka.com, 1 filippo.io, 1 filipsebesta.com, 1 filleritemsindia.com, 1 fillitupchallenge.eu, 1 -fillmysuitca.se, 1 fillo.sk, 1 film-tutorial.com, 1 film.photography, 1 @@ -13037,7 +13039,6 @@ gamblersgaming.eu, 1 game-files.net, 0 game-gentle.com, 1 game7.de, 1 -gamebits.net, 1 gamebrott.com, 1 gamecard-shop.nl, 1 gamecdn.com, 1 @@ -13618,6 +13619,7 @@ glenshere.com, 1 glidingshop.cz, 1 glidingshop.de, 1 glidingshop.eu, 1 +glittersjabloon.nl, 1 glloq.org, 1 glob-coin.com, 1 global-adult-webcams.com, 1 @@ -13661,6 +13663,7 @@ glueckskindter.de, 1 glutenfreelife.co.nz, 1 glyph.ws, 1 glyxins.com, 1 +gm-assicurazioni.it, 1 gm.search.yahoo.com, 0 gmail.com, 0 gmantra.org, 1 @@ -13816,7 +13819,6 @@ gorognyelv.hu, 1 gorschenin.com, 1 gosccs.com, 1 gosciencegirls.com, 1 -gosharewood.com, 1 goshawkdb.io, 1 goshin-group.co.jp, 1 gospelfollower.com, 1 @@ -13913,6 +13915,7 @@ grandcastles.co.uk, 1 grandchamproofing.com, 1 grandchene.ch, 1 grande.coffee, 1 +grandefratellonews.com, 1 grandeto.com, 1 grandjunctionbrewing.com, 1 grandmasfridge.org, 1 @@ -14298,6 +14301,7 @@ hachre.de, 1 hack.club, 1 hack.cz, 1 hackademix.net, 1 +hackanders.com, 1 hackattack.com, 1 hackbarth.guru, 1 hackbeil.name, 1 @@ -15684,7 +15688,7 @@ icsadviseurs.nl, 1 icsfinomornasco.gov.it, 1 icsfinomornasco.it, 1 ict-concept.nl, 0 -ict-crew.nl, 0 +ict-crew.nl, 1 ict-radar.com, 1 ict-radar.nl, 1 ictcareer.ch, 1 @@ -16429,6 +16433,7 @@ invisibles.ch, 1 invisionita.com, 1 invisiverse.com, 1 invitescene.com, 1 +invitethemhome.com, 1 invkao.com, 1 invoiced.com, 1 invoicefinance.com, 1 @@ -16486,7 +16491,6 @@ iplog.info, 1 ipmonitoring.hu, 1 ipmotion.ca, 1 ipnetworking.net, 1 -ipo-times.com, 1 ipokabu.net, 1 ipomue.com, 0 ipop.gr, 1 @@ -16512,7 +16516,6 @@ ir1s.com, 1 iranianholiday.com, 1 irayo.net, 1 irc-results.com, 1 -ircmett.de, 1 iready.ro, 1 ireef.tv, 1 irenekauer.com, 1 @@ -16691,6 +16694,7 @@ itchimes.com, 1 itchy.nl, 1 itchybrainscentral.com, 1 itcko.sk, 1 +itdashboard.gov, 1 itds-consulting.com, 1 itds-consulting.cz, 1 itds-consulting.eu, 1 @@ -16706,7 +16710,6 @@ itfh.eu, 1 itfix.cz, 1 itforge.nl, 1 ithenrik.com, 1 -itilo.de, 1 itiomassagem.com.br, 1 itis.gov, 1 itis4u.ch, 1 @@ -16916,7 +16919,7 @@ jamesheald.com, 1 jameshemmings.co.uk, 1 jameshost.net, 1 jameshunt.us, 0 -jamesj.me, 1 +jamesj.me, 0 jamesknd.uk, 0 jamesmarsh.net, 1 jamesmcdonald.com, 0 @@ -17158,6 +17161,7 @@ jet-stream.fr, 1 jetapi.org, 1 jetbbs.com, 1 jetbrains.pw, 1 +jetflex.de, 1 jetkittens.co.uk, 1 jetmirshatri.com, 1 jetsetboyz.net, 1 @@ -17224,7 +17228,6 @@ jino-jossy.appspot.com, 1 jinshuju.net, 1 jintaiyang123.org, 1 jiogo.com, 1 -jiosongs.com, 1 jirav.com, 1 jiripudil.cz, 1 jiveiaktivno.bg, 1 @@ -17565,7 +17568,6 @@ jugendsuenden.info, 1 jugh.de, 1 juhakoho.com, 1 juice.codes, 1 -juiced.gs, 1 juku-info.top, 1 juku-wing.jp, 1 jule-spil.dk, 1 @@ -18076,7 +18078,6 @@ ketosecology.co.uk, 1 kettner.com, 1 ketty-voyance.com, 1 kevinapease.com, 1 -kevinbowers.me, 1 kevincox.ca, 0 kevindekoninck.com, 0 kevinfoley.cc, 1 @@ -18305,6 +18306,7 @@ kiwipayments.com, 1 kiwiplace.com, 1 kj-prince.com, 1 kj1396.net, 1 +kj1397.com, 1 kjaer.io, 1 kjarni.cc, 1 kjarrval.is, 1 @@ -18839,7 +18841,6 @@ la-cave-a-nodo.fr, 1 la-compagnie-des-elfes.fr, 1 la-ganiere.com, 1 la-maison.ch, 1 -la-maison.eu, 1 la-petite-entreprise.com, 1 la-tourmaline.ch, 1 laassari.me, 1 @@ -18907,7 +18908,6 @@ lagerauftrag.info, 1 lagit.in, 1 laglab.org, 0 laguiadelvaron.com, 1 -laguinguette.fr, 1 lahora.com.ec, 1 lain.at, 1 laindonleisure.co.uk, 1 @@ -19357,7 +19357,6 @@ leowkahman.com, 1 lep.gov, 1 lepenetapeti.com, 1 lepiquillo.fr, 1 -leponton-lorient.fr, 1 leprado.com, 1 lepsos.com, 1 lereporter.ma, 1 @@ -19713,7 +19712,6 @@ lionlyrics.com, 1 lionsdeal.com, 1 lipartydepot.com, 1 lipex.com, 1 -lipo.lol, 1 lipoabaltimore.org, 1 liqd.net, 1 liquid.cz, 1 @@ -20251,7 +20249,6 @@ lunidea.ch, 1 lunidea.com, 1 lunight.ml, 1 lunis.net, 1 -lunix.io, 1 lunorian.is, 1 luoe.me, 1 luoh.cc, 1 @@ -20813,7 +20810,6 @@ marlonschultz.de, 1 marlosoft.net, 1 marmolesromero.com, 1 marmotte.love, 1 -maroc-bivouac.com, 1 marocemploi.co, 1 marocmail.ma, 1 marotero.com, 1 @@ -20856,7 +20852,6 @@ maru-life.com, 1 maruhoi.com, 1 marustat.ru, 1 marvelmoviemarathon.com, 1 -marvinkeller.de, 1 marxist.party, 1 marxmyths.org, 1 maryeclark.com, 1 @@ -20978,7 +20973,7 @@ matthiasott.com, 1 matthiasschwab.de, 1 matthiasweiler.de, 0 matthieuschlosser.fr, 1 -matthijssen.info, 0 +matthijssen.info, 1 mattia98.org, 1 mattiascibien.net, 1 mattisam.com, 1 @@ -21005,6 +21000,7 @@ mawidabp.com, 1 mawidaca.com, 1 max-moeglich.de, 1 max-went.pl, 1 +max.gov, 1 maxbruckner.de, 1 maxbruckner.org, 1 maxbytes.nl, 0 @@ -21218,7 +21214,6 @@ medicinia.com.br, 1 medicinskavranje.edu.rs, 1 medicocompetente.it, 1 medicoresponde.com.br, 1 -medifab.online, 1 medifi.com, 1 medigap-quote.net, 1 medinside.ch, 1 @@ -21640,6 +21635,7 @@ mike2k.de, 1 mikebelanger.ca, 1 mikeblog.site, 1 mikecb.org, 1 +mikedugan.org, 1 mikegarnett.co.uk, 1 mikegerwitz.com, 1 mikehamburg.com, 1 @@ -22054,7 +22050,6 @@ molti.hu, 1 molunerfinn.com, 1 molwick.com, 1 momentumdash.com, 1 -momfulfilled.com, 1 momirfarooq.com, 1 momozeit.de, 1 momstableonline.com, 1 @@ -22233,7 +22228,6 @@ motorbiketourhanoi.com, 1 motorpointarenacardiff.co.uk, 1 motorring.ru, 1 motorsplus.com, 0 -motorsportdiesel.com, 1 motoryachtclub-radolfzell.de, 1 motosikletevi.com, 1 motostorie.blog, 0 @@ -22292,6 +22286,7 @@ mpetroff.net, 1 mpg-universal.com, 1 mpg.ovh, 1 mpi-sa.fr, 1 +mpintaamalabanna.it, 1 mplanetphl.fr, 1 mplant.io, 1 mplicka.cz, 1 @@ -23013,7 +23008,6 @@ navstevnik.sk, 1 navycs.com, 1 nawir.de, 1 nawroth.info, 1 -nay.moe, 1 nayahe.ru, 1 nayanaas.com, 1 nazevfirmy.cz, 1 @@ -24348,6 +24342,7 @@ onlinelegalmarketing.com, 1 onlinelegalmedia.com, 1 onlinelighting.com.au, 1 onlinemarketingtraining.co.uk, 1 +onlinepokerspelen.be, 1 onlinerollout.de, 1 onlinestoreninjas.com, 1 onlineth.com, 0 @@ -24935,7 +24930,6 @@ pardnoy.com, 1 parentheseardenne.be, 1 parentinterview.com, 1 parentsintouch.co.uk, 1 -parfum-baza.ru, 1 pariga.co.uk, 1 paris-store.com, 1 parisderriere.fr, 1 @@ -25003,7 +24997,6 @@ pascal-bourhis.com, 1 pascal-bourhis.net, 1 pascal-kannchen.de, 1 pascal-wittmann.de, 1 -pascaline-jouis.fr, 1 pascalleguern.com, 1 pascalmathis.com, 1 pascalmathis.me, 1 @@ -25148,6 +25141,7 @@ paylike.io, 1 payloc.io, 1 payme.uz, 1 payment-network.com, 1 +paymentaccuracy.gov, 1 payments.google.com, 1 paymerang.com, 1 paymill.com, 1 @@ -25730,7 +25724,6 @@ pixelrain.info, 1 pixelsquared.us, 1 pixelurbia.com, 1 pixelution.at, 1 -pixiv.cat, 1 pixiv.moe, 1 pixivimg.me, 1 pixlfox.com, 0 @@ -26675,7 +26668,6 @@ psychoco.net, 1 psychotherapie-kp.de, 1 psydix.org, 1 psyk.yt, 1 -psylab.cc, 1 psylab.re, 1 psylab.vip, 1 psynapse.net.au, 1 @@ -28268,6 +28260,7 @@ rulu.tv, 1 rulutv.com, 1 rumlager.de, 1 rummel-platz.de, 1 +rumplesinflatables.co.uk, 1 rumtaste.com, 1 rumtaste.de, 1 run-forrest.run, 1 @@ -28333,7 +28326,7 @@ ryanbritton.com, 1 ryancarter.co.uk, 1 ryanhowell.io, 0 ryankearney.com, 0 -ryanmcdonough.co.uk, 1 +ryanmcdonough.co.uk, 0 ryansmithphotography.com, 1 ryazan-region.ru, 1 rybox.info, 1 @@ -28785,7 +28778,7 @@ schlabbi.com, 0 schlachter.ca, 1 schlafguru.com, 1 schlagenhauf.info, 1 -schlagma.de, 1 +schlagma.de, 0 schlarp.com, 1 schlechtewitze.com, 1 schlossereieder.at, 1 @@ -28831,7 +28824,6 @@ schrauger.info, 1 schrauger.net, 1 schrauger.org, 1 schrauger.run, 1 -schraugerrun.com, 1 schreibers.ca, 1 schreinerei-jahreis.de, 1 schreinerei-wortmann.de, 1 @@ -29217,6 +29209,7 @@ sementes.gratis, 1 semianalog.com, 1 seminariruum.ee, 1 semiocast.com, 1 +semjonov.de, 1 semmlers.com, 1 semox.de, 1 semps-2fa.de, 1 @@ -29749,7 +29742,7 @@ silentkernel.fr, 0 silentmode.com, 1 silentundo.org, 1 silerfamily.net, 1 -siliconchip.me, 0 +siliconchip.me, 1 silkebaekken.no, 1 sillisalaatti.fi, 1 sillysnapz.co.uk, 1 @@ -30214,6 +30207,7 @@ smartandcom.ch, 1 smartandhappychild.ro, 1 smartbiz.vn, 1 smartcheck.gov, 1 +smartcleaningcenter.nl, 1 smartcpa.ca, 1 smarterskies.gov, 1 smartest-trading.com, 1 @@ -30679,7 +30673,6 @@ speechndraw.com, 1 speeddate.it, 0 speedof.me, 1 speedracer.ca, 1 -speeds.vip, 1 speedsportofhull.co.uk, 1 speedtailors.com, 1 speedtest-russia.com, 1 @@ -31012,6 +31005,7 @@ startuppeople.co.uk, 1 startupum.ru, 1 starwatches.eu, 1 starwins.co.uk, 1 +stassi.ch, 1 stastka.ch, 1 stat.ink, 1 state-of-body-and-mind.com, 1 @@ -31200,7 +31194,6 @@ stitchfiddle.com, 1 stivesbouncycastlehire.co.uk, 1 stjohnin.com, 1 stjohnmiami.org, 1 -stjohnsc.com, 1 stlu.de, 1 stlucasmuseum.org, 1 stlukesbrandon.org, 1 @@ -31965,6 +31958,7 @@ taunhanh.us, 1 tavolaquadrada.com.br, 1 tavsys.net, 1 taxaroo.com, 1 +taxi-24std.de, 1 taxi-chamonix.fr, 1 taxi-collectif.ch, 1 taxi-puck.pl, 1 @@ -32127,7 +32121,7 @@ techshift.eu, 1 techshift.nl, 1 techshift.se, 1 techtalks.no, 1 -techtuts.info, 0 +techtuts.info, 1 techunit.org, 1 techvalue.gr, 1 techviewforum.com, 1 @@ -32845,7 +32839,6 @@ ticketsvergleichen.de, 1 tickit.ca, 1 tid.jp, 1 tidycustoms.net, 1 -tie-online.org, 1 tielectric.ch, 1 tiendafetichista.com, 1 tiendavertigo.com, 1 @@ -33000,7 +32993,6 @@ tkn.tokyo, 1 tkts.cl, 1 tkusano.jp, 1 tkw01536.de, 1 -tlach.cz, 1 tlca.org, 1 tlcnet.info, 1 tlehseasyads.com, 1 @@ -33939,7 +33931,7 @@ u2fsecuritykeys.com, 1 u4mh-dev-accesscontroller.azurewebsites.net, 1 u4mh-dev-portal.azurewebsites.net, 1 u5b.de, 0 -u5r.nl, 0 +u5r.nl, 1 ua.search.yahoo.com, 0 uae-company-service.com, 1 uahs.org.uk, 1 @@ -34007,7 +33999,6 @@ uiberlay.cz, 1 uicchy.com, 1 uiop.link, 1 uitgeverij-deviant.nl, 1 -uitslagensoftware.nl, 1 ujob.com.cn, 1 uk.dating, 1 uk.search.yahoo.com, 0 @@ -34324,6 +34315,7 @@ uspsoig.gov, 1 ussm.gov, 1 ussuka.com, 1 ust.space, 1 +ustr.gov, 0 usualbeings.com, 1 uswitch.com, 1 ut-addicted.com, 1 @@ -34809,7 +34801,6 @@ vinicius.sl, 1 vinilosdecorativos.net, 1 vinner.com.au, 1 vinnie.gq, 1 -vinogradovka.com, 1 vinolli.de, 1 vinovum.net, 1 vintagebandfestival.org, 1 @@ -34909,6 +34900,7 @@ vivamusic.es, 1 vivanosports.com.br, 1 vivatv.com.tw, 1 vivendi.de, 1 +vivianmaier.cn, 1 vivid-academy.com, 1 vividinflatables.co.uk, 1 vividlumen.com, 1 @@ -34990,9 +34982,11 @@ volcain.io, 1 volcanconcretos.com, 1 volga.us, 1 volgavibes.ru, 0 +voliere-info.nl, 0 volker-gropp.de, 1 volkergropp.de, 1 volkerwesselstransfer.nl, 1 +volkerwesselswave.nl, 1 volkswurst.de, 1 vollans.id.au, 1 voloevents.com, 1 @@ -35020,7 +35014,7 @@ vorodevops.com, 1 vos-fleurs.ch, 1 vos-fleurs.com, 1 vosgym.jp, 1 -voshod.org, 0 +voshod.org, 1 vosjesweb.nl, 1 vosky.fr, 1 vosn.de, 1 @@ -35224,7 +35218,6 @@ waonui.io, 1 warcraftjournal.org, 1 wardow.com, 1 warebouncycastles.co.uk, 1 -warekit.io, 1 warekon.com, 1 warekon.dk, 1 warenits.at, 1 @@ -35513,12 +35506,10 @@ wegotcookies.com, 1 wegvielfalt.de, 1 wehostdnn.com, 1 weibomiaopai.com, 1 -weicn.org, 1 weideheuvel.org, 1 weidmannfibertechnology.com, 1 weien.org, 1 weigelia.nl, 1 -weightreviews.com, 1 weiji.ga, 1 weiler.xyz, 0 weils.net, 1 @@ -35777,7 +35768,6 @@ wickrath.net, 1 widdleguy.com, 1 wideboxmacau.com, 0 widegab.com, 1 -wideinfo.org, 1 widemann.de, 1 widememory.com, 1 widmer.bz, 1 @@ -36063,10 +36053,8 @@ wootware.co.za, 1 worcade.net, 1 worcesterbouncycastlehire.co.uk, 1 worcesterbouncycastles.co.uk, 1 -worcesterdance.org, 1 worcesterfestival.co.uk, 1 word-grabber.com, 1 -wordbits.net, 1 wordcounter.net, 1 wordher.com, 1 wordlessecho.com, 1 @@ -36462,7 +36450,6 @@ xin-in.com, 1 xin-in.net, 1 xing-in.net, 1 xing.ml, 1 -xingiahanvisa.net, 1 xiqi.us, 1 xirion.net, 1 xiyu.it, 0 @@ -37341,7 +37328,6 @@ zokster.net, 1 zolokar.xyz, 1 zombiesecured.com, 1 zomerschoen.nl, 1 -zonadebolsa.es, 1 zone-produkte.de, 0 zone39.com, 1 zonecb.com, 1 From 1373cc1dac4510c47fcba9f2c817c380a4bf0e29 Mon Sep 17 00:00:00 2001 From: ffxbld Date: Mon, 12 Mar 2018 12:54:30 -0700 Subject: [PATCH 47/50] No bug, Automated HPKP preload list update from host bld-linux64-spot-302 - a=hpkp-update --- security/manager/ssl/StaticHPKPins.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/manager/ssl/StaticHPKPins.h b/security/manager/ssl/StaticHPKPins.h index 3497fa1e3a0b..9b78976b1a80 100644 --- a/security/manager/ssl/StaticHPKPins.h +++ b/security/manager/ssl/StaticHPKPins.h @@ -1163,4 +1163,4 @@ static const TransportSecurityPreload kPublicKeyPinningPreloadList[] = { static const int32_t kUnknownId = -1; -static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1529264935824000); +static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1529351485588000); From 120af4f0d40e6408666ee923b91ad3f25bd5c9f7 Mon Sep 17 00:00:00 2001 From: Margareta Eliza Balazs Date: Tue, 13 Mar 2018 01:07:25 +0200 Subject: [PATCH 48/50] Backed out changeset af023ff0275b (bug 1438912) for merge conflicts --- devtools/client/memory/components/Census.js | 1 - .../client/memory/components/DominatorTree.js | 1 - .../client/memory/components/Individuals.js | 1 - .../components/jit-optimizations.js | 1 - .../performance/components/waterfall-tree.js | 1 - .../shared/components/VirtualizedTree.js | 10 +---- .../test/mochitest/test_tree_06.html | 41 +++---------------- 7 files changed, 7 insertions(+), 49 deletions(-) diff --git a/devtools/client/memory/components/Census.js b/devtools/client/memory/components/Census.js index 11dc27bb7d29..1525c6f764a9 100644 --- a/devtools/client/memory/components/Census.js +++ b/devtools/client/memory/components/Census.js @@ -49,7 +49,6 @@ class Census extends Component { return Tree({ autoExpandDepth: 0, - preventNavigationOnArrowRight: false, focused: census.focused, getParent: node => { const parent = parentMap[node.id]; diff --git a/devtools/client/memory/components/DominatorTree.js b/devtools/client/memory/components/DominatorTree.js index d83f0cf03394..12c9dc8b37e7 100644 --- a/devtools/client/memory/components/DominatorTree.js +++ b/devtools/client/memory/components/DominatorTree.js @@ -134,7 +134,6 @@ class DominatorTree extends Component { return Tree({ key: "dominator-tree-tree", autoExpandDepth: DOMINATOR_TREE_AUTO_EXPAND_DEPTH, - preventNavigationOnArrowRight: false, focused: dominatorTree.focused, getParent: node => node instanceof DominatorTreeLazyChildren diff --git a/devtools/client/memory/components/Individuals.js b/devtools/client/memory/components/Individuals.js index e22affc3c705..c9ee79fd5fa9 100644 --- a/devtools/client/memory/components/Individuals.js +++ b/devtools/client/memory/components/Individuals.js @@ -35,7 +35,6 @@ class Individuals extends Component { return Tree({ key: "individuals-tree", autoExpandDepth: 0, - preventNavigationOnArrowRight: false, focused: individuals.focused, getParent: node => null, getChildren: node => [], diff --git a/devtools/client/performance/components/jit-optimizations.js b/devtools/client/performance/components/jit-optimizations.js index d3a49710caa5..109123d9fede 100644 --- a/devtools/client/performance/components/jit-optimizations.js +++ b/devtools/client/performance/components/jit-optimizations.js @@ -189,7 +189,6 @@ class JITOptimizations extends Component { return Tree({ autoExpandDepth, - preventNavigationOnArrowRight: false, getParent: node => { let site = getSite(node.id); let parent; diff --git a/devtools/client/performance/components/waterfall-tree.js b/devtools/client/performance/components/waterfall-tree.js index 6fd66006ba7f..c8eda9f69e57 100644 --- a/devtools/client/performance/components/waterfall-tree.js +++ b/devtools/client/performance/components/waterfall-tree.js @@ -163,7 +163,6 @@ class WaterfallTree extends Component { render() { return Tree({ - preventNavigationOnArrowRight: false, getRoots: this._getRoots, getParent: this._getParent, getChildren: this._getChildren, diff --git a/devtools/client/shared/components/VirtualizedTree.js b/devtools/client/shared/components/VirtualizedTree.js index bded3e958297..d2eb0f66af2d 100644 --- a/devtools/client/shared/components/VirtualizedTree.js +++ b/devtools/client/shared/components/VirtualizedTree.js @@ -198,10 +198,6 @@ class Tree extends Component { // Handle when item is activated with a keyboard (using Space or Enter) onActivate: PropTypes.func, - // Indicates if pressing ArrowRight key should only expand expandable node - // or if the selection should also move to the next node. - preventNavigationOnArrowRight: PropTypes.bool, - // The depth to which we should automatically expand new items. autoExpandDepth: PropTypes.number, @@ -232,7 +228,6 @@ class Tree extends Component { static get defaultProps() { return { autoExpandDepth: AUTO_EXPAND_DEPTH, - preventNavigationOnArrowRight: true, }; } @@ -507,10 +502,9 @@ class Tree extends Component { break; case "ArrowRight": - if (this.props.getChildren(this.props.focused).length && - !this.props.isExpanded(this.props.focused)) { + if (!this.props.isExpanded(this.props.focused)) { this._onExpand(this.props.focused); - } else if (!this.props.preventNavigationOnArrowRight) { + } else { this._focusNextNode(); } break; diff --git a/devtools/client/shared/components/test/mochitest/test_tree_06.html b/devtools/client/shared/components/test/mochitest/test_tree_06.html index f6790675d148..ad1b342f31e8 100644 --- a/devtools/client/shared/components/test/mochitest/test_tree_06.html +++ b/devtools/client/shared/components/test/mochitest/test_tree_06.html @@ -16,17 +16,12 @@ Test keyboard navigation with the Tree component.
 
 
         
     
diff --git a/devtools/client/memory/test/chrome/test_DominatorTreeItem_01.html b/devtools/client/memory/test/chrome/test_DominatorTreeItem_01.html index 6937e1fc3115..631c988a6ab3 100644 --- a/devtools/client/memory/test/chrome/test_DominatorTreeItem_01.html +++ b/devtools/client/memory/test/chrome/test_DominatorTreeItem_01.html @@ -16,11 +16,11 @@ Test that we don't display `JS::ubi::RootList` for the root, and instead show "G
         
         
     
diff --git a/devtools/client/memory/test/chrome/test_DominatorTree_01.html b/devtools/client/memory/test/chrome/test_DominatorTree_01.html index 518d3504c841..e6bf08c0c9bc 100644 --- a/devtools/client/memory/test/chrome/test_DominatorTree_01.html +++ b/devtools/client/memory/test/chrome/test_DominatorTree_01.html @@ -16,7 +16,7 @@ Test that we show a place holder for a subtree we are lazily fetching.
         
         
     
diff --git a/devtools/client/memory/test/chrome/test_DominatorTree_02.html b/devtools/client/memory/test/chrome/test_DominatorTree_02.html index ae8e80b1dcc3..e2159dcfb65d 100644 --- a/devtools/client/memory/test/chrome/test_DominatorTree_02.html +++ b/devtools/client/memory/test/chrome/test_DominatorTree_02.html @@ -16,7 +16,7 @@ Test that we show a link to load more children when some (but not all) are loade
         
         
     
diff --git a/devtools/client/memory/test/chrome/test_DominatorTree_03.html b/devtools/client/memory/test/chrome/test_DominatorTree_03.html index 2f75ed711daa..c51c2f67108c 100644 --- a/devtools/client/memory/test/chrome/test_DominatorTree_03.html +++ b/devtools/client/memory/test/chrome/test_DominatorTree_03.html @@ -16,7 +16,7 @@ Test that expanded DominatorTreeItems are correctly rendered and updated
         
         
     
diff --git a/devtools/client/memory/test/chrome/test_Heap_01.html b/devtools/client/memory/test/chrome/test_Heap_01.html index ebd9076ea805..e8efbd1935c9 100644 --- a/devtools/client/memory/test/chrome/test_Heap_01.html +++ b/devtools/client/memory/test/chrome/test_Heap_01.html @@ -15,7 +15,7 @@ Test that rendering a dominator tree error is handled correctly. diff --git a/devtools/client/memory/test/chrome/test_Heap_02.html b/devtools/client/memory/test/chrome/test_Heap_02.html index 630f7972d4e9..0dd1ba9ea8d9 100644 --- a/devtools/client/memory/test/chrome/test_Heap_02.html +++ b/devtools/client/memory/test/chrome/test_Heap_02.html @@ -14,7 +14,7 @@ Test that the currently selected view is rendered.
         
         
     
diff --git a/devtools/client/memory/test/chrome/test_Heap_03.html b/devtools/client/memory/test/chrome/test_Heap_03.html index d33a30e7e531..687707c39eab 100644 --- a/devtools/client/memory/test/chrome/test_Heap_03.html +++ b/devtools/client/memory/test/chrome/test_Heap_03.html @@ -15,12 +15,12 @@ but not in other dominator tree states.
         
         
     
diff --git a/devtools/client/memory/test/chrome/test_Heap_04.html b/devtools/client/memory/test/chrome/test_Heap_04.html index c80c0a6104a6..751a57228e8e 100644 --- a/devtools/client/memory/test/chrome/test_Heap_04.html +++ b/devtools/client/memory/test/chrome/test_Heap_04.html @@ -14,11 +14,11 @@ Test that we show the "hey you're not recording allocation stacks" message at th
         
         
     
diff --git a/devtools/client/memory/test/chrome/test_Heap_05.html b/devtools/client/memory/test/chrome/test_Heap_05.html index 4662e09e89f7..57406f619c71 100644 --- a/devtools/client/memory/test/chrome/test_Heap_05.html +++ b/devtools/client/memory/test/chrome/test_Heap_05.html @@ -14,11 +14,11 @@ Test that we show a message when the census results are empty.
         
         
     
diff --git a/devtools/client/memory/test/chrome/test_List_01.html b/devtools/client/memory/test/chrome/test_List_01.html index a3fd2f70a99f..e50790ec79b4 100644 --- a/devtools/client/memory/test/chrome/test_List_01.html +++ b/devtools/client/memory/test/chrome/test_List_01.html @@ -15,7 +15,7 @@ Test to verify the delete button calls the onDelete handler for an item
         
         
     
diff --git a/devtools/client/memory/test/chrome/test_ShortestPaths_01.html b/devtools/client/memory/test/chrome/test_ShortestPaths_01.html index b0bace20c4b0..fdecde765a7f 100644 --- a/devtools/client/memory/test/chrome/test_ShortestPaths_01.html +++ b/devtools/client/memory/test/chrome/test_ShortestPaths_01.html @@ -23,11 +23,11 @@ Test that the ShortestPaths component properly renders a graph of the merged sho
         
         
     
diff --git a/devtools/client/memory/test/chrome/test_ShortestPaths_02.html b/devtools/client/memory/test/chrome/test_ShortestPaths_02.html index 5b48bd49f6a6..501cffc9f79c 100644 --- a/devtools/client/memory/test/chrome/test_ShortestPaths_02.html +++ b/devtools/client/memory/test/chrome/test_ShortestPaths_02.html @@ -23,11 +23,11 @@ Test that the ShortestPaths component renders a suggestion to select a node when
         
         
     
diff --git a/devtools/client/memory/test/chrome/test_SnapshotListItem_01.html b/devtools/client/memory/test/chrome/test_SnapshotListItem_01.html index f4796c97e482..c5a07e0be96c 100644 --- a/devtools/client/memory/test/chrome/test_SnapshotListItem_01.html +++ b/devtools/client/memory/test/chrome/test_SnapshotListItem_01.html @@ -16,11 +16,11 @@ path.
         
         
     
diff --git a/devtools/client/memory/test/chrome/test_Toolbar_01.html b/devtools/client/memory/test/chrome/test_Toolbar_01.html index c2c234e09e90..bb16fefe2ff9 100644 --- a/devtools/client/memory/test/chrome/test_Toolbar_01.html +++ b/devtools/client/memory/test/chrome/test_Toolbar_01.html @@ -14,14 +14,14 @@ Test that the Toolbar component shows the view switcher only at the appropriate
         
         
     
diff --git a/devtools/client/memory/test/chrome/test_TreeMap_01.html b/devtools/client/memory/test/chrome/test_TreeMap_01.html index 15be48b5e164..d35134bf9772 100644 --- a/devtools/client/memory/test/chrome/test_TreeMap_01.html +++ b/devtools/client/memory/test/chrome/test_TreeMap_01.html @@ -20,11 +20,11 @@ Test that the Tree Map correctly renders onto 2 managed canvases.
     
     
   
diff --git a/devtools/client/memory/test/unit/head.js b/devtools/client/memory/test/unit/head.js index a58329e4f24c..81ce6423cb96 100644 --- a/devtools/client/memory/test/unit/head.js +++ b/devtools/client/memory/test/unit/head.js @@ -17,6 +17,7 @@ var { FileUtils } = require("resource://gre/modules/FileUtils.jsm"); var { TargetFactory } = require("devtools/client/framework/target"); var promise = require("promise"); var defer = require("devtools/shared/defer"); +var { Task } = require("devtools/shared/task"); var { expectState } = require("devtools/server/actors/common"); var HeapSnapshotFileUtils = require("devtools/shared/heapsnapshot/HeapSnapshotFileUtils"); var HeapAnalysesClient = require("devtools/shared/heapsnapshot/HeapAnalysesClient"); @@ -49,28 +50,28 @@ function StubbedMemoryFront() { this.dbg = initDebugger(); } -StubbedMemoryFront.prototype.attach = async function () { +StubbedMemoryFront.prototype.attach = Task.async(function* () { this.state = "attached"; -}; +}); -StubbedMemoryFront.prototype.detach = async function () { +StubbedMemoryFront.prototype.detach = Task.async(function* () { this.state = "detached"; -}; +}); StubbedMemoryFront.prototype.saveHeapSnapshot = expectState("attached", - async function () { + Task.async(function* () { return ChromeUtils.saveHeapSnapshot({ runtime: true }); - }, "saveHeapSnapshot"); + }), "saveHeapSnapshot"); StubbedMemoryFront.prototype.startRecordingAllocations = expectState("attached", - async function () { + Task.async(function* () { this.recordingAllocations = true; - }); + })); StubbedMemoryFront.prototype.stopRecordingAllocations = expectState("attached", - async function () { + Task.async(function* () { this.recordingAllocations = false; - }); + })); function waitUntilSnapshotState(store, expected) { let predicate = () => { @@ -119,11 +120,11 @@ function waitUntilCensusState(store, getCensus, expected) { return waitUntilState(store, predicate); } -async function createTempFile() { +function* createTempFile() { let file = FileUtils.getFile("TmpD", ["tmp.fxsnapshot"]); file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); let destPath = file.path; - let stat = await OS.File.stat(destPath); + let stat = yield OS.File.stat(destPath); ok(stat.size === 0, "new file is 0 bytes at start"); return destPath; } diff --git a/devtools/client/memory/test/unit/test_action-clear-snapshots_01.js b/devtools/client/memory/test/unit/test_action-clear-snapshots_01.js index cbc880ecc407..47635a9b23d2 100644 --- a/devtools/client/memory/test/unit/test_action-clear-snapshots_01.js +++ b/devtools/client/memory/test/unit/test_action-clear-snapshots_01.js @@ -9,15 +9,15 @@ let { takeSnapshotAndCensus, clearSnapshots } = require("devtools/client/memory/ let { actions } = require("devtools/client/memory/constants"); const { treeMapState } = require("devtools/client/memory/constants"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.treeMap, [treeMapState.SAVED]); + yield waitUntilCensusState(store, s => s.treeMap, [treeMapState.SAVED]); ok(true, "snapshot created"); ok(true, "dispatch clearSnapshots action"); @@ -26,11 +26,11 @@ add_task(async function () { waitUntilAction(store, actions.DELETE_SNAPSHOTS_END) ]); dispatch(clearSnapshots(heapWorker)); - await deleteEvents; + yield deleteEvents; ok(true, "received delete snapshots events"); equal(getState().snapshots.length, 0, "no snapshot remaining"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action-clear-snapshots_02.js b/devtools/client/memory/test/unit/test_action-clear-snapshots_02.js index b2ef780512f2..7cd6984c5972 100644 --- a/devtools/client/memory/test/unit/test_action-clear-snapshots_02.js +++ b/devtools/client/memory/test/unit/test_action-clear-snapshots_02.js @@ -8,10 +8,10 @@ let { takeSnapshotAndCensus, clearSnapshots, takeSnapshot } = require("devtools/client/memory/actions/snapshot"); let { snapshotState: states, treeMapState, actions } = require("devtools/client/memory/constants"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; @@ -19,8 +19,8 @@ add_task(async function () { dispatch(takeSnapshotAndCensus(front, heapWorker)); ok(true, "create a snapshot in SAVED state"); dispatch(takeSnapshot(front)); - await waitUntilSnapshotState(store, [states.SAVED, states.SAVED]); - await waitUntilCensusState(store, snapshot => snapshot.treeMap, + yield waitUntilSnapshotState(store, [states.SAVED, states.SAVED]); + yield waitUntilCensusState(store, snapshot => snapshot.treeMap, [treeMapState.SAVED, null]); ok(true, "snapshots created with expected states"); @@ -30,7 +30,7 @@ add_task(async function () { waitUntilAction(store, actions.DELETE_SNAPSHOTS_END) ]); dispatch(clearSnapshots(heapWorker)); - await deleteEvents; + yield deleteEvents; ok(true, "received delete snapshots events"); equal(getState().snapshots.length, 1, "one snapshot remaining"); @@ -41,5 +41,5 @@ add_task(async function () { "remaining snapshot doesn't have a census property"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action-clear-snapshots_03.js b/devtools/client/memory/test/unit/test_action-clear-snapshots_03.js index 027f6c9da25e..ba97ec5de898 100644 --- a/devtools/client/memory/test/unit/test_action-clear-snapshots_03.js +++ b/devtools/client/memory/test/unit/test_action-clear-snapshots_03.js @@ -8,25 +8,25 @@ let { takeSnapshotAndCensus, clearSnapshots } = require("devtools/client/memory/actions/snapshot"); let { snapshotState: states, treeMapState, actions } = require("devtools/client/memory/constants"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; ok(true, "create a snapshot with a treeMap"); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilSnapshotState(store, [states.SAVED]); + yield waitUntilSnapshotState(store, [states.SAVED]); ok(true, "snapshot created with a SAVED state"); - await waitUntilCensusState(store, snapshot => snapshot.treeMap, + yield waitUntilCensusState(store, snapshot => snapshot.treeMap, [treeMapState.SAVED]); ok(true, "treeMap created with a SAVED state"); ok(true, "set snapshot state to error"); let id = getState().snapshots[0].id; dispatch({ type: actions.SNAPSHOT_ERROR, id, error: new Error("_") }); - await waitUntilSnapshotState(store, [states.ERROR]); + yield waitUntilSnapshotState(store, [states.ERROR]); ok(true, "snapshot set to error state"); ok(true, "dispatch clearSnapshots action"); @@ -35,10 +35,10 @@ add_task(async function () { waitUntilAction(store, actions.DELETE_SNAPSHOTS_END) ]); dispatch(clearSnapshots(heapWorker)); - await deleteEvents; + yield deleteEvents; ok(true, "received delete snapshots events"); equal(getState().snapshots.length, 0, "error snapshot deleted"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action-clear-snapshots_04.js b/devtools/client/memory/test/unit/test_action-clear-snapshots_04.js index 536baf83d690..70c90b4b856d 100644 --- a/devtools/client/memory/test/unit/test_action-clear-snapshots_04.js +++ b/devtools/client/memory/test/unit/test_action-clear-snapshots_04.js @@ -8,10 +8,10 @@ let { takeSnapshotAndCensus, clearSnapshots } = require("devtools/client/memory/actions/snapshot"); let { snapshotState: states, actions, treeMapState } = require("devtools/client/memory/constants"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; @@ -19,14 +19,14 @@ add_task(async function () { dispatch(takeSnapshotAndCensus(front, heapWorker)); dispatch(takeSnapshotAndCensus(front, heapWorker)); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, snapshot => snapshot.treeMap, + yield waitUntilCensusState(store, snapshot => snapshot.treeMap, [treeMapState.SAVED, treeMapState.SAVED, treeMapState.SAVED]); ok(true, "snapshots created with a saved census"); ok(true, "set first snapshot state to error"); let id = getState().snapshots[0].id; dispatch({ type: actions.SNAPSHOT_ERROR, id, error: new Error("_") }); - await waitUntilSnapshotState(store, + yield waitUntilSnapshotState(store, [states.ERROR, states.READ, states.READ]); ok(true, "first snapshot set to error state"); @@ -36,11 +36,11 @@ add_task(async function () { waitUntilAction(store, actions.DELETE_SNAPSHOTS_END) ]); dispatch(clearSnapshots(heapWorker)); - await deleteEvents; + yield deleteEvents; ok(true, "received delete snapshots events"); equal(getState().snapshots.length, 0, "no snapshot remaining"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action-clear-snapshots_05.js b/devtools/client/memory/test/unit/test_action-clear-snapshots_05.js index fce1af5a7358..b5c579341584 100644 --- a/devtools/client/memory/test/unit/test_action-clear-snapshots_05.js +++ b/devtools/client/memory/test/unit/test_action-clear-snapshots_05.js @@ -8,10 +8,10 @@ let { takeSnapshotAndCensus, clearSnapshots } = require("devtools/client/memory/actions/snapshot"); let { actions, treeMapState } = require("devtools/client/memory/constants"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; @@ -19,7 +19,7 @@ add_task(async function () { dispatch(takeSnapshotAndCensus(front, heapWorker)); dispatch(takeSnapshotAndCensus(front, heapWorker)); ok(true, "snapshots created with a saved census"); - await waitUntilCensusState(store, snapshot => snapshot.treeMap, + yield waitUntilCensusState(store, snapshot => snapshot.treeMap, [treeMapState.SAVED, treeMapState.SAVED]); let errorHeapWorker = { @@ -36,10 +36,10 @@ add_task(async function () { waitUntilAction(store, actions.SNAPSHOT_ERROR), ]); dispatch(clearSnapshots(errorHeapWorker)); - await deleteEvents; + yield deleteEvents; ok(true, "received delete snapshots and snapshot error events"); equal(getState().snapshots.length, 0, "no snapshot remaining"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action-clear-snapshots_06.js b/devtools/client/memory/test/unit/test_action-clear-snapshots_06.js index 44858a6cc7c1..889c49e32f5f 100644 --- a/devtools/client/memory/test/unit/test_action-clear-snapshots_06.js +++ b/devtools/client/memory/test/unit/test_action-clear-snapshots_06.js @@ -18,17 +18,17 @@ const { selectSnapshotForDiffingAndRefresh } = require("devtools/client/memory/actions/diffing"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; ok(true, "create 2 snapshots with a saved census"); dispatch(takeSnapshotAndCensus(front, heapWorker)); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, snapshot => snapshot.treeMap, + yield waitUntilCensusState(store, snapshot => snapshot.treeMap, [treeMapState.SAVED, treeMapState.SAVED]); ok(true, "snapshots created with a saved census"); @@ -40,7 +40,7 @@ add_task(async function () { ok(getState().diffing, "We should be in diffing view"); - await waitUntilAction(store, actions.TAKE_CENSUS_DIFF_END); + yield waitUntilAction(store, actions.TAKE_CENSUS_DIFF_END); ok(true, "Received TAKE_CENSUS_DIFF_END action"); ok(true, "Dispatch clearSnapshots action"); @@ -49,12 +49,12 @@ add_task(async function () { waitUntilAction(store, actions.DELETE_SNAPSHOTS_END) ]); dispatch(clearSnapshots(heapWorker)); - await deleteEvents; + yield deleteEvents; ok(true, "received delete snapshots events"); ok(getState().snapshots.length === 0, "Snapshots array should be empty"); ok(!getState().diffing, "We should no longer be diffing"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action-export-snapshot.js b/devtools/client/memory/test/unit/test_action-export-snapshot.js index 6a13fdb58a99..a26869dfb2ee 100644 --- a/devtools/client/memory/test/unit/test_action-export-snapshot.js +++ b/devtools/client/memory/test/unit/test_action-export-snapshot.js @@ -9,16 +9,16 @@ let { exportSnapshot } = require("devtools/client/memory/actions/io"); let { takeSnapshotAndCensus } = require("devtools/client/memory/actions/snapshot"); let { actions, treeMapState } = require("devtools/client/memory/constants"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; - let destPath = await createTempFile(); + let destPath = yield createTempFile(); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, snapshot => snapshot.treeMap, + yield waitUntilCensusState(store, snapshot => snapshot.treeMap, [treeMapState.SAVED]); let exportEvents = Promise.all([ @@ -26,12 +26,12 @@ add_task(async function () { waitUntilAction(store, actions.EXPORT_SNAPSHOT_END) ]); dispatch(exportSnapshot(getState().snapshots[0], destPath)); - await exportEvents; + yield exportEvents; - let stat = await OS.File.stat(destPath); + let stat = yield OS.File.stat(destPath); info(stat.size); ok(stat.size > 0, "destination file is more than 0 bytes"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action-filter-02.js b/devtools/client/memory/test/unit/test_action-filter-02.js index 11f7549d3257..f69201ba3051 100644 --- a/devtools/client/memory/test/unit/test_action-filter-02.js +++ b/devtools/client/memory/test/unit/test_action-filter-02.js @@ -10,10 +10,10 @@ let { setFilterStringAndRefresh } = require("devtools/client/memory/actions/filt let { takeSnapshotAndCensus, selectSnapshotAndRefresh } = require("devtools/client/memory/actions/snapshot"); let { changeView } = require("devtools/client/memory/actions/view"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; @@ -25,18 +25,18 @@ add_task(async function () { dispatch(takeSnapshotAndCensus(front, heapWorker)); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, snapshot => snapshot.census, + yield waitUntilCensusState(store, snapshot => snapshot.census, [censusState.SAVED, censusState.SAVED, censusState.SAVED]); ok(true, "saved 3 snapshots and took a census of each of them"); dispatch(setFilterStringAndRefresh("str", heapWorker)); - await waitUntilCensusState(store, snapshot => snapshot.census, + yield waitUntilCensusState(store, snapshot => snapshot.census, [censusState.SAVED, censusState.SAVED, censusState.SAVING]); ok(true, "setting filter string should recompute the selected snapshot's census"); equal(getState().filter, "str", "now inverted"); - await waitUntilCensusState(store, snapshot => snapshot.census, + yield waitUntilCensusState(store, snapshot => snapshot.census, [censusState.SAVED, censusState.SAVED, censusState.SAVED]); equal(getState().snapshots[0].census.filter, null); @@ -44,11 +44,11 @@ add_task(async function () { equal(getState().snapshots[2].census.filter, "str"); dispatch(selectSnapshotAndRefresh(heapWorker, getState().snapshots[1].id)); - await waitUntilCensusState(store, snapshot => snapshot.census, + yield waitUntilCensusState(store, snapshot => snapshot.census, [censusState.SAVED, censusState.SAVING, censusState.SAVED]); ok(true, "selecting non-inverted census should trigger a recompute"); - await waitUntilCensusState(store, snapshot => snapshot.census, + yield waitUntilCensusState(store, snapshot => snapshot.census, [censusState.SAVED, censusState.SAVED, censusState.SAVED]); equal(getState().snapshots[0].census.filter, null); @@ -56,5 +56,5 @@ add_task(async function () { equal(getState().snapshots[2].census.filter, "str"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action-filter-03.js b/devtools/client/memory/test/unit/test_action-filter-03.js index 51fced580160..23fa6d5cdb50 100644 --- a/devtools/client/memory/test/unit/test_action-filter-03.js +++ b/devtools/client/memory/test/unit/test_action-filter-03.js @@ -11,21 +11,21 @@ let { setFilterString, setFilterStringAndRefresh } = require("devtools/client/me let { takeSnapshotAndCensus } = require("devtools/client/memory/actions/snapshot"); let { changeView } = require("devtools/client/memory/actions/view"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; dispatch(changeView(viewState.CENSUS)); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilSnapshotState(store, [states.SAVING]); + yield waitUntilSnapshotState(store, [states.SAVING]); dispatch(setFilterString("str")); - await waitUntilCensusState(store, snapshot => snapshot.census, + yield waitUntilCensusState(store, snapshot => snapshot.census, [censusState.SAVED]); equal(getState().filter, "str", "should want filtered trees"); @@ -33,18 +33,18 @@ add_task(async function () { "snapshot-we-were-in-the-middle-of-saving's census should be filtered"); dispatch(setFilterStringAndRefresh("", heapWorker)); - await waitUntilCensusState(store, snapshot => snapshot.census, + yield waitUntilCensusState(store, snapshot => snapshot.census, [censusState.SAVING]); ok(true, "changing filter string retriggers census"); ok(!getState().filter, "no longer filtering"); dispatch(setFilterString("obj")); - await waitUntilCensusState(store, snapshot => snapshot.census, + yield waitUntilCensusState(store, snapshot => snapshot.census, [censusState.SAVED]); equal(getState().filter, "obj", "filtering for obj now"); equal(getState().snapshots[0].census.filter, "obj", "census-we-were-in-the-middle-of-recomputing should be filtered again"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action-import-snapshot-and-census.js b/devtools/client/memory/test/unit/test_action-import-snapshot-and-census.js index 7a3d370c8581..182cc8ea6f49 100644 --- a/devtools/client/memory/test/unit/test_action-import-snapshot-and-census.js +++ b/devtools/client/memory/test/unit/test_action-import-snapshot-and-census.js @@ -12,23 +12,23 @@ let { actions, snapshotState: states, treeMapState } = require("devtools/client/ let { exportSnapshot, importSnapshotAndCensus } = require("devtools/client/memory/actions/io"); let { takeSnapshotAndCensus } = require("devtools/client/memory/actions/snapshot"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { subscribe, dispatch, getState } = store; - let destPath = await createTempFile(); + let destPath = yield createTempFile(); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.treeMap, [treeMapState.SAVED]); + yield waitUntilCensusState(store, s => s.treeMap, [treeMapState.SAVED]); let exportEvents = Promise.all([ waitUntilAction(store, actions.EXPORT_SNAPSHOT_START), waitUntilAction(store, actions.EXPORT_SNAPSHOT_END) ]); dispatch(exportSnapshot(getState().snapshots[0], destPath)); - await exportEvents; + yield exportEvents; // Now import our freshly exported snapshot let snapshotI = 0; @@ -58,7 +58,7 @@ add_task(async function () { let unsubscribe = subscribe(expectStates); dispatch(importSnapshotAndCensus(heapWorker, destPath)); - await waitUntilState(store, () => { + yield waitUntilState(store, () => { return snapshotI === snapshotStates.length && censusI === censusStates.length; }); diff --git a/devtools/client/memory/test/unit/test_action-import-snapshot-dominator-tree.js b/devtools/client/memory/test/unit/test_action-import-snapshot-dominator-tree.js index 9f770d280d73..d0c367f7dfd3 100644 --- a/devtools/client/memory/test/unit/test_action-import-snapshot-dominator-tree.js +++ b/devtools/client/memory/test/unit/test_action-import-snapshot-dominator-tree.js @@ -14,10 +14,10 @@ let { snapshotState, dominatorTreeState, viewState, treeMapState } = let { importSnapshotAndCensus } = require("devtools/client/memory/actions/io"); let { changeViewAndRefresh } = require("devtools/client/memory/actions/view"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { subscribe, dispatch, getState } = store; @@ -45,10 +45,10 @@ add_task(async function () { }; let unsubscribe = subscribe(expectStates); - const snapshotPath = await front.saveHeapSnapshot(); + const snapshotPath = yield front.saveHeapSnapshot(); dispatch(importSnapshotAndCensus(heapWorker, snapshotPath)); - await waitUntilState(store, () => i === expected.length); + yield waitUntilState(store, () => i === expected.length); unsubscribe(); equal(i, expected.length, "importSnapshotAndCensus() produces the correct " + "sequence of states in a snapshot"); diff --git a/devtools/client/memory/test/unit/test_action-select-snapshot.js b/devtools/client/memory/test/unit/test_action-select-snapshot.js index fa54b3fbc6a4..d257d78ddd47 100644 --- a/devtools/client/memory/test/unit/test_action-select-snapshot.js +++ b/devtools/client/memory/test/unit/test_action-select-snapshot.js @@ -10,22 +10,22 @@ let actions = require("devtools/client/memory/actions/snapshot"); let { snapshotState: states } = require("devtools/client/memory/constants"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); - await front.attach(); + yield front.attach(); let store = Store(); for (let i = 0; i < 5; i++) { store.dispatch(actions.takeSnapshot(front)); } - await waitUntilState(store, + yield waitUntilState(store, ({ snapshots }) => snapshots.length === 5 && snapshots.every(isDone)); for (let i = 0; i < 5; i++) { info(`Selecting snapshot[${i}]`); store.dispatch(actions.selectSnapshot(store.getState().snapshots[i].id)); - await waitUntilState(store, ({ snapshots }) => snapshots[i].selected); + yield waitUntilState(store, ({ snapshots }) => snapshots[i].selected); let { snapshots } = store.getState(); ok(snapshots[i].selected, `snapshot[${i}] selected`); diff --git a/devtools/client/memory/test/unit/test_action-set-display-and-refresh-01.js b/devtools/client/memory/test/unit/test_action-set-display-and-refresh-01.js index addebaee724d..159262c7321c 100644 --- a/devtools/client/memory/test/unit/test_action-set-display-and-refresh-01.js +++ b/devtools/client/memory/test/unit/test_action-set-display-and-refresh-01.js @@ -18,10 +18,10 @@ const { changeView } = require("devtools/client/memory/actions/view"); // We test setting an invalid display, which triggers an assertion failure. EXPECTED_DTU_ASSERT_FAILURE_COUNT = 1; -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; @@ -38,7 +38,7 @@ add_task(async function () { // Test invalid displays ok(getState().errors.length === 0, "No error actions in the queue."); dispatch(setCensusDisplayAndRefresh(heapWorker, {})); - await waitUntilState(store, () => getState().errors.length === 1); + yield waitUntilState(store, () => getState().errors.length === 1); ok(true, "Emits an error action when passing in an invalid display object"); equal(getState().censusDisplay.breakdown.by, "allocationStack", @@ -46,7 +46,7 @@ add_task(async function () { // Test new snapshots dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, snapshot => snapshot.census, + yield waitUntilCensusState(store, snapshot => snapshot.census, [censusState.SAVED]); equal(getState().snapshots[0].census.display, censusDisplays.allocationStack, @@ -54,10 +54,10 @@ add_task(async function () { // Updates when changing display during `SAVING` dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, snapshot => snapshot.census, + yield waitUntilCensusState(store, snapshot => snapshot.census, [censusState.SAVED, censusState.SAVING]); dispatch(setCensusDisplayAndRefresh(heapWorker, censusDisplays.coarseType)); - await waitUntilCensusState(store, snapshot => snapshot.census, + yield waitUntilCensusState(store, snapshot => snapshot.census, [censusState.SAVED, censusState.SAVED]); equal(getState().snapshots[1].census.display, censusDisplays.coarseType, "Changing display while saving a snapshot results " + @@ -65,10 +65,10 @@ add_task(async function () { // Updates when changing display during `SAVING_CENSUS` dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, snapshot => snapshot.census, + yield waitUntilCensusState(store, snapshot => snapshot.census, [censusState.SAVED, censusState.SAVED, censusState.SAVING]); dispatch(setCensusDisplayAndRefresh(heapWorker, censusDisplays.allocationStack)); - await waitUntilCensusState(store, snapshot => snapshot.census, + yield waitUntilCensusState(store, snapshot => snapshot.census, [censusState.SAVED, censusState.SAVED, censusState.SAVED]); equal(getState().snapshots[2].census.display, censusDisplays.allocationStack, "Display can be changed while saving census, stores updated display in snapshot"); @@ -76,16 +76,16 @@ add_task(async function () { // Updates census on currently selected snapshot when changing display ok(getState().snapshots[2].selected, "Third snapshot currently selected"); dispatch(setCensusDisplayAndRefresh(heapWorker, censusDisplays.coarseType)); - await waitUntilState(store, + yield waitUntilState(store, state => state.snapshots[2].census.state === censusState.SAVING); - await waitUntilState(store, + yield waitUntilState(store, state => state.snapshots[2].census.state === censusState.SAVED); equal(getState().snapshots[2].census.display, censusDisplays.coarseType, "Snapshot census updated when changing displays " + "after already generating one census"); dispatch(setCensusDisplayAndRefresh(heapWorker, censusDisplays.allocationStack)); - await waitUntilState(store, + yield waitUntilState(store, state => state.snapshots[2].census.state === censusState.SAVED); equal(getState().snapshots[2].census.display, censusDisplays.allocationStack, "Snapshot census updated when changing displays " + @@ -99,9 +99,9 @@ add_task(async function () { // Updates to current display when switching to stale snapshot. dispatch(selectSnapshotAndRefresh(heapWorker, getState().snapshots[1].id)); - await waitUntilCensusState(store, snapshot => snapshot.census, + yield waitUntilCensusState(store, snapshot => snapshot.census, [censusState.SAVED, censusState.SAVING, censusState.SAVED]); - await waitUntilCensusState(store, snapshot => snapshot.census, + yield waitUntilCensusState(store, snapshot => snapshot.census, [censusState.SAVED, censusState.SAVED, censusState.SAVED]); ok(getState().snapshots[1].selected, "Second snapshot selected currently"); @@ -109,5 +109,5 @@ add_task(async function () { "Second snapshot using `allocationStack` display and updated to correct display"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action-set-display-and-refresh-02.js b/devtools/client/memory/test/unit/test_action-set-display-and-refresh-02.js index 567c414d67c4..1146f1e8767d 100644 --- a/devtools/client/memory/test/unit/test_action-set-display-and-refresh-02.js +++ b/devtools/client/memory/test/unit/test_action-set-display-and-refresh-02.js @@ -23,10 +23,10 @@ let CUSTOM = { } }; -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; @@ -36,7 +36,7 @@ add_task(async function () { "CUSTOM display stored in display state."); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.census, [censusState.SAVED]); + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED]); equal(getState().snapshots[0].census.display, CUSTOM, "New snapshot stored CUSTOM display when done taking census"); diff --git a/devtools/client/memory/test/unit/test_action-set-display.js b/devtools/client/memory/test/unit/test_action-set-display.js index bea4c4c3d4cb..be555087c986 100644 --- a/devtools/client/memory/test/unit/test_action-set-display.js +++ b/devtools/client/memory/test/unit/test_action-set-display.js @@ -17,10 +17,10 @@ const { changeView } = require("devtools/client/memory/actions/view"); // We test setting an invalid display, which triggers an assertion failure. EXPECTED_DTU_ASSERT_FAILURE_COUNT = 1; -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; @@ -46,7 +46,7 @@ add_task(async function () { // Test new snapshots dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.census, [censusState.SAVED]); + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED]); equal(getState().snapshots[0].census.display, censusDisplays.allocationStack, "New snapshots use the current, non-default display"); }); diff --git a/devtools/client/memory/test/unit/test_action-take-census.js b/devtools/client/memory/test/unit/test_action-take-census.js index 256e2d7639cc..9da57d1104a1 100644 --- a/devtools/client/memory/test/unit/test_action-take-census.js +++ b/devtools/client/memory/test/unit/test_action-take-census.js @@ -15,16 +15,16 @@ var { changeView } = require("devtools/client/memory/actions/view"); // triggers an assertion failure. EXPECTED_DTU_ASSERT_FAILURE_COUNT = 1; -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); store.dispatch(changeView(viewState.CENSUS)); store.dispatch(actions.takeSnapshot(front)); - await waitUntilState(store, () => { + yield waitUntilState(store, () => { let snapshots = store.getState().snapshots; return snapshots.length === 1 && snapshots[0].state === states.SAVED; }); @@ -34,18 +34,18 @@ add_task(async function () { // Test error case of wrong state. store.dispatch(actions.takeCensus(heapWorker, snapshot.id)); - await waitUntilState(store, () => store.getState().errors.length === 1); + yield waitUntilState(store, () => store.getState().errors.length === 1); dumpn("Found error: " + store.getState().errors[0]); ok(/Assertion failure/.test(store.getState().errors[0]), "Error thrown when taking a census of a snapshot that has not been read."); store.dispatch(actions.readSnapshot(heapWorker, snapshot.id)); - await waitUntilState(store, () => store.getState().snapshots[0].state === states.READ); + yield waitUntilState(store, () => store.getState().snapshots[0].state === states.READ); store.dispatch(actions.takeCensus(heapWorker, snapshot.id)); - await waitUntilCensusState(store, s => s.census, [censusState.SAVING]); - await waitUntilCensusState(store, s => s.census, [censusState.SAVED]); + yield waitUntilCensusState(store, s => s.census, [censusState.SAVING]); + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED]); snapshot = store.getState().snapshots[0]; ok(snapshot.census, "Snapshot has census after saved census"); diff --git a/devtools/client/memory/test/unit/test_action-take-snapshot-and-census.js b/devtools/client/memory/test/unit/test_action-take-snapshot-and-census.js index 53b87cb277d5..bb300719a92e 100644 --- a/devtools/client/memory/test/unit/test_action-take-snapshot-and-census.js +++ b/devtools/client/memory/test/unit/test_action-take-snapshot-and-census.js @@ -11,10 +11,10 @@ let { snapshotState: states, treeMapState } = require("devtools/client/memory/constants"); let actions = require("devtools/client/memory/actions/snapshot"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let snapshotI = 0; @@ -44,7 +44,7 @@ add_task(async function () { let unsubscribe = store.subscribe(expectStates); store.dispatch(actions.takeSnapshotAndCensus(front, heapWorker)); - await waitUntilState(store, () => { + yield waitUntilState(store, () => { return snapshotI === snapshotStates.length && censusI === censusStates.length; }); diff --git a/devtools/client/memory/test/unit/test_action-take-snapshot.js b/devtools/client/memory/test/unit/test_action-take-snapshot.js index a246c17d532e..f344edcb3287 100644 --- a/devtools/client/memory/test/unit/test_action-take-snapshot.js +++ b/devtools/client/memory/test/unit/test_action-take-snapshot.js @@ -10,9 +10,9 @@ let actions = require("devtools/client/memory/actions/snapshot"); let { snapshotState: states } = require("devtools/client/memory/constants"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); - await front.attach(); + yield front.attach(); let store = Store(); let unsubscribe = store.subscribe(checkState); @@ -41,7 +41,7 @@ add_task(async function () { for (let i = 0; i < 4; i++) { store.dispatch(actions.takeSnapshot(front)); - await waitUntilState(store, () => foundPendingState && foundDoneState); + yield waitUntilState(store, () => foundPendingState && foundDoneState); // reset state trackers foundDoneState = foundPendingState = false; diff --git a/devtools/client/memory/test/unit/test_action-toggle-inverted-and-refresh-01.js b/devtools/client/memory/test/unit/test_action-toggle-inverted-and-refresh-01.js index 69fea4c666e7..3f3459c7c8bc 100644 --- a/devtools/client/memory/test/unit/test_action-toggle-inverted-and-refresh-01.js +++ b/devtools/client/memory/test/unit/test_action-toggle-inverted-and-refresh-01.js @@ -20,10 +20,10 @@ const { } = require("devtools/client/memory/actions/snapshot"); const { changeView } = require("devtools/client/memory/actions/view"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; @@ -37,7 +37,7 @@ add_task(async function () { dispatch(takeSnapshotAndCensus(front, heapWorker)); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.census, + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED, censusState.SAVED, censusState.SAVED]); ok(true, "saved 3 snapshots and took a census of each of them"); @@ -45,13 +45,13 @@ add_task(async function () { dispatch(setCensusDisplayAndRefresh(heapWorker, censusDisplays.invertedAllocationStack)); - await waitUntilCensusState(store, s => s.census, + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED, censusState.SAVED, censusState.SAVING]); ok(true, "toggling inverted should recompute the selected snapshot's census"); equal(getState().censusDisplay.inverted, true, "now inverted"); - await waitUntilCensusState(store, s => s.census, + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED, censusState.SAVED, censusState.SAVED]); equal(getState().snapshots[0].census.display.inverted, false); @@ -59,11 +59,11 @@ add_task(async function () { equal(getState().snapshots[2].census.display.inverted, true); dispatch(selectSnapshotAndRefresh(heapWorker, getState().snapshots[1].id)); - await waitUntilCensusState(store, s => s.census, + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED, censusState.SAVING, censusState.SAVED]); ok(true, "selecting non-inverted census should trigger a recompute"); - await waitUntilCensusState(store, s => s.census, + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED, censusState.SAVED, censusState.SAVED]); equal(getState().snapshots[0].census.display.inverted, false); @@ -71,5 +71,5 @@ add_task(async function () { equal(getState().snapshots[2].census.display.inverted, true); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action-toggle-inverted-and-refresh-02.js b/devtools/client/memory/test/unit/test_action-toggle-inverted-and-refresh-02.js index 6e63d0476b93..c5f594f7baac 100644 --- a/devtools/client/memory/test/unit/test_action-toggle-inverted-and-refresh-02.js +++ b/devtools/client/memory/test/unit/test_action-toggle-inverted-and-refresh-02.js @@ -14,10 +14,10 @@ const { } = require("devtools/client/memory/actions/census-display"); const { changeView } = require("devtools/client/memory/actions/view"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; @@ -28,12 +28,12 @@ add_task(async function () { "Should not have an inverted census display"); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilSnapshotState(store, [states.SAVING]); + yield waitUntilSnapshotState(store, [states.SAVING]); dispatch(setCensusDisplayAndRefresh(heapWorker, censusDisplays.invertedAllocationStack)); - await waitUntilCensusState(store, s => s.census, [censusState.SAVED]); + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED]); ok(getState().censusDisplay.inverted, "should want inverted trees"); @@ -41,17 +41,17 @@ add_task(async function () { "snapshot-we-were-in-the-middle-of-saving's census should be inverted"); dispatch(setCensusDisplayAndRefresh(heapWorker, censusDisplays.allocationStack)); - await waitUntilCensusState(store, s => s.census, [censusState.SAVING]); + yield waitUntilCensusState(store, s => s.census, [censusState.SAVING]); ok(true, "toggling inverted retriggers census"); ok(!getState().censusDisplay.inverted, "no longer inverted"); dispatch(setCensusDisplayAndRefresh(heapWorker, censusDisplays.invertedAllocationStack)); - await waitUntilCensusState(store, s => s.census, [censusState.SAVED]); + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED]); ok(getState().censusDisplay.inverted, "inverted again"); ok(getState().snapshots[0].census.display.inverted, "census-we-were-in-the-middle-of-recomputing should be inverted again"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action-toggle-recording-allocations.js b/devtools/client/memory/test/unit/test_action-toggle-recording-allocations.js index a4d73a502c11..ec3795016052 100644 --- a/devtools/client/memory/test/unit/test_action-toggle-recording-allocations.js +++ b/devtools/client/memory/test/unit/test_action-toggle-recording-allocations.js @@ -9,9 +9,9 @@ let { toggleRecordingAllocationStacks } = require("devtools/client/memory/actions/allocations"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; @@ -20,20 +20,20 @@ add_task(async function () { "not in the process of toggling by default"); dispatch(toggleRecordingAllocationStacks(front)); - await waitUntilState(store, () => getState().allocations.togglingInProgress); + yield waitUntilState(store, () => getState().allocations.togglingInProgress); ok(true, "`togglingInProgress` set to true when toggling on"); - await waitUntilState(store, () => !getState().allocations.togglingInProgress); + yield waitUntilState(store, () => !getState().allocations.togglingInProgress); equal(getState().allocations.recording, true, "now we are recording"); ok(front.recordingAllocations, "front is recording too"); dispatch(toggleRecordingAllocationStacks(front)); - await waitUntilState(store, () => getState().allocations.togglingInProgress); + yield waitUntilState(store, () => getState().allocations.togglingInProgress); ok(true, "`togglingInProgress` set to true when toggling off"); - await waitUntilState(store, () => !getState().allocations.togglingInProgress); + yield waitUntilState(store, () => !getState().allocations.togglingInProgress); equal(getState().allocations.recording, false, "now we are not recording"); ok(front.recordingAllocations, "front is not recording anymore"); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action_diffing_01.js b/devtools/client/memory/test/unit/test_action_diffing_01.js index dc29b12f0834..d62fbf8743e8 100644 --- a/devtools/client/memory/test/unit/test_action_diffing_01.js +++ b/devtools/client/memory/test/unit/test_action_diffing_01.js @@ -7,10 +7,10 @@ const { toggleDiffing } = require("devtools/client/memory/actions/diffing"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; @@ -23,5 +23,5 @@ add_task(async function () { equal(getState().diffing, null, "not diffing again after toggling again"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action_diffing_02.js b/devtools/client/memory/test/unit/test_action_diffing_02.js index 944f3392b0c3..6ba9d4ec4447 100644 --- a/devtools/client/memory/test/unit/test_action_diffing_02.js +++ b/devtools/client/memory/test/unit/test_action_diffing_02.js @@ -10,10 +10,10 @@ const { toggleDiffing } = require("devtools/client/memory/actions/diffing"); const { takeSnapshotAndCensus } = require("devtools/client/memory/actions/snapshot"); const { changeView } = require("devtools/client/memory/actions/view"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; @@ -24,7 +24,7 @@ add_task(async function () { dispatch(takeSnapshotAndCensus(front, heapWorker)); dispatch(takeSnapshotAndCensus(front, heapWorker)); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.census, + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED, censusState.SAVED, censusState.SAVED]); ok(getState().snapshots.some(s => s.selected), @@ -39,5 +39,5 @@ add_task(async function () { } heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action_diffing_03.js b/devtools/client/memory/test/unit/test_action_diffing_03.js index 96e91817f7d5..87244d792ab3 100644 --- a/devtools/client/memory/test/unit/test_action_diffing_03.js +++ b/devtools/client/memory/test/unit/test_action_diffing_03.js @@ -18,10 +18,10 @@ const { changeView } = require("devtools/client/memory/actions/view"); // trigger assertion failures. EXPECTED_DTU_ASSERT_FAILURE_COUNT = 2; -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; @@ -32,7 +32,7 @@ add_task(async function () { dispatch(takeSnapshot(front, heapWorker)); dispatch(takeSnapshot(front, heapWorker)); - await waitUntilSnapshotState(store, + yield waitUntilSnapshotState(store, [snapshotState.SAVED, snapshotState.SAVED, snapshotState.SAVED]); dispatch(takeSnapshot(front)); @@ -97,5 +97,5 @@ add_task(async function () { ok(threw, "Can't select more than two snapshots for diffing"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action_diffing_04.js b/devtools/client/memory/test/unit/test_action_diffing_04.js index 5d1f396b6c58..735a734150af 100644 --- a/devtools/client/memory/test/unit/test_action_diffing_04.js +++ b/devtools/client/memory/test/unit/test_action_diffing_04.js @@ -20,23 +20,23 @@ const { } = require("devtools/client/memory/actions/snapshot"); const { changeView } = require("devtools/client/memory/actions/view"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; dispatch(changeView(viewState.CENSUS)); equal(getState().diffing, null, "not diffing by default"); - const s1 = await dispatch(takeSnapshot(front, heapWorker)); - const s2 = await dispatch(takeSnapshot(front, heapWorker)); - const s3 = await dispatch(takeSnapshot(front, heapWorker)); + const s1 = yield dispatch(takeSnapshot(front, heapWorker)); + const s2 = yield dispatch(takeSnapshot(front, heapWorker)); + const s3 = yield dispatch(takeSnapshot(front, heapWorker)); dispatch(readSnapshot(heapWorker, s1)); dispatch(readSnapshot(heapWorker, s2)); dispatch(readSnapshot(heapWorker, s3)); - await waitUntilSnapshotState(store, + yield waitUntilSnapshotState(store, [snapshotState.READ, snapshotState.READ, snapshotState.READ]); dispatch(toggleDiffing()); @@ -51,13 +51,13 @@ add_task(async function () { equal(getState().diffing.secondSnapshotId, getState().snapshots[1].id, "Second snapshot selected."); - await waitUntilState(store, + yield waitUntilState(store, state => state.diffing.state === diffingState.TAKING_DIFF); ok(true, "Selecting two snapshots for diffing should trigger computing a diff."); - await waitUntilState(store, + yield waitUntilState(store, state => state.diffing.state === diffingState.TOOK_DIFF); ok(true, "And then the diff should complete."); ok(getState().diffing.census, "And we should have a census."); @@ -71,5 +71,5 @@ add_task(async function () { "And that census should have the correct inversion"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_action_diffing_05.js b/devtools/client/memory/test/unit/test_action_diffing_05.js index 201d24960a4d..74e47badee15 100644 --- a/devtools/client/memory/test/unit/test_action_diffing_05.js +++ b/devtools/client/memory/test/unit/test_action_diffing_05.js @@ -27,36 +27,36 @@ const { } = require("devtools/client/memory/actions/snapshot"); const { changeView } = require("devtools/client/memory/actions/view"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; dispatch(changeView(viewState.CENSUS)); - await dispatch(setCensusDisplayAndRefresh(heapWorker, + yield dispatch(setCensusDisplayAndRefresh(heapWorker, censusDisplays.allocationStack)); equal(getState().censusDisplay.inverted, false, "not inverted at start"); equal(getState().diffing, null, "not diffing by default"); - const s1 = await dispatch(takeSnapshot(front, heapWorker)); - const s2 = await dispatch(takeSnapshot(front, heapWorker)); - const s3 = await dispatch(takeSnapshot(front, heapWorker)); + const s1 = yield dispatch(takeSnapshot(front, heapWorker)); + const s2 = yield dispatch(takeSnapshot(front, heapWorker)); + const s3 = yield dispatch(takeSnapshot(front, heapWorker)); dispatch(readSnapshot(heapWorker, s1)); dispatch(readSnapshot(heapWorker, s2)); dispatch(readSnapshot(heapWorker, s3)); - await waitUntilSnapshotState(store, + yield waitUntilSnapshotState(store, [snapshotState.READ, snapshotState.READ, snapshotState.READ]); - await dispatch(toggleDiffing()); + yield dispatch(toggleDiffing()); dispatch(selectSnapshotForDiffingAndRefresh(heapWorker, getState().snapshots[0])); dispatch(selectSnapshotForDiffingAndRefresh(heapWorker, getState().snapshots[1])); - await waitUntilState(store, + yield waitUntilState(store, state => state.diffing.state === diffingState.TOOK_DIFF); const shouldTriggerRecompute = [ @@ -82,12 +82,12 @@ add_task(async function () { dumpn(`Testing that "${name}" triggers a diff recompute`); func(); - await waitUntilState(store, + yield waitUntilState(store, state => state.diffing.state === diffingState.TAKING_DIFF); ok(true, "triggered diff recompute."); - await waitUntilState(store, + yield waitUntilState(store, state => state.diffing.state === diffingState.TOOK_DIFF); ok(true, "And then the diff should complete."); @@ -105,5 +105,5 @@ add_task(async function () { } heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_dominator_trees_01.js b/devtools/client/memory/test/unit/test_dominator_trees_01.js index b92e445a01ed..8044a5543849 100644 --- a/devtools/client/memory/test/unit/test_dominator_trees_01.js +++ b/devtools/client/memory/test/unit/test_dominator_trees_01.js @@ -14,15 +14,15 @@ let { computeAndFetchDominatorTree, } = require("devtools/client/memory/actions/snapshot"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.treeMap, [treeMapState.SAVED]); + yield waitUntilCensusState(store, s => s.treeMap, [treeMapState.SAVED]); ok(!getState().snapshots[0].dominatorTree, "There shouldn't be a dominator tree model yet since it is not computed " + "until we switch to the dominators view."); @@ -33,26 +33,26 @@ add_task(async function () { "Should now have a dominator tree model for the selected snapshot"); // Wait for the dominator tree to start being computed. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.COMPUTING); ok(true, "The dominator tree started computing"); ok(!getState().snapshots[0].dominatorTree.root, "When the dominator tree is computing, we should not have its root"); // Wait for the dominator tree to finish computing and start being fetched. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.FETCHING); ok(true, "The dominator tree started fetching"); ok(!getState().snapshots[0].dominatorTree.root, "When the dominator tree is fetching, we should not have its root"); // Wait for the dominator tree to finish being fetched. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED); ok(true, "The dominator tree was fetched"); ok(getState().snapshots[0].dominatorTree.root, "When the dominator tree is loaded, we should have its root"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_dominator_trees_02.js b/devtools/client/memory/test/unit/test_dominator_trees_02.js index c7bd0854583e..c682964f53d2 100644 --- a/devtools/client/memory/test/unit/test_dominator_trees_02.js +++ b/devtools/client/memory/test/unit/test_dominator_trees_02.js @@ -18,15 +18,15 @@ const { changeViewAndRefresh } = require("devtools/client/memory/actions/view"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.treeMap, [treeMapState.SAVED]); + yield waitUntilCensusState(store, s => s.treeMap, [treeMapState.SAVED]); ok(!getState().snapshots[0].dominatorTree, "There shouldn't be a dominator tree model yet since it is not computed " + "until we switch to the dominators view."); @@ -36,26 +36,26 @@ add_task(async function () { "Should now have a dominator tree model for the selected snapshot"); // Wait for the dominator tree to start being computed. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.COMPUTING); ok(true, "The dominator tree started computing"); ok(!getState().snapshots[0].dominatorTree.root, "When the dominator tree is computing, we should not have its root"); // Wait for the dominator tree to finish computing and start being fetched. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.FETCHING); ok(true, "The dominator tree started fetching"); ok(!getState().snapshots[0].dominatorTree.root, "When the dominator tree is fetching, we should not have its root"); // Wait for the dominator tree to finish being fetched. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED); ok(true, "The dominator tree was fetched"); ok(getState().snapshots[0].dominatorTree.root, "When the dominator tree is loaded, we should have its root"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_dominator_trees_03.js b/devtools/client/memory/test/unit/test_dominator_trees_03.js index 1274076e175e..7779fdab2703 100644 --- a/devtools/client/memory/test/unit/test_dominator_trees_03.js +++ b/devtools/client/memory/test/unit/test_dominator_trees_03.js @@ -17,10 +17,10 @@ const { changeView } = require("devtools/client/memory/actions/view"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; @@ -31,7 +31,7 @@ add_task(async function () { dispatch(takeSnapshotAndCensus(front, heapWorker)); // Wait for the dominator tree to start being computed. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0] && state.snapshots[0].dominatorTree); equal(getState().snapshots[0].dominatorTree.state, dominatorTreeState.COMPUTING, @@ -40,19 +40,19 @@ add_task(async function () { "When the dominator tree is computing, we should not have its root"); // Wait for the dominator tree to finish computing and start being fetched. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.FETCHING); ok(true, "The dominator tree started fetching"); ok(!getState().snapshots[0].dominatorTree.root, "When the dominator tree is fetching, we should not have its root"); // Wait for the dominator tree to finish being fetched. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED); ok(true, "The dominator tree was fetched"); ok(getState().snapshots[0].dominatorTree.root, "When the dominator tree is loaded, we should have its root"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_dominator_trees_04.js b/devtools/client/memory/test/unit/test_dominator_trees_04.js index 82ba8767bed0..addd418fb7bb 100644 --- a/devtools/client/memory/test/unit/test_dominator_trees_04.js +++ b/devtools/client/memory/test/unit/test_dominator_trees_04.js @@ -18,10 +18,10 @@ const { changeView } = require("devtools/client/memory/actions/view"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); for (let intermediateSnapshotState of [states.SAVING, states.READING, states.READ]) { dumpn("Testing switching to the DOMINATOR_TREE view in the middle of the " + @@ -31,14 +31,14 @@ add_task(async function () { let { getState, dispatch } = store; dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilSnapshotState(store, [intermediateSnapshotState]); + yield waitUntilSnapshotState(store, [intermediateSnapshotState]); dispatch(changeView(viewState.DOMINATOR_TREE)); equal(getState().view.state, viewState.DOMINATOR_TREE, "We should now be in the DOMINATOR_TREE view"); // Wait for the dominator tree to start being computed. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0] && state.snapshots[0].dominatorTree); equal(getState().snapshots[0].dominatorTree.state, dominatorTreeState.COMPUTING, @@ -47,14 +47,14 @@ add_task(async function () { "When the dominator tree is computing, we should not have its root"); // Wait for the dominator tree to finish computing and start being fetched. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.FETCHING); ok(true, "The dominator tree started fetching"); ok(!getState().snapshots[0].dominatorTree.root, "When the dominator tree is fetching, we should not have its root"); // Wait for the dominator tree to finish being fetched. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED); ok(true, "The dominator tree was fetched"); ok(getState().snapshots[0].dominatorTree.root, @@ -62,5 +62,5 @@ add_task(async function () { } heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_dominator_trees_05.js b/devtools/client/memory/test/unit/test_dominator_trees_05.js index 202a17754c4e..850a0bd80b49 100644 --- a/devtools/client/memory/test/unit/test_dominator_trees_05.js +++ b/devtools/client/memory/test/unit/test_dominator_trees_05.js @@ -18,16 +18,16 @@ let { let { changeView } = require("devtools/client/memory/actions/view"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; dispatch(takeSnapshotAndCensus(front, heapWorker)); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.treeMap, + yield waitUntilCensusState(store, s => s.treeMap, [treeMapState.SAVED, treeMapState.SAVED]); ok(getState().snapshots[1].selected, "The second snapshot is selected"); @@ -36,7 +36,7 @@ add_task(async function () { dispatch(changeView(viewState.DOMINATOR_TREE)); // Wait for the dominator tree to finish being fetched. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[1].dominatorTree && state.snapshots[1].dominatorTree.state === dominatorTreeState.LOADED); ok(true, "The second snapshot's dominator tree was fetched"); @@ -46,11 +46,11 @@ add_task(async function () { // And now the first snapshot should have its dominator tree fetched and // computed because of the new selection. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree && state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED); ok(true, "The first snapshot's dominator tree was fetched"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_dominator_trees_06.js b/devtools/client/memory/test/unit/test_dominator_trees_06.js index b380a86e4fcb..4155c784ce1e 100644 --- a/devtools/client/memory/test/unit/test_dominator_trees_06.js +++ b/devtools/client/memory/test/unit/test_dominator_trees_06.js @@ -18,10 +18,10 @@ const DominatorTreeLazyChildren const { changeView } = require("devtools/client/memory/actions/view"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; @@ -29,7 +29,7 @@ add_task(async function () { dispatch(takeSnapshotAndCensus(front, heapWorker)); // Wait for the dominator tree to finish being fetched. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0] && state.snapshots[0].dominatorTree && state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED); @@ -72,7 +72,7 @@ add_task(async function () { "Fetching immediately dominated children should put us in the " + "INCREMENTAL_FETCHING state"); - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED); ok(true, "The dominator tree should go back to LOADED after the incremental " + @@ -121,5 +121,5 @@ add_task(async function () { ok(newNode.children, "And the new node should have the children attached"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_dominator_trees_07.js b/devtools/client/memory/test/unit/test_dominator_trees_07.js index 643749fd6643..52c78bd5f998 100644 --- a/devtools/client/memory/test/unit/test_dominator_trees_07.js +++ b/devtools/client/memory/test/unit/test_dominator_trees_07.js @@ -19,10 +19,10 @@ const DominatorTreeLazyChildren const { changeView } = require("devtools/client/memory/actions/view"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; @@ -30,7 +30,7 @@ add_task(async function () { dispatch(takeSnapshotAndCensus(front, heapWorker)); // Wait for the dominator tree to finish being fetched. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0] && state.snapshots[0].dominatorTree && state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED); @@ -94,7 +94,7 @@ add_task(async function () { "Fetching immediately dominated children should put us in the " + "INCREMENTAL_FETCHING state"); - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED); ok(true, "The dominator tree should go back to LOADED after the incremental " + @@ -138,5 +138,5 @@ add_task(async function () { "And the new node should have the new children attached"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_dominator_trees_08.js b/devtools/client/memory/test/unit/test_dominator_trees_08.js index 57625c7a6cd6..87bdacc6bce6 100644 --- a/devtools/client/memory/test/unit/test_dominator_trees_08.js +++ b/devtools/client/memory/test/unit/test_dominator_trees_08.js @@ -22,23 +22,23 @@ const { takeSnapshotAndCensus, } = require("devtools/client/memory/actions/snapshot"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; dispatch(changeView(viewState.DOMINATOR_TREE)); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.treeMap, [treeMapState.SAVED]); + yield waitUntilCensusState(store, s => s.treeMap, [treeMapState.SAVED]); ok(!getState().snapshots[0].dominatorTree, "There shouldn't be a dominator tree model yet since it is not computed " + "until we switch to the dominators view."); // Wait for the dominator tree to finish being fetched. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0] && state.snapshots[0].dominatorTree && state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED); @@ -57,13 +57,13 @@ add_task(async function () { heapWorker, labelDisplays.allocationStack)); - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.FETCHING); ok(true, "switching display types caused the dominator tree to be fetched " + "again."); - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED); equal(getState().snapshots[0].dominatorTree.display, labelDisplays.allocationStack, @@ -73,5 +73,5 @@ add_task(async function () { "as is our requested dominator tree display"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_dominator_trees_09.js b/devtools/client/memory/test/unit/test_dominator_trees_09.js index af1566b43178..1f6ab222baa9 100644 --- a/devtools/client/memory/test/unit/test_dominator_trees_09.js +++ b/devtools/client/memory/test/unit/test_dominator_trees_09.js @@ -22,23 +22,23 @@ const { takeSnapshotAndCensus, } = require("devtools/client/memory/actions/snapshot"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; dispatch(changeView(viewState.DOMINATOR_TREE)); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.treeMap, [treeMapState.SAVED]); + yield waitUntilCensusState(store, s => s.treeMap, [treeMapState.SAVED]); ok(!getState().snapshots[0].dominatorTree, "There shouldn't be a dominator tree model yet since it is not computed " + "until we switch to the dominators view."); // Wait for the dominator tree to start fetching. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0] && state.snapshots[0].dominatorTree && state.snapshots[0].dominatorTree.state === dominatorTreeState.FETCHING); @@ -59,7 +59,7 @@ add_task(async function () { labelDisplays.allocationStack)); // Wait for the dominator tree to finish being fetched. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED); equal(getState().snapshots[0].dominatorTree.display, @@ -70,5 +70,5 @@ add_task(async function () { "as is our requested dominator tree display"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_dominator_trees_10.js b/devtools/client/memory/test/unit/test_dominator_trees_10.js index 84496e107cdf..8d2ff9ddbf45 100644 --- a/devtools/client/memory/test/unit/test_dominator_trees_10.js +++ b/devtools/client/memory/test/unit/test_dominator_trees_10.js @@ -22,10 +22,10 @@ const { setLabelDisplayAndRefresh, } = require("devtools/client/memory/actions/label-display"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; @@ -33,7 +33,7 @@ add_task(async function () { dispatch(takeSnapshotAndCensus(front, heapWorker)); // Wait for the dominator tree to finish being fetched. - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0] && state.snapshots[0].dominatorTree && state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED); @@ -53,11 +53,11 @@ add_task(async function () { equal(getState().labelDisplay, labelDisplays.allocationStack, "Using labelDisplays.allocationStack now"); - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.FETCHING); ok(true, "We started re-fetching the dominator tree"); - await waitUntilState(store, state => + yield waitUntilState(store, state => state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED); ok(true, "The dominator tree was loaded again"); @@ -67,5 +67,5 @@ add_task(async function () { "Focused node is the same as before"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_individuals_01.js b/devtools/client/memory/test/unit/test_individuals_01.js index 899bb32c4e12..ba06b4cc28e8 100644 --- a/devtools/client/memory/test/unit/test_individuals_01.js +++ b/devtools/client/memory/test/unit/test_individuals_01.js @@ -24,10 +24,10 @@ const EXPECTED_INDIVIDUAL_STATES = [ individualsState.FETCHED, ]; -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; @@ -36,7 +36,7 @@ add_task(async function () { dispatch(changeView(viewState.CENSUS)); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.census, [censusState.SAVED]); + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED]); const root = getState().snapshots[0].census.report; ok(root, "Should have a census"); @@ -55,7 +55,7 @@ add_task(async function () { // Wait for each expected state. for (let state of EXPECTED_INDIVIDUAL_STATES) { - await waitUntilState(store, s => { + yield waitUntilState(store, s => { return s.view.state === viewState.INDIVIDUALS && s.individuals && s.individuals.state === state; @@ -69,5 +69,5 @@ add_task(async function () { "Should have a positive number of nodes"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_individuals_02.js b/devtools/client/memory/test/unit/test_individuals_02.js index 4f8d53b7dd54..f3b80c82ac69 100644 --- a/devtools/client/memory/test/unit/test_individuals_02.js +++ b/devtools/client/memory/test/unit/test_individuals_02.js @@ -27,10 +27,10 @@ const EXPECTED_INDIVIDUAL_STATES = [ individualsState.FETCHED, ]; -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; @@ -39,7 +39,7 @@ add_task(async function () { dispatch(changeView(viewState.CENSUS)); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.census, [censusState.SAVED]); + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED]); const root = getState().snapshots[0].census.report; ok(root, "Should have a census"); @@ -67,7 +67,7 @@ add_task(async function () { // Wait for each expected state. for (let state of EXPECTED_INDIVIDUAL_STATES) { - await waitUntilState(store, s => { + yield waitUntilState(store, s => { return s.view.state === viewState.INDIVIDUALS && s.individuals && s.individuals.state === state; @@ -81,5 +81,5 @@ add_task(async function () { "Should have a positive number of nodes"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_individuals_03.js b/devtools/client/memory/test/unit/test_individuals_03.js index 41b47b2b1651..12b7ff679b81 100644 --- a/devtools/client/memory/test/unit/test_individuals_03.js +++ b/devtools/client/memory/test/unit/test_individuals_03.js @@ -29,10 +29,10 @@ const EXPECTED_INDIVIDUAL_STATES = [ individualsState.FETCHED, ]; -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; @@ -42,14 +42,14 @@ add_task(async function () { dispatch(takeSnapshotAndCensus(front, heapWorker)); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.census, + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED, censusState.SAVED]); dispatch(changeView(viewState.DIFFING)); dispatch(selectSnapshotForDiffingAndRefresh(heapWorker, getState().snapshots[0])); dispatch(selectSnapshotForDiffingAndRefresh(heapWorker, getState().snapshots[1])); - await waitUntilState(store, state => { + yield waitUntilState(store, state => { return state.diffing && state.diffing.state === diffingState.TOOK_DIFF; }); @@ -73,7 +73,7 @@ add_task(async function () { reportLeafIndex)); for (let state of EXPECTED_INDIVIDUAL_STATES) { - await waitUntilState(store, s => { + yield waitUntilState(store, s => { return s.view.state === viewState.INDIVIDUALS && s.individuals && s.individuals.state === state; @@ -90,7 +90,7 @@ add_task(async function () { dispatch(popViewAndRefresh(heapWorker)); - await waitUntilState(store, state => { + yield waitUntilState(store, state => { return state.diffing && state.diffing.state === diffingState.TOOK_DIFF; }); @@ -99,5 +99,5 @@ add_task(async function () { "We have our census diff again after popping back to the last view"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_individuals_04.js b/devtools/client/memory/test/unit/test_individuals_04.js index 284d362421f2..4391508c5a8d 100644 --- a/devtools/client/memory/test/unit/test_individuals_04.js +++ b/devtools/client/memory/test/unit/test_individuals_04.js @@ -27,10 +27,10 @@ const EXPECTED_INDIVIDUAL_STATES = [ individualsState.FETCHED, ]; -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; @@ -40,7 +40,7 @@ add_task(async function () { // Take a snapshot and wait for the census to finish. dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.census, [censusState.SAVED]); + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED]); // Fetch individuals. @@ -60,7 +60,7 @@ add_task(async function () { reportLeafIndex)); for (let state of EXPECTED_INDIVIDUAL_STATES) { - await waitUntilState(store, s => { + yield waitUntilState(store, s => { return s.view.state === viewState.INDIVIDUALS && s.individuals && s.individuals.state === state; @@ -82,5 +82,5 @@ add_task(async function () { } heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_individuals_05.js b/devtools/client/memory/test/unit/test_individuals_05.js index 9e4de84aba2d..25ada7eb6d03 100644 --- a/devtools/client/memory/test/unit/test_individuals_05.js +++ b/devtools/client/memory/test/unit/test_individuals_05.js @@ -28,10 +28,10 @@ const EXPECTED_INDIVIDUAL_STATES = [ individualsState.FETCHED, ]; -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; @@ -41,7 +41,7 @@ add_task(async function () { // Take a snapshot and wait for the census to finish. dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.census, [censusState.SAVED]); + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED]); // Fetch individuals. @@ -61,7 +61,7 @@ add_task(async function () { reportLeafIndex)); for (let state of EXPECTED_INDIVIDUAL_STATES) { - await waitUntilState(store, s => { + yield waitUntilState(store, s => { return s.view.state === viewState.INDIVIDUALS && s.individuals && s.individuals.state === state; @@ -75,5 +75,5 @@ add_task(async function () { "Should have a positive number of nodes"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_individuals_06.js b/devtools/client/memory/test/unit/test_individuals_06.js index d8feca6b1ed0..9eafd335fb35 100644 --- a/devtools/client/memory/test/unit/test_individuals_06.js +++ b/devtools/client/memory/test/unit/test_individuals_06.js @@ -26,10 +26,10 @@ const EXPECTED_INDIVIDUAL_STATES = [ individualsState.FETCHED, ]; -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; @@ -38,7 +38,7 @@ add_task(async function () { // Take a snapshot and wait for the census to finish. dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.census, [censusState.SAVED]); + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED]); // Fetch individuals. @@ -58,7 +58,7 @@ add_task(async function () { reportLeafIndex)); for (let state of EXPECTED_INDIVIDUAL_STATES) { - await waitUntilState(store, s => { + yield waitUntilState(store, s => { return s.view.state === viewState.INDIVIDUALS && s.individuals && s.individuals.state === state; @@ -77,5 +77,5 @@ add_task(async function () { "Went back to census view"); heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_pop_view_01.js b/devtools/client/memory/test/unit/test_pop_view_01.js index 5d5eef8c1bf7..520e1608a863 100644 --- a/devtools/client/memory/test/unit/test_pop_view_01.js +++ b/devtools/client/memory/test/unit/test_pop_view_01.js @@ -25,10 +25,10 @@ const TEST_STATES = [ individualsState.FETCHED, ]; -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); const { getState, dispatch } = store; @@ -37,7 +37,7 @@ add_task(async function () { dispatch(changeView(viewState.CENSUS)); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.census, [censusState.SAVED]); + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED]); const root = getState().snapshots[0].census.report; ok(root, "Should have a census"); @@ -58,7 +58,7 @@ add_task(async function () { reportLeafIndex)); // Wait for the expected test state. - await waitUntilState(store, s => { + yield waitUntilState(store, s => { return s.view.state === viewState.INDIVIDUALS && s.individuals && s.individuals.state === state; @@ -67,12 +67,12 @@ add_task(async function () { // Pop back to the CENSUS state. dispatch(popViewAndRefresh(heapWorker)); - await waitUntilState(store, s => { + yield waitUntilState(store, s => { return s.view.state === viewState.CENSUS; }); ok(!getState().individuals, "Should no longer have individuals"); } heapWorker.destroy(); - await front.detach(); + yield front.detach(); }); diff --git a/devtools/client/memory/test/unit/test_utils-get-snapshot-totals.js b/devtools/client/memory/test/unit/test_utils-get-snapshot-totals.js index c42389b4c1a3..d0a113c46f6b 100644 --- a/devtools/client/memory/test/unit/test_utils-get-snapshot-totals.js +++ b/devtools/client/memory/test/unit/test_utils-get-snapshot-totals.js @@ -14,20 +14,20 @@ const { takeSnapshotAndCensus } = require("devtools/client/memory/actions/snapsh const { setCensusDisplayAndRefresh } = require("devtools/client/memory/actions/census-display"); const { changeView } = require("devtools/client/memory/actions/view"); -add_task(async function () { +add_task(function* () { let front = new StubbedMemoryFront(); let heapWorker = new HeapAnalysesClient(); - await front.attach(); + yield front.attach(); let store = Store(); let { getState, dispatch } = store; dispatch(changeView(viewState.CENSUS)); - await dispatch(setCensusDisplayAndRefresh(heapWorker, + yield dispatch(setCensusDisplayAndRefresh(heapWorker, censusDisplays.allocationStack)); dispatch(takeSnapshotAndCensus(front, heapWorker)); - await waitUntilCensusState(store, s => s.census, [censusState.SAVED]); + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED]); ok(!getState().snapshots[0].census.display.inverted, "Snapshot is not inverted"); @@ -46,8 +46,8 @@ add_task(async function () { dispatch(setCensusDisplayAndRefresh(heapWorker, censusDisplays.invertedAllocationStack)); - await waitUntilCensusState(store, s => s.census, [censusState.SAVING]); - await waitUntilCensusState(store, s => s.census, [censusState.SAVED]); + yield waitUntilCensusState(store, s => s.census, [censusState.SAVING]); + yield waitUntilCensusState(store, s => s.census, [censusState.SAVED]); ok(getState().snapshots[0].census.display.inverted, "Snapshot is inverted"); result = getSnapshotTotals(getState().snapshots[0].census); diff --git a/devtools/client/netmonitor/test/browser_net_view-source-debugger.js b/devtools/client/netmonitor/test/browser_net_view-source-debugger.js index ac4e12dc2335..bc98af104b23 100644 --- a/devtools/client/netmonitor/test/browser_net_view-source-debugger.js +++ b/devtools/client/netmonitor/test/browser_net_view-source-debugger.js @@ -61,8 +61,7 @@ async function checkClickOnNode(toolbox, frameLinkNode) { // wait for the promise to resolve await onJsDebuggerSelected; - let dbg = await toolbox.getPanelWhenReady("jsdebugger"); - await waitUntil(() => dbg._selectors.getSelectedSource(dbg._getState())); + let dbg = toolbox.getPanel("jsdebugger"); is( dbg._selectors.getSelectedSource(dbg._getState()).get("url"), url, diff --git a/devtools/client/performance/components/test/head.js b/devtools/client/performance/components/test/head.js index 7957e3710129..691d5ddabc7f 100644 --- a/devtools/client/performance/components/test/head.js +++ b/devtools/client/performance/components/test/head.js @@ -11,6 +11,7 @@ let { Assert } = require("resource://testing-common/Assert.jsm"); let { BrowserLoader } = ChromeUtils.import("resource://devtools/client/shared/browser-loader.js", {}); let defer = require("devtools/shared/defer"); let flags = require("devtools/shared/flags"); +let { Task } = require("devtools/shared/task"); let { TargetFactory } = require("devtools/client/framework/target"); let { Toolbox } = require("devtools/client/framework/toolbox"); diff --git a/devtools/client/performance/components/test/test_jit_optimizations_01.html b/devtools/client/performance/components/test/test_jit_optimizations_01.html index bc09d9845664..8e82bcf89a68 100644 --- a/devtools/client/performance/components/test/test_jit_optimizations_01.html +++ b/devtools/client/performance/components/test/test_jit_optimizations_01.html @@ -13,7 +13,7 @@ Test the rendering of the JIT Optimizations tree. Tests when jit data has observ
 
 
 
diff --git a/devtools/client/performance/modules/widgets/graphs.js b/devtools/client/performance/modules/widgets/graphs.js index 6af864ca2ee2..ff4ba5524369 100644 --- a/devtools/client/performance/modules/widgets/graphs.js +++ b/devtools/client/performance/modules/widgets/graphs.js @@ -7,6 +7,7 @@ * This file contains the base line graph that all Performance line graphs use. */ +const { Task } = require("devtools/shared/task"); const { extend } = require("devtools/shared/extend"); const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); const MountainGraphWidget = require("devtools/client/shared/widgets/MountainGraphWidget"); @@ -205,12 +206,12 @@ GraphsController.prototype = { * Saves rendering progress as a promise to be consumed by `destroy`, * to wait for cleaning up rendering during destruction. */ - async render(recordingData, resolution) { + render: Task.async(function* (recordingData, resolution) { // Get the previous render promise so we don't start rendering // until the previous render cycle completes, which can occur // especially when a recording is finished, and triggers a // fresh rendering at a higher rate - await (this._rendering && this._rendering.promise); + yield (this._rendering && this._rendering.promise); // Check after yielding to ensure we're not tearing down, // as this can create a race condition in tests @@ -219,17 +220,17 @@ GraphsController.prototype = { } this._rendering = defer(); - for (let graph of (await this._getEnabled())) { - await graph.setPerformanceData(recordingData, resolution); + for (let graph of (yield this._getEnabled())) { + yield graph.setPerformanceData(recordingData, resolution); this.emit("rendered", graph.graphName); } this._rendering.resolve(); - }, + }), /** * Destroys the underlying graphs. */ - async destroy() { + destroy: Task.async(function* () { let primary = this._getPrimaryLink(); this._destroyed = true; @@ -241,13 +242,13 @@ GraphsController.prototype = { // If there was rendering, wait until the most recent render cycle // has finished if (this._rendering) { - await this._rendering.promise; + yield this._rendering.promise; } for (let graph of this.getWidgets()) { - await graph.destroy(); + yield graph.destroy(); } - }, + }), /** * Applies the theme to the underlying graphs. Optionally takes @@ -266,7 +267,7 @@ GraphsController.prototype = { * to the graph if it is enabled once it's ready, or otherwise returns * null if disabled. */ - async isAvailable(graphName) { + isAvailable: Task.async(function* (graphName) { if (!this._enabled.has(graphName)) { return null; } @@ -274,12 +275,12 @@ GraphsController.prototype = { let graph = this.get(graphName); if (!graph) { - graph = await this._construct(graphName); + graph = yield this._construct(graphName); } - await graph.ready(); + yield graph.ready(); return graph; - }, + }), /** * Enable or disable a subgraph controlled by GraphsController. @@ -355,23 +356,23 @@ GraphsController.prototype = { /** * Makes sure the selection is enabled or disabled in all the graphs. */ - async selectionEnabled(enabled) { - for (let graph of (await this._getEnabled())) { + selectionEnabled: Task.async(function* (enabled) { + for (let graph of (yield this._getEnabled())) { graph.selectionEnabled = enabled; } - }, + }), /** * Creates the graph `graphName` and initializes it. */ - async _construct(graphName) { + _construct: Task.async(function* (graphName) { let def = this._definition[graphName]; let el = this.$(def.selector); let filter = this._getFilter(); let graph = this._graphs[graphName] = new def.constructor(el, filter); graph.graphName = graphName; - await graph.ready(); + yield graph.ready(); // Sync the graphs' animations and selections together if (def.primaryLink) { @@ -386,7 +387,7 @@ GraphsController.prototype = { this.setTheme(); return graph; - }, + }), /** * Returns the main graph for this collection, that all graphs @@ -409,20 +410,20 @@ GraphsController.prototype = { * as those could be enabled. Uses caching, as rendering happens many times per second, * compared to how often which graphs/features are changed (rarely). */ - async _getEnabled() { + _getEnabled: Task.async(function* () { if (this._enabledGraphs) { return this._enabledGraphs; } let enabled = []; for (let graphName of this._enabled) { - let graph = await this.isAvailable(graphName); + let graph = yield this.isAvailable(graphName); if (graph) { enabled.push(graph); } } this._enabledGraphs = enabled; return this._enabledGraphs; - }, + }), }; /** @@ -440,10 +441,10 @@ function OptimizationsGraph(parent) { OptimizationsGraph.prototype = extend(MountainGraphWidget.prototype, { - async render(threadNode, frameNode) { + render: Task.async(function* (threadNode, frameNode) { // Regardless if we draw or clear the graph, wait // until it's ready. - await this.ready(); + yield this.ready(); if (!threadNode || !frameNode) { this.setData([]); @@ -476,8 +477,8 @@ OptimizationsGraph.prototype = extend(MountainGraphWidget.prototype, { } this.dataOffsetX = startTime; - await this.setData(data); - }, + yield this.setData(data); + }), /** * Sets the theme via `theme` to either "light" or "dark", diff --git a/devtools/client/performance/panel.js b/devtools/client/performance/panel.js index df3748da309f..bd6a31e23420 100644 --- a/devtools/client/performance/panel.js +++ b/devtools/client/performance/panel.js @@ -5,6 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; +const { Task } = require("devtools/shared/task"); const defer = require("devtools/shared/defer"); loader.lazyRequireGetter(this, "EventEmitter", @@ -27,7 +28,7 @@ PerformancePanel.prototype = { * A promise that is resolved when the Performance tool * completes opening. */ - async open() { + open: Task.async(function* () { if (this._opening) { return this._opening; } @@ -42,7 +43,7 @@ PerformancePanel.prototype = { // the same front, and the toolbox will also initialize the front, // but redo it here so we can hook into the same event to prevent race conditions // in the case of the front still being in the process of opening. - let front = await this.panelWin.gToolbox.initPerformance(); + let front = yield this.panelWin.gToolbox.initPerformance(); // This should only happen if this is completely unsupported (when profiler // does not exist), and in that case, the tool shouldn't be available, @@ -55,7 +56,7 @@ PerformancePanel.prototype = { let { PerformanceController, EVENTS } = this.panelWin; PerformanceController.on(EVENTS.RECORDING_ADDED, this._checkRecordingStatus); PerformanceController.on(EVENTS.RECORDING_STATE_CHANGE, this._checkRecordingStatus); - await this.panelWin.startupPerformance(); + yield this.panelWin.startupPerformance(); // Fire this once incase we have an in-progress recording (console profile) // that caused this start up, and no state change yet, so we can highlight the @@ -67,7 +68,7 @@ PerformancePanel.prototype = { deferred.resolve(this); return this._opening; - }, + }), // DevToolPanel API @@ -75,7 +76,7 @@ PerformancePanel.prototype = { return this.toolbox.target; }, - async destroy() { + destroy: Task.async(function* () { // Make sure this panel is not already destroyed. if (this._destroyed) { return; @@ -84,10 +85,10 @@ PerformancePanel.prototype = { let { PerformanceController, EVENTS } = this.panelWin; PerformanceController.off(EVENTS.RECORDING_ADDED, this._checkRecordingStatus); PerformanceController.off(EVENTS.RECORDING_STATE_CHANGE, this._checkRecordingStatus); - await this.panelWin.shutdownPerformance(); + yield this.panelWin.shutdownPerformance(); this.emit("destroyed"); this._destroyed = true; - }, + }), _checkRecordingStatus: function () { if (this.panelWin.PerformanceController.isRecording()) { diff --git a/devtools/client/performance/performance-controller.js b/devtools/client/performance/performance-controller.js index e71470d7e450..c300a62971c7 100644 --- a/devtools/client/performance/performance-controller.js +++ b/devtools/client/performance/performance-controller.js @@ -12,6 +12,7 @@ var { loader, require } = BrowserLoaderModule.BrowserLoader({ baseURI: "resource://devtools/client/performance/", window }); +var { Task } = require("devtools/shared/task"); /* exported ViewHelpers, WidgetMethods, setNamedTimeout, clearNamedTimeout */ var { ViewHelpers, WidgetMethods, setNamedTimeout, clearNamedTimeout } = require("devtools/client/shared/widgets/view-helpers"); var { PrefObserver } = require("devtools/client/shared/prefs"); @@ -90,20 +91,20 @@ var gToolbox, gTarget, gFront; /** * Initializes the profiler controller and views. */ -var startupPerformance = async function () { - await PerformanceController.initialize(); - await PerformanceView.initialize(); +var startupPerformance = Task.async(function* () { + yield PerformanceController.initialize(); + yield PerformanceView.initialize(); PerformanceController.enableFrontEventListeners(); -}; +}); /** * Destroys the profiler controller and views. */ -var shutdownPerformance = async function () { - await PerformanceController.destroy(); - await PerformanceView.destroy(); +var shutdownPerformance = Task.async(function* () { + yield PerformanceController.destroy(); + yield PerformanceView.destroy(); PerformanceController.disableFrontEventListeners(); -}; +}); /** * Functions handling target-related lifetime events and @@ -117,7 +118,7 @@ var PerformanceController = { * Listen for events emitted by the current tab target and * main UI events. */ - async initialize() { + initialize: Task.async(function* () { this._telemetry = new PerformanceTelemetry(this); this.startRecording = this.startRecording.bind(this); this.stopRecording = this.stopRecording.bind(this); @@ -149,7 +150,7 @@ var PerformanceController = { this._prefObserver = new PrefObserver("devtools."); this._prefObserver.on("devtools.theme", this._onThemeChanged); - }, + }), /** * Remove events handled by the PerformanceController @@ -238,22 +239,22 @@ var PerformanceController = { * Checks whether or not a new recording is supported by the PerformanceFront. * @return Promise:boolean */ - async canCurrentlyRecord() { - let hasActor = await gTarget.hasActor("performance"); + canCurrentlyRecord: Task.async(function* () { + let hasActor = yield gTarget.hasActor("performance"); if (!hasActor) { return true; } - let actorCanCheck = await gTarget.actorHasMethod("performance", "canCurrentlyRecord"); + let actorCanCheck = yield gTarget.actorHasMethod("performance", "canCurrentlyRecord"); if (!actorCanCheck) { return true; } - return (await gFront.canCurrentlyRecord()).success; - }, + return (yield gFront.canCurrentlyRecord()).success; + }), /** * Starts recording with the PerformanceFront. */ - async startRecording() { + startRecording: Task.async(function* () { let options = { withMarkers: true, withTicks: this.getOption("enable-framerate"), @@ -267,7 +268,7 @@ var PerformanceController = { sampleFrequency: this.getPref("profiler-sample-frequency") }; - let recordingStarted = await gFront.startRecording(options); + let recordingStarted = yield gFront.startRecording(options); // In some cases, like when the target has a private browsing tab, // recording is not currently supported because of the profiler module. @@ -278,16 +279,16 @@ var PerformanceController = { } else { this.emit(EVENTS.BACKEND_READY_AFTER_RECORDING_START); } - }, + }), /** * Stops recording with the PerformanceFront. */ - async stopRecording() { + stopRecording: Task.async(function* () { let recording = this.getLatestManualRecording(); - await gFront.stopRecording(recording); + yield gFront.stopRecording(recording); this.emit(EVENTS.BACKEND_READY_AFTER_RECORDING_STOP); - }, + }), /** * Saves the given recording to a file. Emits `EVENTS.RECORDING_EXPORTED` @@ -298,26 +299,26 @@ var PerformanceController = { * @param nsIFile file * The file to stream the data into. */ - async exportRecording(_, recording, file) { - await recording.exportRecording(file); + exportRecording: Task.async(function* (_, recording, file) { + yield recording.exportRecording(file); this.emit(EVENTS.RECORDING_EXPORTED, recording, file); - }, + }), /** * Clears all completed recordings from the list as well as the current non-console * recording. Emits `EVENTS.RECORDING_DELETED` when complete so other components can * clean up. */ - async clearRecordings() { + clearRecordings: Task.async(function* () { for (let i = this._recordings.length - 1; i >= 0; i--) { let model = this._recordings[i]; if (!model.isConsole() && model.isRecording()) { - await this.stopRecording(); + yield this.stopRecording(); } // If last recording is not recording, but finalizing itself, // wait for that to finish if (!model.isRecording() && !model.isCompleted()) { - await this.waitForStateChangeOnRecording(model, "recording-stopped"); + yield this.waitForStateChangeOnRecording(model, "recording-stopped"); } // If recording is completed, // clean it up from UI and remove it from the _recordings array. @@ -333,7 +334,7 @@ var PerformanceController = { } else { this.setCurrentRecording(null); } - }, + }), /** * Loads a recording from a file, adding it to the recordings list. Emits @@ -342,12 +343,12 @@ var PerformanceController = { * @param nsIFile file * The file to import the data from. */ - async importRecording(_, file) { - let recording = await gFront.importRecording(file); + importRecording: Task.async(function* (_, file) { + let recording = yield gFront.importRecording(file); this._addRecordingIfUnknown(recording); this.emit(EVENTS.RECORDING_IMPORTED, recording); - }, + }), /** * Sets the currently active PerformanceRecording. Should rarely be called directly, @@ -537,7 +538,7 @@ var PerformanceController = { * @param {string} expectedState * @return {Promise} */ - async waitForStateChangeOnRecording(recording, expectedState) { + waitForStateChangeOnRecording: Task.async(function* (recording, expectedState) { let deferred = defer(); this.on(EVENTS.RECORDING_STATE_CHANGE, function handler(state, model) { if (state === expectedState && model === recording) { @@ -545,8 +546,8 @@ var PerformanceController = { deferred.resolve(); } }); - await deferred.promise; - }, + yield deferred.promise; + }), /** * Called on init, sets an `e10s` attribute on the main view container with diff --git a/devtools/client/performance/performance-view.js b/devtools/client/performance/performance-view.js index a6f2dbd91df4..526f3a8ec27e 100644 --- a/devtools/client/performance/performance-view.js +++ b/devtools/client/performance/performance-view.js @@ -115,7 +115,7 @@ var PerformanceView = { /** * Sets up the view with event binding and main subviews. */ - async initialize() { + initialize: Task.async(function* () { this._onRecordButtonClick = this._onRecordButtonClick.bind(this); this._onImportButtonClick = this._onImportButtonClick.bind(this); this._onClearButtonClick = this._onClearButtonClick.bind(this); @@ -133,7 +133,7 @@ var PerformanceView = { PerformanceController.on(EVENTS.BACKEND_FAILED_AFTER_RECORDING_START, this._onNewRecordingFailed); - if (await PerformanceController.canCurrentlyRecord()) { + if (yield PerformanceController.canCurrentlyRecord()) { this.setState("empty"); } else { this.setState("unavailable"); @@ -141,10 +141,10 @@ var PerformanceView = { // Initialize the ToolbarView first, because other views may need access // to the OptionsView via the controller, to read prefs. - await ToolbarView.initialize(); - await RecordingsView.initialize(); - await OverviewView.initialize(); - await DetailsView.initialize(); + yield ToolbarView.initialize(); + yield RecordingsView.initialize(); + yield OverviewView.initialize(); + yield DetailsView.initialize(); // DE-XUL: Begin migrating the toolbar to React. Temporarily hold state here. this._recordingControlsState = { @@ -161,7 +161,7 @@ var PerformanceView = { .map(createHtmlMount); this._renderRecordingControls(); - }, + }), /** * DE-XUL: Render the recording controls and buttons using React. @@ -177,7 +177,7 @@ var PerformanceView = { /** * Unbinds events and destroys subviews. */ - async destroy() { + destroy: Task.async(function* () { PerformanceController.off(EVENTS.RECORDING_SELECTED, this._onRecordingSelected); PerformanceController.off(EVENTS.RECORDING_PROFILER_STATUS_UPDATE, this._onProfilerStatusUpdated); @@ -187,11 +187,11 @@ var PerformanceView = { PerformanceController.off(EVENTS.BACKEND_FAILED_AFTER_RECORDING_START, this._onNewRecordingFailed); - await ToolbarView.destroy(); - await RecordingsView.destroy(); - await OverviewView.destroy(); - await DetailsView.destroy(); - }, + yield ToolbarView.destroy(); + yield RecordingsView.destroy(); + yield OverviewView.destroy(); + yield DetailsView.destroy(); + }), /** * Sets the state of the profiler view. Possible options are "unavailable", diff --git a/devtools/client/performance/test/browser_aaa-run-first-leaktest.js b/devtools/client/performance/test/browser_aaa-run-first-leaktest.js index d06087ab403e..d3ecef42e328 100644 --- a/devtools/client/performance/test/browser_aaa-run-first-leaktest.js +++ b/devtools/client/performance/test/browser_aaa-run-first-leaktest.js @@ -10,8 +10,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls"); -add_task(async function () { - let { target, toolbox, panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { target, toolbox, panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -24,5 +24,5 @@ add_task(async function () { ok(panel.panelWin.gToolbox, "Should have a toolbox reference on the panel window."); ok(panel.panelWin.gFront, "Should have a front reference on the panel window."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-button-states.js b/devtools/client/performance/test/browser_perf-button-states.js index 4ed11ea0f9fa..7f7ca1b2a463 100644 --- a/devtools/client/performance/test/browser_perf-button-states.js +++ b/devtools/client/performance/test/browser_perf-button-states.js @@ -10,8 +10,8 @@ const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls"); const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -33,16 +33,16 @@ add_task(async function () { }); click(recordButton); - await uiStartClick; + yield uiStartClick; checkRecordButtonsStates(true, true); - await recordingStarted; + yield recordingStarted; checkRecordButtonsStates(true, false); - await backendStartReady; - await uiStateRecording; + yield backendStartReady; + yield uiStateRecording; let uiStopClick = once(PerformanceView, EVENTS.UI_STOP_RECORDING); let recordingStopped = once(PerformanceController, EVENTS.RECORDING_STATE_CHANGE, { @@ -55,15 +55,15 @@ add_task(async function () { }); click(recordButton); - await uiStopClick; - await recordingStopped; + yield uiStopClick; + yield recordingStopped; checkRecordButtonsStates(false, false); - await backendStopReady; - await uiStateRecorded; + yield backendStopReady; + yield uiStateRecorded; - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); function checkRecordButtonsStates(checked, locked) { for (let button of $$(".record-button")) { diff --git a/devtools/client/performance/test/browser_perf-calltree-js-categories.js b/devtools/client/performance/test/browser_perf-calltree-js-categories.js index 726e412399c2..c0710932f7fe 100644 --- a/devtools/client/performance/test/browser_perf-calltree-js-categories.js +++ b/devtools/client/performance/test/browser_perf-calltree-js-categories.js @@ -14,8 +14,8 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { busyWait } = require("devtools/client/performance/test/helpers/wait-utils"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -25,14 +25,14 @@ add_task(async function () { // Enable platform data to show the categories in the tree. Services.prefs.setBoolPref(UI_SHOW_PLATFORM_DATA_PREF, true); - await startRecording(panel); + yield startRecording(panel); // To show the `Gecko` category in the tree. - await busyWait(100); - await stopRecording(panel); + yield busyWait(100); + yield stopRecording(panel); let rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); - await DetailsView.selectView("js-calltree"); - await rendered; + yield DetailsView.selectView("js-calltree"); + yield rendered; is($(".call-tree-cells-container").hasAttribute("categories-hidden"), false, "The call tree cells container should show the categories now."); @@ -47,7 +47,7 @@ add_task(async function () { ok(!geckoCategoryPresent($$), "A category node with the text `Gecko` doesn't exist in the tree anymore."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); function geckoCategoryPresent($$) { diff --git a/devtools/client/performance/test/browser_perf-calltree-js-columns.js b/devtools/client/performance/test/browser_perf-calltree-js-columns.js index b54fc1689f5d..5c8b6e2f36c4 100644 --- a/devtools/client/performance/test/browser_perf-calltree-js-columns.js +++ b/devtools/client/performance/test/browser_perf-calltree-js-columns.js @@ -13,8 +13,8 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { busyWait } = require("devtools/client/performance/test/helpers/wait-utils"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -24,14 +24,14 @@ add_task(async function () { // Enable platform data to show the platform functions in the tree. Services.prefs.setBoolPref(UI_SHOW_PLATFORM_DATA_PREF, true); - await startRecording(panel); + yield startRecording(panel); // To show the `busyWait` function in the tree. - await busyWait(100); - await stopRecording(panel); + yield busyWait(100); + yield stopRecording(panel); let rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); - await DetailsView.selectView("js-calltree"); - await rendered; + yield DetailsView.selectView("js-calltree"); + yield rendered; ok(DetailsView.isViewSelected(JsCallTreeView), "The call tree is now selected."); @@ -46,7 +46,7 @@ add_task(async function () { "function": true }); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); function testCells($, $$, visibleCells) { diff --git a/devtools/client/performance/test/browser_perf-calltree-js-events.js b/devtools/client/performance/test/browser_perf-calltree-js-events.js index e0198a95a2e0..c93c7f069633 100644 --- a/devtools/client/performance/test/browser_perf-calltree-js-events.js +++ b/devtools/client/performance/test/browser_perf-calltree-js-events.js @@ -13,20 +13,20 @@ const { synthesizeProfile } = require("devtools/client/performance/test/helpers/ const { once } = require("devtools/client/performance/test/helpers/event-utils"); const { ThreadNode } = require("devtools/client/performance/modules/logic/tree-model"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { EVENTS, $, DetailsView, OverviewView, JsCallTreeView } = panel.panelWin; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); - await DetailsView.selectView("js-calltree"); - await rendered; + yield DetailsView.selectView("js-calltree"); + yield rendered; // Mock the profile used so we can get a deterministic tree created. let profile = synthesizeProfile(); @@ -54,5 +54,5 @@ add_task(async function () { JsCallTreeView.off("focus", onFocus); is(count, 4, "Several focus events are fired for the calltree."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-calltree-memory-columns.js b/devtools/client/performance/test/browser_perf-calltree-memory-columns.js index 2a0557fcf2e0..9eb8a8de9cba 100644 --- a/devtools/client/performance/test/browser_perf-calltree-memory-columns.js +++ b/devtools/client/performance/test/browser_perf-calltree-memory-columns.js @@ -12,8 +12,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -23,12 +23,12 @@ add_task(async function () { // Enable allocations to test. Services.prefs.setBoolPref(UI_ENABLE_ALLOCATIONS_PREF, true); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(MemoryCallTreeView, EVENTS.UI_MEMORY_CALL_TREE_RENDERED); - await DetailsView.selectView("memory-calltree"); - await rendered; + yield DetailsView.selectView("memory-calltree"); + yield rendered; ok(DetailsView.isViewSelected(MemoryCallTreeView), "The call tree is now selected."); @@ -49,7 +49,7 @@ add_task(async function () { "function": true }); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); function testCells($, $$, visibleCells) { diff --git a/devtools/client/performance/test/browser_perf-console-record-01.js b/devtools/client/performance/test/browser_perf-console-record-01.js index b3792986e0e9..9353c2f9a478 100644 --- a/devtools/client/performance/test/browser_perf-console-record-01.js +++ b/devtools/client/performance/test/browser_perf-console-record-01.js @@ -12,20 +12,20 @@ const { initPerformanceInTab, initConsoleInNewTab, teardownToolboxAndRemoveTab } const { waitUntil } = require("devtools/client/performance/test/helpers/wait-utils"); const { getSelectedRecording } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { target, console } = await initConsoleInNewTab({ +add_task(function* () { + let { target, console } = yield initConsoleInNewTab({ url: SIMPLE_URL, win: window }); - await console.profile("rust"); - await console.profileEnd("rust"); + yield console.profile("rust"); + yield console.profileEnd("rust"); - let { panel } = await initPerformanceInTab({ tab: target.tab }); + let { panel } = yield initPerformanceInTab({ tab: target.tab }); let { PerformanceController, WaterfallView } = panel.panelWin; - await waitUntil(() => PerformanceController.getRecordings().length == 1); - await waitUntil(() => WaterfallView.wasRenderedAtLeastOnce); + yield waitUntil(() => PerformanceController.getRecordings().length == 1); + yield waitUntil(() => WaterfallView.wasRenderedAtLeastOnce); let recordings = PerformanceController.getRecordings(); is(recordings.length, 1, "One recording found in the performance panel."); @@ -39,5 +39,5 @@ add_task(async function () { is(selected.getLabel(), "rust", "The profile label for the first recording is correct."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-console-record-02.js b/devtools/client/performance/test/browser_perf-console-record-02.js index e150d21cb107..36d0a54d10fd 100644 --- a/devtools/client/performance/test/browser_perf-console-record-02.js +++ b/devtools/client/performance/test/browser_perf-console-record-02.js @@ -15,19 +15,19 @@ const { waitUntil } = require("devtools/client/performance/test/helpers/wait-uti const { times } = require("devtools/client/performance/test/helpers/event-utils"); const { getSelectedRecording } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { target, console } = await initConsoleInNewTab({ +add_task(function* () { + let { target, console } = yield initConsoleInNewTab({ url: SIMPLE_URL, win: window }); - await console.profile("rust"); - await console.profile("rust2"); + yield console.profile("rust"); + yield console.profile("rust2"); - let { panel } = await initPerformanceInTab({ tab: target.tab }); + let { panel } = yield initPerformanceInTab({ tab: target.tab }); let { EVENTS, PerformanceController, OverviewView } = panel.panelWin; - await waitUntil(() => PerformanceController.getRecordings().length == 2); + yield waitUntil(() => PerformanceController.getRecordings().length == 2); let recordings = PerformanceController.getRecordings(); is(recordings.length, 2, "Two recordings found in the performance panel."); @@ -45,7 +45,7 @@ add_task(async function () { "The profile label for the first recording is correct."); // Ensure overview is still rendering. - await times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { + yield times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { expectedArgs: { "1": Constants.FRAMERATE_GRAPH_LOW_RES_INTERVAL } }); @@ -53,8 +53,8 @@ add_task(async function () { // only emitted for manual recordings skipWaitingForBackendReady: true }); - await console.profileEnd("rust"); - await stopped; + yield console.profileEnd("rust"); + yield stopped; stopped = waitForRecordingStoppedEvents(panel, { // only emitted for manual recordings @@ -63,8 +63,8 @@ add_task(async function () { skipWaitingForOverview: true, skipWaitingForSubview: true, }); - await console.profileEnd("rust2"); - await stopped; + yield console.profileEnd("rust2"); + yield stopped; - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-console-record-03.js b/devtools/client/performance/test/browser_perf-console-record-03.js index 69fcab6eecdf..a12aab5f2b61 100644 --- a/devtools/client/performance/test/browser_perf-console-record-03.js +++ b/devtools/client/performance/test/browser_perf-console-record-03.js @@ -13,21 +13,21 @@ const { waitForRecordingStoppedEvents } = require("devtools/client/performance/t const { waitUntil } = require("devtools/client/performance/test/helpers/wait-utils"); const { getSelectedRecording } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { target, console } = await initConsoleInNewTab({ +add_task(function* () { + let { target, console } = yield initConsoleInNewTab({ url: SIMPLE_URL, win: window }); - await console.profile("rust"); - await console.profileEnd("rust"); - await console.profile("rust2"); + yield console.profile("rust"); + yield console.profileEnd("rust"); + yield console.profile("rust2"); - let { panel } = await initPerformanceInTab({ tab: target.tab }); + let { panel } = yield initPerformanceInTab({ tab: target.tab }); let { PerformanceController, WaterfallView } = panel.panelWin; - await waitUntil(() => PerformanceController.getRecordings().length == 2); - await waitUntil(() => WaterfallView.wasRenderedAtLeastOnce); + yield waitUntil(() => PerformanceController.getRecordings().length == 2); + yield waitUntil(() => WaterfallView.wasRenderedAtLeastOnce); let recordings = PerformanceController.getRecordings(); is(recordings.length, 2, "Two recordings found in the performance panel."); @@ -51,8 +51,8 @@ add_task(async function () { skipWaitingForOverview: true, skipWaitingForSubview: true, }); - await console.profileEnd("rust2"); - await stopped; + yield console.profileEnd("rust2"); + yield stopped; - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-console-record-04.js b/devtools/client/performance/test/browser_perf-console-record-04.js index 45ddc5916698..6465bc7460da 100644 --- a/devtools/client/performance/test/browser_perf-console-record-04.js +++ b/devtools/client/performance/test/browser_perf-console-record-04.js @@ -14,21 +14,21 @@ const { waitForRecordingStartedEvents, waitForRecordingStoppedEvents } = require const { times } = require("devtools/client/performance/test/helpers/event-utils"); const { getSelectedRecording } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { target, console } = await initConsoleInNewTab({ +add_task(function* () { + let { target, console } = yield initConsoleInNewTab({ url: SIMPLE_URL, win: window }); - let { panel } = await initPerformanceInTab({ tab: target.tab }); + let { panel } = yield initPerformanceInTab({ tab: target.tab }); let { EVENTS, PerformanceController, OverviewView } = panel.panelWin; let started = waitForRecordingStartedEvents(panel, { // only emitted for manual recordings skipWaitingForBackendReady: true }); - await console.profile("rust"); - await started; + yield console.profile("rust"); + yield started; let recordings = PerformanceController.getRecordings(); is(recordings.length, 1, "One recording found in the performance panel."); @@ -43,7 +43,7 @@ add_task(async function () { "The profile label for the first recording is correct."); // Ensure overview is still rendering. - await times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { + yield times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { expectedArgs: { "1": Constants.FRAMERATE_GRAPH_LOW_RES_INTERVAL } }); @@ -51,8 +51,8 @@ add_task(async function () { // only emitted for manual recordings skipWaitingForBackendReady: true }); - await console.profileEnd("rust"); - await stopped; + yield console.profileEnd("rust"); + yield stopped; - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-console-record-05.js b/devtools/client/performance/test/browser_perf-console-record-05.js index 6a32b9b85bac..373fd5b0f40f 100644 --- a/devtools/client/performance/test/browser_perf-console-record-05.js +++ b/devtools/client/performance/test/browser_perf-console-record-05.js @@ -14,21 +14,21 @@ const { waitForRecordingStartedEvents, waitForRecordingStoppedEvents } = require const { times } = require("devtools/client/performance/test/helpers/event-utils"); const { getSelectedRecording } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { target, console } = await initConsoleInNewTab({ +add_task(function* () { + let { target, console } = yield initConsoleInNewTab({ url: SIMPLE_URL, win: window }); - let { panel } = await initPerformanceInTab({ tab: target.tab }); + let { panel } = yield initPerformanceInTab({ tab: target.tab }); let { EVENTS, PerformanceController, OverviewView } = panel.panelWin; let started = waitForRecordingStartedEvents(panel, { // only emitted for manual recordings skipWaitingForBackendReady: true }); - await console.profile("rust"); - await started; + yield console.profile("rust"); + yield started; let recordings = PerformanceController.getRecordings(); is(recordings.length, 1, "One recording found in the performance panel."); @@ -43,7 +43,7 @@ add_task(async function () { "The profile label for the first recording is correct."); // Ensure overview is still rendering. - await times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { + yield times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { expectedArgs: { "1": Constants.FRAMERATE_GRAPH_LOW_RES_INTERVAL } }); @@ -51,8 +51,8 @@ add_task(async function () { // only emitted for manual recordings skipWaitingForBackendReady: true }); - await console.profileEnd("rust"); - await stopped; + yield console.profileEnd("rust"); + yield stopped; started = waitForRecordingStartedEvents(panel, { // only emitted for manual recordings @@ -63,8 +63,8 @@ add_task(async function () { // in-progress recording is selected, which won't happen skipWaitingForViewState: true, }); - await console.profile("rust"); - await started; + yield console.profile("rust"); + yield started; recordings = PerformanceController.getRecordings(); is(recordings.length, 2, "Two recordings found in the performance panel."); @@ -85,8 +85,8 @@ add_task(async function () { skipWaitingForOverview: true, skipWaitingForSubview: true, }); - await console.profileEnd("rust"); - await stopped; + yield console.profileEnd("rust"); + yield stopped; - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-console-record-06.js b/devtools/client/performance/test/browser_perf-console-record-06.js index 6b74ea8269b4..f1057c261f2f 100644 --- a/devtools/client/performance/test/browser_perf-console-record-06.js +++ b/devtools/client/performance/test/browser_perf-console-record-06.js @@ -13,21 +13,21 @@ const { waitForRecordingStartedEvents, waitForRecordingStoppedEvents } = require const { times } = require("devtools/client/performance/test/helpers/event-utils"); const { getSelectedRecording } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { target, console } = await initConsoleInNewTab({ +add_task(function* () { + let { target, console } = yield initConsoleInNewTab({ url: SIMPLE_URL, win: window }); - let { panel } = await initPerformanceInTab({ tab: target.tab }); + let { panel } = yield initPerformanceInTab({ tab: target.tab }); let { EVENTS, PerformanceController, OverviewView } = panel.panelWin; let started = waitForRecordingStartedEvents(panel, { // only emitted for manual recordings skipWaitingForBackendReady: true }); - await console.profile("rust"); - await started; + yield console.profile("rust"); + yield started; let recordings = PerformanceController.getRecordings(); is(recordings.length, 1, "A recording found in the performance panel."); @@ -35,7 +35,7 @@ add_task(async function () { "The first console recording should be selected."); // Ensure overview is still rendering. - await times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { + yield times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { expectedArgs: { "1": Constants.FRAMERATE_GRAPH_LOW_RES_INTERVAL } }); @@ -48,8 +48,8 @@ add_task(async function () { // in-progress recording is selected, which won't happen skipWaitingForViewState: true, }); - await console.profile("golang"); - await started; + yield console.profile("golang"); + yield started; recordings = PerformanceController.getRecordings(); is(recordings.length, 2, "Two recordings found in the performance panel."); @@ -57,7 +57,7 @@ add_task(async function () { "The first console recording should still be selected."); // Ensure overview is still rendering. - await times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { + yield times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { expectedArgs: { "1": Constants.FRAMERATE_GRAPH_LOW_RES_INTERVAL } }); @@ -65,8 +65,8 @@ add_task(async function () { // only emitted for manual recordings skipWaitingForBackendReady: true }); - await console.profileEnd("rust"); - await stopped; + yield console.profileEnd("rust"); + yield stopped; recordings = PerformanceController.getRecordings(); is(recordings.length, 2, "Two recordings found in the performance panel."); @@ -82,8 +82,8 @@ add_task(async function () { skipWaitingForOverview: true, skipWaitingForSubview: true, }); - await console.profileEnd("golang"); - await stopped; + yield console.profileEnd("golang"); + yield stopped; recordings = PerformanceController.getRecordings(); is(recordings.length, 2, "Two recordings found in the performance panel."); @@ -92,5 +92,5 @@ add_task(async function () { is(recordings[1].isRecording(), false, "The second console recording should no longer be recording."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-console-record-07.js b/devtools/client/performance/test/browser_perf-console-record-07.js index 7f6afd5fc802..af8dc5144a40 100644 --- a/devtools/client/performance/test/browser_perf-console-record-07.js +++ b/devtools/client/performance/test/browser_perf-console-record-07.js @@ -14,21 +14,21 @@ const { waitForRecordingStartedEvents, waitForRecordingStoppedEvents } = require const { idleWait } = require("devtools/client/performance/test/helpers/wait-utils"); const { getSelectedRecording } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { target, console } = await initConsoleInNewTab({ +add_task(function* () { + let { target, console } = yield initConsoleInNewTab({ url: SIMPLE_URL, win: window }); - let { panel } = await initPerformanceInTab({ tab: target.tab }); + let { panel } = yield initPerformanceInTab({ tab: target.tab }); let { PerformanceController } = panel.panelWin; let started = waitForRecordingStartedEvents(panel, { // only emitted for manual recordings skipWaitingForBackendReady: true }); - await console.profile(); - await started; + yield console.profile(); + yield started; started = waitForRecordingStartedEvents(panel, { // only emitted for manual recordings @@ -39,8 +39,8 @@ add_task(async function () { // in-progress recording is selected, which won't happen skipWaitingForViewState: true, }); - await console.profile("1"); - await started; + yield console.profile("1"); + yield started; started = waitForRecordingStartedEvents(panel, { // only emitted for manual recordings @@ -51,8 +51,8 @@ add_task(async function () { // in-progress recording is selected, which won't happen skipWaitingForViewState: true, }); - await console.profile("2"); - await started; + yield console.profile("2"); + yield started; let recordings = PerformanceController.getRecordings(); let selected = getSelectedRecording(panel); @@ -80,8 +80,8 @@ add_task(async function () { // finished recording is selected, which won't happen skipWaitingForViewState: true, }); - await console.profileEnd(); - await stopped; + yield console.profileEnd(); + yield stopped; selected = getSelectedRecording(panel); recordings = PerformanceController.getRecordings(); @@ -98,7 +98,7 @@ add_task(async function () { info("Trying to `profileEnd` a non-existent console recording."); console.profileEnd("fxos"); - await idleWait(1000); + yield idleWait(1000); selected = getSelectedRecording(panel); recordings = PerformanceController.getRecordings(); @@ -123,8 +123,8 @@ add_task(async function () { // finished recording is selected, which won't happen skipWaitingForViewState: true, }); - await console.profileEnd(); - await stopped; + yield console.profileEnd(); + yield stopped; selected = getSelectedRecording(panel); recordings = PerformanceController.getRecordings(); @@ -143,8 +143,8 @@ add_task(async function () { // only emitted for manual recordings skipWaitingForBackendReady: true }); - await console.profileEnd(); - await stopped; + yield console.profileEnd(); + yield stopped; selected = getSelectedRecording(panel); recordings = PerformanceController.getRecordings(); @@ -161,10 +161,10 @@ add_task(async function () { info("Trying to `profileEnd` with no pending recordings."); console.profileEnd(); - await idleWait(1000); + yield idleWait(1000); ok(true, "Calling console.profileEnd() with no argument and no pending recordings " + "does not throw."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-console-record-08.js b/devtools/client/performance/test/browser_perf-console-record-08.js index 45f6538c720a..2ad81c413137 100644 --- a/devtools/client/performance/test/browser_perf-console-record-08.js +++ b/devtools/client/performance/test/browser_perf-console-record-08.js @@ -39,16 +39,16 @@ function hasBitFlag(expected, actual) { return !!(expected & actual); } -add_task(async function () { +add_task(function* () { // This test seems to take a very long time to finish on Linux VMs. requestLongerTimeout(4); - let { target, console } = await initConsoleInNewTab({ + let { target, console } = yield initConsoleInNewTab({ url: SIMPLE_URL, win: window }); - let { panel } = await initPerformanceInTab({ tab: target.tab }); + let { panel } = yield initPerformanceInTab({ tab: target.tab }); let { EVENTS, PerformanceController, OverviewView } = panel.panelWin; info("Recording 1 - Starting console.profile()..."); @@ -56,14 +56,14 @@ add_task(async function () { // only emitted for manual recordings skipWaitingForBackendReady: true }); - await console.profile("rust"); - await started; + yield console.profile("rust"); + yield started; testRecordings(PerformanceController, [ CONSOLE + SELECTED + RECORDING ]); info("Recording 2 - Starting manual recording..."); - await startRecording(panel); + yield startRecording(panel); testRecordings(PerformanceController, [ CONSOLE + RECORDING, MANUAL + RECORDING + SELECTED @@ -79,8 +79,8 @@ add_task(async function () { // in-progress recording is selected, which won't happen skipWaitingForViewState: true, }); - await console.profile("3"); - await started; + yield console.profile("3"); + yield started; testRecordings(PerformanceController, [ CONSOLE + RECORDING, MANUAL + RECORDING + SELECTED, @@ -97,8 +97,8 @@ add_task(async function () { // in-progress recording is selected, which won't happen skipWaitingForViewState: true, }); - await console.profile("4"); - await started; + yield console.profile("4"); + yield started; testRecordings(PerformanceController, [ CONSOLE + RECORDING, MANUAL + RECORDING + SELECTED, @@ -117,8 +117,8 @@ add_task(async function () { // finished recording is selected, which won't happen skipWaitingForViewState: true, }); - await console.profileEnd(); - await stopped; + yield console.profileEnd(); + yield stopped; testRecordings(PerformanceController, [ CONSOLE + RECORDING, MANUAL + RECORDING + SELECTED, @@ -129,7 +129,7 @@ add_task(async function () { info("Recording 4 - Select last recording..."); let recordingSelected = once(PerformanceController, EVENTS.RECORDING_SELECTED); setSelectedRecording(panel, 3); - await recordingSelected; + yield recordingSelected; testRecordings(PerformanceController, [ CONSOLE + RECORDING, MANUAL + RECORDING, @@ -141,7 +141,7 @@ add_task(async function () { info("Recording 2 - Stop manual recording."); - await stopRecording(panel); + yield stopRecording(panel); testRecordings(PerformanceController, [ CONSOLE + RECORDING, MANUAL + SELECTED, @@ -154,7 +154,7 @@ add_task(async function () { info("Recording 1 - Select first recording."); recordingSelected = once(PerformanceController, EVENTS.RECORDING_SELECTED); setSelectedRecording(panel, 0); - await recordingSelected; + yield recordingSelected; testRecordings(PerformanceController, [ CONSOLE + RECORDING + SELECTED, MANUAL, @@ -165,7 +165,7 @@ add_task(async function () { "Should be rendering overview a recording in progress is selected."); // Ensure overview is still rendering. - await times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { + yield times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { expectedArgs: { "1": Constants.FRAMERATE_GRAPH_LOW_RES_INTERVAL } }); @@ -180,8 +180,8 @@ add_task(async function () { // finished recording is selected, which won't happen skipWaitingForViewState: true, }); - await console.profileEnd(); - await stopped; + yield console.profileEnd(); + yield stopped; testRecordings(PerformanceController, [ CONSOLE + RECORDING + SELECTED, MANUAL, @@ -192,12 +192,12 @@ add_task(async function () { "Should be rendering overview a recording in progress is selected."); // Ensure overview is still rendering. - await times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { + yield times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { expectedArgs: { "1": Constants.FRAMERATE_GRAPH_LOW_RES_INTERVAL } }); info("Recording 5 - Start one more manual recording."); - await startRecording(panel); + yield startRecording(panel); testRecordings(PerformanceController, [ CONSOLE + RECORDING, MANUAL, @@ -209,12 +209,12 @@ add_task(async function () { "Should be rendering overview a recording in progress is selected."); // Ensure overview is still rendering. - await times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { + yield times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { expectedArgs: { "1": Constants.FRAMERATE_GRAPH_LOW_RES_INTERVAL } }); info("Recording 5 - Stop manual recording."); - await stopRecording(panel); + yield stopRecording(panel); testRecordings(PerformanceController, [ CONSOLE + RECORDING, MANUAL, @@ -236,8 +236,8 @@ add_task(async function () { // in-progress recording is selected, which won't happen skipWaitingForViewState: true, }); - await console.profileEnd(); - await stopped; + yield console.profileEnd(); + yield stopped; testRecordings(PerformanceController, [ CONSOLE, MANUAL, @@ -248,7 +248,7 @@ add_task(async function () { ok(!OverviewView.isRendering(), "Stop rendering overview when a completed recording is selected."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); function testRecordings(controller, expectedBitFlags) { diff --git a/devtools/client/performance/test/browser_perf-console-record-09.js b/devtools/client/performance/test/browser_perf-console-record-09.js index 98d5de92364f..06c14faa59ea 100644 --- a/devtools/client/performance/test/browser_perf-console-record-09.js +++ b/devtools/client/performance/test/browser_perf-console-record-09.js @@ -14,17 +14,17 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { waitForRecordingStartedEvents } = require("devtools/client/performance/test/helpers/actions"); const { idleWait } = require("devtools/client/performance/test/helpers/wait-utils"); -add_task(async function () { - let { target, console } = await initConsoleInNewTab({ +add_task(function* () { + let { target, console } = yield initConsoleInNewTab({ url: SIMPLE_URL, win: window }); - let { panel } = await initPerformanceInTab({ tab: target.tab }); + let { panel } = yield initPerformanceInTab({ tab: target.tab }); let { PerformanceController } = panel.panelWin; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); info("Starting console.profile()..."); let started = waitForRecordingStartedEvents(panel, { @@ -36,10 +36,10 @@ add_task(async function () { // in-progress recording is selected, which won't happen skipWaitingForViewState: true, }); - await console.profile(); - await started; + yield console.profile(); + yield started; - await PerformanceController.clearRecordings(); + yield PerformanceController.clearRecordings(); let recordings = PerformanceController.getRecordings(); is(recordings.length, 1, "One recording found in the performance panel."); is(recordings[0].isConsole(), true, "Recording came from console.profile."); @@ -48,17 +48,17 @@ add_task(async function () { "There current recording should be the first one."); info("Attempting to end console.profileEnd()..."); - await console.profileEnd(); - await idleWait(1000); + yield console.profileEnd(); + yield idleWait(1000); ok(true, "Stopping an in-progress console profile after clearing recordings does not throw."); - await PerformanceController.clearRecordings(); + yield PerformanceController.clearRecordings(); recordings = PerformanceController.getRecordings(); is(recordings.length, 0, "No recordings found"); is(PerformanceController.getCurrentRecording(), null, "There should be no current recording."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-details-01-toggle.js b/devtools/client/performance/test/browser_perf-details-01-toggle.js index fb4211d68e73..8cc7f9e0c9c8 100644 --- a/devtools/client/performance/test/browser_perf-details-01-toggle.js +++ b/devtools/client/performance/test/browser_perf-details-01-toggle.js @@ -12,16 +12,16 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { once } = require("devtools/client/performance/test/helpers/event-utils"); const { command } = require("devtools/client/performance/test/helpers/input-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { EVENTS, $, DetailsView } = panel.panelWin; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); info("Checking views on startup."); checkViews(DetailsView, $, "waterfall"); @@ -30,25 +30,25 @@ add_task(async function () { let viewChanged = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED, { spreadArgs: true }); command($("toolbarbutton[data-view='js-calltree']")); - let [, viewName] = await viewChanged; + let [, viewName] = yield viewChanged; is(viewName, "js-calltree", "UI_DETAILS_VIEW_SELECTED fired with view name"); checkViews(DetailsView, $, "js-calltree"); // Select js flamegraph view. viewChanged = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED, { spreadArgs: true }); command($("toolbarbutton[data-view='js-flamegraph']")); - [, viewName] = await viewChanged; + [, viewName] = yield viewChanged; is(viewName, "js-flamegraph", "UI_DETAILS_VIEW_SELECTED fired with view name"); checkViews(DetailsView, $, "js-flamegraph"); // Select waterfall view. viewChanged = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED, { spreadArgs: true }); command($("toolbarbutton[data-view='waterfall']")); - [, viewName] = await viewChanged; + [, viewName] = yield viewChanged; is(viewName, "waterfall", "UI_DETAILS_VIEW_SELECTED fired with view name"); checkViews(DetailsView, $, "waterfall"); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); function checkViews(DetailsView, $, currentView) { diff --git a/devtools/client/performance/test/browser_perf-details-02-utility-fun.js b/devtools/client/performance/test/browser_perf-details-02-utility-fun.js index 8b0c623f7cdf..5914742ddb0c 100644 --- a/devtools/client/performance/test/browser_perf-details-02-utility-fun.js +++ b/devtools/client/performance/test/browser_perf-details-02-utility-fun.js @@ -11,8 +11,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -25,35 +25,35 @@ add_task(async function () { JsFlameGraphView } = panel.panelWin; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); ok(DetailsView.isViewSelected(WaterfallView), "The waterfall view is selected by default in the details view."); // Select js calltree view. let selected = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED); - await DetailsView.selectView("js-calltree"); - await selected; + yield DetailsView.selectView("js-calltree"); + yield selected; ok(DetailsView.isViewSelected(JsCallTreeView), "The js calltree view is now selected in the details view."); // Select js flamegraph view. selected = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED); - await DetailsView.selectView("js-flamegraph"); - await selected; + yield DetailsView.selectView("js-flamegraph"); + yield selected; ok(DetailsView.isViewSelected(JsFlameGraphView), "The js flamegraph view is now selected in the details view."); // Select waterfall view. selected = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED); - await DetailsView.selectView("waterfall"); - await selected; + yield DetailsView.selectView("waterfall"); + yield selected; ok(DetailsView.isViewSelected(WaterfallView), "The waterfall view is now selected in the details view."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-details-03-without-allocations.js b/devtools/client/performance/test/browser_perf-details-03-without-allocations.js index 5aa9721789db..c69c1de9fa73 100644 --- a/devtools/client/performance/test/browser_perf-details-03-without-allocations.js +++ b/devtools/client/performance/test/browser_perf-details-03-without-allocations.js @@ -16,8 +16,8 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { once } = require("devtools/client/performance/test/helpers/event-utils"); const { setSelectedRecording } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -37,8 +37,8 @@ add_task(async function () { // Disable allocations to prevent recording them. Services.prefs.setBoolPref(UI_ENABLE_ALLOCATIONS_PREF, false); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); ok(DetailsView.isViewSelected(WaterfallView), "The waterfall view is selected by default in the details view."); @@ -48,8 +48,8 @@ add_task(async function () { // The toolbar buttons will always be hidden when a recording isn't available, // so make sure we have one that's finished. - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); ok(DetailsView.isViewSelected(WaterfallView), "The waterfall view is still selected in the details view."); @@ -62,8 +62,8 @@ add_task(async function () { let selected = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED); let rendered = once(MemoryCallTreeView, EVENTS.UI_MEMORY_CALL_TREE_RENDERED); DetailsView.selectView("memory-calltree"); - await selected; - await rendered; + yield selected; + yield rendered; ok(DetailsView.isViewSelected(MemoryCallTreeView), "The memory call tree view can now be selected."); @@ -71,8 +71,8 @@ add_task(async function () { selected = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED); rendered = once(MemoryFlameGraphView, EVENTS.UI_MEMORY_FLAMEGRAPH_RENDERED); DetailsView.selectView("memory-flamegraph"); - await selected; - await rendered; + yield selected; + yield rendered; ok(DetailsView.isViewSelected(MemoryFlameGraphView), "The memory flamegraph view can now be selected."); @@ -81,8 +81,8 @@ add_task(async function () { selected = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED); rendered = once(WaterfallView, EVENTS.UI_WATERFALL_RENDERED); setSelectedRecording(panel, 0); - await selected; - await rendered; + yield selected; + yield rendered; ok(DetailsView.isViewSelected(WaterfallView), "The waterfall view is now selected " + "when switching back to a recording that does not have memory data."); @@ -95,7 +95,7 @@ add_task(async function () { // Go back to the recording with memory data. rendered = once(WaterfallView, EVENTS.UI_WATERFALL_RENDERED); setSelectedRecording(panel, 1); - await rendered; + yield rendered; ok(DetailsView.isViewSelected(WaterfallView), "The waterfall view is still selected in the details view."); @@ -108,8 +108,8 @@ add_task(async function () { selected = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED); rendered = once(MemoryCallTreeView, EVENTS.UI_MEMORY_CALL_TREE_RENDERED); DetailsView.selectView("memory-calltree"); - await selected; - await rendered; + yield selected; + yield rendered; ok(DetailsView.isViewSelected(MemoryCallTreeView), "The memory call tree view can be " + "selected again after going back to the view with memory data."); @@ -117,11 +117,11 @@ add_task(async function () { selected = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED); rendered = once(MemoryFlameGraphView, EVENTS.UI_MEMORY_FLAMEGRAPH_RENDERED); DetailsView.selectView("memory-flamegraph"); - await selected; - await rendered; + yield selected; + yield rendered; ok(DetailsView.isViewSelected(MemoryFlameGraphView), "The memory flamegraph view can " + "be selected again after going back to the view with memory data."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-details-04-toolbar-buttons.js b/devtools/client/performance/test/browser_perf-details-04-toolbar-buttons.js index 7509216ce81b..9dec9fe7c5ea 100644 --- a/devtools/client/performance/test/browser_perf-details-04-toolbar-buttons.js +++ b/devtools/client/performance/test/browser_perf-details-04-toolbar-buttons.js @@ -13,8 +13,8 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { once } = require("devtools/client/performance/test/helpers/event-utils"); const { setSelectedRecording, getSelectedRecordingIndex } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -43,7 +43,7 @@ add_task(async function () { is(memCallBtn.hidden, true, "The `memory-calltree` button is hidden when tool starts."); - await startRecording(panel); + yield startRecording(panel); is(waterfallBtn.hidden, true, "The `waterfall` button is hidden when recording starts."); @@ -56,7 +56,7 @@ add_task(async function () { is(memCallBtn.hidden, true, "The `memory-calltree` button is hidden when recording starts."); - await stopRecording(panel); + yield stopRecording(panel); is(waterfallBtn.hidden, false, "The `waterfall` button is visible when recording ends."); @@ -69,7 +69,7 @@ add_task(async function () { is(memCallBtn.hidden, true, "The `memory-calltree` button is hidden when recording ends."); - await startRecording(panel); + yield startRecording(panel); is(waterfallBtn.hidden, true, "The `waterfall` button is hidden when another recording starts."); @@ -85,8 +85,8 @@ add_task(async function () { let selected = once(PerformanceController, EVENTS.RECORDING_SELECTED); let rendered = once(WaterfallView, EVENTS.UI_WATERFALL_RENDERED); setSelectedRecording(panel, 0); - await selected; - await rendered; + yield selected; + yield rendered; let selectedIndex = getSelectedRecordingIndex(panel); is(selectedIndex, 0, @@ -105,7 +105,7 @@ add_task(async function () { selected = once(PerformanceController, EVENTS.RECORDING_SELECTED); setSelectedRecording(panel, 1); - await selected; + yield selected; selectedIndex = getSelectedRecordingIndex(panel); is(selectedIndex, 1, @@ -123,8 +123,8 @@ add_task(async function () { "The `memory-calltree button` still is hidden when second recording selected."); rendered = once(WaterfallView, EVENTS.UI_WATERFALL_RENDERED); - await stopRecording(panel); - await rendered; + yield stopRecording(panel); + yield rendered; selectedIndex = getSelectedRecordingIndex(panel); is(selectedIndex, 1, @@ -141,5 +141,5 @@ add_task(async function () { is(memCallBtn.hidden, true, "The `memory-calltree` button is hidden when second recording finished."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-details-05-preserve-view.js b/devtools/client/performance/test/browser_perf-details-05-preserve-view.js index 7f13417716a4..00c71db7e7ec 100644 --- a/devtools/client/performance/test/browser_perf-details-05-preserve-view.js +++ b/devtools/client/performance/test/browser_perf-details-05-preserve-view.js @@ -12,33 +12,33 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { EVENTS, PerformanceController, DetailsView, JsCallTreeView } = panel.panelWin; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let selected = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED); let rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); - await DetailsView.selectView("js-calltree"); - await selected; - await rendered; + yield DetailsView.selectView("js-calltree"); + yield selected; + yield rendered; ok(DetailsView.isViewSelected(JsCallTreeView), "The js calltree view is now selected in the details view."); let cleared = once(PerformanceController, EVENTS.RECORDING_SELECTED, { expectedArgs: { "1": null } }); - await PerformanceController.clearRecordings(); - await cleared; + yield PerformanceController.clearRecordings(); + yield cleared; - await startRecording(panel); - await stopRecording(panel, { + yield startRecording(panel); + yield stopRecording(panel, { expectedViewClass: "JsCallTreeView", expectedViewEvent: "UI_JS_CALL_TREE_RENDERED" }); @@ -46,5 +46,5 @@ add_task(async function () { ok(DetailsView.isViewSelected(JsCallTreeView), "The js calltree view is still selected in the details view."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-details-06-rerender-on-selection.js b/devtools/client/performance/test/browser_perf-details-06-rerender-on-selection.js index 79b6a533844c..abe2dfc75acb 100644 --- a/devtools/client/performance/test/browser_perf-details-06-rerender-on-selection.js +++ b/devtools/client/performance/test/browser_perf-details-06-rerender-on-selection.js @@ -13,8 +13,8 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { once } = require("devtools/client/performance/test/helpers/event-utils"); const { scrollCanvasGraph, HORIZONTAL_AXIS } = require("devtools/client/performance/test/helpers/input-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -28,24 +28,24 @@ add_task(async function () { JsFlameGraphView } = panel.panelWin; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let waterfallRendered = once(WaterfallView, EVENTS.UI_WATERFALL_RENDERED); OverviewView.setTimeInterval({ startTime: 10, endTime: 20 }); - await waterfallRendered; + yield waterfallRendered; // Select the call tree to make sure it's initialized and ready to receive // redrawing requests once reselected. let callTreeRendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); - await DetailsView.selectView("js-calltree"); - await callTreeRendered; + yield DetailsView.selectView("js-calltree"); + yield callTreeRendered; // Switch to the flamegraph and perform a scroll over the visualization. // The waterfall and call tree should get rerendered when reselected. let flamegraphRendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); - await DetailsView.selectView("js-flamegraph"); - await flamegraphRendered; + yield DetailsView.selectView("js-flamegraph"); + yield flamegraphRendered; let overviewRangeSelected = once(OverviewView, EVENTS.UI_OVERVIEW_RANGE_SELECTED); let waterfallRerendered = once(WaterfallView, EVENTS.UI_WATERFALL_RENDERED); @@ -64,16 +64,16 @@ add_task(async function () { x: 10 }); - await overviewRangeSelected; + yield overviewRangeSelected; ok(true, "Overview range was changed."); - await DetailsView.selectView("waterfall"); - await waterfallRerendered; + yield DetailsView.selectView("waterfall"); + yield waterfallRerendered; ok(true, "Waterfall rerendered by flame graph changing interval."); - await DetailsView.selectView("js-calltree"); - await callTreeRerendered; + yield DetailsView.selectView("js-calltree"); + yield callTreeRerendered; ok(true, "CallTree rerendered by flame graph changing interval."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-details-07-bleed-events.js b/devtools/client/performance/test/browser_perf-details-07-bleed-events.js index 4b0c4a77c5fb..f299aadad744 100644 --- a/devtools/client/performance/test/browser_perf-details-07-bleed-events.js +++ b/devtools/client/performance/test/browser_perf-details-07-bleed-events.js @@ -11,38 +11,38 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { EVENTS, DetailsView, JsCallTreeView } = panel.panelWin; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); // The waterfall should render by default, and we want to make // sure that the render events don't bleed between detail views // so test that's the case after both views have been created. let callTreeRendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); - await DetailsView.selectView("js-calltree"); - await callTreeRendered; + yield DetailsView.selectView("js-calltree"); + yield callTreeRendered; let waterfallSelected = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED); - await DetailsView.selectView("waterfall"); - await waterfallSelected; + yield DetailsView.selectView("waterfall"); + yield waterfallSelected; once(JsCallTreeView, EVENTS.UI_WATERFALL_RENDERED).then(() => ok(false, "JsCallTreeView should not receive UI_WATERFALL_RENDERED event.")); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let callTreeRerendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); - await DetailsView.selectView("js-calltree"); - await callTreeRerendered; + yield DetailsView.selectView("js-calltree"); + yield callTreeRerendered; ok(true, "Test passed."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-details-render-00-waterfall.js b/devtools/client/performance/test/browser_perf-details-render-00-waterfall.js index b1738fb27b40..5f65fa00dc7c 100644 --- a/devtools/client/performance/test/browser_perf-details-render-00-waterfall.js +++ b/devtools/client/performance/test/browser_perf-details-render-00-waterfall.js @@ -10,31 +10,31 @@ const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls"); const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { DetailsView, WaterfallView } = panel.panelWin; - await startRecording(panel); + yield startRecording(panel); // Already waits for EVENTS.UI_WATERFALL_RENDERED. - await stopRecording(panel); + yield stopRecording(panel); ok(DetailsView.isViewSelected(WaterfallView), "The waterfall view is selected by default in the details view."); ok(true, "WaterfallView rendered after recording is stopped."); - await startRecording(panel); + yield startRecording(panel); // Already waits for EVENTS.UI_WATERFALL_RENDERED. - await stopRecording(panel); + yield stopRecording(panel); ok(DetailsView.isViewSelected(WaterfallView), "The waterfall view is still selected in the details view."); ok(true, "WaterfallView rendered again after recording completed a second time."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-details-render-01-js-calltree.js b/devtools/client/performance/test/browser_perf-details-render-01-js-calltree.js index 66b412f2adf5..bc191f2fccf5 100644 --- a/devtools/client/performance/test/browser_perf-details-render-01-js-calltree.js +++ b/devtools/client/performance/test/browser_perf-details-render-01-js-calltree.js @@ -11,30 +11,30 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { EVENTS, DetailsView, JsCallTreeView } = panel.panelWin; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); - await DetailsView.selectView("js-calltree"); - await rendered; + yield DetailsView.selectView("js-calltree"); + yield rendered; ok(true, "JsCallTreeView rendered after recording is stopped."); - await startRecording(panel); - await stopRecording(panel, { + yield startRecording(panel); + yield stopRecording(panel, { expectedViewClass: "JsCallTreeView", expectedViewEvent: "UI_JS_CALL_TREE_RENDERED" }); ok(true, "JsCallTreeView rendered again after recording completed a second time."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-details-render-02-js-flamegraph.js b/devtools/client/performance/test/browser_perf-details-render-02-js-flamegraph.js index 2ca5e816ef9c..e5e74fc7c109 100644 --- a/devtools/client/performance/test/browser_perf-details-render-02-js-flamegraph.js +++ b/devtools/client/performance/test/browser_perf-details-render-02-js-flamegraph.js @@ -11,30 +11,30 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { EVENTS, DetailsView, JsFlameGraphView } = panel.panelWin; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); - await DetailsView.selectView("js-flamegraph"); - await rendered; + yield DetailsView.selectView("js-flamegraph"); + yield rendered; ok(true, "JsFlameGraphView rendered after recording is stopped."); - await startRecording(panel); - await stopRecording(panel, { + yield startRecording(panel); + yield stopRecording(panel, { expectedViewClass: "JsFlameGraphView", expectedViewEvent: "UI_JS_FLAMEGRAPH_RENDERED" }); ok(true, "JsFlameGraphView rendered again after recording completed a second time."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-details-render-03-memory-calltree.js b/devtools/client/performance/test/browser_perf-details-render-03-memory-calltree.js index 0228c9c8b3a4..758dea8c657d 100644 --- a/devtools/client/performance/test/browser_perf-details-render-03-memory-calltree.js +++ b/devtools/client/performance/test/browser_perf-details-render-03-memory-calltree.js @@ -12,8 +12,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -23,22 +23,22 @@ add_task(async function () { // Enable allocations to test. Services.prefs.setBoolPref(UI_ENABLE_ALLOCATIONS_PREF, true); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(MemoryCallTreeView, EVENTS.UI_MEMORY_CALL_TREE_RENDERED); - await DetailsView.selectView("memory-calltree"); - await rendered; + yield DetailsView.selectView("memory-calltree"); + yield rendered; ok(true, "MemoryCallTreeView rendered after recording is stopped."); - await startRecording(panel); - await stopRecording(panel, { + yield startRecording(panel); + yield stopRecording(panel, { expectedViewClass: "MemoryCallTreeView", expectedViewEvent: "UI_MEMORY_CALL_TREE_RENDERED" }); ok(true, "MemoryCallTreeView rendered again after recording completed a second time."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-details-render-04-memory-flamegraph.js b/devtools/client/performance/test/browser_perf-details-render-04-memory-flamegraph.js index d5f9011a4890..119f090e5ff9 100644 --- a/devtools/client/performance/test/browser_perf-details-render-04-memory-flamegraph.js +++ b/devtools/client/performance/test/browser_perf-details-render-04-memory-flamegraph.js @@ -12,8 +12,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -23,17 +23,17 @@ add_task(async function () { // Enable allocations to test. Services.prefs.setBoolPref(UI_ENABLE_ALLOCATIONS_PREF, true); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(MemoryFlameGraphView, EVENTS.UI_MEMORY_FLAMEGRAPH_RENDERED); - await DetailsView.selectView("memory-flamegraph"); - await rendered; + yield DetailsView.selectView("memory-flamegraph"); + yield rendered; ok(true, "MemoryFlameGraphView rendered after recording is stopped."); - await startRecording(panel); - await stopRecording(panel, { + yield startRecording(panel); + yield stopRecording(panel, { expectedViewClass: "MemoryFlameGraphView", expectedViewEvent: "UI_MEMORY_FLAMEGRAPH_RENDERED" }); @@ -41,5 +41,5 @@ add_task(async function () { ok(true, "MemoryFlameGraphView rendered again after recording completed a second time."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-docload.js b/devtools/client/performance/test/browser_perf-docload.js index 68c888c4d174..b92a8cfbdd13 100644 --- a/devtools/client/performance/test/browser_perf-docload.js +++ b/devtools/client/performance/test/browser_perf-docload.js @@ -11,18 +11,18 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording, reload } = require("devtools/client/performance/test/helpers/actions"); const { waitUntil } = require("devtools/client/performance/test/helpers/wait-utils"); -add_task(async function () { - let { panel, target } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel, target } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { PerformanceController } = panel.panelWin; - await startRecording(panel); - await reload(target); + yield startRecording(panel); + yield reload(target); - await waitUntil(() => { + yield waitUntil(() => { // Wait until we get the necessary markers. let markers = PerformanceController.getCurrentRecording().getMarkers(); if (!markers.some(m => m.name == "document::DOMContentLoaded") || @@ -38,6 +38,6 @@ add_task(async function () { return true; }); - await stopRecording(panel); - await teardownToolboxAndRemoveTab(panel); + yield stopRecording(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-gc-snap.js b/devtools/client/performance/test/browser_perf-gc-snap.js index 4d147e1195ca..57589825ec95 100644 --- a/devtools/client/performance/test/browser_perf-gc-snap.js +++ b/devtools/client/performance/test/browser_perf-gc-snap.js @@ -6,23 +6,23 @@ * Tests that the marker details on GC markers displays allocation * buttons and snaps to the correct range */ -async function spawnTest() { - let { panel } = await initPerformance(ALLOCS_URL); +function* spawnTest() { + let { panel } = yield initPerformance(ALLOCS_URL); let { $, $$, EVENTS, PerformanceController, OverviewView, DetailsView, WaterfallView, MemoryCallTreeView } = panel.panelWin; let EPSILON = 0.00001; Services.prefs.setBoolPref(ALLOCATIONS_PREF, true); - await startRecording(panel); - await idleWait(1000); - await stopRecording(panel); + yield startRecording(panel); + yield idleWait(1000); + yield stopRecording(panel); injectGCMarkers(PerformanceController, WaterfallView); // Select everything let rendered = WaterfallView.once(EVENTS.UI_WATERFALL_RENDERED); OverviewView.setTimeInterval({ startTime: 0, endTime: Number.MAX_VALUE }); - await rendered; + yield rendered; let bars = $$(".waterfall-marker-bar"); let gcMarkers = PerformanceController.getCurrentRecording().getMarkers(); @@ -39,12 +39,12 @@ async function spawnTest() { EventUtils.sendMouseEvent({ type: "mousedown" }, targetBar); let showAllocsButton; // On slower machines this can not be found immediately? - await waitUntil(() => showAllocsButton = $("#waterfall-details .custom-button[type='show-allocations']")); + yield waitUntil(() => showAllocsButton = $("#waterfall-details .custom-button[type='show-allocations']")); ok(showAllocsButton, "GC buttons when allocations are enabled"); rendered = once(MemoryCallTreeView, EVENTS.UI_MEMORY_CALL_TREE_RENDERED); EventUtils.sendMouseEvent({ type: "click" }, showAllocsButton); - await rendered; + yield rendered; is(OverviewView.getTimeInterval().startTime, 0, "When clicking first GC, should use 0 as start time"); within(OverviewView.getTimeInterval().endTime, targetMarker.start, EPSILON, "Correct end time range"); @@ -52,8 +52,8 @@ async function spawnTest() { let duration = PerformanceController.getCurrentRecording().getDuration(); rendered = once(WaterfallView, EVENTS.UI_WATERFALL_RENDERED); OverviewView.setTimeInterval({ startTime: 0, endTime: duration }); - await DetailsView.selectView("waterfall"); - await rendered; + yield DetailsView.selectView("waterfall"); + yield rendered; /** * Check when there is a previous GC cycle @@ -66,12 +66,12 @@ async function spawnTest() { info(`Clicking GC Marker of type ${targetMarker.causeName} ${targetMarker.start}:${targetMarker.end}`); EventUtils.sendMouseEvent({ type: "mousedown" }, targetBar); // On slower machines this can not be found immediately? - await waitUntil(() => showAllocsButton = $("#waterfall-details .custom-button[type='show-allocations']")); + yield waitUntil(() => showAllocsButton = $("#waterfall-details .custom-button[type='show-allocations']")); ok(showAllocsButton, "GC buttons when allocations are enabled"); rendered = once(MemoryCallTreeView, EVENTS.UI_MEMORY_CALL_TREE_RENDERED); EventUtils.sendMouseEvent({ type: "click" }, showAllocsButton); - await rendered; + yield rendered; within(OverviewView.getTimeInterval().startTime, gcMarkers[2].end, EPSILON, "selection start range is last marker from previous GC cycle."); @@ -87,20 +87,20 @@ async function spawnTest() { duration = PerformanceController.getCurrentRecording().getDuration(); rendered = once(WaterfallView, EVENTS.UI_WATERFALL_RENDERED); OverviewView.setTimeInterval({ startTime: 0, endTime: duration }); - await rendered; + yield rendered; Services.prefs.setBoolPref(ALLOCATIONS_PREF, false); - await startRecording(panel); + yield startRecording(panel); rendered = once(WaterfallView, EVENTS.UI_WATERFALL_RENDERED); - await stopRecording(panel); - await rendered; + yield stopRecording(panel); + yield rendered; injectGCMarkers(PerformanceController, WaterfallView); // Select everything rendered = WaterfallView.once(EVENTS.UI_WATERFALL_RENDERED); OverviewView.setTimeInterval({ startTime: 0, endTime: Number.MAX_VALUE }); - await rendered; + yield rendered; ok(true, "WaterfallView rendered after recording is stopped."); @@ -112,7 +112,7 @@ async function spawnTest() { ok(!showAllocsButton, "No GC buttons when allocations are disabled"); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/performance/test/browser_perf-highlighted.js b/devtools/client/performance/test/browser_perf-highlighted.js index 3af658963c9e..111747ce0296 100644 --- a/devtools/client/performance/test/browser_perf-highlighted.js +++ b/devtools/client/performance/test/browser_perf-highlighted.js @@ -12,37 +12,37 @@ const { initPerformanceInTab, initConsoleInNewTab, teardownToolboxAndRemoveTab } const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { waitUntil } = require("devtools/client/performance/test/helpers/wait-utils"); -add_task(async function () { - let { target, toolbox, console } = await initConsoleInNewTab({ +add_task(function* () { + let { target, toolbox, console } = yield initConsoleInNewTab({ url: SIMPLE_URL, win: window }); let tab = toolbox.doc.getElementById("toolbox-tab-performance"); - await console.profile("rust"); - await waitUntil(() => tab.classList.contains("highlighted")); + yield console.profile("rust"); + yield waitUntil(() => tab.classList.contains("highlighted")); ok(tab.classList.contains("highlighted"), "Performance tab is highlighted during " + "recording from console.profile when unloaded."); - await console.profileEnd("rust"); - await waitUntil(() => !tab.classList.contains("highlighted")); + yield console.profileEnd("rust"); + yield waitUntil(() => !tab.classList.contains("highlighted")); ok(!tab.classList.contains("highlighted"), "Performance tab is no longer highlighted when console.profile recording finishes."); - let { panel } = await initPerformanceInTab({ tab: target.tab }); + let { panel } = yield initPerformanceInTab({ tab: target.tab }); - await startRecording(panel); + yield startRecording(panel); ok(tab.classList.contains("highlighted"), "Performance tab is highlighted during recording while in performance tool."); - await stopRecording(panel); + yield stopRecording(panel); ok(!tab.classList.contains("highlighted"), "Performance tab is no longer highlighted when recording finishes."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-loading-01.js b/devtools/client/performance/test/browser_perf-loading-01.js index 70486e6c8b53..d732efcae471 100644 --- a/devtools/client/performance/test/browser_perf-loading-01.js +++ b/devtools/client/performance/test/browser_perf-loading-01.js @@ -13,15 +13,15 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { once } = require("devtools/client/performance/test/helpers/event-utils"); const { getSelectedRecording, getDurationLabelText } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { EVENTS, L10N, PerformanceController } = panel.panelWin; - await startRecording(panel); + yield startRecording(panel); is(getDurationLabelText(panel, 0), L10N.getStr("recordingsList.recordingLabel"), @@ -35,18 +35,18 @@ add_task(async function () { }); let everythingStopped = stopRecording(panel); - await recordingStopping; + yield recordingStopping; is(getDurationLabelText(panel, 0), L10N.getStr("recordingsList.loadingLabel"), "The duration node should show the 'loading' message while stopping"); - await recordingStopped; + yield recordingStopped; const selected = getSelectedRecording(panel); is(getDurationLabelText(panel, 0), L10N.getFormatStr("recordingsList.durationLabel", selected.getDuration().toFixed(0)), "The duration node should show the duration after the record has stopped"); - await everythingStopped; - await teardownToolboxAndRemoveTab(panel); + yield everythingStopped; + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-loading-02.js b/devtools/client/performance/test/browser_perf-loading-02.js index df20138e89bb..c860cb7a9d73 100644 --- a/devtools/client/performance/test/browser_perf-loading-02.js +++ b/devtools/client/performance/test/browser_perf-loading-02.js @@ -15,8 +15,8 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { once } = require("devtools/client/performance/test/helpers/event-utils"); const { getSelectedRecordingIndex, setSelectedRecording } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -27,7 +27,7 @@ add_task(async function () { let loadingNotice = $("#loading-notice"); let detailsPane = $("#details-pane"); - await startRecording(panel); + yield startRecording(panel); is(detailsContainer.selectedPanel, recordingNotice, "The recording-notice is shown while recording."); @@ -40,21 +40,21 @@ add_task(async function () { }); let everythingStopped = stopRecording(panel); - await recordingStopping; + yield recordingStopping; is(detailsContainer.selectedPanel, loadingNotice, "The loading-notice is shown while the record is stopping."); - await recordingStopped; + yield recordingStopped; is(detailsContainer.selectedPanel, detailsPane, "The details panel is shown after the record has stopped."); - await everythingStopped; - await startRecording(panel); + yield everythingStopped; + yield startRecording(panel); info("While the 2nd record is still going, switch to the first one."); let recordingSelected = once(PerformanceController, EVENTS.RECORDING_SELECTED); setSelectedRecording(panel, 0); - await recordingSelected; + yield recordingSelected; recordingStopping = once(PerformanceController, EVENTS.RECORDING_STATE_CHANGE, { expectedArgs: { "1": "recording-stopping" } @@ -64,19 +64,19 @@ add_task(async function () { }); everythingStopped = stopRecording(panel); - await recordingStopping; + yield recordingStopping; is(detailsContainer.selectedPanel, detailsPane, "The details panel is still shown while the 2nd record is being stopped."); is(getSelectedRecordingIndex(panel), 0, "The first record is still selected."); - await recordingStopped; + yield recordingStopped; is(detailsContainer.selectedPanel, detailsPane, "The details panel is still shown after the 2nd record has stopped."); is(getSelectedRecordingIndex(panel), 1, "The second record is now selected."); - await everythingStopped; - await teardownToolboxAndRemoveTab(panel); + yield everythingStopped; + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-marker-details.js b/devtools/client/performance/test/browser_perf-marker-details.js index 8286918eec64..7a5447d6a9c7 100644 --- a/devtools/client/performance/test/browser_perf-marker-details.js +++ b/devtools/client/performance/test/browser_perf-marker-details.js @@ -7,8 +7,8 @@ * for each marker. */ -async function spawnTest() { - let { target, panel } = await initPerformance(MARKERS_URL); +function* spawnTest() { + let { target, panel } = yield initPerformance(MARKERS_URL); let { $, $$, EVENTS, PerformanceController, OverviewView, WaterfallView } = panel.panelWin; // Hijack the markers massaging part of creating the waterfall view, @@ -23,16 +23,16 @@ async function spawnTest() { "Styles", "Reflow", "ConsoleTime", "TimeStamp" ]; - await startRecording(panel); + yield startRecording(panel); ok(true, "Recording has started."); - await waitUntil(() => { + yield waitUntil(() => { // Wait until we get all the different markers. let markers = PerformanceController.getCurrentRecording().getMarkers(); return MARKER_TYPES.every(type => markers.some(m => m.name === type)); }); - await stopRecording(panel); + yield stopRecording(panel); ok(true, "Recording has ended."); info("No need to select everything in the timeline."); @@ -127,7 +127,7 @@ async function spawnTest() { } } - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/performance/test/browser_perf-options-01-toggle-throw.js b/devtools/client/performance/test/browser_perf-options-01-toggle-throw.js index f81310019ea0..4ecfb41524bb 100644 --- a/devtools/client/performance/test/browser_perf-options-01-toggle-throw.js +++ b/devtools/client/performance/test/browser_perf-options-01-toggle-throw.js @@ -9,15 +9,15 @@ const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls"); const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { DetailsView, JsCallTreeView } = panel.panelWin; - await DetailsView.selectView("js-calltree"); + yield DetailsView.selectView("js-calltree"); // Manually call the _onPrefChanged function so we can catch an error. try { @@ -27,5 +27,5 @@ add_task(async function () { ok(false, "Toggling preferences before there are any recordings should not fail."); } - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-02-toggle-throw-alt.js b/devtools/client/performance/test/browser_perf-options-02-toggle-throw-alt.js index af63ad17ecd8..cdea1556a6cf 100644 --- a/devtools/client/performance/test/browser_perf-options-02-toggle-throw-alt.js +++ b/devtools/client/performance/test/browser_perf-options-02-toggle-throw-alt.js @@ -10,16 +10,16 @@ const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls"); const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { DetailsView, JsCallTreeView } = panel.panelWin; - await DetailsView.selectView("js-calltree"); - await startRecording(panel); + yield DetailsView.selectView("js-calltree"); + yield startRecording(panel); // Manually call the _onPrefChanged function so we can catch an error. try { @@ -29,10 +29,10 @@ add_task(async function () { ok(false, "Toggling preferences during a recording should not fail."); } - await stopRecording(panel, { + yield stopRecording(panel, { expectedViewClass: "JsCallTreeView", expectedViewEvent: "UI_JS_CALL_TREE_RENDERED" }); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-03-toggle-meta.js b/devtools/client/performance/test/browser_perf-options-03-toggle-meta.js index 854b0371844b..384133fff37a 100644 --- a/devtools/client/performance/test/browser_perf-options-03-toggle-meta.js +++ b/devtools/client/performance/test/browser_perf-options-03-toggle-meta.js @@ -10,10 +10,10 @@ const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls"); const { UI_EXPERIMENTAL_PREF } = require("devtools/client/performance/test/helpers/prefs"); const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); -add_task(async function () { +add_task(function* () { Services.prefs.setBoolPref(UI_EXPERIMENTAL_PREF, false); - let { panel } = await initPerformanceInNewTab({ + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -34,5 +34,5 @@ add_task(async function () { ok($menu.classList.contains("experimental-enabled"), "The menu popup has `experimental-enabled` after toggle."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-enable-framerate-01.js b/devtools/client/performance/test/browser_perf-options-enable-framerate-01.js index 7c7b1e8a297b..ad75db6cfbe9 100644 --- a/devtools/client/performance/test/browser_perf-options-enable-framerate-01.js +++ b/devtools/client/performance/test/browser_perf-options-enable-framerate-01.js @@ -13,8 +13,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { isVisible } = require("devtools/client/performance/test/helpers/dom-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -24,8 +24,8 @@ add_task(async function () { // Disable framerate to test. Services.prefs.setBoolPref(UI_ENABLE_FRAMERATE_PREF, false); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); is(PerformanceController.getCurrentRecording().getConfiguration().withTicks, false, "PerformanceFront started without ticks recording."); @@ -40,13 +40,13 @@ add_task(async function () { ok(!isVisible($("#time-framerate")), "The fps graph is still hidden if recording does not contain ticks."); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); is(PerformanceController.getCurrentRecording().getConfiguration().withTicks, true, "PerformanceFront started with ticks recording."); ok(isVisible($("#time-framerate")), "The fps graph is not hidden when ticks enabled before recording."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-enable-framerate-02.js b/devtools/client/performance/test/browser_perf-options-enable-framerate-02.js index b0573e8c9f5d..b7f870bba985 100644 --- a/devtools/client/performance/test/browser_perf-options-enable-framerate-02.js +++ b/devtools/client/performance/test/browser_perf-options-enable-framerate-02.js @@ -12,8 +12,8 @@ const { UI_ENABLE_FRAMERATE_PREF } = require("devtools/client/performance/test/h const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -22,22 +22,22 @@ add_task(async function () { // Test starting without framerate, and stopping with it. Services.prefs.setBoolPref(UI_ENABLE_FRAMERATE_PREF, false); - await startRecording(panel); + yield startRecording(panel); Services.prefs.setBoolPref(UI_ENABLE_FRAMERATE_PREF, true); - await stopRecording(panel); + yield stopRecording(panel); is(PerformanceController.getCurrentRecording().getConfiguration().withTicks, false, "The recording finished without tracking framerate."); // Test starting with framerate, and stopping without it. - await startRecording(panel); + yield startRecording(panel); Services.prefs.setBoolPref(UI_ENABLE_FRAMERATE_PREF, false); - await stopRecording(panel); + yield stopRecording(panel); is(PerformanceController.getCurrentRecording().getConfiguration().withTicks, true, "The recording finished with tracking framerate."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-enable-memory-01.js b/devtools/client/performance/test/browser_perf-options-enable-memory-01.js index c421fe7a76ca..9785d54d60c4 100644 --- a/devtools/client/performance/test/browser_perf-options-enable-memory-01.js +++ b/devtools/client/performance/test/browser_perf-options-enable-memory-01.js @@ -13,8 +13,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { isVisible } = require("devtools/client/performance/test/helpers/dom-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -24,8 +24,8 @@ add_task(async function () { // Disable memory to test. Services.prefs.setBoolPref(UI_ENABLE_MEMORY_PREF, false); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); is(PerformanceController.getCurrentRecording().getConfiguration().withMemory, false, "PerformanceFront started without memory recording."); @@ -44,8 +44,8 @@ add_task(async function () { ok(!isVisible($("#memory-overview")), "memory graph is still hidden after enabling " + "if recording did not start recording memory"); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); is(PerformanceController.getCurrentRecording().getConfiguration().withMemory, true, "PerformanceFront started with memory recording."); @@ -54,5 +54,5 @@ add_task(async function () { ok(isVisible($("#memory-overview")), "The memory graph is not hidden when memory enabled before recording."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-enable-memory-02.js b/devtools/client/performance/test/browser_perf-options-enable-memory-02.js index fab4b89ec7aa..b9c5776875a0 100644 --- a/devtools/client/performance/test/browser_perf-options-enable-memory-02.js +++ b/devtools/client/performance/test/browser_perf-options-enable-memory-02.js @@ -12,8 +12,8 @@ const { UI_ENABLE_MEMORY_PREF } = require("devtools/client/performance/test/help const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -22,10 +22,10 @@ add_task(async function () { // Test starting without memory, and stopping with it. Services.prefs.setBoolPref(UI_ENABLE_MEMORY_PREF, false); - await startRecording(panel); + yield startRecording(panel); Services.prefs.setBoolPref(UI_ENABLE_MEMORY_PREF, true); - await stopRecording(panel); + yield stopRecording(panel); is(PerformanceController.getCurrentRecording().getConfiguration().withMemory, false, "The recording finished without tracking memory."); @@ -34,10 +34,10 @@ add_task(async function () { "The recording finished without tracking allocations."); // Test starting with memory, and stopping without it. - await startRecording(panel); + yield startRecording(panel); Services.prefs.setBoolPref(UI_ENABLE_MEMORY_PREF, false); - await stopRecording(panel); + yield stopRecording(panel); is(PerformanceController.getCurrentRecording().getConfiguration().withMemory, true, "The recording finished with tracking memory."); @@ -45,5 +45,5 @@ add_task(async function () { false, "The recording still is not recording allocations."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-flatten-tree-recursion-01.js b/devtools/client/performance/test/browser_perf-options-flatten-tree-recursion-01.js index f71ce9d51207..9fccd619949c 100644 --- a/devtools/client/performance/test/browser_perf-options-flatten-tree-recursion-01.js +++ b/devtools/client/performance/test/browser_perf-options-flatten-tree-recursion-01.js @@ -12,8 +12,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -28,12 +28,12 @@ add_task(async function () { Services.prefs.setBoolPref(UI_FLATTEN_RECURSION_PREF, true); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); - await DetailsView.selectView("js-flamegraph"); - await rendered; + yield DetailsView.selectView("js-flamegraph"); + yield rendered; let thread1 = PerformanceController.getCurrentRecording().getProfile().threads[0]; let rendering1 = FlameGraphUtils._cache.get(thread1); @@ -45,7 +45,7 @@ add_task(async function () { rendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); Services.prefs.setBoolPref(UI_FLATTEN_RECURSION_PREF, false); - await rendered; + yield rendered; ok(true, "JsFlameGraphView rerendered when toggling flatten-tree-recursion."); let thread2 = PerformanceController.getCurrentRecording().getProfile().threads[0]; @@ -58,7 +58,7 @@ add_task(async function () { rendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); Services.prefs.setBoolPref(UI_FLATTEN_RECURSION_PREF, true); - await rendered; + yield rendered; ok(true, "JsFlameGraphView rerendered when toggling back flatten-tree-recursion."); let thread3 = PerformanceController.getCurrentRecording().getProfile().threads[0]; @@ -69,5 +69,5 @@ add_task(async function () { isnot(rendering2, rendering3, "The rendering data should be different because other options were used (2)."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-flatten-tree-recursion-02.js b/devtools/client/performance/test/browser_perf-options-flatten-tree-recursion-02.js index fefff47a7e1c..509dd0f666a7 100644 --- a/devtools/client/performance/test/browser_perf-options-flatten-tree-recursion-02.js +++ b/devtools/client/performance/test/browser_perf-options-flatten-tree-recursion-02.js @@ -13,8 +13,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -32,12 +32,12 @@ add_task(async function () { Services.prefs.setBoolPref(UI_ENABLE_ALLOCATIONS_PREF, true); Services.prefs.setBoolPref(UI_FLATTEN_RECURSION_PREF, true); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(MemoryFlameGraphView, EVENTS.UI_MEMORY_FLAMEGRAPH_RENDERED); - await DetailsView.selectView("memory-flamegraph"); - await rendered; + yield DetailsView.selectView("memory-flamegraph"); + yield rendered; let allocations1 = PerformanceController.getCurrentRecording().getAllocations(); let thread1 = RecordingUtils.getProfileThreadFromAllocations(allocations1); @@ -52,7 +52,7 @@ add_task(async function () { rendered = once(MemoryFlameGraphView, EVENTS.UI_MEMORY_FLAMEGRAPH_RENDERED); Services.prefs.setBoolPref(UI_FLATTEN_RECURSION_PREF, false); - await rendered; + yield rendered; ok(true, "MemoryFlameGraphView rerendered when toggling flatten-tree-recursion."); let allocations2 = PerformanceController.getCurrentRecording().getAllocations(); @@ -68,7 +68,7 @@ add_task(async function () { rendered = once(MemoryFlameGraphView, EVENTS.UI_MEMORY_FLAMEGRAPH_RENDERED); Services.prefs.setBoolPref(UI_FLATTEN_RECURSION_PREF, true); - await rendered; + yield rendered; ok(true, "MemoryFlameGraphView rerendered when toggling back flatten-tree-recursion."); let allocations3 = PerformanceController.getCurrentRecording().getAllocations(); @@ -82,5 +82,5 @@ add_task(async function () { isnot(rendering2, rendering3, "The rendering data should be different because other options were used (2)."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-invert-call-tree-01.js b/devtools/client/performance/test/browser_perf-options-invert-call-tree-01.js index a40a39ca5e10..cd84e8754351 100644 --- a/devtools/client/performance/test/browser_perf-options-invert-call-tree-01.js +++ b/devtools/client/performance/test/browser_perf-options-invert-call-tree-01.js @@ -12,8 +12,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -22,22 +22,22 @@ add_task(async function () { Services.prefs.setBoolPref(UI_INVERT_CALL_TREE_PREF, true); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); - await DetailsView.selectView("js-calltree"); - await rendered; + yield DetailsView.selectView("js-calltree"); + yield rendered; rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); Services.prefs.setBoolPref(UI_INVERT_CALL_TREE_PREF, false); - await rendered; + yield rendered; ok(true, "JsCallTreeView rerendered when toggling invert-call-tree."); rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); Services.prefs.setBoolPref(UI_INVERT_CALL_TREE_PREF, true); - await rendered; + yield rendered; ok(true, "JsCallTreeView rerendered when toggling back invert-call-tree."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-invert-call-tree-02.js b/devtools/client/performance/test/browser_perf-options-invert-call-tree-02.js index 551ba8251091..ae0c8ede8b52 100644 --- a/devtools/client/performance/test/browser_perf-options-invert-call-tree-02.js +++ b/devtools/client/performance/test/browser_perf-options-invert-call-tree-02.js @@ -12,8 +12,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -24,22 +24,22 @@ add_task(async function () { Services.prefs.setBoolPref(UI_ENABLE_ALLOCATIONS_PREF, true); Services.prefs.setBoolPref(UI_INVERT_CALL_TREE_PREF, true); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(MemoryCallTreeView, EVENTS.UI_MEMORY_CALL_TREE_RENDERED); - await DetailsView.selectView("memory-calltree"); - await rendered; + yield DetailsView.selectView("memory-calltree"); + yield rendered; rendered = once(MemoryCallTreeView, EVENTS.UI_MEMORY_CALL_TREE_RENDERED); Services.prefs.setBoolPref(UI_INVERT_CALL_TREE_PREF, false); - await rendered; + yield rendered; ok(true, "MemoryCallTreeView rerendered when toggling invert-call-tree."); rendered = once(MemoryCallTreeView, EVENTS.UI_MEMORY_CALL_TREE_RENDERED); Services.prefs.setBoolPref(UI_INVERT_CALL_TREE_PREF, true); - await rendered; + yield rendered; ok(true, "MemoryCallTreeView rerendered when toggling back invert-call-tree."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-invert-flame-graph-01.js b/devtools/client/performance/test/browser_perf-options-invert-flame-graph-01.js index 865958f3e125..ee009bacfb12 100644 --- a/devtools/client/performance/test/browser_perf-options-invert-flame-graph-01.js +++ b/devtools/client/performance/test/browser_perf-options-invert-flame-graph-01.js @@ -12,8 +12,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -22,22 +22,22 @@ add_task(async function () { Services.prefs.setBoolPref(UI_INVERT_FLAME_PREF, true); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); - await DetailsView.selectView("js-flamegraph"); - await rendered; + yield DetailsView.selectView("js-flamegraph"); + yield rendered; rendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); Services.prefs.setBoolPref(UI_INVERT_FLAME_PREF, false); - await rendered; + yield rendered; ok(true, "JsFlameGraphView rerendered when toggling invert-call-tree."); rendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); Services.prefs.setBoolPref(UI_INVERT_FLAME_PREF, true); - await rendered; + yield rendered; ok(true, "JsFlameGraphView rerendered when toggling back invert-call-tree."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-invert-flame-graph-02.js b/devtools/client/performance/test/browser_perf-options-invert-flame-graph-02.js index 8f1493a7de7d..0a93225477d4 100644 --- a/devtools/client/performance/test/browser_perf-options-invert-flame-graph-02.js +++ b/devtools/client/performance/test/browser_perf-options-invert-flame-graph-02.js @@ -13,8 +13,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -25,22 +25,22 @@ add_task(async function () { Services.prefs.setBoolPref(UI_ENABLE_ALLOCATIONS_PREF, true); Services.prefs.setBoolPref(UI_INVERT_FLAME_PREF, true); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(MemoryFlameGraphView, EVENTS.UI_MEMORY_FLAMEGRAPH_RENDERED); - await DetailsView.selectView("memory-flamegraph"); - await rendered; + yield DetailsView.selectView("memory-flamegraph"); + yield rendered; rendered = once(MemoryFlameGraphView, EVENTS.UI_MEMORY_FLAMEGRAPH_RENDERED); Services.prefs.setBoolPref(UI_INVERT_FLAME_PREF, false); - await rendered; + yield rendered; ok(true, "MemoryFlameGraphView rerendered when toggling invert-call-tree."); rendered = once(MemoryFlameGraphView, EVENTS.UI_MEMORY_FLAMEGRAPH_RENDERED); Services.prefs.setBoolPref(UI_INVERT_FLAME_PREF, true); - await rendered; + yield rendered; ok(true, "MemoryFlameGraphView rerendered when toggling back invert-call-tree."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-propagate-allocations.js b/devtools/client/performance/test/browser_perf-options-propagate-allocations.js index e246bc6234de..509452be4ae9 100644 --- a/devtools/client/performance/test/browser_perf-options-propagate-allocations.js +++ b/devtools/client/performance/test/browser_perf-options-propagate-allocations.js @@ -12,8 +12,8 @@ const { MEMORY_SAMPLE_PROB_PREF, MEMORY_MAX_LOG_LEN_PREF, UI_ENABLE_ALLOCATIONS_ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); -add_task(async function () { - let { panel, toolbox } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel, toolbox } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -23,14 +23,14 @@ add_task(async function () { Services.prefs.setCharPref(MEMORY_SAMPLE_PROB_PREF, "0.213"); Services.prefs.setIntPref(MEMORY_MAX_LOG_LEN_PREF, 777777); - await startRecording(panel); - let { probability, maxLogLength } = await toolbox.performance.getConfiguration(); - await stopRecording(panel); + yield startRecording(panel); + let { probability, maxLogLength } = yield toolbox.performance.getConfiguration(); + yield stopRecording(panel); is(probability, 0.213, "The allocations probability option is set on memory actor."); is(maxLogLength, 777777, "The allocations max log length option is set on memory actor."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-propagate-profiler.js b/devtools/client/performance/test/browser_perf-options-propagate-profiler.js index c0e908f9d815..d592330517a1 100644 --- a/devtools/client/performance/test/browser_perf-options-propagate-profiler.js +++ b/devtools/client/performance/test/browser_perf-options-propagate-profiler.js @@ -12,8 +12,8 @@ const { PROFILER_BUFFER_SIZE_PREF, PROFILER_SAMPLE_RATE_PREF } = require("devtoo const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); -add_task(async function () { - let { panel, toolbox } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel, toolbox } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -21,12 +21,12 @@ add_task(async function () { Services.prefs.setIntPref(PROFILER_BUFFER_SIZE_PREF, 1000); Services.prefs.setIntPref(PROFILER_SAMPLE_RATE_PREF, 2); - await startRecording(panel); - let { entries, interval } = await toolbox.performance.getConfiguration(); - await stopRecording(panel); + yield startRecording(panel); + let { entries, interval } = yield toolbox.performance.getConfiguration(); + yield stopRecording(panel); is(entries, 1000, "profiler entries option is set on profiler"); is(interval, 0.5, "profiler interval option is set on profiler"); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-show-idle-blocks-01.js b/devtools/client/performance/test/browser_perf-options-show-idle-blocks-01.js index 67a3ab31b081..8c59ede4210a 100644 --- a/devtools/client/performance/test/browser_perf-options-show-idle-blocks-01.js +++ b/devtools/client/performance/test/browser_perf-options-show-idle-blocks-01.js @@ -12,8 +12,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -22,22 +22,22 @@ add_task(async function () { Services.prefs.setBoolPref(UI_SHOW_IDLE_BLOCKS_PREF, true); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); - await DetailsView.selectView("js-flamegraph"); - await rendered; + yield DetailsView.selectView("js-flamegraph"); + yield rendered; rendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); Services.prefs.setBoolPref(UI_SHOW_IDLE_BLOCKS_PREF, false); - await rendered; + yield rendered; ok(true, "JsFlameGraphView rerendered when toggling show-idle-blocks."); rendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); Services.prefs.setBoolPref(UI_SHOW_IDLE_BLOCKS_PREF, true); - await rendered; + yield rendered; ok(true, "JsFlameGraphView rerendered when toggling back show-idle-blocks."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-show-idle-blocks-02.js b/devtools/client/performance/test/browser_perf-options-show-idle-blocks-02.js index 47af07e40046..3e0146ac74a0 100644 --- a/devtools/client/performance/test/browser_perf-options-show-idle-blocks-02.js +++ b/devtools/client/performance/test/browser_perf-options-show-idle-blocks-02.js @@ -12,8 +12,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -24,22 +24,22 @@ add_task(async function () { Services.prefs.setBoolPref(UI_ENABLE_ALLOCATIONS_PREF, true); Services.prefs.setBoolPref(UI_SHOW_IDLE_BLOCKS_PREF, true); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(MemoryFlameGraphView, EVENTS.UI_MEMORY_FLAMEGRAPH_RENDERED); - await DetailsView.selectView("memory-flamegraph"); - await rendered; + yield DetailsView.selectView("memory-flamegraph"); + yield rendered; rendered = once(MemoryFlameGraphView, EVENTS.UI_MEMORY_FLAMEGRAPH_RENDERED); Services.prefs.setBoolPref(UI_SHOW_IDLE_BLOCKS_PREF, false); - await rendered; + yield rendered; ok(true, "MemoryFlameGraphView rerendered when toggling show-idle-blocks."); rendered = once(MemoryFlameGraphView, EVENTS.UI_MEMORY_FLAMEGRAPH_RENDERED); Services.prefs.setBoolPref(UI_SHOW_IDLE_BLOCKS_PREF, true); - await rendered; + yield rendered; ok(true, "MemoryFlameGraphView rerendered when toggling back show-idle-blocks."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-show-jit-optimizations.js b/devtools/client/performance/test/browser_perf-options-show-jit-optimizations.js index dea3dd63e205..fd0bbc663ba4 100644 --- a/devtools/client/performance/test/browser_perf-options-show-jit-optimizations.js +++ b/devtools/client/performance/test/browser_perf-options-show-jit-optimizations.js @@ -12,8 +12,8 @@ requestLongerTimeout(2); const { setSelectedRecording } = require("devtools/client/performance/test/helpers/recording-utils"); Services.prefs.setBoolPref(INVERT_PREF, false); -async function spawnTest() { - let { panel } = await initPerformance(SIMPLE_URL); +function* spawnTest() { + let { panel } = yield initPerformance(SIMPLE_URL); let { EVENTS, $, $$, window, PerformanceController } = panel.panelWin; let { OverviewView, DetailsView, OptimizationsListView, JsCallTreeView } = panel.panelWin; @@ -25,72 +25,72 @@ async function spawnTest() { // Make two recordings, so we have one to switch to later, as the // second one will have fake sample data - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); - await DetailsView.selectView("js-calltree"); + yield DetailsView.selectView("js-calltree"); - await injectAndRenderProfilerData(); + yield injectAndRenderProfilerData(); is($("#jit-optimizations-view").classList.contains("hidden"), true, "JIT Optimizations should be hidden when pref is on, but no frame selected"); // A is never a leaf, so it's optimizations should not be shown. - await checkFrame(1); + yield checkFrame(1); // gRawSite2 and gRawSite3 are both optimizations on B, so they'll have // indices in descending order of # of samples. - await checkFrame(2, true); + yield checkFrame(2, true); // Leaf node (C) with no optimizations should not display any opts. - await checkFrame(3); + yield checkFrame(3); // Select the node with optimizations and change to a new recording // to ensure the opts view is cleared let rendered = once(JsCallTreeView, "focus"); mousedown(window, $$(".call-tree-item")[2]); - await rendered; + yield rendered; let isHidden = $("#jit-optimizations-view").classList.contains("hidden"); ok(!isHidden, "opts view should be visible when selecting a frame with opts"); let select = once(PerformanceController, EVENTS.RECORDING_SELECTED); rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); setSelectedRecording(panel, 0); - await Promise.all([select, rendered]); + yield Promise.all([select, rendered]); isHidden = $("#jit-optimizations-view").classList.contains("hidden"); ok(isHidden, "opts view is hidden when switching recordings"); rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); setSelectedRecording(panel, 1); - await rendered; + yield rendered; rendered = once(JsCallTreeView, "focus"); mousedown(window, $$(".call-tree-item")[2]); - await rendered; + yield rendered; isHidden = $("#jit-optimizations-view").classList.contains("hidden"); ok(!isHidden, "opts view should be visible when selecting a frame with opts"); rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); Services.prefs.setBoolPref(JIT_PREF, false); - await rendered; + yield rendered; ok(true, "call tree rerendered when JIT pref changes"); isHidden = $("#jit-optimizations-view").classList.contains("hidden"); ok(isHidden, "opts view hidden when toggling off jit pref"); rendered = once(JsCallTreeView, "focus"); mousedown(window, $$(".call-tree-item")[2]); - await rendered; + yield rendered; isHidden = $("#jit-optimizations-view").classList.contains("hidden"); ok(isHidden, "opts view hidden when jit pref off and selecting a frame with opts"); - await teardown(panel); + yield teardown(panel); finish(); - async function injectAndRenderProfilerData() { + function* injectAndRenderProfilerData() { // Get current recording and inject our mock data info("Injecting mock profile data"); let recording = PerformanceController.getCurrentRecording(); @@ -99,15 +99,15 @@ async function spawnTest() { // Force a rerender let rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); JsCallTreeView.render(OverviewView.getTimeInterval()); - await rendered; + yield rendered; } - async function checkFrame(frameIndex, hasOpts) { + function* checkFrame(frameIndex, hasOpts) { info(`Checking frame ${frameIndex}`); // Click the frame let rendered = once(JsCallTreeView, "focus"); mousedown(window, $$(".call-tree-item")[frameIndex]); - await rendered; + yield rendered; let isHidden = $("#jit-optimizations-view").classList.contains("hidden"); if (hasOpts) { diff --git a/devtools/client/performance/test/browser_perf-options-show-platform-data-01.js b/devtools/client/performance/test/browser_perf-options-show-platform-data-01.js index 0186ce82579c..20e69bd9a83f 100644 --- a/devtools/client/performance/test/browser_perf-options-show-platform-data-01.js +++ b/devtools/client/performance/test/browser_perf-options-show-platform-data-01.js @@ -12,8 +12,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -22,22 +22,22 @@ add_task(async function () { Services.prefs.setBoolPref(UI_SHOW_PLATFORM_DATA_PREF, true); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); - await DetailsView.selectView("js-calltree"); - await rendered; + yield DetailsView.selectView("js-calltree"); + yield rendered; rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); Services.prefs.setBoolPref(UI_SHOW_PLATFORM_DATA_PREF, false); - await rendered; + yield rendered; ok(true, "JsCallTreeView rerendered when toggling show-idle-blocks."); rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); Services.prefs.setBoolPref(UI_SHOW_PLATFORM_DATA_PREF, true); - await rendered; + yield rendered; ok(true, "JsCallTreeView rerendered when toggling back show-idle-blocks."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-options-show-platform-data-02.js b/devtools/client/performance/test/browser_perf-options-show-platform-data-02.js index 8044561f81c6..df199e797c4b 100644 --- a/devtools/client/performance/test/browser_perf-options-show-platform-data-02.js +++ b/devtools/client/performance/test/browser_perf-options-show-platform-data-02.js @@ -12,8 +12,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -22,22 +22,22 @@ add_task(async function () { Services.prefs.setBoolPref(UI_SHOW_PLATFORM_DATA_PREF, true); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); - await DetailsView.selectView("js-flamegraph"); - await rendered; + yield DetailsView.selectView("js-flamegraph"); + yield rendered; rendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); Services.prefs.setBoolPref(UI_SHOW_PLATFORM_DATA_PREF, false); - await rendered; + yield rendered; ok(true, "JsFlameGraphView rerendered when toggling show-idle-blocks."); rendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); Services.prefs.setBoolPref(UI_SHOW_PLATFORM_DATA_PREF, true); - await rendered; + yield rendered; ok(true, "JsFlameGraphView rerendered when toggling back show-idle-blocks."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-overview-render-01.js b/devtools/client/performance/test/browser_perf-overview-render-01.js index ea4d2b420a8b..a34ba21eaf02 100644 --- a/devtools/client/performance/test/browser_perf-overview-render-01.js +++ b/devtools/client/performance/test/browser_perf-overview-render-01.js @@ -12,23 +12,23 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { times } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { EVENTS, OverviewView } = panel.panelWin; - await startRecording(panel); + yield startRecording(panel); // Ensure overview keeps rendering. - await times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { + yield times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { expectedArgs: { "1": Constants.FRAMERATE_GRAPH_LOW_RES_INTERVAL } }); ok(true, "Overview was rendered while recording."); - await stopRecording(panel); - await teardownToolboxAndRemoveTab(panel); + yield stopRecording(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-overview-render-02.js b/devtools/client/performance/test/browser_perf-overview-render-02.js index 7f2442f6e187..a7cb7026ebf7 100644 --- a/devtools/client/performance/test/browser_perf-overview-render-02.js +++ b/devtools/client/performance/test/browser_perf-overview-render-02.js @@ -14,8 +14,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { times } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -25,7 +25,7 @@ add_task(async function () { // Enable memory to test. Services.prefs.setBoolPref(UI_ENABLE_MEMORY_PREF, true); - await startRecording(panel); + yield startRecording(panel); let framerate = OverviewView.graphs.get("framerate"); let markers = OverviewView.graphs.get("timeline"); @@ -53,7 +53,7 @@ add_task(async function () { "The memory overview shouldn't have a selection before recording."); // Ensure overview keeps rendering. - await times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { + yield times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, { expectedArgs: { "1": Constants.FRAMERATE_GRAPH_LOW_RES_INTERVAL } }); @@ -78,7 +78,7 @@ add_task(async function () { is(memory.hasSelection(), false, "The memory overview still shouldn't have a selection before recording."); - await stopRecording(panel); + yield stopRecording(panel); is(framerate.selectionEnabled, true, "The selection should now be enabled for the framerate overview."); @@ -87,5 +87,5 @@ add_task(async function () { is(memory.selectionEnabled, true, "The selection should now be enabled for the memory overview."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-overview-render-03.js b/devtools/client/performance/test/browser_perf-overview-render-03.js index 8d8399f6ad7c..e46ce2f91b1f 100644 --- a/devtools/client/performance/test/browser_perf-overview-render-03.js +++ b/devtools/client/performance/test/browser_perf-overview-render-03.js @@ -12,8 +12,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { waitUntil } = require("devtools/client/performance/test/helpers/wait-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -61,16 +61,16 @@ add_task(async function () { "The markers and framerate graphs data scale are the same."); }; - await startRecording(panel); + yield startRecording(panel); doChecks(); - await waitUntil(() => PerformanceController.getCurrentRecording().getMarkers().length); - await waitUntil(() => PerformanceController.getCurrentRecording().getMemory().length); - await waitUntil(() => PerformanceController.getCurrentRecording().getTicks().length); + yield waitUntil(() => PerformanceController.getCurrentRecording().getMarkers().length); + yield waitUntil(() => PerformanceController.getCurrentRecording().getMemory().length); + yield waitUntil(() => PerformanceController.getCurrentRecording().getTicks().length); doChecks(); - await stopRecording(panel); + yield stopRecording(panel); doChecks(); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-overview-render-04.js b/devtools/client/performance/test/browser_perf-overview-render-04.js index 65d3f7967c21..22c8568511b8 100644 --- a/devtools/client/performance/test/browser_perf-overview-render-04.js +++ b/devtools/client/performance/test/browser_perf-overview-render-04.js @@ -15,8 +15,8 @@ const { waitUntil } = require("devtools/client/performance/test/helpers/wait-uti const { isVisible } = require("devtools/client/performance/test/helpers/dom-utils"); const { setSelectedRecording } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -32,23 +32,23 @@ add_task(async function () { let updated = 0; OverviewView.on(EVENTS.UI_OVERVIEW_RENDERED, () => updated++); - await startRecording(panel, { skipWaitingForOverview: true }); + yield startRecording(panel, { skipWaitingForOverview: true }); is(isVisible($("#overview-pane")), false, "Overview graphs hidden."); is(updated, 0, "Overview graphs have not been updated"); - await waitUntil(() => PerformanceController.getCurrentRecording().getMarkers().length); - await waitUntil(() => PerformanceController.getCurrentRecording().getMemory().length); - await waitUntil(() => PerformanceController.getCurrentRecording().getTicks().length); + yield waitUntil(() => PerformanceController.getCurrentRecording().getMarkers().length); + yield waitUntil(() => PerformanceController.getCurrentRecording().getMemory().length); + yield waitUntil(() => PerformanceController.getCurrentRecording().getTicks().length); is(isVisible($("#overview-pane")), false, "Overview graphs still hidden."); is(updated, 0, "Overview graphs have still not been updated"); - await stopRecording(panel); + yield stopRecording(panel); is(isVisible($("#overview-pane")), true, "Overview graphs no longer hidden."); is(updated, 1, "Overview graphs rendered upon completion."); - await startRecording(panel, { skipWaitingForOverview: true }); + yield startRecording(panel, { skipWaitingForOverview: true }); is(isVisible($("#overview-pane")), false, "Overview graphs hidden again when starting new recording."); @@ -64,11 +64,11 @@ add_task(async function () { "Overview graphs hidden again when going back to inprogress recording."); is(updated, 1, "Overview graphs have not been updated again."); - await stopRecording(panel); + yield stopRecording(panel); is(isVisible($("#overview-pane")), true, "overview graphs no longer hidden when recording finishes"); is(updated, 2, "Overview graphs rendered again upon completion."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-overview-selection-01.js b/devtools/client/performance/test/browser_perf-overview-selection-01.js index b7e0c130bff4..b8a8d730bfae 100644 --- a/devtools/client/performance/test/browser_perf-overview-selection-01.js +++ b/devtools/client/performance/test/browser_perf-overview-selection-01.js @@ -12,16 +12,16 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { once } = require("devtools/client/performance/test/helpers/event-utils"); const { dragStartCanvasGraph, dragStopCanvasGraph, clickCanvasGraph } = require("devtools/client/performance/test/helpers/input-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { EVENTS, PerformanceController, OverviewView } = panel.panelWin; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let duration = PerformanceController.getCurrentRecording().getDuration(); let graph = OverviewView.graphs.get("timeline"); @@ -31,13 +31,13 @@ add_task(async function () { let rangeSelected = once(OverviewView, EVENTS.UI_OVERVIEW_RANGE_SELECTED, { spreadArgs: true }); dragStartCanvasGraph(graph, { x: 0 }); - let [, { startTime, endTime }] = await rangeSelected; + let [, { startTime, endTime }] = yield rangeSelected; is(endTime, duration, "The selected range is the entire graph, for now."); rangeSelected = once(OverviewView, EVENTS.UI_OVERVIEW_RANGE_SELECTED, { spreadArgs: true }); dragStopCanvasGraph(graph, { x: graph.width / 2 }); - [, { startTime, endTime }] = await rangeSelected; + [, { startTime, endTime }] = yield rangeSelected; is(endTime, duration / 2, "The selected range is half of the graph."); is(graph.hasSelection(), true, @@ -58,7 +58,7 @@ add_task(async function () { rangeSelected = once(OverviewView, EVENTS.UI_OVERVIEW_RANGE_SELECTED, { spreadArgs: true }); clickCanvasGraph(graph, { x: 3 * graph.width / 4 }); - [, { startTime, endTime }] = await rangeSelected; + [, { startTime, endTime }] = yield rangeSelected; is(graph.hasSelection(), false, "A selection no longer on the graph."); @@ -67,5 +67,5 @@ add_task(async function () { is(endTime, duration, "The UI_OVERVIEW_RANGE_SELECTED event fired with duration as `endTime`."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-overview-selection-02.js b/devtools/client/performance/test/browser_perf-overview-selection-02.js index 3f0dccea6f8a..71b410094664 100644 --- a/devtools/client/performance/test/browser_perf-overview-selection-02.js +++ b/devtools/client/performance/test/browser_perf-overview-selection-02.js @@ -11,8 +11,8 @@ const { UI_ENABLE_MEMORY_PREF } = require("devtools/client/performance/test/help const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -22,7 +22,7 @@ add_task(async function () { // Enable memory to test. Services.prefs.setBoolPref(UI_ENABLE_MEMORY_PREF, true); - await startRecording(panel); + yield startRecording(panel); let markersOverview = OverviewView.graphs.get("timeline"); let memoryGraph = OverviewView.graphs.get("memory"); @@ -42,7 +42,7 @@ add_task(async function () { ok(!framerateGraph.selectionEnabled, "Selection shouldn't be enabled when the first recording started (1)."); - await stopRecording(panel); + yield stopRecording(panel); ok(markersOverview.selectionEnabled, "Selection should be enabled when the first recording finishes (2)."); @@ -51,7 +51,7 @@ add_task(async function () { ok(framerateGraph.selectionEnabled, "Selection should be enabled when the first recording finishes (1)."); - await startRecording(panel); + yield startRecording(panel); ok(!markersOverview.selectionEnabled, "Selection shouldn't be enabled when the second recording started (2)."); @@ -60,7 +60,7 @@ add_task(async function () { ok(!framerateGraph.selectionEnabled, "Selection shouldn't be enabled when the second recording started (1)."); - await stopRecording(panel); + yield stopRecording(panel); ok(markersOverview.selectionEnabled, "Selection should be enabled when the first second finishes (2)."); @@ -69,5 +69,5 @@ add_task(async function () { ok(framerateGraph.selectionEnabled, "Selection should be enabled when the first second finishes (1)."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-overview-selection-03.js b/devtools/client/performance/test/browser_perf-overview-selection-03.js index 9e9493609e90..8f06901e8f4d 100644 --- a/devtools/client/performance/test/browser_perf-overview-selection-03.js +++ b/devtools/client/performance/test/browser_perf-overview-selection-03.js @@ -13,8 +13,8 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { times } = require("devtools/client/performance/test/helpers/event-utils"); const { dragStartCanvasGraph, dragStopCanvasGraph } = require("devtools/client/performance/test/helpers/input-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -24,8 +24,8 @@ add_task(async function () { // Enable memory to test. Services.prefs.setBoolPref(UI_ENABLE_MEMORY_PREF, true); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let markersOverview = OverviewView.graphs.get("timeline"); let memoryGraph = OverviewView.graphs.get("memory"); @@ -37,7 +37,7 @@ add_task(async function () { let rangeSelected = times(OverviewView, EVENTS.UI_OVERVIEW_RANGE_SELECTED, 2); dragStartCanvasGraph(framerateGraph, { x: 0 }); dragStopCanvasGraph(framerateGraph, { x: width / 2 }); - await rangeSelected; + yield rangeSelected; is(markersOverview.getSelection().toSource(), framerateGraph.getSelection().toSource(), "The markers overview has a correct selection."); @@ -53,7 +53,7 @@ add_task(async function () { rangeSelected = times(OverviewView, EVENTS.UI_OVERVIEW_RANGE_SELECTED, 2); dragStartCanvasGraph(markersOverview, { x: 0 }); dragStopCanvasGraph(markersOverview, { x: width / 4 }); - await rangeSelected; + yield rangeSelected; is(markersOverview.getSelection().toSource(), framerateGraph.getSelection().toSource(), "The markers overview has a correct selection."); @@ -69,7 +69,7 @@ add_task(async function () { rangeSelected = times(OverviewView, EVENTS.UI_OVERVIEW_RANGE_SELECTED, 2); dragStartCanvasGraph(memoryGraph, { x: 0 }); dragStopCanvasGraph(memoryGraph, { x: width / 10 }); - await rangeSelected; + yield rangeSelected; is(markersOverview.getSelection().toSource(), framerateGraph.getSelection().toSource(), "The markers overview has a correct selection."); @@ -78,5 +78,5 @@ add_task(async function () { is(framerateGraph.getSelection().toSource(), "({start:0, end:" + (width / 10) + "})", "The framerate graph has a correct selection."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-overview-time-interval.js b/devtools/client/performance/test/browser_perf-overview-time-interval.js index c7c13e9b7c6b..b66e3ef86097 100644 --- a/devtools/client/performance/test/browser_perf-overview-time-interval.js +++ b/devtools/client/performance/test/browser_perf-overview-time-interval.js @@ -12,8 +12,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -34,14 +34,14 @@ add_task(async function () { ok(true, "Getting the time interval didn't work, as expected."); } - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); // Get/set the time interval and wait for the event propagation. let rangeSelected = once(OverviewView, EVENTS.UI_OVERVIEW_RANGE_SELECTED); OverviewView.setTimeInterval({ startTime: 10, endTime: 20 }); - await rangeSelected; + yield rangeSelected; let firstInterval = OverviewView.getTimeInterval(); info("First interval start time: " + firstInterval.startTime); @@ -69,5 +69,5 @@ add_task(async function () { is(Math.round(secondInterval.endTime), 40, "The interval's end time was properly set again."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-private-browsing.js b/devtools/client/performance/test/browser_perf-private-browsing.js index b4f39b3f06af..dd2383fd4da5 100644 --- a/devtools/client/performance/test/browser_perf-private-browsing.js +++ b/devtools/client/performance/test/browser_perf-private-browsing.js @@ -14,25 +14,25 @@ const { once } = require("devtools/client/performance/test/helpers/event-utils") let gPanelWinTuples = []; -add_task(async function () { - await testNormalWindow(); - await testPrivateWindow(); - await testRecordingFailingInWindow(0); - await testRecordingFailingInWindow(1); - await teardownPerfInWindow(1, { shouldCloseWindow: true, dontWaitForTabClose: true }); - await testRecordingSucceedingInWindow(0); - await teardownPerfInWindow(0, { shouldCloseWindow: false }); +add_task(function* () { + yield testNormalWindow(); + yield testPrivateWindow(); + yield testRecordingFailingInWindow(0); + yield testRecordingFailingInWindow(1); + yield teardownPerfInWindow(1, { shouldCloseWindow: true, dontWaitForTabClose: true }); + yield testRecordingSucceedingInWindow(0); + yield teardownPerfInWindow(0, { shouldCloseWindow: false }); gPanelWinTuples = null; }); -async function createPanelInNewWindow(options) { - let win = await addWindow(options); - return createPanelInWindow(options, win); +function* createPanelInNewWindow(options) { + let win = yield addWindow(options); + return yield createPanelInWindow(options, win); } -async function createPanelInWindow(options, win = window) { - let { panel } = await initPerformanceInNewTab({ +function* createPanelInWindow(options, win = window) { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: win }, options); @@ -41,8 +41,8 @@ async function createPanelInWindow(options, win = window) { return { panel, win }; } -async function testNormalWindow() { - let { panel } = await createPanelInWindow({ +function* testNormalWindow() { + let { panel } = yield createPanelInWindow({ private: false }); @@ -52,8 +52,8 @@ async function testNormalWindow() { "The initial state of the performance panel view is correct (1)."); } -async function testPrivateWindow() { - let { panel } = await createPanelInNewWindow({ +function* testPrivateWindow() { + let { panel } = yield createPanelInNewWindow({ private: true, // The add-on SDK can't seem to be able to listen to "ready" or "close" // events for private tabs. Don't really absolutely need to though. @@ -66,7 +66,7 @@ async function testPrivateWindow() { "The initial state of the performance panel view is correct (2)."); } -async function testRecordingFailingInWindow(index) { +function* testRecordingFailingInWindow(index) { let { panel } = gPanelWinTuples[index]; let { EVENTS, PerformanceController } = panel.panelWin; @@ -79,13 +79,13 @@ async function testRecordingFailingInWindow(index) { let whenFailed = once(PerformanceController, EVENTS.BACKEND_FAILED_AFTER_RECORDING_START); PerformanceController.startRecording(); - await whenFailed; + yield whenFailed; ok(true, "Recording has failed."); PerformanceController.off(EVENTS.RECORDING_STATE_CHANGE, onRecordingStarted); } -async function testRecordingSucceedingInWindow(index) { +function* testRecordingSucceedingInWindow(index) { let { panel } = gPanelWinTuples[index]; let { EVENTS, PerformanceController } = panel.panelWin; @@ -96,17 +96,17 @@ async function testRecordingSucceedingInWindow(index) { PerformanceController.on(EVENTS.BACKEND_FAILED_AFTER_RECORDING_START, onRecordingFailed); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); ok(true, "Recording has succeeded."); PerformanceController.off(EVENTS.BACKEND_FAILED_AFTER_RECORDING_START, onRecordingFailed); } -async function teardownPerfInWindow(index, options) { +function* teardownPerfInWindow(index, options) { let { panel, win } = gPanelWinTuples[index]; - await teardownToolboxAndRemoveTab(panel, options); + yield teardownToolboxAndRemoveTab(panel, options); if (options.shouldCloseWindow) { win.close(); diff --git a/devtools/client/performance/test/browser_perf-range-changed-render.js b/devtools/client/performance/test/browser_perf-range-changed-render.js index ec3ecf208092..b3b9c6a92a4f 100644 --- a/devtools/client/performance/test/browser_perf-range-changed-render.js +++ b/devtools/client/performance/test/browser_perf-range-changed-render.js @@ -11,8 +11,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -36,37 +36,37 @@ add_task(async function () { JsCallTreeView.on(EVENTS.UI_JS_CALL_TREE_RENDERED, updateCallTree); JsFlameGraphView.on(EVENTS.UI_JS_FLAMEGRAPH_RENDERED, updateFlameGraph); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rendered = once(WaterfallView, EVENTS.UI_WATERFALL_RENDERED); OverviewView.emit(EVENTS.UI_OVERVIEW_RANGE_SELECTED, { startTime: 0, endTime: 10 }); - await rendered; + yield rendered; ok(true, "Waterfall rerenders when a range in the overview graph is selected."); rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); - await DetailsView.selectView("js-calltree"); - await rendered; + yield DetailsView.selectView("js-calltree"); + yield rendered; ok(true, "Call tree rerenders after its corresponding pane is shown."); rendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); - await DetailsView.selectView("js-flamegraph"); - await rendered; + yield DetailsView.selectView("js-flamegraph"); + yield rendered; ok(true, "Flamegraph rerenders after its corresponding pane is shown."); rendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); OverviewView.emit(EVENTS.UI_OVERVIEW_RANGE_SELECTED); - await rendered; + yield rendered; ok(true, "Flamegraph rerenders when a range in the overview graph is removed."); rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); - await DetailsView.selectView("js-calltree"); - await rendered; + yield DetailsView.selectView("js-calltree"); + yield rendered; ok(true, "Call tree rerenders after its corresponding pane is shown."); rendered = once(WaterfallView, EVENTS.UI_WATERFALL_RENDERED); - await DetailsView.selectView("waterfall"); - await rendered; + yield DetailsView.selectView("waterfall"); + yield rendered; ok(true, "Waterfall rerenders after its corresponding pane is shown."); is(updatedWaterfall, 3, "WaterfallView rerendered 3 times."); @@ -77,5 +77,5 @@ add_task(async function () { JsCallTreeView.off(EVENTS.UI_JS_CALL_TREE_RENDERED, updateCallTree); JsFlameGraphView.off(EVENTS.UI_JS_FLAMEGRAPH_RENDERED, updateFlameGraph); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-recording-notices-01.js b/devtools/client/performance/test/browser_perf-recording-notices-01.js index 931b07bc887e..697691a558ba 100644 --- a/devtools/client/performance/test/browser_perf-recording-notices-01.js +++ b/devtools/client/performance/test/browser_perf-recording-notices-01.js @@ -11,8 +11,8 @@ const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls"); const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -29,17 +29,17 @@ add_task(async function () { is(PerformanceView.getState(), "empty", "Correct default state."); is(MAIN_CONTAINER.selectedPanel, EMPTY, "Showing empty panel on load."); - await startRecording(panel); + yield startRecording(panel); is(PerformanceView.getState(), "recording", "Correct state during recording."); is(MAIN_CONTAINER.selectedPanel, CONTENT, "Showing main view with timeline."); is(DETAILS_CONTAINER.selectedPanel, RECORDING, "Showing recording panel."); - await stopRecording(panel); + yield stopRecording(panel); is(PerformanceView.getState(), "recorded", "Correct state after recording."); is(MAIN_CONTAINER.selectedPanel, CONTENT, "Showing main view with timeline."); is(DETAILS_CONTAINER.selectedPanel, DETAILS, "Showing rendered graphs."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-recording-notices-02.js b/devtools/client/performance/test/browser_perf-recording-notices-02.js index 0c81f5f397bb..b7905b3d7100 100644 --- a/devtools/client/performance/test/browser_perf-recording-notices-02.js +++ b/devtools/client/performance/test/browser_perf-recording-notices-02.js @@ -13,8 +13,8 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { once } = require("devtools/client/performance/test/helpers/event-utils"); const { setSelectedRecording } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -32,10 +32,10 @@ add_task(async function () { let RECORDING = $("#recording-notice"); let DETAILS = $("#details-pane"); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); - await startRecording(panel); + yield startRecording(panel); is(PerformanceView.getState(), "recording", "Correct state during recording."); is(MAIN_CONTAINER.selectedPanel, CONTENT, "Showing main view with timeline."); @@ -43,7 +43,7 @@ add_task(async function () { let selected = once(PerformanceController, EVENTS.RECORDING_SELECTED); setSelectedRecording(panel, 0); - await selected; + yield selected; is(PerformanceView.getState(), "recorded", "Correct state during recording but selecting a completed recording."); @@ -52,14 +52,14 @@ add_task(async function () { selected = once(PerformanceController, EVENTS.RECORDING_SELECTED); setSelectedRecording(panel, 1); - await selected; + yield selected; is(PerformanceView.getState(), "recording", "Correct state when switching back to recording in progress."); is(MAIN_CONTAINER.selectedPanel, CONTENT, "Showing main view with timeline."); is(DETAILS_CONTAINER.selectedPanel, RECORDING, "Showing recording panel."); - await stopRecording(panel); + yield stopRecording(panel); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-recording-notices-03.js b/devtools/client/performance/test/browser_perf-recording-notices-03.js index d2add0df33dd..cb3779d10391 100644 --- a/devtools/client/performance/test/browser_perf-recording-notices-03.js +++ b/devtools/client/performance/test/browser_perf-recording-notices-03.js @@ -17,20 +17,20 @@ const { waitUntil } = require("devtools/client/performance/test/helpers/wait-uti const { once } = require("devtools/client/performance/test/helpers/event-utils"); const { setSelectedRecording } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { +add_task(function* () { // Make sure the profiler module is stopped so we can set a new buffer limit. pmmLoadFrameScripts(gBrowser); - await pmmStopProfiler(); + yield pmmStopProfiler(); // Keep the profiler's buffer large, but still get to 1% relatively quick. Services.prefs.setIntPref(PROFILER_BUFFER_SIZE_PREF, 1000000); - let { target, console } = await initConsoleInNewTab({ + let { target, console } = yield initConsoleInNewTab({ url: SIMPLE_URL, win: window }); - let { panel } = await initPerformanceInTab({ tab: target.tab }); + let { panel } = yield initPerformanceInTab({ tab: target.tab }); let { gFront, EVENTS, @@ -40,7 +40,7 @@ add_task(async function () { } = panel.panelWin; // Set a fast profiler-status update interval. - await gFront.setProfilerStatusInterval(10); + yield gFront.setProfilerStatusInterval(10); let DETAILS_CONTAINER = $("#details-pane-container"); let NORMAL_BUFFER_STATUS_MESSAGE = $("#recording-notice .buffer-status-message"); @@ -49,10 +49,10 @@ add_task(async function () { let gPercent; // Start a manual recording. - await startRecording(panel); + yield startRecording(panel); - await waitUntil(async function () { - [, gPercent] = await once(PerformanceView, + yield waitUntil(function* () { + [, gPercent] = yield once(PerformanceView, EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED, { spreadArgs: true }); return gPercent > 0; @@ -68,10 +68,10 @@ add_task(async function () { "Buffer status text has correct percentage."); // Start a console profile. - await console.profile("rust"); + yield console.profile("rust"); - await waitUntil(async function () { - [, gPercent] = await once(PerformanceView, + yield waitUntil(function* () { + [, gPercent] = yield once(PerformanceView, EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED, { spreadArgs: true }); return gPercent > Math.floor(bufferUsage * 100); @@ -89,10 +89,10 @@ add_task(async function () { // Select the console recording. let selected = once(PerformanceController, EVENTS.RECORDING_SELECTED); setSelectedRecording(panel, 1); - await selected; + yield selected; - await waitUntil(async function () { - [, gPercent] = await once(PerformanceView, + yield waitUntil(function* () { + [, gPercent] = yield once(PerformanceView, EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED, { spreadArgs: true }); return gPercent > 0; @@ -106,14 +106,14 @@ add_task(async function () { "Buffer status text has correct percentage for console recording."); // Stop the console profile, then select the original manual recording. - await console.profileEnd("rust"); + yield console.profileEnd("rust"); selected = once(PerformanceController, EVENTS.RECORDING_SELECTED); setSelectedRecording(panel, 0); - await selected; + yield selected; - await waitUntil(async function () { - [, gPercent] = await once(PerformanceView, + yield waitUntil(function* () { + [, gPercent] = yield once(PerformanceView, EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED, { spreadArgs: true }); return gPercent > Math.floor(bufferUsage * 100); @@ -127,9 +127,9 @@ add_task(async function () { "Buffer status text has correct percentage."); // Stop the manual recording. - await stopRecording(panel); + yield stopRecording(panel); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); pmmClearFrameScripts(); }); diff --git a/devtools/client/performance/test/browser_perf-recording-notices-04.js b/devtools/client/performance/test/browser_perf-recording-notices-04.js index 40b85843026b..61441e5d3389 100644 --- a/devtools/client/performance/test/browser_perf-recording-notices-04.js +++ b/devtools/client/performance/test/browser_perf-recording-notices-04.js @@ -15,15 +15,15 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { waitUntil } = require("devtools/client/performance/test/helpers/wait-utils"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { +add_task(function* () { // Make sure the profiler module is stopped so we can set a new buffer limit. pmmLoadFrameScripts(gBrowser); - await pmmStopProfiler(); + yield pmmStopProfiler(); // Keep the profiler's buffer small, to get to 100% really quickly. Services.prefs.setIntPref(PROFILER_BUFFER_SIZE_PREF, 10000); - let { panel } = await initPerformanceInNewTab({ + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -31,17 +31,17 @@ add_task(async function () { let { gFront, EVENTS, $, PerformanceController, PerformanceView } = panel.panelWin; // Set a fast profiler-status update interval - await gFront.setProfilerStatusInterval(10); + yield gFront.setProfilerStatusInterval(10); let DETAILS_CONTAINER = $("#details-pane-container"); let NORMAL_BUFFER_STATUS_MESSAGE = $("#recording-notice .buffer-status-message"); let gPercent; // Start a manual recording. - await startRecording(panel); + yield startRecording(panel); - await waitUntil(async function () { - [, gPercent] = await once(PerformanceView, + yield waitUntil(function* () { + [, gPercent] = yield once(PerformanceView, EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED, { spreadArgs: true }); return gPercent == 100; @@ -58,9 +58,9 @@ add_task(async function () { "Buffer status text has correct percentage."); // Stop the manual recording. - await stopRecording(panel); + yield stopRecording(panel); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); pmmClearFrameScripts(); }); diff --git a/devtools/client/performance/test/browser_perf-recording-notices-05.js b/devtools/client/performance/test/browser_perf-recording-notices-05.js index 20546f106009..5107f81a6bad 100644 --- a/devtools/client/performance/test/browser_perf-recording-notices-05.js +++ b/devtools/client/performance/test/browser_perf-recording-notices-05.js @@ -9,8 +9,8 @@ const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls"); const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -18,7 +18,7 @@ add_task(async function () { let { gFront, $, PerformanceController } = panel.panelWin; // Set a fast profiler-status update interval - await gFront.setProfilerStatusInterval(10); + yield gFront.setProfilerStatusInterval(10); let enabled = false; @@ -36,5 +36,5 @@ add_task(async function () { ok($("#performance-view").getAttribute("e10s"), "", "When e10s is enabled, there should be no e10s attribute."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-recording-selected-01.js b/devtools/client/performance/test/browser_perf-recording-selected-01.js index d7f4d932f80f..15cb66ec954e 100644 --- a/devtools/client/performance/test/browser_perf-recording-selected-01.js +++ b/devtools/client/performance/test/browser_perf-recording-selected-01.js @@ -13,19 +13,19 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { once } = require("devtools/client/performance/test/helpers/event-utils"); const { setSelectedRecording, getRecordingsCount, getSelectedRecordingIndex } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { EVENTS, PerformanceController } = panel.panelWin; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); is(getRecordingsCount(panel), 2, "There should be two recordings visible."); @@ -34,12 +34,12 @@ add_task(async function () { let selected = once(PerformanceController, EVENTS.RECORDING_SELECTED); setSelectedRecording(panel, 0); - await selected; + yield selected; is(getRecordingsCount(panel), 2, "There should still be two recordings visible."); is(getSelectedRecordingIndex(panel), 0, "The first recording item should be selected."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-recording-selected-02.js b/devtools/client/performance/test/browser_perf-recording-selected-02.js index 0e202be613e2..0bffa3a73aa1 100644 --- a/devtools/client/performance/test/browser_perf-recording-selected-02.js +++ b/devtools/client/performance/test/browser_perf-recording-selected-02.js @@ -13,21 +13,21 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { once } = require("devtools/client/performance/test/helpers/event-utils"); const { getSelectedRecordingIndex, setSelectedRecording, getRecordingsCount } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { +add_task(function* () { // This test seems to take a very long time to finish on Linux VMs. requestLongerTimeout(4); - let { panel } = await initPerformanceInNewTab({ + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { EVENTS, PerformanceController } = panel.panelWin; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); - await startRecording(panel); + yield startRecording(panel); is(getRecordingsCount(panel), 2, "There should be two recordings visible."); @@ -36,7 +36,7 @@ add_task(async function () { let selected = once(PerformanceController, EVENTS.RECORDING_SELECTED); setSelectedRecording(panel, 0); - await selected; + yield selected; is(getRecordingsCount(panel), 2, "There should still be two recordings visible."); @@ -45,14 +45,14 @@ add_task(async function () { selected = once(PerformanceController, EVENTS.RECORDING_SELECTED); setSelectedRecording(panel, 1); - await selected; + yield selected; is(getRecordingsCount(panel), 2, "There should still be two recordings visible."); is(getSelectedRecordingIndex(panel), 1, "The second recording item should be selected again."); - await stopRecording(panel); + yield stopRecording(panel); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-recording-selected-03.js b/devtools/client/performance/test/browser_perf-recording-selected-03.js index c1b1349a2073..7febfbb2b96d 100644 --- a/devtools/client/performance/test/browser_perf-recording-selected-03.js +++ b/devtools/client/performance/test/browser_perf-recording-selected-03.js @@ -14,31 +14,31 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { once } = require("devtools/client/performance/test/helpers/event-utils"); const { setSelectedRecording } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { $, EVENTS, PerformanceController } = panel.panelWin; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); - await startRecording(panel); + yield startRecording(panel); info("Selecting recording #0 and waiting for it to be displayed."); let selected = once(PerformanceController, EVENTS.RECORDING_SELECTED); setSelectedRecording(panel, 0); - await selected; + yield selected; ok($("#main-record-button").classList.contains("checked"), "Button is still checked after selecting another item."); ok(!$("#main-record-button").hasAttribute("disabled"), "Button is not locked after selecting another item."); - await stopRecording(panel); + yield stopRecording(panel); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-recording-selected-04.js b/devtools/client/performance/test/browser_perf-recording-selected-04.js index d39149fcf7f5..014ef5bddb2b 100644 --- a/devtools/client/performance/test/browser_perf-recording-selected-04.js +++ b/devtools/client/performance/test/browser_perf-recording-selected-04.js @@ -12,8 +12,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording, waitForAllWidgetsRendered } = require("devtools/client/performance/test/helpers/actions"); const { setSelectedRecording } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -26,8 +26,8 @@ add_task(async function () { // Enable allocations to test the memory-calltree and memory-flamegraph. Services.prefs.setBoolPref(UI_ENABLE_ALLOCATIONS_PREF, true); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); // Ållow widgets to be updated while hidden, to make testing easier. DetailsSubview.canUpdateWhileHidden = true; @@ -35,25 +35,25 @@ add_task(async function () { // Cycle through all the views to initialize them. The waterfall is shown // by default, but all the other views are created lazily, so won't emit // any events. - await DetailsView.selectView("js-calltree"); - await DetailsView.selectView("js-flamegraph"); - await DetailsView.selectView("memory-calltree"); - await DetailsView.selectView("memory-flamegraph"); + yield DetailsView.selectView("js-calltree"); + yield DetailsView.selectView("js-flamegraph"); + yield DetailsView.selectView("memory-calltree"); + yield DetailsView.selectView("memory-flamegraph"); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let rerender = waitForAllWidgetsRendered(panel); setSelectedRecording(panel, 0); - await rerender; + yield rerender; ok(true, "All widgets were rendered when selecting the first recording."); rerender = waitForAllWidgetsRendered(panel); setSelectedRecording(panel, 1); - await rerender; + yield rerender; ok(true, "All widgets were rendered when selecting the second recording."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-recordings-clear-01.js b/devtools/client/performance/test/browser_perf-recordings-clear-01.js index 79722c0fc04a..87579896a273 100644 --- a/devtools/client/performance/test/browser_perf-recordings-clear-01.js +++ b/devtools/client/performance/test/browser_perf-recordings-clear-01.js @@ -12,8 +12,8 @@ const { initPanelInNewTab, teardownToolboxAndRemoveTab } = require("devtools/cli const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { getRecordingsCount } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { panel } = await initPanelInNewTab({ +add_task(function* () { + let { panel } = yield initPanelInNewTab({ tool: "performance", url: SIMPLE_URL, win: window @@ -21,8 +21,8 @@ add_task(async function () { let { PerformanceController, PerformanceView } = panel.panelWin; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); is(getRecordingsCount(panel), 1, "The recordings list should have one recording."); @@ -31,8 +31,8 @@ add_task(async function () { isnot(PerformanceController.getCurrentRecording(), null, "There should be a current recording."); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); is(getRecordingsCount(panel), 2, "The recordings list should have two recordings."); @@ -41,7 +41,7 @@ add_task(async function () { isnot(PerformanceController.getCurrentRecording(), null, "There should be a current recording."); - await PerformanceController.clearRecordings(); + yield PerformanceController.clearRecordings(); is(getRecordingsCount(panel), 0, "The recordings list should be empty."); @@ -50,5 +50,5 @@ add_task(async function () { is(PerformanceController.getCurrentRecording(), null, "There should be no current recording."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-recordings-clear-02.js b/devtools/client/performance/test/browser_perf-recordings-clear-02.js index f57f0409d046..d8196dbd1a79 100644 --- a/devtools/client/performance/test/browser_perf-recordings-clear-02.js +++ b/devtools/client/performance/test/browser_perf-recordings-clear-02.js @@ -13,8 +13,8 @@ const { startRecording, stopRecording } = require("devtools/client/performance/t const { times, once } = require("devtools/client/performance/test/helpers/event-utils"); const { getRecordingsCount } = require("devtools/client/performance/test/helpers/recording-utils"); -add_task(async function () { - let { panel } = await initPanelInNewTab({ +add_task(function* () { + let { panel } = yield initPanelInNewTab({ tool: "performance", url: SIMPLE_URL, win: window @@ -22,8 +22,8 @@ add_task(async function () { let { EVENTS, PerformanceController, PerformanceView } = panel.panelWin; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); is(getRecordingsCount(panel), 1, "The recordings list should have one recording."); @@ -32,7 +32,7 @@ add_task(async function () { isnot(PerformanceController.getCurrentRecording(), null, "There should be a current recording."); - await startRecording(panel); + yield startRecording(panel); is(getRecordingsCount(panel), 2, "The recordings list should have two recordings."); @@ -48,8 +48,8 @@ add_task(async function () { PerformanceController.clearRecordings(); - await recordingDeleted; - await recordingStopped; + yield recordingDeleted; + yield recordingStopped; is(getRecordingsCount(panel), 0, "The recordings list should be empty."); @@ -59,11 +59,11 @@ add_task(async function () { "There should be no current recording."); // Bug 1169146: Try another recording after clearing mid-recording. - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); is(getRecordingsCount(panel), 1, "The recordings list should have one recording."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-recordings-io-01.js b/devtools/client/performance/test/browser_perf-recordings-io-01.js index 63040566c199..90a0144215da 100644 --- a/devtools/client/performance/test/browser_perf-recordings-io-01.js +++ b/devtools/client/performance/test/browser_perf-recordings-io-01.js @@ -6,8 +6,8 @@ * Tests if the performance tool is able to save and load recordings. */ -var test = async function () { - var { target, panel, toolbox } = await initPerformance(SIMPLE_URL); +var test = Task.async(function* () { + var { target, panel, toolbox } = yield initPerformance(SIMPLE_URL); var { $, EVENTS, PerformanceController, PerformanceView, DetailsView, DetailsSubview } = panel.panelWin; // Enable allocations to test the memory-calltree and memory-flamegraph. @@ -19,16 +19,16 @@ var test = async function () { // `waitForWidgetsRendered`. DetailsSubview.canUpdateWhileHidden = true; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); // Cycle through all the views to initialize them, otherwise we can't use // `waitForWidgetsRendered`. The waterfall is shown by default, but all the // other views are created lazily, so won't emit any events. - await DetailsView.selectView("js-calltree"); - await DetailsView.selectView("js-flamegraph"); - await DetailsView.selectView("memory-calltree"); - await DetailsView.selectView("memory-flamegraph"); + yield DetailsView.selectView("js-calltree"); + yield DetailsView.selectView("js-flamegraph"); + yield DetailsView.selectView("memory-calltree"); + yield DetailsView.selectView("memory-flamegraph"); // Verify original recording. @@ -41,9 +41,9 @@ var test = async function () { file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("666", 8)); let exported = once(PerformanceController, EVENTS.RECORDING_EXPORTED); - await PerformanceController.exportRecording("", PerformanceController.getCurrentRecording(), file); + yield PerformanceController.exportRecording("", PerformanceController.getCurrentRecording(), file); - await exported; + yield exported; ok(true, "The recording data appears to have been successfully saved."); // Check if the imported file name has tmpprofile in it as the file @@ -59,10 +59,10 @@ var test = async function () { let imported = once(PerformanceController, EVENTS.RECORDING_IMPORTED); PerformanceView.emit(EVENTS.UI_IMPORT_RECORDING, file); - await imported; + yield imported; ok(true, "The recording data appears to have been successfully imported."); - await rerendered; + yield rerendered; ok(true, "The imported data was re-rendered."); // Verify imported recording. @@ -88,7 +88,7 @@ var test = async function () { is(importedData.configuration.withMemory, originalData.configuration.withMemory, "The imported data is identical to the original data (8)."); - await teardown(panel); + yield teardown(panel); finish(); -}; +}); /* eslint-enable */ diff --git a/devtools/client/performance/test/browser_perf-recordings-io-02.js b/devtools/client/performance/test/browser_perf-recordings-io-02.js index 3104a40e9685..48e7fb63c822 100644 --- a/devtools/client/performance/test/browser_perf-recordings-io-02.js +++ b/devtools/client/performance/test/browser_perf-recordings-io-02.js @@ -6,21 +6,21 @@ * Tests if the performance tool gracefully handles loading bogus files. */ -var test = async function () { - let { target, panel, toolbox } = await initPerformance(SIMPLE_URL); +var test = Task.async(function* () { + let { target, panel, toolbox } = yield initPerformance(SIMPLE_URL); let { EVENTS, PerformanceController } = panel.panelWin; let file = FileUtils.getFile("TmpD", ["tmpprofile.json"]); file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("666", 8)); try { - await PerformanceController.importRecording("", file); + yield PerformanceController.importRecording("", file); ok(false, "The recording succeeded unexpectedly."); } catch (e) { is(e.message, "Could not read recording data file.", "Message is correct."); ok(true, "The recording was cancelled."); } - await teardown(panel); + yield teardown(panel); finish(); -}; +}); diff --git a/devtools/client/performance/test/browser_perf-recordings-io-03.js b/devtools/client/performance/test/browser_perf-recordings-io-03.js index 791f373c76e6..d53268c3e685 100644 --- a/devtools/client/performance/test/browser_perf-recordings-io-03.js +++ b/devtools/client/performance/test/browser_perf-recordings-io-03.js @@ -10,25 +10,25 @@ var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm", {}); var { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm", {}); -var test = async function () { - let { target, panel, toolbox } = await initPerformance(SIMPLE_URL); +var test = Task.async(function* () { + let { target, panel, toolbox } = yield initPerformance(SIMPLE_URL); let { EVENTS, PerformanceController } = panel.panelWin; let file = FileUtils.getFile("TmpD", ["tmpprofile.json"]); file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("666", 8)); - await asyncCopy({ bogus: "data" }, file); + yield asyncCopy({ bogus: "data" }, file); try { - await PerformanceController.importRecording("", file); + yield PerformanceController.importRecording("", file); ok(false, "The recording succeeded unexpectedly."); } catch (e) { is(e.message, "Unrecognized recording data file.", "Message is correct."); ok(true, "The recording was cancelled."); } - await teardown(panel); + yield teardown(panel); finish(); -}; +}); function getUnicodeConverter() { let className = "@mozilla.org/intl/scriptableunicodeconverter"; diff --git a/devtools/client/performance/test/browser_perf-recordings-io-04.js b/devtools/client/performance/test/browser_perf-recordings-io-04.js index 8d7b5b7d0b89..8fff37c81b38 100644 --- a/devtools/client/performance/test/browser_perf-recordings-io-04.js +++ b/devtools/client/performance/test/browser_perf-recordings-io-04.js @@ -69,8 +69,8 @@ var PROFILER_DATA = (function () { return data; })(); -var test = async function () { - let { target, panel, toolbox } = await initPerformance(SIMPLE_URL); +var test = Task.async(function* () { + let { target, panel, toolbox } = yield initPerformance(SIMPLE_URL); let { $, EVENTS, PerformanceController, DetailsView, OverviewView, JsCallTreeView } = panel.panelWin; // Enable memory to test the memory-calltree and memory-flamegraph. @@ -90,20 +90,20 @@ var test = async function () { // Save recording as an old profiler data. let file = FileUtils.getFile("TmpD", ["tmpprofile.json"]); file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("666", 8)); - await asyncCopy(oldProfilerData, file); + yield asyncCopy(oldProfilerData, file); // Import recording. let calltreeRendered = once(OverviewView, EVENTS.UI_FRAMERATE_GRAPH_RENDERED); let fpsRendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); let imported = once(PerformanceController, EVENTS.RECORDING_IMPORTED); - await PerformanceController.importRecording("", file); + yield PerformanceController.importRecording("", file); - await imported; + yield imported; ok(true, "The original profiler data appears to have been successfully imported."); - await calltreeRendered; - await fpsRendered; + yield calltreeRendered; + yield fpsRendered; ok(true, "The imported data was re-rendered."); // Ensure that only framerate and js calltree/flamegraph view are available @@ -148,9 +148,9 @@ var test = async function () { } } - await teardown(panel); + yield teardown(panel); finish(); -}; +}); function getUnicodeConverter() { let className = "@mozilla.org/intl/scriptableunicodeconverter"; diff --git a/devtools/client/performance/test/browser_perf-recordings-io-05.js b/devtools/client/performance/test/browser_perf-recordings-io-05.js index 4d671543d20b..e836da917fda 100644 --- a/devtools/client/performance/test/browser_perf-recordings-io-05.js +++ b/devtools/client/performance/test/browser_perf-recordings-io-05.js @@ -7,12 +7,12 @@ * `getMappedSelection` error. */ -var test = async function () { - var { target, panel, toolbox } = await initPerformance(SIMPLE_URL); +var test = Task.async(function* () { + var { target, panel, toolbox } = yield initPerformance(SIMPLE_URL); var { EVENTS, PerformanceController, WaterfallView } = panel.panelWin; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); // Save recording. @@ -20,24 +20,24 @@ var test = async function () { file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("666", 8)); let exported = once(PerformanceController, EVENTS.RECORDING_EXPORTED); - await PerformanceController.exportRecording("", PerformanceController.getCurrentRecording(), file); + yield PerformanceController.exportRecording("", PerformanceController.getCurrentRecording(), file); - await exported; + yield exported; ok(true, "The recording data appears to have been successfully saved."); // Clear and re-import. - await PerformanceController.clearRecordings(); + yield PerformanceController.clearRecordings(); let rendered = once(WaterfallView, EVENTS.UI_WATERFALL_RENDERED); let imported = once(PerformanceController, EVENTS.RECORDING_IMPORTED); - await PerformanceController.importRecording("", file); - await imported; - await rendered; + yield PerformanceController.importRecording("", file); + yield imported; + yield rendered; ok(true, "No error was thrown."); - await teardown(panel); + yield teardown(panel); finish(); -}; +}); /* eslint-enable */ diff --git a/devtools/client/performance/test/browser_perf-recordings-io-06.js b/devtools/client/performance/test/browser_perf-recordings-io-06.js index 8a52c38e4150..e3a40680bf90 100644 --- a/devtools/client/performance/test/browser_perf-recordings-io-06.js +++ b/devtools/client/performance/test/browser_perf-recordings-io-06.js @@ -84,8 +84,8 @@ var PROFILER_DATA = (function () { return data; })(); -var test = async function () { - let { target, panel, toolbox } = await initPerformance(SIMPLE_URL); +var test = Task.async(function* () { + let { target, panel, toolbox } = yield initPerformance(SIMPLE_URL); let { $, EVENTS, PerformanceController, DetailsView, JsCallTreeView } = panel.panelWin; let profilerData = { @@ -98,23 +98,23 @@ var test = async function () { let file = FileUtils.getFile("TmpD", ["tmpprofile.json"]); file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("666", 8)); - await asyncCopy(profilerData, file); + yield asyncCopy(profilerData, file); // Import recording. let calltreeRendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); let imported = once(PerformanceController, EVENTS.RECORDING_IMPORTED); - await PerformanceController.importRecording("", file); + yield PerformanceController.importRecording("", file); - await imported; + yield imported; ok(true, "The profiler data appears to have been successfully imported."); - await calltreeRendered; + yield calltreeRendered; ok(true, "The imported data was re-rendered."); - await teardown(panel); + yield teardown(panel); finish(); -}; +}); function getUnicodeConverter() { let className = "@mozilla.org/intl/scriptableunicodeconverter"; diff --git a/devtools/client/performance/test/browser_perf-refresh.js b/devtools/client/performance/test/browser_perf-refresh.js index 06d5fc0c0635..825e2153fa3a 100644 --- a/devtools/client/performance/test/browser_perf-refresh.js +++ b/devtools/client/performance/test/browser_perf-refresh.js @@ -11,16 +11,16 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording, reload } = require("devtools/client/performance/test/helpers/actions"); const { waitUntil } = require("devtools/client/performance/test/helpers/wait-utils"); -add_task(async function () { - let { panel, target } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel, target } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { PerformanceController } = panel.panelWin; - await startRecording(panel); - await reload(target); + yield startRecording(panel); + yield reload(target); let recording = PerformanceController.getCurrentRecording(); let markersLength = recording.getAllData().markers.length; @@ -28,9 +28,9 @@ add_task(async function () { ok(recording.isRecording(), "RecordingModel should still be recording after reload"); - await waitUntil(() => recording.getMarkers().length > markersLength); + yield waitUntil(() => recording.getMarkers().length > markersLength); ok("Markers continue after reload."); - await stopRecording(panel); - await teardownToolboxAndRemoveTab(panel); + yield stopRecording(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-states.js b/devtools/client/performance/test/browser_perf-states.js index 48e2dd64037b..c01fb31213b4 100644 --- a/devtools/client/performance/test/browser_perf-states.js +++ b/devtools/client/performance/test/browser_perf-states.js @@ -11,8 +11,8 @@ const { UI_ENABLE_MEMORY_PREF, UI_ENABLE_ALLOCATIONS_PREF } = require("devtools/ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -50,7 +50,7 @@ add_task(async function () { ok(!(OverviewView.graphs.get("framerate")), "The framerate graph should still not have been created yet."); - await startRecording(panel); + yield startRecording(panel); is(PerformanceView.getState(), "recording", "The current state of the performance panel view is 'recording'."); @@ -59,7 +59,7 @@ add_task(async function () { ok(OverviewView.graphs.get("framerate"), "The framerate graph should have been created now."); - await stopRecording(panel); + yield stopRecording(panel); is(PerformanceView.getState(), "recorded", "The current state of the performance panel view is 'recorded'."); @@ -72,7 +72,7 @@ add_task(async function () { ok(!DetailsView.components["memory-flamegraph"].initialized, "The memory-flamegraph detail view should still not have been created yet."); - await DetailsView.selectView("js-calltree"); + yield DetailsView.selectView("js-calltree"); is(PerformanceView.getState(), "recorded", "The current state of the performance panel view is still 'recorded'."); @@ -85,7 +85,7 @@ add_task(async function () { ok(!DetailsView.components["memory-flamegraph"].initialized, "The memory-flamegraph detail view should still not have been created yet."); - await DetailsView.selectView("memory-calltree"); + yield DetailsView.selectView("memory-calltree"); is(PerformanceView.getState(), "recorded", "The current state of the performance panel view is still 'recorded'."); @@ -98,5 +98,5 @@ add_task(async function () { ok(!DetailsView.components["memory-flamegraph"].initialized, "The memory-flamegraph detail view should still not have been created yet."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-telemetry-01.js b/devtools/client/performance/test/browser_perf-telemetry-01.js index 5fd2165deaa0..2c37e6c5ae15 100644 --- a/devtools/client/performance/test/browser_perf-telemetry-01.js +++ b/devtools/client/performance/test/browser_perf-telemetry-01.js @@ -12,8 +12,8 @@ const { UI_ENABLE_MEMORY_PREF } = require("devtools/client/performance/test/help const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -29,13 +29,13 @@ add_task(async function () { Services.prefs.setBoolPref(UI_ENABLE_MEMORY_PREF, false); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); Services.prefs.setBoolPref(UI_ENABLE_MEMORY_PREF, true); - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); is(logs[DURATION].length, 2, `There are two entries for ${DURATION}.`); ok(logs[DURATION].every(d => typeof d === "number"), @@ -49,5 +49,5 @@ add_task(async function () { ok(logs[FEATURES].find(r => r[0] === "withMemory" && r[1] === false), "One feature entry for memory disabled."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-telemetry-02.js b/devtools/client/performance/test/browser_perf-telemetry-02.js index 9306a82cb5c7..6fe268e3a153 100644 --- a/devtools/client/performance/test/browser_perf-telemetry-02.js +++ b/devtools/client/performance/test/browser_perf-telemetry-02.js @@ -12,8 +12,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -25,24 +25,24 @@ add_task(async function () { let EXPORTED = "DEVTOOLS_PERFTOOLS_RECORDING_EXPORT_FLAG"; let IMPORTED = "DEVTOOLS_PERFTOOLS_RECORDING_IMPORT_FLAG"; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let file = FileUtils.getFile("TmpD", ["tmpprofile.json"]); file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("666", 8)); let exported = once(PerformanceController, EVENTS.RECORDING_EXPORTED); - await PerformanceController.exportRecording("", + yield PerformanceController.exportRecording("", PerformanceController.getCurrentRecording(), file); - await exported; + yield exported; ok(logs[EXPORTED], `A telemetry entry for ${EXPORTED} exists after exporting.`); let imported = once(PerformanceController, EVENTS.RECORDING_IMPORTED); - await PerformanceController.importRecording(null, file); - await imported; + yield PerformanceController.importRecording(null, file); + yield imported; ok(logs[IMPORTED], `A telemetry entry for ${IMPORTED} exists after importing.`); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-telemetry-03.js b/devtools/client/performance/test/browser_perf-telemetry-03.js index 102265e6ec3f..a10f314d2424 100644 --- a/devtools/client/performance/test/browser_perf-telemetry-03.js +++ b/devtools/client/performance/test/browser_perf-telemetry-03.js @@ -12,8 +12,8 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); @@ -30,20 +30,20 @@ add_task(async function () { let logs = telemetry.getLogs(); let VIEWS = "DEVTOOLS_PERFTOOLS_SELECTED_VIEW_MS"; - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); let calltreeRendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); let flamegraphRendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED); // Go through some views to check later. - await DetailsView.selectView("js-calltree"); - await calltreeRendered; + yield DetailsView.selectView("js-calltree"); + yield calltreeRendered; - await DetailsView.selectView("js-flamegraph"); - await flamegraphRendered; + yield DetailsView.selectView("js-flamegraph"); + yield flamegraphRendered; - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); // Check views after destruction to ensure `js-flamegraph` gets called // with a time during destruction. diff --git a/devtools/client/performance/test/browser_perf-telemetry-04.js b/devtools/client/performance/test/browser_perf-telemetry-04.js index cc702e9d4cef..362b5471425e 100644 --- a/devtools/client/performance/test/browser_perf-telemetry-04.js +++ b/devtools/client/performance/test/browser_perf-telemetry-04.js @@ -10,13 +10,13 @@ const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls"); const { initPerformanceInTab, initConsoleInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); const { waitForRecordingStartedEvents, waitForRecordingStoppedEvents } = require("devtools/client/performance/test/helpers/actions"); -add_task(async function () { - let { target, console } = await initConsoleInNewTab({ +add_task(function* () { + let { target, console } = yield initConsoleInNewTab({ url: SIMPLE_URL, win: window }); - let { panel } = await initPerformanceInTab({ tab: target.tab }); + let { panel } = yield initPerformanceInTab({ tab: target.tab }); let { PerformanceController } = panel.panelWin; let telemetry = PerformanceController._telemetry; @@ -29,15 +29,15 @@ add_task(async function () { // only emitted for manual recordings skipWaitingForBackendReady: true }); - await console.profile("rust"); - await started; + yield console.profile("rust"); + yield started; let stopped = waitForRecordingStoppedEvents(panel, { // only emitted for manual recordings skipWaitingForBackendReady: true }); - await console.profileEnd("rust"); - await stopped; + yield console.profileEnd("rust"); + yield stopped; is(logs[DURATION].length, 1, `There is one entry for ${DURATION}.`); ok(logs[DURATION].every(d => typeof d === "number"), @@ -46,5 +46,5 @@ add_task(async function () { is(logs[FEATURES].length, 4, `There is one recording worth of entries for ${FEATURES}.`); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_perf-theme-toggle.js b/devtools/client/performance/test/browser_perf-theme-toggle.js index b866e59b6a96..f8dbe97678cb 100644 --- a/devtools/client/performance/test/browser_perf-theme-toggle.js +++ b/devtools/client/performance/test/browser_perf-theme-toggle.js @@ -17,19 +17,19 @@ Services.prefs.setBoolPref(MEMORY_PREF, false); requestLongerTimeout(2); -async function spawnTest() { - let { panel } = await initPerformance(SIMPLE_URL); +function* spawnTest() { + let { panel } = yield initPerformance(SIMPLE_URL); let { EVENTS, $, OverviewView, document: doc } = panel.panelWin; - await startRecording(panel); + yield startRecording(panel); let markers = OverviewView.graphs.get("timeline"); is(markers.backgroundColor, DARK_BG, "correct theme on load for markers."); - await stopRecording(panel); + yield stopRecording(panel); let refreshed = once(markers, "refresh"); setTheme("light"); - await refreshed; + yield refreshed; ok(true, "markers were rerendered after theme change."); is(markers.backgroundColor, LIGHT_BG, @@ -38,24 +38,24 @@ async function spawnTest() { // reset back to dark refreshed = once(markers, "refresh"); setTheme("dark"); - await refreshed; + yield refreshed; info("Testing with memory overview"); Services.prefs.setBoolPref(MEMORY_PREF, true); - await startRecording(panel); + yield startRecording(panel); let memory = OverviewView.graphs.get("memory"); is(memory.backgroundColor, DARK_BG, "correct theme on load for memory."); - await stopRecording(panel); + yield stopRecording(panel); refreshed = Promise.all([ once(markers, "refresh"), once(memory, "refresh"), ]); setTheme("light"); - await refreshed; + yield refreshed; ok(true, "Both memory and markers were rerendered after theme change."); is(markers.backgroundColor, LIGHT_BG, @@ -70,9 +70,9 @@ async function spawnTest() { // Set theme back to light setTheme("light"); - await refreshed; + yield refreshed; - await teardown(panel); + yield teardown(panel); finish(); } /* eslint-enable */ diff --git a/devtools/client/performance/test/browser_perf-tree-abstract-01.js b/devtools/client/performance/test/browser_perf-tree-abstract-01.js index acbbf766bd28..61fc32a1dbcb 100644 --- a/devtools/client/performance/test/browser_perf-tree-abstract-01.js +++ b/devtools/client/performance/test/browser_perf-tree-abstract-01.js @@ -11,11 +11,11 @@ const { appendAndWaitForPaint } = require("devtools/client/performance/test/help const { synthesizeCustomTreeClass } = require("devtools/client/performance/test/helpers/synth-utils"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { +add_task(function* () { let { MyCustomTreeItem, myDataSrc } = synthesizeCustomTreeClass(); let container = document.createElement("vbox"); - await appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container); + yield appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container); // Populate the tree and test the root item... @@ -51,11 +51,11 @@ add_task(async function () { let receivedFocusEvent = once(treeRoot, "focus"); mousedown(treeRoot.target.querySelector(".arrow")); - let [eventItem] = await receivedExpandEvent; + let [eventItem] = yield receivedExpandEvent; is(eventItem, treeRoot, "The 'expand' event target is correct (1)."); - await receivedFocusEvent; + yield receivedFocusEvent; is(document.commandDispatcher.focusedElement, treeRoot.target, "The root node is now focused."); @@ -102,7 +102,7 @@ add_task(async function () { receivedFocusEvent = once(treeRoot, "focus", { spreadArgs: true }); mousedown(fooItem.target); - [eventItem] = await receivedFocusEvent; + [eventItem] = yield receivedFocusEvent; is(eventItem, fooItem, "The 'focus' event target is correct (2)."); is(document.commandDispatcher.focusedElement, fooItem.target, @@ -114,11 +114,11 @@ add_task(async function () { receivedFocusEvent = once(treeRoot, "focus"); dblclick(barItem.target); - [eventItem] = await receivedExpandEvent; + [eventItem] = yield receivedExpandEvent; is(eventItem, barItem, "The 'expand' event target is correct (3)."); - await receivedFocusEvent; + yield receivedFocusEvent; is(document.commandDispatcher.focusedElement, barItem.target, "The 'foo' node is now focused."); diff --git a/devtools/client/performance/test/browser_perf-tree-abstract-02.js b/devtools/client/performance/test/browser_perf-tree-abstract-02.js index 1d068345cc60..62db4cfd6de2 100644 --- a/devtools/client/performance/test/browser_perf-tree-abstract-02.js +++ b/devtools/client/performance/test/browser_perf-tree-abstract-02.js @@ -10,11 +10,11 @@ const { appendAndWaitForPaint } = require("devtools/client/performance/test/helpers/dom-utils"); const { synthesizeCustomTreeClass } = require("devtools/client/performance/test/helpers/synth-utils"); -add_task(async function () { +add_task(function* () { let { MyCustomTreeItem, myDataSrc } = synthesizeCustomTreeClass(); let container = document.createElement("vbox"); - await appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container); + yield appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container); // Populate the tree and test the root item... diff --git a/devtools/client/performance/test/browser_perf-tree-abstract-03.js b/devtools/client/performance/test/browser_perf-tree-abstract-03.js index c19f08f8f3f7..4e427fcd3f30 100644 --- a/devtools/client/performance/test/browser_perf-tree-abstract-03.js +++ b/devtools/client/performance/test/browser_perf-tree-abstract-03.js @@ -10,11 +10,11 @@ const { appendAndWaitForPaint } = require("devtools/client/performance/test/helpers/dom-utils"); const { synthesizeCustomTreeClass } = require("devtools/client/performance/test/helpers/synth-utils"); -add_task(async function () { +add_task(function* () { let { MyCustomTreeItem, myDataSrc } = synthesizeCustomTreeClass(); let container = document.createElement("vbox"); - await appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container); + yield appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container); // Populate the tree by pressing RIGHT... diff --git a/devtools/client/performance/test/browser_perf-tree-abstract-04.js b/devtools/client/performance/test/browser_perf-tree-abstract-04.js index 2115a1cd4eb2..614235ab8317 100644 --- a/devtools/client/performance/test/browser_perf-tree-abstract-04.js +++ b/devtools/client/performance/test/browser_perf-tree-abstract-04.js @@ -10,11 +10,11 @@ const { appendAndWaitForPaint } = require("devtools/client/performance/test/help const { synthesizeCustomTreeClass } = require("devtools/client/performance/test/helpers/synth-utils"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { +add_task(function* () { let { MyCustomTreeItem, myDataSrc } = synthesizeCustomTreeClass(); let container = document.createElement("vbox"); - await appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container); + yield appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container); // Populate the tree and test the root item... @@ -26,7 +26,7 @@ add_task(async function () { let receivedFocusEvent = once(treeRoot, "focus"); dblclick(treeRoot.target.querySelector(".arrow")); - await receivedFocusEvent; + yield receivedFocusEvent; is(treeRoot.expanded, originalTreeRootExpandedState, "A double click on the arrow was ignored."); diff --git a/devtools/client/performance/test/browser_perf-tree-abstract-05.js b/devtools/client/performance/test/browser_perf-tree-abstract-05.js index 62000369138c..88138b6f35ce 100644 --- a/devtools/client/performance/test/browser_perf-tree-abstract-05.js +++ b/devtools/client/performance/test/browser_perf-tree-abstract-05.js @@ -10,13 +10,13 @@ const { appendAndWaitForPaint } = require("devtools/client/performance/test/helpers/dom-utils"); const { synthesizeCustomTreeClass } = require("devtools/client/performance/test/helpers/synth-utils"); -add_task(async function () { +add_task(function* () { let { MyCustomTreeItem } = synthesizeCustomTreeClass(); let container = document.createElement("vbox"); container.style.height = "100%"; container.style.overflow = "scroll"; - await appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container); + yield appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container); let myDataSrc = { label: "root", diff --git a/devtools/client/performance/test/browser_perf-tree-view-06.js b/devtools/client/performance/test/browser_perf-tree-view-06.js index 56ad879b8d4f..9d2fb6718c59 100644 --- a/devtools/client/performance/test/browser_perf-tree-view-06.js +++ b/devtools/client/performance/test/browser_perf-tree-view-06.js @@ -12,7 +12,7 @@ const { CallView } = require("devtools/client/performance/modules/widgets/tree-v const { synthesizeProfile } = require("devtools/client/performance/test/helpers/synth-utils"); const { idleWait, waitUntil } = require("devtools/client/performance/test/helpers/wait-utils"); -add_task(async function () { +add_task(function* () { let profile = synthesizeProfile(); let threadNode = new ThreadNode(profile.threads[0], { startTime: 0, endTime: 20 }); @@ -38,14 +38,14 @@ add_task(async function () { rightMousedown(D.target.querySelector(".call-tree-url")); // Ensure link was not called for right click. - await idleWait(100); + yield idleWait(100); ok(!linkEvent, "The `link` event not fired for right click."); // Fire left click. mousedown(D.target.querySelector(".call-tree-url")); // Ensure link was called for left click. - await waitUntil(() => linkEvent); + yield waitUntil(() => linkEvent); is(linkEvent, D, "The `link` event target is correct."); treeRoot.off("link", handler); diff --git a/devtools/client/performance/test/browser_perf-tree-view-11.js b/devtools/client/performance/test/browser_perf-tree-view-11.js index 3a25f6c1dcf0..a316098e3272 100644 --- a/devtools/client/performance/test/browser_perf-tree-view-11.js +++ b/devtools/client/performance/test/browser_perf-tree-view-11.js @@ -9,8 +9,8 @@ var { CATEGORY_MASK } = require("devtools/client/performance/modules/categories"); -async function spawnTest() { - let { panel } = await initPerformance(SIMPLE_URL); +function* spawnTest() { + let { panel } = yield initPerformance(SIMPLE_URL); let { EVENTS, $, $$, window, PerformanceController } = panel.panelWin; let { OverviewView, DetailsView, JsCallTreeView } = panel.panelWin; @@ -22,12 +22,12 @@ async function spawnTest() { // Make two recordings, so we have one to switch to later, as the // second one will have fake sample data - await startRecording(panel); - await stopRecording(panel); + yield startRecording(panel); + yield stopRecording(panel); - await DetailsView.selectView("js-calltree"); + yield DetailsView.selectView("js-calltree"); - await injectAndRenderProfilerData(); + yield injectAndRenderProfilerData(); let rows = $$("#js-calltree-view .call-tree-item"); is(rows.length, 4, "4 call tree rows exist"); @@ -52,10 +52,10 @@ async function spawnTest() { } } - await teardown(panel); + yield teardown(panel); finish(); - async function injectAndRenderProfilerData() { + function* injectAndRenderProfilerData() { // Get current recording and inject our mock data info("Injecting mock profile data"); let recording = PerformanceController.getCurrentRecording(); @@ -64,7 +64,7 @@ async function spawnTest() { // Force a rerender let rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED); JsCallTreeView.render(OverviewView.getTimeInterval()); - await rendered; + yield rendered; } } diff --git a/devtools/client/performance/test/browser_perf-ui-recording.js b/devtools/client/performance/test/browser_perf-ui-recording.js index c1265f4c3dea..b585f763bb24 100644 --- a/devtools/client/performance/test/browser_perf-ui-recording.js +++ b/devtools/client/performance/test/browser_perf-ui-recording.js @@ -12,28 +12,28 @@ const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls"); const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); pmmLoadFrameScripts(gBrowser); - ok(!(await pmmIsProfilerActive()), + ok(!(yield pmmIsProfilerActive()), "The built-in profiler module should not have been automatically started."); - await startRecording(panel); + yield startRecording(panel); - ok((await pmmIsProfilerActive()), + ok((yield pmmIsProfilerActive()), "The built-in profiler module should now be active."); - await stopRecording(panel); + yield stopRecording(panel); - ok((await pmmIsProfilerActive()), + ok((yield pmmIsProfilerActive()), "The built-in profiler module should still be active."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); pmmClearFrameScripts(); }); diff --git a/devtools/client/performance/test/browser_timeline-filters-01.js b/devtools/client/performance/test/browser_timeline-filters-01.js index ff9698cbf8e4..4a8d485852fa 100644 --- a/devtools/client/performance/test/browser_timeline-filters-01.js +++ b/devtools/client/performance/test/browser_timeline-filters-01.js @@ -8,16 +8,16 @@ const EPSILON = 0.00000001; -async function spawnTest() { - let { panel } = await initPerformance(SIMPLE_URL); +function* spawnTest() { + let { panel } = yield initPerformance(SIMPLE_URL); let { $, $$, EVENTS, PerformanceController, OverviewView, WaterfallView } = panel.panelWin; let { TimelineGraph } = require("devtools/client/performance/modules/widgets/graphs"); let { rowHeight: MARKERS_GRAPH_ROW_HEIGHT } = TimelineGraph.prototype; - await startRecording(panel); + yield startRecording(panel); ok(true, "Recording has started."); - await waitUntil(() => { + yield waitUntil(() => { // Wait until we get 3 different markers. let markers = PerformanceController.getCurrentRecording().getMarkers(); return markers.some(m => m.name == "Styles") && @@ -25,7 +25,7 @@ async function spawnTest() { markers.some(m => m.name == "Paint"); }); - await stopRecording(panel); + yield stopRecording(panel); ok(true, "Recording has ended."); // Push some fake markers of a type we do not have a blueprint for @@ -50,7 +50,7 @@ async function spawnTest() { let overview = OverviewView.graphs.get("timeline"); let originalHeight = overview.fixedHeight; - await waterfallRendered; + yield waterfallRendered; ok($(".waterfall-marker-bar[type=Styles]"), "Found at least one 'Styles' marker (1)"); ok($(".waterfall-marker-bar[type=Reflow]"), "Found at least one 'Reflow' marker (1)"); @@ -59,7 +59,7 @@ async function spawnTest() { let heightBefore = overview.fixedHeight; EventUtils.synthesizeMouseAtCenter(menuItem1, {type: "mouseup"}, panel.panelWin); - await waitForOverviewAndCommand(overview, menuItem1); + yield waitForOverviewAndCommand(overview, menuItem1); is(overview.fixedHeight, heightBefore, "Overview height hasn't changed"); ok(!$(".waterfall-marker-bar[type=Styles]"), "No 'Styles' marker (2)"); @@ -69,7 +69,7 @@ async function spawnTest() { heightBefore = overview.fixedHeight; EventUtils.synthesizeMouseAtCenter(menuItem2, {type: "mouseup"}, panel.panelWin); - await waitForOverviewAndCommand(overview, menuItem2); + yield waitForOverviewAndCommand(overview, menuItem2); is(overview.fixedHeight, heightBefore, "Overview height hasn't changed"); ok(!$(".waterfall-marker-bar[type=Styles]"), "No 'Styles' marker (3)"); @@ -79,7 +79,7 @@ async function spawnTest() { heightBefore = overview.fixedHeight; EventUtils.synthesizeMouseAtCenter(menuItem3, {type: "mouseup"}, panel.panelWin); - await waitForOverviewAndCommand(overview, menuItem3); + yield waitForOverviewAndCommand(overview, menuItem3); is(overview.fixedHeight, heightBefore - MARKERS_GRAPH_ROW_HEIGHT, "Overview is smaller"); ok(!$(".waterfall-marker-bar[type=Styles]"), "No 'Styles' marker (4)"); @@ -88,7 +88,7 @@ async function spawnTest() { ok($(".waterfall-marker-bar[type=CustomMarker]"), "Found at least one 'Unknown' marker (4)"); EventUtils.synthesizeMouseAtCenter(menuItem4, {type: "mouseup"}, panel.panelWin); - await waitForOverviewAndCommand(overview, menuItem4); + yield waitForOverviewAndCommand(overview, menuItem4); ok(!$(".waterfall-marker-bar[type=Styles]"), "No 'Styles' marker (5)"); ok(!$(".waterfall-marker-bar[type=Reflow]"), "No 'Reflow' marker (5)"); @@ -97,7 +97,7 @@ async function spawnTest() { for (let item of [menuItem1, menuItem2, menuItem3]) { EventUtils.synthesizeMouseAtCenter(item, {type: "mouseup"}, panel.panelWin); - await waitForOverviewAndCommand(overview, item); + yield waitForOverviewAndCommand(overview, item); } ok($(".waterfall-marker-bar[type=Styles]"), "Found at least one 'Styles' marker (6)"); @@ -107,7 +107,7 @@ async function spawnTest() { is(overview.fixedHeight, originalHeight, "Overview restored"); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/performance/test/browser_timeline-filters-02.js b/devtools/client/performance/test/browser_timeline-filters-02.js index 6d94853dc60a..f9ab00711913 100644 --- a/devtools/client/performance/test/browser_timeline-filters-02.js +++ b/devtools/client/performance/test/browser_timeline-filters-02.js @@ -8,32 +8,32 @@ const URL = EXAMPLE_URL + "doc_innerHTML.html"; -async function spawnTest() { - let { panel } = await initPerformance(URL); +function* spawnTest() { + let { panel } = yield initPerformance(URL); let { $, $$, EVENTS, PerformanceController, OverviewView, WaterfallView } = panel.panelWin; - await startRecording(panel); + yield startRecording(panel); ok(true, "Recording has started."); - await waitUntil(() => { + yield waitUntil(() => { let markers = PerformanceController.getCurrentRecording().getMarkers(); return markers.some(m => m.name == "Parse HTML") && markers.some(m => m.name == "Javascript"); }); let waterfallRendered = WaterfallView.once(EVENTS.UI_WATERFALL_RENDERED); - await stopRecording(panel); + yield stopRecording(panel); $("#filter-button").click(); let filterJS = $("menuitem[marker-type=Javascript]"); - await waterfallRendered; + yield waterfallRendered; ok($(".waterfall-marker-bar[type=Javascript]"), "Found at least one 'Javascript' marker"); ok(!$(".waterfall-marker-bar[type='Parse HTML']"), "Found no Parse HTML markers as they are nested still"); EventUtils.synthesizeMouseAtCenter(filterJS, {type: "mouseup"}, panel.panelWin); - await Promise.all([ + yield Promise.all([ WaterfallView.once(EVENTS.UI_WATERFALL_RENDERED), once(filterJS, "command") ]); @@ -42,7 +42,7 @@ async function spawnTest() { ok($(".waterfall-marker-bar[type='Parse HTML']"), "Found at least one 'Parse HTML' marker still visible after hiding JS markers"); - await teardown(panel); + yield teardown(panel); finish(); } /* eslint-enable */ diff --git a/devtools/client/performance/test/browser_timeline-waterfall-background.js b/devtools/client/performance/test/browser_timeline-waterfall-background.js index 6d4de73a27e8..85d5bd28cb62 100644 --- a/devtools/client/performance/test/browser_timeline-waterfall-background.js +++ b/devtools/client/performance/test/browser_timeline-waterfall-background.js @@ -11,21 +11,21 @@ const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls"); const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); const { startRecording, stopRecording, waitForOverviewRenderedWithMarkers } = require("devtools/client/performance/test/helpers/actions"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { WaterfallView } = panel.panelWin; - await startRecording(panel); + yield startRecording(panel); ok(true, "Recording has started."); // Ensure overview is rendering and some markers were received. - await waitForOverviewRenderedWithMarkers(panel); + yield waitForOverviewRenderedWithMarkers(panel); - await stopRecording(panel); + yield stopRecording(panel); ok(true, "Recording has ended."); // Test the waterfall background. @@ -37,5 +37,5 @@ add_task(async function () { is(WaterfallView.canvas.height, 1, "The canvas height is correct."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_timeline-waterfall-generic.js b/devtools/client/performance/test/browser_timeline-waterfall-generic.js index ff76a475968a..bcb87d80ca9e 100644 --- a/devtools/client/performance/test/browser_timeline-waterfall-generic.js +++ b/devtools/client/performance/test/browser_timeline-waterfall-generic.js @@ -11,21 +11,21 @@ const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtoo const { startRecording, stopRecording, waitForOverviewRenderedWithMarkers } = require("devtools/client/performance/test/helpers/actions"); const { once } = require("devtools/client/performance/test/helpers/event-utils"); -add_task(async function () { - let { panel } = await initPerformanceInNewTab({ +add_task(function* () { + let { panel } = yield initPerformanceInNewTab({ url: SIMPLE_URL, win: window }); let { $, $$, EVENTS, WaterfallView } = panel.panelWin; - await startRecording(panel); + yield startRecording(panel); ok(true, "Recording has started."); // Ensure overview is rendering and some markers were received. - await waitForOverviewRenderedWithMarkers(panel); + yield waitForOverviewRenderedWithMarkers(panel); - await stopRecording(panel); + yield stopRecording(panel); ok(true, "Recording has ended."); // Test the header container. @@ -82,7 +82,7 @@ add_task(async function () { let waterfallRerendered = once(WaterfallView, EVENTS.UI_WATERFALL_RENDERED); $$(".waterfall-tree-item")[0].click(); - await waterfallRerendered; + yield waterfallRerendered; let parentWidthAfter = $("#waterfall-view").getBoundingClientRect().width; let sidebarWidthAfter = $(".waterfall-sidebar").getBoundingClientRect().width; @@ -101,5 +101,5 @@ add_task(async function () { - WaterfallView.WATERFALL_MARKER_SIDEBAR_SAFE_BOUNDS, "The waterfall width is correct (2)."); - await teardownToolboxAndRemoveTab(panel); + yield teardownToolboxAndRemoveTab(panel); }); diff --git a/devtools/client/performance/test/browser_timeline-waterfall-rerender.js b/devtools/client/performance/test/browser_timeline-waterfall-rerender.js index 955ad3038f39..8bf842560c88 100644 --- a/devtools/client/performance/test/browser_timeline-waterfall-rerender.js +++ b/devtools/client/performance/test/browser_timeline-waterfall-rerender.js @@ -5,25 +5,25 @@ * Tests if the waterfall remembers the selection when rerendering. */ -async function spawnTest() { - let { target, panel } = await initPerformance(SIMPLE_URL); +function* spawnTest() { + let { target, panel } = yield initPerformance(SIMPLE_URL); let { $, $$, EVENTS, PerformanceController, OverviewView, WaterfallView } = panel.panelWin; const MIN_MARKERS_COUNT = 50; const MAX_MARKERS_SELECT = 20; - await startRecording(panel); + yield startRecording(panel); ok(true, "Recording has started."); let updated = 0; OverviewView.on(EVENTS.UI_OVERVIEW_RENDERED, () => updated++); - ok((await waitUntil(() => updated > 0)), + ok((yield waitUntil(() => updated > 0)), "The overview graphs were updated a bunch of times."); - ok((await waitUntil(() => PerformanceController.getCurrentRecording().getMarkers().length > MIN_MARKERS_COUNT)), + ok((yield waitUntil(() => PerformanceController.getCurrentRecording().getMarkers().length > MIN_MARKERS_COUNT)), "There are some markers available."); - await stopRecording(panel); + yield stopRecording(panel); ok(true, "Recording has ended."); let currentMarkers = PerformanceController.getCurrentRecording().getMarkers(); @@ -35,7 +35,7 @@ async function spawnTest() { // Select a portion of the overview. let rerendered = WaterfallView.once(EVENTS.UI_WATERFALL_RENDERED); OverviewView.setTimeInterval({ startTime: 0, endTime: currentMarkers[MAX_MARKERS_SELECT].end }); - await rerendered; + yield rerendered; ok(!$(".waterfall-tree-item:focus"), "There is no item focused in the waterfall yet."); @@ -58,7 +58,7 @@ async function spawnTest() { // Simulate a resize on the marker details. rerendered = WaterfallView.once(EVENTS.UI_WATERFALL_RENDERED); EventUtils.sendMouseEvent({ type: "mouseup" }, WaterfallView.detailsSplitter); - await rerendered; + yield rerendered; let afterResizeBarsCount = $$(".waterfall-marker-bar").length; info("After resize bars count: " + afterResizeBarsCount); @@ -70,7 +70,7 @@ async function spawnTest() { ok(!$("#waterfall-details").hidden, "The waterfall sidebar is still visible."); - await teardown(panel); + yield teardown(panel); finish(); } /* eslint-enable */ diff --git a/devtools/client/performance/test/browser_timeline-waterfall-sidebar.js b/devtools/client/performance/test/browser_timeline-waterfall-sidebar.js index 3353ac69c3cf..5a933f7ad11d 100644 --- a/devtools/client/performance/test/browser_timeline-waterfall-sidebar.js +++ b/devtools/client/performance/test/browser_timeline-waterfall-sidebar.js @@ -5,8 +5,8 @@ * Tests if the sidebar is properly updated when a marker is selected. */ -async function spawnTest() { - let { target, panel } = await initPerformance(SIMPLE_URL); +function* spawnTest() { + let { target, panel } = yield initPerformance(SIMPLE_URL); let { $, $$, PerformanceController, WaterfallView } = panel.panelWin; let { L10N } = require("devtools/client/performance/modules/global"); let { MarkerBlueprintUtils } = require("devtools/client/performance/modules/marker-blueprint-utils"); @@ -19,10 +19,10 @@ async function spawnTest() { return { submarkers: markers }; }; - await startRecording(panel); + yield startRecording(panel); ok(true, "Recording has started."); - await waitUntil(() => { + yield waitUntil(() => { // Wait until we get 3 different markers. let markers = PerformanceController.getCurrentRecording().getMarkers(); return markers.some(m => m.name == "Styles") && @@ -30,7 +30,7 @@ async function spawnTest() { markers.some(m => m.name == "Paint"); }); - await stopRecording(panel); + yield stopRecording(panel); ok(true, "Recording has ended."); info("No need to select everything in the timeline."); @@ -71,7 +71,7 @@ async function spawnTest() { ok(tooltip.includes(toMs(mkr.end)), "Tooltip has end time."); } - await teardown(panel); + yield teardown(panel); finish(); } /* eslint-enable */ diff --git a/devtools/client/performance/test/browser_timeline-waterfall-workers.js b/devtools/client/performance/test/browser_timeline-waterfall-workers.js index 505b81d3ea7a..73e61cd0d78f 100644 --- a/devtools/client/performance/test/browser_timeline-waterfall-workers.js +++ b/devtools/client/performance/test/browser_timeline-waterfall-workers.js @@ -6,18 +6,18 @@ * Tests if the sidebar is properly updated with worker markers. */ -async function spawnTest() { - let { panel } = await initPerformance(WORKER_URL); +function* spawnTest() { + let { panel } = yield initPerformance(WORKER_URL); let { $$, $, PerformanceController } = panel.panelWin; loadFrameScripts(); - await startRecording(panel); + yield startRecording(panel); ok(true, "Recording has started."); evalInDebuggee("performWork()"); - await waitUntil(() => { + yield waitUntil(() => { // Wait until we get the worker markers. let markers = PerformanceController.getCurrentRecording().getMarkers(); if (!markers.some(m => m.name == "Worker") || @@ -32,14 +32,14 @@ async function spawnTest() { return true; }); - await stopRecording(panel); + yield stopRecording(panel); ok(true, "Recording has ended."); for (let node of $$(".waterfall-marker-name[value=Worker")) { testWorkerMarkerUI(node.parentNode.parentNode); } - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/performance/test/helpers/panel-utils.js b/devtools/client/performance/test/helpers/panel-utils.js index fc956793c0ea..468a86607825 100644 --- a/devtools/client/performance/test/helpers/panel-utils.js +++ b/devtools/client/performance/test/helpers/panel-utils.js @@ -12,25 +12,25 @@ const { once } = require("devtools/client/performance/test/helpers/event-utils") /** * Initializes a toolbox panel in a new tab. */ -exports.initPanelInNewTab = async function ({ tool, url, win }, options = {}) { - let tab = await addTab({ url, win }, options); - return exports.initPanelInTab({ tool, tab }); +exports.initPanelInNewTab = function* ({ tool, url, win }, options = {}) { + let tab = yield addTab({ url, win }, options); + return (yield exports.initPanelInTab({ tool, tab })); }; /** * Initializes a toolbox panel in the specified tab. */ -exports.initPanelInTab = async function ({ tool, tab }) { +exports.initPanelInTab = function* ({ tool, tab }) { dump(`Initializing a ${tool} panel.\n`); let target = TargetFactory.forTab(tab); - await target.makeRemote(); + yield target.makeRemote(); // Open a toolbox and wait for the connection to the performance actors // to be opened. This is necessary because of the WebConsole's // `profile` and `profileEnd` methods. - let toolbox = await gDevTools.showToolbox(target, tool); - await toolbox.initPerformance(); + let toolbox = yield gDevTools.showToolbox(target, tool); + yield toolbox.initPerformance(); let panel = toolbox.getCurrentPanel(); return { target, toolbox, panel }; @@ -39,56 +39,56 @@ exports.initPanelInTab = async function ({ tool, tab }) { /** * Initializes a performance panel in a new tab. */ -exports.initPerformanceInNewTab = async function ({ url, win }, options = {}) { - let tab = await addTab({ url, win }, options); - return exports.initPerformanceInTab({ tab }); +exports.initPerformanceInNewTab = function* ({ url, win }, options = {}) { + let tab = yield addTab({ url, win }, options); + return (yield exports.initPerformanceInTab({ tab })); }; /** * Initializes a performance panel in the specified tab. */ -exports.initPerformanceInTab = async function ({ tab }) { - return exports.initPanelInTab({ +exports.initPerformanceInTab = function* ({ tab }) { + return (yield exports.initPanelInTab({ tool: "performance", tab: tab - }); + })); }; /** * Initializes a webconsole panel in a new tab. * Returns a console property that allows calls to `profile` and `profileEnd`. */ -exports.initConsoleInNewTab = async function ({ url, win }, options = {}) { - let tab = await addTab({ url, win }, options); - return exports.initConsoleInTab({ tab }); +exports.initConsoleInNewTab = function* ({ url, win }, options = {}) { + let tab = yield addTab({ url, win }, options); + return (yield exports.initConsoleInTab({ tab })); }; /** * Initializes a webconsole panel in the specified tab. * Returns a console property that allows calls to `profile` and `profileEnd`. */ -exports.initConsoleInTab = async function ({ tab }) { - let { target, toolbox, panel } = await exports.initPanelInTab({ +exports.initConsoleInTab = function* ({ tab }) { + let { target, toolbox, panel } = yield exports.initPanelInTab({ tool: "webconsole", tab: tab }); - let consoleMethod = async function (method, label, event) { + let consoleMethod = function* (method, label, event) { let recordingEventReceived = once(toolbox.performance, event); if (label === undefined) { - await panel.hud.jsterm.execute(`console.${method}()`); + yield panel.hud.jsterm.execute(`console.${method}()`); } else { - await panel.hud.jsterm.execute(`console.${method}("${label}")`); + yield panel.hud.jsterm.execute(`console.${method}("${label}")`); } - await recordingEventReceived; + yield recordingEventReceived; }; - let profile = async function (label) { - return consoleMethod("profile", label, "recording-started"); + let profile = function* (label) { + return yield consoleMethod("profile", label, "recording-started"); }; - let profileEnd = async function (label) { - return consoleMethod("profileEnd", label, "recording-stopped"); + let profileEnd = function* (label) { + return yield consoleMethod("profileEnd", label, "recording-stopped"); }; return { target, toolbox, panel, console: { profile, profileEnd } }; @@ -97,10 +97,10 @@ exports.initConsoleInTab = async function ({ tab }) { /** * Tears down a toolbox panel and removes an associated tab. */ -exports.teardownToolboxAndRemoveTab = async function (panel, options) { +exports.teardownToolboxAndRemoveTab = function* (panel, options) { dump("Destroying panel.\n"); let tab = panel.target.tab; - await panel.toolbox.destroy(); - await removeTab(tab, options); + yield panel.toolbox.destroy(); + yield removeTab(tab, options); }; diff --git a/devtools/client/performance/test/helpers/profiler-mm-utils.js b/devtools/client/performance/test/helpers/profiler-mm-utils.js index fd63b4935281..4718115d452e 100644 --- a/devtools/client/performance/test/helpers/profiler-mm-utils.js +++ b/devtools/client/performance/test/helpers/profiler-mm-utils.js @@ -10,6 +10,7 @@ */ const { Cc, Ci } = require("chrome"); +const { Task } = require("devtools/shared/task"); const FRAME_SCRIPT_UTILS_URL = "chrome://mochitests/content/browser/devtools/client/shared/test/frame-script-utils.js"; @@ -65,24 +66,24 @@ exports.pmmIsProfilerActive = () => { /** * Starts the nsProfiler module. */ -exports.pmmStartProfiler = async function ({ entries, interval, features }) { - let isActive = (await exports.pmmSendProfilerCommand("IsActive")).isActive; +exports.pmmStartProfiler = Task.async(function* ({ entries, interval, features }) { + let isActive = (yield exports.pmmSendProfilerCommand("IsActive")).isActive; if (!isActive) { return exports.pmmSendProfilerCommand("StartProfiler", [entries, interval, features, features.length]); } return null; -}; +}); /** * Stops the nsProfiler module. */ -exports.pmmStopProfiler = async function () { - let isActive = (await exports.pmmSendProfilerCommand("IsActive")).isActive; +exports.pmmStopProfiler = Task.async(function* () { + let isActive = (yield exports.pmmSendProfilerCommand("IsActive")).isActive; if (isActive) { return exports.pmmSendProfilerCommand("StopProfiler"); } return null; -}; +}); /** * Calls a method on the nsProfiler module. diff --git a/devtools/client/performance/test/helpers/tab-utils.js b/devtools/client/performance/test/helpers/tab-utils.js index 47db4ebae5d0..e1857fb36add 100644 --- a/devtools/client/performance/test/helpers/tab-utils.js +++ b/devtools/client/performance/test/helpers/tab-utils.js @@ -50,9 +50,9 @@ exports.removeTab = function (tab, options = {}) { /** * Adds a browser window with the provided options. */ -exports.addWindow = async function (options) { +exports.addWindow = function* (options) { let { OpenBrowserWindow } = Services.wm.getMostRecentWindow(gDevTools.chromeWindowType); let win = OpenBrowserWindow(options); - await waitForDelayedStartupFinished(win); + yield waitForDelayedStartupFinished(win); return win; }; diff --git a/devtools/client/performance/test/helpers/wait-utils.js b/devtools/client/performance/test/helpers/wait-utils.js index 52e252b7c9d8..be654b7d8c48 100644 --- a/devtools/client/performance/test/helpers/wait-utils.js +++ b/devtools/client/performance/test/helpers/wait-utils.js @@ -5,6 +5,7 @@ /* globals dump */ const { CC } = require("chrome"); +const { Task } = require("devtools/shared/task"); const DevToolsUtils = require("devtools/shared/DevToolsUtils"); const { once, observeOnce } = require("devtools/client/performance/test/helpers/event-utils"); @@ -33,13 +34,13 @@ exports.idleWait = function (time) { /** * Waits until a predicate returns true. */ -exports.waitUntil = async function (predicate, interval = 100, tries = 100) { +exports.waitUntil = function* (predicate, interval = 100, tries = 100) { for (let i = 1; i <= tries; i++) { - if (await predicate()) { + if (yield Task.spawn(predicate)) { dump(`Predicate returned true after ${i} tries.\n`); return; } - await exports.idleWait(interval); + yield exports.idleWait(interval); } throw new Error(`Predicate returned false after ${tries} tries, aborting.\n`); }; diff --git a/devtools/client/performance/views/details-abstract-subview.js b/devtools/client/performance/views/details-abstract-subview.js index 69d2962b7df1..f3f36cb3095a 100644 --- a/devtools/client/performance/views/details-abstract-subview.js +++ b/devtools/client/performance/views/details-abstract-subview.js @@ -33,11 +33,11 @@ var DetailsSubview = { this._wasRendered = true; }; - this.render = async function (...args) { - let maybeRetval = await originalRenderFn.apply(self, args); + this.render = Task.async(function* (...args) { + let maybeRetval = yield originalRenderFn.apply(self, args); afterRenderFn(); return maybeRetval; - }; + }); }, /** diff --git a/devtools/client/performance/views/details-js-flamegraph.js b/devtools/client/performance/views/details-js-flamegraph.js index b3a411ed9dc2..0e40a37c5073 100644 --- a/devtools/client/performance/views/details-js-flamegraph.js +++ b/devtools/client/performance/views/details-js-flamegraph.js @@ -24,32 +24,32 @@ var JsFlameGraphView = extend(DetailsSubview, { /** * Sets up the view with event binding. */ - async initialize() { + initialize: Task.async(function* () { DetailsSubview.initialize.call(this); this.graph = new FlameGraph($("#js-flamegraph-view")); this.graph.timelineTickUnits = L10N.getStr("graphs.ms"); this.graph.setTheme(PerformanceController.getTheme()); - await this.graph.ready(); + yield this.graph.ready(); this._onRangeChangeInGraph = this._onRangeChangeInGraph.bind(this); this._onThemeChanged = this._onThemeChanged.bind(this); PerformanceController.on(EVENTS.THEME_CHANGED, this._onThemeChanged); this.graph.on("selecting", this._onRangeChangeInGraph); - }, + }), /** * Unbinds events. */ - async destroy() { + destroy: Task.async(function* () { DetailsSubview.destroy.call(this); PerformanceController.off(EVENTS.THEME_CHANGED, this._onThemeChanged); this.graph.off("selecting", this._onRangeChangeInGraph); - await this.graph.destroy(); - }, + yield this.graph.destroy(); + }), /** * Method for handling all the set up for rendering a new flamegraph. diff --git a/devtools/client/performance/views/details-memory-flamegraph.js b/devtools/client/performance/views/details-memory-flamegraph.js index 9ac49eda57d2..b73250529043 100644 --- a/devtools/client/performance/views/details-memory-flamegraph.js +++ b/devtools/client/performance/views/details-memory-flamegraph.js @@ -23,32 +23,32 @@ var MemoryFlameGraphView = extend(DetailsSubview, { /** * Sets up the view with event binding. */ - async initialize() { + initialize: Task.async(function* () { DetailsSubview.initialize.call(this); this.graph = new FlameGraph($("#memory-flamegraph-view")); this.graph.timelineTickUnits = L10N.getStr("graphs.ms"); this.graph.setTheme(PerformanceController.getTheme()); - await this.graph.ready(); + yield this.graph.ready(); this._onRangeChangeInGraph = this._onRangeChangeInGraph.bind(this); this._onThemeChanged = this._onThemeChanged.bind(this); PerformanceController.on(EVENTS.THEME_CHANGED, this._onThemeChanged); this.graph.on("selecting", this._onRangeChangeInGraph); - }, + }), /** * Unbinds events. */ - async destroy() { + destroy: Task.async(function* () { DetailsSubview.destroy.call(this); PerformanceController.off(EVENTS.THEME_CHANGED, this._onThemeChanged); this.graph.off("selecting", this._onRangeChangeInGraph); - await this.graph.destroy(); - }, + yield this.graph.destroy(); + }), /** * Method for handling all the set up for rendering a new flamegraph. diff --git a/devtools/client/performance/views/details.js b/devtools/client/performance/views/details.js index 51ee6935cd03..95557bc3682d 100644 --- a/devtools/client/performance/views/details.js +++ b/devtools/client/performance/views/details.js @@ -46,7 +46,7 @@ var DetailsView = { /** * Sets up the view with event binding, initializes subviews. */ - async initialize() { + initialize: Task.async(function* () { this.el = $("#details-pane"); this.toolbar = $("#performance-toolbar-controls-detail-views"); @@ -58,25 +58,25 @@ var DetailsView = { button.addEventListener("command", this._onViewToggle); } - await this.setAvailableViews(); + yield this.setAvailableViews(); PerformanceController.on(EVENTS.RECORDING_STATE_CHANGE, this._onRecordingStoppedOrSelected); PerformanceController.on(EVENTS.RECORDING_SELECTED, this._onRecordingStoppedOrSelected); PerformanceController.on(EVENTS.PREF_CHANGED, this.setAvailableViews); - }, + }), /** * Unbinds events, destroys subviews. */ - async destroy() { + destroy: Task.async(function* () { for (let button of $$("toolbarbutton[data-view]", this.toolbar)) { button.removeEventListener("command", this._onViewToggle); } for (let component of Object.values(this.components)) { - component.initialized && (await component.view.destroy()); + component.initialized && (yield component.view.destroy()); } PerformanceController.off(EVENTS.RECORDING_STATE_CHANGE, @@ -84,7 +84,7 @@ var DetailsView = { PerformanceController.off(EVENTS.RECORDING_SELECTED, this._onRecordingStoppedOrSelected); PerformanceController.off(EVENTS.PREF_CHANGED, this.setAvailableViews); - }, + }), /** * Sets the possible views based off of recording features and server actor support @@ -92,7 +92,7 @@ var DetailsView = { * if currently selected. Called when a preference changes in * `devtools.performance.ui.`. */ - async setAvailableViews() { + setAvailableViews: Task.async(function* () { let recording = PerformanceController.getCurrentRecording(); let isCompleted = recording && recording.isCompleted(); let invalidCurrentView = false; @@ -119,9 +119,9 @@ var DetailsView = { // use a default now that we have the recording configurations if ((this._initialized && isCompleted && invalidCurrentView) || (!this._initialized && isCompleted && recording)) { - await this.selectDefaultView(); + yield this.selectDefaultView(); } - }, + }), /** * Takes a view name and determines if the current recording @@ -151,11 +151,11 @@ var DetailsView = { * @param String viewName * Name of the view to be shown. */ - async selectView(viewName) { + selectView: Task.async(function* (viewName) { let component = this.components[viewName]; this.el.selectedPanel = $("#" + component.id); - await this._whenViewInitialized(component); + yield this._whenViewInitialized(component); for (let button of $$("toolbarbutton[data-view]", this.toolbar)) { if (button.getAttribute("data-view") === viewName) { @@ -170,7 +170,7 @@ var DetailsView = { this._initialized = true; this.emit(EVENTS.UI_DETAILS_VIEW_SELECTED, viewName); - }, + }), /** * Selects a default view based off of protocol support @@ -220,12 +220,12 @@ var DetailsView = { * @param object component * A component descriptor from DetailsView.components */ - async _whenViewInitialized(component) { + _whenViewInitialized: Task.async(function* (component) { if (component.initialized) { return; } component.initialized = true; - await component.view.initialize(); + yield component.view.initialize(); // If this view is initialized *after* a recording is shown, it won't display // any data. Make sure it's populated by setting `shouldUpdateWhenShown`. @@ -235,7 +235,7 @@ var DetailsView = { if (recording && recording.isCompleted()) { component.view.shouldUpdateWhenShown = true; } - }, + }), /** * Called when recording stops or is selected. diff --git a/devtools/client/performance/views/overview.js b/devtools/client/performance/views/overview.js index a40eee138859..f45a6d844541 100644 --- a/devtools/client/performance/views/overview.js +++ b/devtools/client/performance/views/overview.js @@ -77,7 +77,7 @@ var OverviewView = { /** * Unbinds events. */ - async destroy() { + destroy: Task.async(function* () { PerformanceController.off(EVENTS.PREF_CHANGED, this._onPrefChanged); PerformanceController.off(EVENTS.THEME_CHANGED, this._onThemeChanged); PerformanceController.off(EVENTS.RECORDING_STATE_CHANGE, @@ -85,8 +85,8 @@ var OverviewView = { PerformanceController.off(EVENTS.RECORDING_SELECTED, this._onRecordingSelected); this.graphs.off("selecting", this._onGraphSelecting); this.graphs.off("rendered", this._onGraphRendered); - await this.graphs.destroy(); - }, + yield this.graphs.destroy(); + }), /** * Returns true if any of the overview graphs have mouse dragging active, @@ -173,27 +173,27 @@ var OverviewView = { * @param number resolution * The fps graph resolution. @see Graphs.js */ - async render(resolution) { + render: Task.async(function* (resolution) { if (this.isDisabled()) { return; } let recording = PerformanceController.getCurrentRecording(); - await this.graphs.render(recording.getAllData(), resolution); + yield this.graphs.render(recording.getAllData(), resolution); // Finished rendering all graphs in this overview. this.emit(EVENTS.UI_OVERVIEW_RENDERED, resolution); - }, + }), /** * Called at most every OVERVIEW_UPDATE_INTERVAL milliseconds * and uses data fetched from the controller to render * data into all the corresponding overview graphs. */ - async _onRecordingTick() { - await this.render(FRAMERATE_GRAPH_LOW_RES_INTERVAL); + _onRecordingTick: Task.async(function* () { + yield this.render(FRAMERATE_GRAPH_LOW_RES_INTERVAL); this._prepareNextTick(); - }, + }), /** * Called to refresh the timer to keep firing _onRecordingTick. @@ -209,8 +209,8 @@ var OverviewView = { /** * Called when recording state changes. */ - _onRecordingStateChange: - OverviewViewOnStateChange(async function (_, state, recording) { + _onRecordingStateChange: OverviewViewOnStateChange(Task.async( + function* (_, state, recording) { if (state !== "recording-stopped") { return; } @@ -223,22 +223,22 @@ var OverviewView = { return; } this.render(FRAMERATE_GRAPH_HIGH_RES_INTERVAL); - await this._checkSelection(recording); - }), + yield this._checkSelection(recording); + })), /** * Called when a new recording is selected. */ - _onRecordingSelected: OverviewViewOnStateChange(async function (_, recording) { + _onRecordingSelected: OverviewViewOnStateChange(Task.async(function* (_, recording) { this._setGraphVisibilityFromRecordingFeatures(recording); // If this recording is complete, render the high res graph if (recording.isCompleted()) { - await this.render(FRAMERATE_GRAPH_HIGH_RES_INTERVAL); + yield this.render(FRAMERATE_GRAPH_HIGH_RES_INTERVAL); } - await this._checkSelection(recording); + yield this._checkSelection(recording); this.graphs.dropSelection(); - }), + })), /** * Start the polling for rendering the overview graph. @@ -266,10 +266,10 @@ var OverviewView = { * Makes sure the selection is enabled or disabled in all the graphs, * based on whether a recording currently exists and is not in progress. */ - async _checkSelection(recording) { + _checkSelection: Task.async(function* (recording) { let isEnabled = recording ? recording.isCompleted() : false; - await this.graphs.selectionEnabled(isEnabled); - }, + yield this.graphs.selectionEnabled(isEnabled); + }), /** * Fired when the graph selection has changed. Called by @@ -303,10 +303,10 @@ var OverviewView = { * because those will set values on a recording model, and * the graphs will render based on the existence. */ - async _onPrefChanged(_, prefName, prefValue) { + _onPrefChanged: Task.async(function* (_, prefName, prefValue) { switch (prefName) { case "hidden-markers": { - let graph = await this.graphs.isAvailable("timeline"); + let graph = yield this.graphs.isAvailable("timeline"); if (graph) { let filter = PerformanceController.getPref("hidden-markers"); graph.setFilter(filter); @@ -315,7 +315,7 @@ var OverviewView = { break; } } - }, + }), _setGraphVisibilityFromRecordingFeatures: function (recording) { for (let [graphName, requirements] of Object.entries(GRAPH_REQUIREMENTS)) { diff --git a/devtools/client/performance/views/recordings.js b/devtools/client/performance/views/recordings.js index 7242522fcbe5..487ea4f037cc 100644 --- a/devtools/client/performance/views/recordings.js +++ b/devtools/client/performance/views/recordings.js @@ -161,11 +161,11 @@ var RecordingsView = { /** * The select listener for this container. */ - async _onSelect(recording) { + _onSelect: Task.async(function* (recording) { this._listState.selected = recording; this.emit(EVENTS.UI_RECORDING_SELECTED, recording); this._renderList(); - }, + }), /** * The click listener for the "save" button of each item in this container. diff --git a/devtools/client/performance/views/toolbar.js b/devtools/client/performance/views/toolbar.js index 0784d79432da..3636add166d1 100644 --- a/devtools/client/performance/views/toolbar.js +++ b/devtools/client/performance/views/toolbar.js @@ -13,7 +13,7 @@ var ToolbarView = { /** * Sets up the view with event binding. */ - async initialize() { + initialize: Task.async(function* () { this._onFilterPopupShowing = this._onFilterPopupShowing.bind(this); this._onFilterPopupHiding = this._onFilterPopupHiding.bind(this); this._onHiddenMarkersChanged = this._onHiddenMarkersChanged.bind(this); @@ -30,7 +30,7 @@ var ToolbarView = { let experimentalEnabled = PerformanceController.getOption("experimental"); this._toggleExperimentalUI(experimentalEnabled); - await this.optionsView.initialize(); + yield this.optionsView.initialize(); this.optionsView.on("pref-changed", this._onPrefChanged); this._buildMarkersFilterPopup(); @@ -39,7 +39,7 @@ var ToolbarView = { this._onFilterPopupShowing); $("#performance-filter-menupopup").addEventListener("popuphiding", this._onFilterPopupHiding); - }, + }), /** * Unbinds events and cleans up view. diff --git a/devtools/client/scratchpad/test/browser_scratchpad_autocomplete.js b/devtools/client/scratchpad/test/browser_scratchpad_autocomplete.js index 88a7e57972b1..3a6eef8b44ac 100644 --- a/devtools/client/scratchpad/test/browser_scratchpad_autocomplete.js +++ b/devtools/client/scratchpad/test/browser_scratchpad_autocomplete.js @@ -6,6 +6,7 @@ // Test the completions using numbers. const source = "0x1."; const completions = ["toExponential", "toFixed", "toString"]; +const { Task } = require("devtools/shared/task"); function test() { const options = { tabContent: "test scratchpad autocomplete" }; @@ -15,14 +16,14 @@ function test() { } -async function runTests([win, sp]) { +function* runTests([win, sp]) { const {editor} = sp; const editorWin = editor.container.contentWindow; // Show the completions popup. sp.setText(source); sp.editor.setCursor({ line: 0, ch: source.length }); - await keyOnce("suggestion-entered", " ", { ctrlKey: true }); + yield keyOnce("suggestion-entered", " ", { ctrlKey: true }); // Get the hints popup container. const hints = editorWin.document.querySelector(".CodeMirror-hints"); @@ -37,18 +38,18 @@ async function runTests([win, sp]) { let active = hints.querySelector(".CodeMirror-hint-active"); is(active.textContent, completion, "Check that completion " + i++ + " is what is expected."); - await keyOnce("suggestion-entered", "VK_DOWN"); + yield keyOnce("suggestion-entered", "VK_DOWN"); } // We should have looped around to the first suggestion again. Accept it. - await keyOnce("after-suggest", "VK_RETURN"); + yield keyOnce("after-suggest", "VK_RETURN"); is(sp.getText(), source + completions[0], "Autocompletion should work and select the right element."); // Check that the information tooltips work. sp.setText("5"); - await keyOnce("show-information", " ", { ctrlKey: true, shiftKey: true }); + yield keyOnce("show-information", " ", { ctrlKey: true, shiftKey: true }); // Get the information container. const info = editorWin.document.querySelector(".CodeMirror-Tern-information"); diff --git a/devtools/client/scratchpad/test/browser_scratchpad_close_toolbox.js b/devtools/client/scratchpad/test/browser_scratchpad_close_toolbox.js index 1057380e82a4..fd1126fd42af 100644 --- a/devtools/client/scratchpad/test/browser_scratchpad_close_toolbox.js +++ b/devtools/client/scratchpad/test/browser_scratchpad_close_toolbox.js @@ -4,6 +4,7 @@ // Test that closing the toolbox after having opened a scratchpad leaves the // latter in a functioning state. +var {Task} = require("devtools/shared/task"); var {TargetFactory} = require("devtools/client/framework/target"); function test() { @@ -15,23 +16,23 @@ function test() { .then(finish, console.error); } -async function runTests([win, sp]) { +function* runTests([win, sp]) { // Use the scratchpad before opening the toolbox. const source = "window.foobar = 7;"; sp.setText(source); - let [,, result] = await sp.display(); + let [,, result] = yield sp.display(); is(result, 7, "Display produced the expected output."); // Now open the toolbox and close it again. let target = TargetFactory.forTab(gBrowser.selectedTab); - let toolbox = await gDevTools.showToolbox(target, "webconsole"); + let toolbox = yield gDevTools.showToolbox(target, "webconsole"); ok(toolbox, "Toolbox was opened."); - let closed = await gDevTools.closeToolbox(target); + let closed = yield gDevTools.closeToolbox(target); is(closed, true, "Toolbox was closed."); // Now see if using the scratcphad works as expected. sp.setText(source); - let [,, result2] = await sp.display(); + let [,, result2] = yield sp.display(); is(result2, 7, "Display produced the expected output after the toolbox was gone."); } diff --git a/devtools/client/scratchpad/test/browser_scratchpad_contexts.js b/devtools/client/scratchpad/test/browser_scratchpad_contexts.js index 687eb7b5c870..adb23b29f86d 100644 --- a/devtools/client/scratchpad/test/browser_scratchpad_contexts.js +++ b/devtools/client/scratchpad/test/browser_scratchpad_contexts.js @@ -26,7 +26,7 @@ function runTests() { let tests = [{ method: "run", - prepare: async function () { + prepare: function* () { sp.setContentContext(); is(sp.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_CONTENT, @@ -43,18 +43,18 @@ function runTests() { sp.editor.setText("window.foobarBug636725 = 'aloha';"); - let pageResult = await inContent(function() { + let pageResult = yield inContent(function* () { return content.wrappedJSObject.foobarBug636725; }); ok(!pageResult, "no content.foobarBug636725"); }, - then: function() { + then: function* () { is(gBrowser.contentWindowAsCPOW.wrappedJSObject.foobarBug636725, "aloha", "content.foobarBug636725 has been set"); } }, { method: "run", - prepare: function() { + prepare: function* () { sp.setBrowserContext(); is(sp.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_BROWSER, @@ -75,7 +75,7 @@ function runTests() { is(sp.getText(), "window.foobarBug636725 = 'aloha2';", "setText() worked"); }, - then: function() { + then: function* () { is(window.foobarBug636725, "aloha2", "window.foobarBug636725 has been set"); @@ -84,48 +84,48 @@ function runTests() { } }, { method: "run", - prepare: function() { + prepare: function* () { sp.editor.replaceText("gBrowser", sp.editor.getPosition(7)); is(sp.getText(), "window.gBrowser", "setText() worked with no end for the replace range"); }, - then: function([, , result]) { + then: function* ([, , result]) { is(result.class, "Object", "chrome context has access to chrome objects"); } }, { method: "run", - prepare: function() { + prepare: function* () { // Check that the sandbox is cached. sp.editor.setText("typeof foobarBug636725cache;"); }, - then: function([, , result]) { + then: function* ([, , result]) { is(result, "undefined", "global variable does not exist"); } }, { method: "run", - prepare: function() { + prepare: function* () { sp.editor.setText("window.foobarBug636725cache = 'foo';" + "typeof foobarBug636725cache;"); }, - then: function([, , result]) { + then: function* ([, , result]) { is(result, "string", "global variable exists across two different executions"); } }, { method: "run", - prepare: function() { + prepare: function* () { sp.editor.setText("window.foobarBug636725cache2 = 'foo';" + "typeof foobarBug636725cache2;"); }, - then: function([, , result]) { + then: function* ([, , result]) { is(result, "string", "global variable exists across two different executions"); } }, { method: "run", - prepare: function() { + prepare: function* () { sp.setContentContext(); is(sp.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_CONTENT, @@ -133,7 +133,7 @@ function runTests() { sp.editor.setText("typeof foobarBug636725cache2;"); }, - then: function([, , result]) { + then: function* ([, , result]) { is(result, "undefined", "global variable no longer exists after changing the context"); } diff --git a/devtools/client/scratchpad/test/browser_scratchpad_disable_view_menu_items.js b/devtools/client/scratchpad/test/browser_scratchpad_disable_view_menu_items.js index ec337bbfb7d7..ed501ce2d64f 100644 --- a/devtools/client/scratchpad/test/browser_scratchpad_disable_view_menu_items.js +++ b/devtools/client/scratchpad/test/browser_scratchpad_disable_view_menu_items.js @@ -4,6 +4,7 @@ // Test if the view menu items "Larger Font" and "Smaller Font" are disabled // when the font size reaches the maximum/minimum values. +var {Task} = require("devtools/shared/task"); function test() { const options = { @@ -14,17 +15,17 @@ function test() { .then(finish, console.error); } -async function runTests([win, sp]) { - await testMaximumFontSize(win, sp); +function* runTests([win, sp]) { + yield testMaximumFontSize(win, sp); - await testMinimumFontSize(win, sp); + yield testMinimumFontSize(win, sp); } const MAXIMUM_FONT_SIZE = 96; const MINIMUM_FONT_SIZE = 6; const NORMAL_FONT_SIZE = 12; -var testMaximumFontSize = async function (win, sp) { +var testMaximumFontSize = Task.async(function* (win, sp) { let doc = win.document; Services.prefs.clearUserPref("devtools.scratchpad.editorFontSize"); @@ -42,9 +43,9 @@ var testMaximumFontSize = async function (win, sp) { menu.doCommand(); ok(cmd.hasAttribute("disabled") === false, 'Command "sp-cmd-larger-font" is enabled.'); -}; +}); -var testMinimumFontSize = async function (win, sp) { +var testMinimumFontSize = Task.async(function* (win, sp) { let doc = win.document; let menu = doc.getElementById("sp-menu-smaller-font"); @@ -62,4 +63,4 @@ var testMinimumFontSize = async function (win, sp) { ok(cmd.hasAttribute("disabled") === false, 'Command "sp-cmd-smaller-font" is enabled.'); Services.prefs.clearUserPref("devtools.scratchpad.editorFontSize"); -}; +}); diff --git a/devtools/client/scratchpad/test/browser_scratchpad_execute_print.js b/devtools/client/scratchpad/test/browser_scratchpad_execute_print.js index b31971e67199..804cea16f234 100644 --- a/devtools/client/scratchpad/test/browser_scratchpad_execute_print.js +++ b/devtools/client/scratchpad/test/browser_scratchpad_execute_print.js @@ -18,16 +18,16 @@ function runTests() { let sp = gScratchpadWindow.Scratchpad; let tests = [{ method: "run", - prepare: async function () { - await inContent(function() { + prepare: function* () { + yield inContent(function* () { content.wrappedJSObject.foobarBug636725 = 1; }); sp.editor.setText("++window.foobarBug636725"); }, - then: async function ([code, , result]) { + then: function* ([code, , result]) { is(code, sp.getText(), "code is correct"); - let pageResult = await inContent(function() { + let pageResult = yield inContent(function* () { return content.wrappedJSObject.foobarBug636725; }); is(result, pageResult, @@ -40,9 +40,9 @@ function runTests() { } }, { method: "display", - prepare: function() {}, - then: async function () { - let pageResult = await inContent(function() { + prepare: function* () {}, + then: function* () { + let pageResult = yield inContent(function* () { return content.wrappedJSObject.foobarBug636725; }); is(pageResult, 3, "display() updated window.foobarBug636725"); @@ -54,12 +54,12 @@ function runTests() { } }, { method: "run", - prepare: function() { + prepare: function* () { sp.editor.setText("window.foobarBug636725 = 'a';\n" + "window.foobarBug636725 = 'b';"); sp.editor.setSelection({ line: 0, ch: 0 }, { line: 0, ch: 29 }); }, - then: async function ([code, , result]) { + then: function* ([code, , result]) { is(code, "window.foobarBug636725 = 'a';", "code is correct"); is(result, "a", "result is correct"); @@ -67,20 +67,20 @@ function runTests() { "window.foobarBug636725 = 'b';", "run() does not change the textbox value"); - let pageResult = await inContent(function() { + let pageResult = yield inContent(function* () { return content.wrappedJSObject.foobarBug636725; }); is(pageResult, "a", "run() worked for the selected range"); } }, { method: "display", - prepare: function() { + prepare: function* () { sp.editor.setText("window.foobarBug636725 = 'c';\n" + "window.foobarBug636725 = 'b';"); sp.editor.setSelection({ line: 0, ch: 0 }, { line: 0, ch: 22 }); }, - then: async function () { - let pageResult = await inContent(function() { + then: function* () { + let pageResult = yield inContent(function* () { return content.wrappedJSObject.foobarBug636725; }); is(pageResult, "a", "display() worked for the selected range"); diff --git a/devtools/client/scratchpad/test/browser_scratchpad_inspect_primitives.js b/devtools/client/scratchpad/test/browser_scratchpad_inspect_primitives.js index a19cae413251..914f0a6d8919 100644 --- a/devtools/client/scratchpad/test/browser_scratchpad_inspect_primitives.js +++ b/devtools/client/scratchpad/test/browser_scratchpad_inspect_primitives.js @@ -4,6 +4,7 @@ // Test that inspecting primitive values uses the object inspector, not an // inline comment. +var {Task} = require("devtools/shared/task"); function test() { const options = { @@ -14,26 +15,26 @@ function test() { .then(finish, console.error); } -async function runTests([win, sp]) { +function* runTests([win, sp]) { // Inspect a number. - await checkResults(sp, 7); + yield checkResults(sp, 7); // Inspect a string. - await checkResults(sp, "foobar", true); + yield checkResults(sp, "foobar", true); // Inspect a boolean. - await checkResults(sp, true); + yield checkResults(sp, true); } // Helper function that does the actual testing. -var checkResults = async function (sp, value, isString = false) { +var checkResults = Task.async(function* (sp, value, isString = false) { let sourceValue = value; if (isString) { sourceValue = '"' + value + '"'; } let source = "var foobar = " + sourceValue + "; foobar"; sp.setText(source); - await sp.inspect(); + yield sp.inspect(); let sidebar = sp.sidebar; ok(sidebar.visible, "sidebar is open"); @@ -57,4 +58,4 @@ var checkResults = async function (sp, value, isString = false) { ok(!tabbox.hasAttribute("hidden"), "Scratchpad sidebar visible"); sidebar.hide(); ok(tabbox.hasAttribute("hidden"), "Scratchpad sidebar hidden"); -}; +}); diff --git a/devtools/client/scratchpad/test/head.js b/devtools/client/scratchpad/test/head.js index d6bd525d0de8..f1e4d72a4822 100644 --- a/devtools/client/scratchpad/test/head.js +++ b/devtools/client/scratchpad/test/head.js @@ -192,13 +192,13 @@ function runAsyncTests(aScratchpad, aTests) * @return Promise * The promise that will be resolved when all tests are finished. */ -var runAsyncCallbackTests = async function (aScratchpad, aTests) { +var runAsyncCallbackTests = Task.async(function* (aScratchpad, aTests) { for (let {prepare, method, then} of aTests) { - await prepare(); - let res = await aScratchpad[method](); - await then(res); + yield prepare(); + let res = yield aScratchpad[method](); + yield then(res); } -}; +}); /** * A simple wrapper for ContentTask.spawn for more compact code. diff --git a/devtools/client/shadereditor/shadereditor.js b/devtools/client/shadereditor/shadereditor.js index 46f351bbde52..0ab1e5ff051e 100644 --- a/devtools/client/shadereditor/shadereditor.js +++ b/devtools/client/shadereditor/shadereditor.js @@ -8,7 +8,6 @@ const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm"); const {SideMenuWidget} = require("resource://devtools/client/shared/widgets/SideMenuWidget.jsm"); const promise = require("promise"); const defer = require("devtools/shared/defer"); -const {Task} = require("devtools/shared/task"); const Services = require("Services"); const EventEmitter = require("devtools/shared/old-event-emitter"); const Tooltip = require("devtools/client/shared/widgets/tooltip/Tooltip"); @@ -17,6 +16,7 @@ const {LocalizationHelper} = require("devtools/shared/l10n"); const {extend} = require("devtools/shared/extend"); const {WidgetMethods, setNamedTimeout} = require("devtools/client/shared/widgets/view-helpers"); +const {Task} = require("devtools/shared/task"); // Use privileged promise in panel documents to prevent having them to freeze // during toolbox destruction. See bug 1402779. @@ -405,14 +405,14 @@ var ShadersEditorsView = { editor.clearHistory(); } - return (async function () { - await view._toggleListeners("off"); - await promise.all([ + return Task.spawn(function* () { + yield view._toggleListeners("off"); + yield promise.all([ view._getEditor("vs").then(e => setTextAndClearHistory(e, sources.vs)), view._getEditor("fs").then(e => setTextAndClearHistory(e, sources.fs)) ]); - await view._toggleListeners("on"); - })().then(() => window.emit(EVENTS.SOURCES_SHOWN, sources)); + yield view._toggleListeners("on"); + }).then(() => window.emit(EVENTS.SOURCES_SHOWN, sources)); }, /** @@ -498,17 +498,17 @@ var ShadersEditorsView = { * The corresponding shader type for the focused editor (e.g. "vs"). */ _doCompile: function (type) { - (async function () { - let editor = await this._getEditor(type); - let shaderActor = await ShadersListView.selectedAttachment[type]; + Task.spawn(function* () { + let editor = yield this._getEditor(type); + let shaderActor = yield ShadersListView.selectedAttachment[type]; try { - await shaderActor.compile(editor.getText()); + yield shaderActor.compile(editor.getText()); this._onSuccessfulCompilation(); } catch (e) { this._onFailedCompilation(type, editor, e); } - }.bind(this))(); + }.bind(this)); }, /** diff --git a/devtools/client/shadereditor/test/browser_se_aaa_run_first_leaktest.js b/devtools/client/shadereditor/test/browser_se_aaa_run_first_leaktest.js index c5b101aaec0a..6efe510913ec 100644 --- a/devtools/client/shadereditor/test/browser_se_aaa_run_first_leaktest.js +++ b/devtools/client/shadereditor/test/browser_se_aaa_run_first_leaktest.js @@ -6,12 +6,12 @@ * You can also use this initialization format as a template for other tests. */ -async function ifWebGLSupported() { - let { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, panel } = yield initShaderEditor(SIMPLE_CANVAS_URL); ok(target, "Should have a target available."); ok(panel, "Should have a panel available."); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/shadereditor/test/browser_se_bfcache.js b/devtools/client/shadereditor/test/browser_se_bfcache.js index e5f8a9e113c8..2b568e3fe643 100644 --- a/devtools/client/shadereditor/test/browser_se_bfcache.js +++ b/devtools/client/shadereditor/test/browser_se_bfcache.js @@ -4,8 +4,8 @@ /** * Tests if the shader editor works with bfcache. */ -async function ifWebGLSupported() { - let { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, panel } = yield initShaderEditor(SIMPLE_CANVAS_URL); let { gFront, $, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin; // Attach frame scripts if in e10s to perform @@ -13,19 +13,19 @@ async function ifWebGLSupported() { loadFrameScripts(); let reloaded = reload(target); - let firstProgram = await once(gFront, "program-linked"); - await reloaded; + let firstProgram = yield once(gFront, "program-linked"); + yield reloaded; let navigated = navigate(target, MULTIPLE_CONTEXTS_URL); - let [secondProgram, thirdProgram] = await getPrograms(gFront, 2); - await navigated; + let [secondProgram, thirdProgram] = yield getPrograms(gFront, 2); + yield navigated; - let vsEditor = await ShadersEditorsView._getEditor("vs"); - let fsEditor = await ShadersEditorsView._getEditor("fs"); + let vsEditor = yield ShadersEditorsView._getEditor("vs"); + let fsEditor = yield ShadersEditorsView._getEditor("fs"); - await navigateInHistory(target, "back", "will-navigate"); - await once(panel.panelWin, EVENTS.PROGRAMS_ADDED); - await once(panel.panelWin, EVENTS.SOURCES_SHOWN); + yield navigateInHistory(target, "back", "will-navigate"); + yield once(panel.panelWin, EVENTS.PROGRAMS_ADDED); + yield once(panel.panelWin, EVENTS.SOURCES_SHOWN); is($("#content").hidden, false, "The tool's content should not be hidden."); @@ -39,9 +39,9 @@ async function ifWebGLSupported() { is(fsEditor.getText().indexOf("gl_FragColor"), 97, "The fragment shader editor contains the correct text."); - await navigateInHistory(target, "forward", "will-navigate"); - await once(panel.panelWin, EVENTS.PROGRAMS_ADDED); - await once(panel.panelWin, EVENTS.SOURCES_SHOWN); + yield navigateInHistory(target, "forward", "will-navigate"); + yield once(panel.panelWin, EVENTS.PROGRAMS_ADDED); + yield once(panel.panelWin, EVENTS.SOURCES_SHOWN); is($("#content").hidden, false, "The tool's content should not be hidden."); @@ -55,6 +55,6 @@ async function ifWebGLSupported() { is(fsEditor.getText().indexOf("gl_FragColor"), 89, "The fragment shader editor contains the correct text."); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/shadereditor/test/browser_se_editors-contents.js b/devtools/client/shadereditor/test/browser_se_editors-contents.js index e0a9d8ca7564..fdf2612ed9ef 100644 --- a/devtools/client/shadereditor/test/browser_se_editors-contents.js +++ b/devtools/client/shadereditor/test/browser_se_editors-contents.js @@ -6,18 +6,18 @@ * becomes available. */ -async function ifWebGLSupported() { - let { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, panel } = yield initShaderEditor(SIMPLE_CANVAS_URL); let { gFront, ShadersEditorsView, EVENTS } = panel.panelWin; reload(target); - await promise.all([ + yield promise.all([ once(gFront, "program-linked"), once(panel.panelWin, EVENTS.SOURCES_SHOWN) ]); - let vsEditor = await ShadersEditorsView._getEditor("vs"); - let fsEditor = await ShadersEditorsView._getEditor("fs"); + let vsEditor = yield ShadersEditorsView._getEditor("vs"); + let fsEditor = yield ShadersEditorsView._getEditor("fs"); is(vsEditor.getText().indexOf("gl_Position"), 170, @@ -25,6 +25,6 @@ async function ifWebGLSupported() { is(fsEditor.getText().indexOf("gl_FragColor"), 97, "The fragment shader editor contains the correct text."); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/shadereditor/test/browser_se_editors-error-gutter.js b/devtools/client/shadereditor/test/browser_se_editors-error-gutter.js index 1d113622c7d5..686fb120a5c7 100644 --- a/devtools/client/shadereditor/test/browser_se_editors-error-gutter.js +++ b/devtools/client/shadereditor/test/browser_se_editors-error-gutter.js @@ -6,72 +6,72 @@ * when there's a shader compilation error. */ -async function ifWebGLSupported() { - let { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, panel } = yield initShaderEditor(SIMPLE_CANVAS_URL); let { gFront, EVENTS, ShadersEditorsView } = panel.panelWin; reload(target); - await promise.all([ + yield promise.all([ once(gFront, "program-linked"), once(panel.panelWin, EVENTS.SOURCES_SHOWN) ]); - let vsEditor = await ShadersEditorsView._getEditor("vs"); - let fsEditor = await ShadersEditorsView._getEditor("fs"); + let vsEditor = yield ShadersEditorsView._getEditor("vs"); + let fsEditor = yield ShadersEditorsView._getEditor("fs"); vsEditor.replaceText("vec3", { line: 7, ch: 22 }, { line: 7, ch: 26 }); - let [, vertError] = await onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); + let [, vertError] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); checkHasVertFirstError(true, vertError); checkHasVertSecondError(false, vertError); info("Error marks added in the vertex shader editor."); vsEditor.insertText(" ", { line: 1, ch: 0 }); - await once(panel.panelWin, EVENTS.EDITOR_ERROR_MARKERS_REMOVED); + yield once(panel.panelWin, EVENTS.EDITOR_ERROR_MARKERS_REMOVED); is(vsEditor.getText(1), " precision lowp float;", "Typed space."); checkHasVertFirstError(false, vertError); checkHasVertSecondError(false, vertError); info("Error marks removed while typing in the vertex shader editor."); - [, vertError] = await onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); + [, vertError] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); checkHasVertFirstError(true, vertError); checkHasVertSecondError(false, vertError); info("Error marks were re-added after recompiling the vertex shader."); fsEditor.replaceText("vec4", { line: 2, ch: 14 }, { line: 2, ch: 18 }); - let [, fragError] = await onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); + let [, fragError] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); checkHasVertFirstError(true, vertError); checkHasVertSecondError(false, vertError); checkHasFragError(true, fragError); info("Error marks added in the fragment shader editor."); fsEditor.insertText(" ", { line: 1, ch: 0 }); - await once(panel.panelWin, EVENTS.EDITOR_ERROR_MARKERS_REMOVED); + yield once(panel.panelWin, EVENTS.EDITOR_ERROR_MARKERS_REMOVED); is(fsEditor.getText(1), " precision lowp float;", "Typed space."); checkHasVertFirstError(true, vertError); checkHasVertSecondError(false, vertError); checkHasFragError(false, fragError); info("Error marks removed while typing in the fragment shader editor."); - [, fragError] = await onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); + [, fragError] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); checkHasVertFirstError(true, vertError); checkHasVertSecondError(false, vertError); checkHasFragError(true, fragError); info("Error marks were re-added after recompiling the fragment shader."); vsEditor.replaceText("2", { line: 3, ch: 19 }, { line: 3, ch: 20 }); - await once(panel.panelWin, EVENTS.EDITOR_ERROR_MARKERS_REMOVED); + yield once(panel.panelWin, EVENTS.EDITOR_ERROR_MARKERS_REMOVED); checkHasVertFirstError(false, vertError); checkHasVertSecondError(false, vertError); checkHasFragError(true, fragError); info("Error marks removed while typing in the vertex shader editor again."); - [, vertError] = await onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); + [, vertError] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); checkHasVertFirstError(true, vertError); checkHasVertSecondError(true, vertError); checkHasFragError(true, fragError); info("Error marks were re-added after recompiling the fragment shader again."); - await teardown(panel); + yield teardown(panel); finish(); function checkHasVertFirstError(bool, error) { diff --git a/devtools/client/shadereditor/test/browser_se_editors-error-tooltip.js b/devtools/client/shadereditor/test/browser_se_editors-error-tooltip.js index 9a45e52fef35..d124d867b180 100644 --- a/devtools/client/shadereditor/test/browser_se_editors-error-tooltip.js +++ b/devtools/client/shadereditor/test/browser_se_editors-error-tooltip.js @@ -6,21 +6,21 @@ * a shader compilation error. */ -async function ifWebGLSupported() { - let { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, panel } = yield initShaderEditor(SIMPLE_CANVAS_URL); let { gFront, EVENTS, ShadersEditorsView } = panel.panelWin; reload(target); - await promise.all([ + yield promise.all([ once(gFront, "program-linked"), once(panel.panelWin, EVENTS.SOURCES_SHOWN) ]); - let vsEditor = await ShadersEditorsView._getEditor("vs"); - let fsEditor = await ShadersEditorsView._getEditor("fs"); + let vsEditor = yield ShadersEditorsView._getEditor("vs"); + let fsEditor = yield ShadersEditorsView._getEditor("fs"); vsEditor.replaceText("vec3", { line: 7, ch: 22 }, { line: 7, ch: 26 }); - await once(panel.panelWin, EVENTS.SHADER_COMPILED); + yield once(panel.panelWin, EVENTS.SHADER_COMPILED); // Synthesizing 'mouseover' events doesn't work, hack around this by // manually calling the event listener with the expected arguments. @@ -55,6 +55,6 @@ async function ifWebGLSupported() { ok(messages[2].textContent.includes("'assign' : cannot convert"), "The third message contains the correct text."); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/shadereditor/test/browser_se_editors-lazy-init.js b/devtools/client/shadereditor/test/browser_se_editors-lazy-init.js index 5c64c2668f10..b2d9d888e827 100644 --- a/devtools/client/shadereditor/test/browser_se_editors-lazy-init.js +++ b/devtools/client/shadereditor/test/browser_se_editors-lazy-init.js @@ -5,15 +5,15 @@ * Tests if source editors are lazily initialized. */ -async function ifWebGLSupported() { - let { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, panel } = yield initShaderEditor(SIMPLE_CANVAS_URL); let { gFront, ShadersEditorsView } = panel.panelWin; reload(target); - await once(gFront, "program-linked"); + yield once(gFront, "program-linked"); - let vsEditor = await ShadersEditorsView._getEditor("vs"); - let fsEditor = await ShadersEditorsView._getEditor("fs"); + let vsEditor = yield ShadersEditorsView._getEditor("vs"); + let fsEditor = yield ShadersEditorsView._getEditor("fs"); ok(vsEditor, "A vertex shader editor was initialized."); ok(fsEditor, "A fragment shader editor was initialized."); @@ -21,14 +21,14 @@ async function ifWebGLSupported() { isnot(vsEditor, fsEditor, "The vertex shader editor is distinct from the fragment shader editor."); - let vsEditor2 = await ShadersEditorsView._getEditor("vs"); - let fsEditor2 = await ShadersEditorsView._getEditor("fs"); + let vsEditor2 = yield ShadersEditorsView._getEditor("vs"); + let fsEditor2 = yield ShadersEditorsView._getEditor("fs"); is(vsEditor, vsEditor2, "The vertex shader editor instances are cached."); is(fsEditor, fsEditor2, "The fragment shader editor instances are cached."); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/shadereditor/test/browser_se_first-run.js b/devtools/client/shadereditor/test/browser_se_first-run.js index 3258e9cd15cf..33239bcbee99 100644 --- a/devtools/client/shadereditor/test/browser_se_first-run.js +++ b/devtools/client/shadereditor/test/browser_se_first-run.js @@ -5,8 +5,8 @@ * Tests if the shader editor shows the appropriate UI when opened. */ -async function ifWebGLSupported() { - let { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, panel } = yield initShaderEditor(SIMPLE_CANVAS_URL); let { gFront, $ } = panel.panelWin; is($("#reload-notice").hidden, false, @@ -20,7 +20,7 @@ async function ifWebGLSupported() { let linked = once(gFront, "program-linked"); reload(target); - await navigating; + yield navigating; is($("#reload-notice").hidden, true, "The 'reload this page' notice should be hidden when navigating."); @@ -29,7 +29,7 @@ async function ifWebGLSupported() { is($("#content").hidden, true, "The tool's content should still be hidden."); - await linked; + yield linked; is($("#reload-notice").hidden, true, "The 'reload this page' notice should be hidden after linking."); @@ -38,6 +38,6 @@ async function ifWebGLSupported() { is($("#content").hidden, false, "The tool's content should not be hidden anymore."); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/shadereditor/test/browser_se_navigation.js b/devtools/client/shadereditor/test/browser_se_navigation.js index ccd0947f1453..f1adc3e76e3f 100644 --- a/devtools/client/shadereditor/test/browser_se_navigation.js +++ b/devtools/client/shadereditor/test/browser_se_navigation.js @@ -5,12 +5,12 @@ * Tests target navigations are handled correctly in the UI. */ -async function ifWebGLSupported() { - let { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, panel } = yield initShaderEditor(SIMPLE_CANVAS_URL); let { gFront, $, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin; reload(target); - await promise.all([ + yield promise.all([ once(gFront, "program-linked"), once(panel.panelWin, EVENTS.SOURCES_SHOWN) ]); @@ -29,8 +29,8 @@ async function ifWebGLSupported() { is(ShadersListView.selectedIndex, 0, "The shaders list has a correct index selected."); - let vsEditor = await ShadersEditorsView._getEditor("vs"); - let fsEditor = await ShadersEditorsView._getEditor("fs"); + let vsEditor = yield ShadersEditorsView._getEditor("vs"); + let fsEditor = yield ShadersEditorsView._getEditor("fs"); is(vsEditor.getText().indexOf("gl_Position"), 170, "The vertex shader editor contains the correct text."); @@ -41,7 +41,7 @@ async function ifWebGLSupported() { let navigated = once(target, "will-navigate"); navigate(target, "about:blank"); - await promise.all([navigating, once(panel.panelWin, EVENTS.UI_RESET) ]); + yield promise.all([navigating, once(panel.panelWin, EVENTS.UI_RESET) ]); is($("#reload-notice").hidden, true, "The 'reload this page' notice should be hidden while navigating."); @@ -57,7 +57,7 @@ async function ifWebGLSupported() { is(ShadersListView.selectedIndex, -1, "The shaders list has a negative index."); - await navigated; + yield navigated; is($("#reload-notice").hidden, true, "The 'reload this page' notice should still be hidden after navigating."); @@ -66,6 +66,6 @@ async function ifWebGLSupported() { is($("#content").hidden, true, "The tool's content should be still hidden since there's no WebGL content."); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/shadereditor/test/browser_se_programs-blackbox-01.js b/devtools/client/shadereditor/test/browser_se_programs-blackbox-01.js index 59d3088093bf..b451365a450e 100644 --- a/devtools/client/shadereditor/test/browser_se_programs-blackbox-01.js +++ b/devtools/client/shadereditor/test/browser_se_programs-blackbox-01.js @@ -5,8 +5,8 @@ * Tests if blackboxing a program works properly. */ -async function ifWebGLSupported() { - let { target, debuggee, panel } = await initShaderEditor(MULTIPLE_CONTEXTS_URL); +function* ifWebGLSupported() { + let { target, debuggee, panel } = yield initShaderEditor(MULTIPLE_CONTEXTS_URL); let { gFront, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin; once(panel.panelWin, EVENTS.SHADER_COMPILED).then(() => { @@ -14,13 +14,13 @@ async function ifWebGLSupported() { }); reload(target); - let [[firstProgramActor, secondProgramActor]] = await promise.all([ + let [[firstProgramActor, secondProgramActor]] = yield promise.all([ getPrograms(gFront, 2), once(panel.panelWin, EVENTS.SOURCES_SHOWN) ]); - let vsEditor = await ShadersEditorsView._getEditor("vs"); - let fsEditor = await ShadersEditorsView._getEditor("fs"); + let vsEditor = yield ShadersEditorsView._getEditor("vs"); + let fsEditor = yield ShadersEditorsView._getEditor("fs"); vsEditor.once("change", () => { ok(false, "The vertex shader source was unexpectedly changed."); @@ -32,10 +32,10 @@ async function ifWebGLSupported() { ok(false, "No sources should be changed form this point onward."); }); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(!ShadersListView.selectedAttachment.isBlackBoxed, "The first program should not be blackboxed yet."); @@ -57,10 +57,10 @@ async function ifWebGLSupported() { is(getBlackBoxCheckbox(panel, 1).checked, true, "The second blackbox checkbox should still be checked."); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The first program was correctly blackboxed."); getBlackBoxCheckbox(panel, 1).click(); @@ -74,35 +74,35 @@ async function ifWebGLSupported() { is(getBlackBoxCheckbox(panel, 1).checked, false, "The second blackbox checkbox should now be unchecked."); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2"); ok(true, "The second program was correctly blackboxed."); ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 0) }); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2"); ok(true, "Highlighting shouldn't work while blackboxed (1)."); ShadersListView._onProgramMouseOut({ target: getItemLabel(panel, 0) }); ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 1) }); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2"); ok(true, "Highlighting shouldn't work while blackboxed (2)."); ShadersListView._onProgramMouseOut({ target: getItemLabel(panel, 1) }); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2"); ok(true, "Highlighting shouldn't work while blackboxed (3)."); getBlackBoxCheckbox(panel, 0).click(); @@ -117,38 +117,38 @@ async function ifWebGLSupported() { is(getBlackBoxCheckbox(panel, 1).checked, true, "The second blackbox checkbox should now be rechecked."); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The two programs were correctly unblackboxed."); ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 0) }); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The first program was correctly highlighted."); ShadersListView._onProgramMouseOut({ target: getItemLabel(panel, 0) }); ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 1) }); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2"); ok(true, "The second program was correctly highlighted."); ShadersListView._onProgramMouseOut({ target: getItemLabel(panel, 1) }); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The two programs were correctly unhighlighted."); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/shadereditor/test/browser_se_programs-blackbox-02.js b/devtools/client/shadereditor/test/browser_se_programs-blackbox-02.js index a7849d8961fe..391a272c8540 100644 --- a/devtools/client/shadereditor/test/browser_se_programs-blackbox-02.js +++ b/devtools/client/shadereditor/test/browser_se_programs-blackbox-02.js @@ -6,54 +6,54 @@ * overlapping geometry. */ -async function ifWebGLSupported() { - let { target, debuggee, panel } = await initShaderEditor(BLENDED_GEOMETRY_CANVAS_URL); +function* ifWebGLSupported() { + let { target, debuggee, panel } = yield initShaderEditor(BLENDED_GEOMETRY_CANVAS_URL); let { gFront, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin; reload(target); - let [[firstProgramActor, secondProgramActor]] = await promise.all([ + let [[firstProgramActor, secondProgramActor]] = yield promise.all([ getPrograms(gFront, 2), once(panel.panelWin, EVENTS.SOURCES_SHOWN) ]); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); - await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true); ok(true, "The canvas was correctly drawn."); getBlackBoxCheckbox(panel, 0).click(); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 0, b: 0, a: 127 }, true); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 0, b: 0, a: 127 }, true); ok(true, "The first program was correctly blackboxed."); getBlackBoxCheckbox(panel, 0).click(); getBlackBoxCheckbox(panel, 1).click(); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); - await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 127, g: 127, b: 127, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 127, g: 127, b: 127, a: 255 }, true); ok(true, "The second program was correctly blackboxed."); getBlackBoxCheckbox(panel, 1).click(); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); - await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true); ok(true, "The two programs were correctly unblackboxed."); getBlackBoxCheckbox(panel, 0).click(); getBlackBoxCheckbox(panel, 1).click(); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 0, b: 0, a: 255 }, true); ok(true, "The two programs were correctly blackboxed again."); getBlackBoxCheckbox(panel, 0).click(); getBlackBoxCheckbox(panel, 1).click(); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); - await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true); ok(true, "The two programs were correctly unblackboxed again."); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/shadereditor/test/browser_se_programs-cache.js b/devtools/client/shadereditor/test/browser_se_programs-cache.js index c13ab5bf82da..5e5708e446a4 100644 --- a/devtools/client/shadereditor/test/browser_se_programs-cache.js +++ b/devtools/client/shadereditor/test/browser_se_programs-cache.js @@ -5,12 +5,12 @@ * Tests that program and shader actors are cached in the frontend. */ -async function ifWebGLSupported() { - let { target, debuggee, panel } = await initShaderEditor(MULTIPLE_CONTEXTS_URL); +function* ifWebGLSupported() { + let { target, debuggee, panel } = yield initShaderEditor(MULTIPLE_CONTEXTS_URL); let { EVENTS, gFront, ShadersListView, ShadersEditorsView } = panel.panelWin; reload(target); - let [[programActor]] = await promise.all([ + let [[programActor]] = yield promise.all([ getPrograms(gFront, 1), once(panel.panelWin, EVENTS.SOURCES_SHOWN) ]); @@ -20,22 +20,22 @@ async function ifWebGLSupported() { is(programItem.attachment.programActor, programActor, "The correct program actor is cached for the selected item."); - is((await programActor.getVertexShader()), - (await programItem.attachment.vs), + is((yield programActor.getVertexShader()), + (yield programItem.attachment.vs), "The cached vertex shader promise returns the correct actor."); - is((await programActor.getFragmentShader()), - (await programItem.attachment.fs), + is((yield programActor.getFragmentShader()), + (yield programItem.attachment.fs), "The cached fragment shader promise returns the correct actor."); - is((await (await programActor.getVertexShader()).getText()), - (await (await ShadersEditorsView._getEditor("vs")).getText()), + is((yield (yield programActor.getVertexShader()).getText()), + (yield (yield ShadersEditorsView._getEditor("vs")).getText()), "The cached vertex shader promise returns the correct text."); - is((await (await programActor.getFragmentShader()).getText()), - (await (await ShadersEditorsView._getEditor("fs")).getText()), + is((yield (yield programActor.getFragmentShader()).getText()), + (yield (yield ShadersEditorsView._getEditor("fs")).getText()), "The cached fragment shader promise returns the correct text."); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/shadereditor/test/browser_se_programs-highlight-01.js b/devtools/client/shadereditor/test/browser_se_programs-highlight-01.js index 03b7e6da076f..863dc2672c6e 100644 --- a/devtools/client/shadereditor/test/browser_se_programs-highlight-01.js +++ b/devtools/client/shadereditor/test/browser_se_programs-highlight-01.js @@ -5,8 +5,8 @@ * Tests if highlighting a program works properly. */ -async function ifWebGLSupported() { - let { target, panel } = await initShaderEditor(MULTIPLE_CONTEXTS_URL); +function* ifWebGLSupported() { + let { target, panel } = yield initShaderEditor(MULTIPLE_CONTEXTS_URL); let { gFront, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin; once(panel.panelWin, EVENTS.SHADER_COMPILED).then(() => { @@ -14,13 +14,13 @@ async function ifWebGLSupported() { }); reload(target); - let [[firstProgramActor, secondProgramActor]] = await promise.all([ + let [[firstProgramActor, secondProgramActor]] = yield promise.all([ getPrograms(gFront, 2), once(panel.panelWin, EVENTS.SOURCES_SHOWN) ]); - let vsEditor = await ShadersEditorsView._getEditor("vs"); - let fsEditor = await ShadersEditorsView._getEditor("fs"); + let vsEditor = yield ShadersEditorsView._getEditor("vs"); + let fsEditor = yield ShadersEditorsView._getEditor("fs"); vsEditor.once("change", () => { ok(false, "The vertex shader source was unexpectedly changed."); @@ -32,53 +32,53 @@ async function ifWebGLSupported() { ok(false, "No sources should be changed form this point onward."); }); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 0) }); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The first program was correctly highlighted."); ShadersListView._onProgramMouseOut({ target: getItemLabel(panel, 0) }); ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 1) }); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2"); ok(true, "The second program was correctly highlighted."); ShadersListView._onProgramMouseOut({ target: getItemLabel(panel, 1) }); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The two programs were correctly unhighlighted."); ShadersListView._onProgramMouseOver({ target: getBlackBoxCheckbox(panel, 0) }); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The two programs were left unchanged after hovering a blackbox checkbox."); ShadersListView._onProgramMouseOut({ target: getBlackBoxCheckbox(panel, 0) }); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The two programs were left unchanged after unhovering a blackbox checkbox."); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/shadereditor/test/browser_se_programs-highlight-02.js b/devtools/client/shadereditor/test/browser_se_programs-highlight-02.js index a1c9b6a3f3d4..c6cbd796b63a 100644 --- a/devtools/client/shadereditor/test/browser_se_programs-highlight-02.js +++ b/devtools/client/shadereditor/test/browser_se_programs-highlight-02.js @@ -6,40 +6,40 @@ * overlapping geometry. */ -async function ifWebGLSupported() { - let { target, debuggee, panel } = await initShaderEditor(BLENDED_GEOMETRY_CANVAS_URL); +function* ifWebGLSupported() { + let { target, debuggee, panel } = yield initShaderEditor(BLENDED_GEOMETRY_CANVAS_URL); let { gFront, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin; reload(target); - let [[firstProgramActor, secondProgramActor]] = await promise.all([ + let [[firstProgramActor, secondProgramActor]] = yield promise.all([ getPrograms(gFront, 2), once(panel.panelWin, EVENTS.SOURCES_SHOWN) ]); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); - await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true); ok(true, "The canvas was correctly drawn."); ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 0) }); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 0, b: 32, a: 255 }, true); - await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 0, b: 32, a: 127 }, true); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 0, b: 32, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 0, b: 32, a: 127 }, true); ok(true, "The first program was correctly highlighted."); ShadersListView._onProgramMouseOut({ target: getItemLabel(panel, 0) }); ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 1) }); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); - await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 255, g: 0, b: 64, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 255, g: 0, b: 64, a: 255 }, true); ok(true, "The second program was correctly highlighted."); ShadersListView._onProgramMouseOut({ target: getItemLabel(panel, 1) }); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); - await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true); ok(true, "The two programs were correctly unhighlighted."); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/shadereditor/test/browser_se_programs-list.js b/devtools/client/shadereditor/test/browser_se_programs-list.js index f7f9a0598860..6218808868e6 100644 --- a/devtools/client/shadereditor/test/browser_se_programs-list.js +++ b/devtools/client/shadereditor/test/browser_se_programs-list.js @@ -6,8 +6,8 @@ * shaders are linked. */ -async function ifWebGLSupported() { - let { target, panel } = await initShaderEditor(MULTIPLE_CONTEXTS_URL); +function* ifWebGLSupported() { + let { target, panel } = yield initShaderEditor(MULTIPLE_CONTEXTS_URL); let { gFront, EVENTS, L10N, ShadersListView, ShadersEditorsView } = panel.panelWin; is(ShadersListView.itemCount, 0, @@ -19,7 +19,7 @@ async function ifWebGLSupported() { reload(target); - let [firstProgramActor, secondProgramActor] = await promise.all([ + let [firstProgramActor, secondProgramActor] = yield promise.all([ getPrograms(gFront, 2, (actors) => { // Fired upon each actor addition, we want to check only // after the first actor has been added so we can test state @@ -36,13 +36,13 @@ async function ifWebGLSupported() { is(ShadersListView.attachments[1].label, L10N.getFormatStr("shadersList.programLabel", 1), "The correct second label is shown in the shaders list."); - let vertexShader = await firstProgramActor.getVertexShader(); - let fragmentShader = await firstProgramActor.getFragmentShader(); - let vertSource = await vertexShader.getText(); - let fragSource = await fragmentShader.getText(); + let vertexShader = yield firstProgramActor.getVertexShader(); + let fragmentShader = yield firstProgramActor.getFragmentShader(); + let vertSource = yield vertexShader.getText(); + let fragSource = yield fragmentShader.getText(); - let vsEditor = await ShadersEditorsView._getEditor("vs"); - let fsEditor = await ShadersEditorsView._getEditor("fs"); + let vsEditor = yield ShadersEditorsView._getEditor("vs"); + let fsEditor = yield ShadersEditorsView._getEditor("fs"); is(vertSource, vsEditor.getText(), "The vertex shader editor contains the correct text."); @@ -58,14 +58,14 @@ async function ifWebGLSupported() { }); EventUtils.sendMouseEvent({ type: "mousedown" }, ShadersListView.items[1].target); - await shown; + yield shown; is(ShadersListView.selectedItem, ShadersListView.items[1], "The shaders list has a correct item selected."); is(ShadersListView.selectedIndex, 1, "The shaders list has a correct index selected."); - await teardown(panel); + yield teardown(panel); finish(); function checkFirstProgram() { diff --git a/devtools/client/shadereditor/test/browser_se_shaders-edit-01.js b/devtools/client/shadereditor/test/browser_se_shaders-edit-01.js index 1bedb529aa86..0cb52ac19644 100644 --- a/devtools/client/shadereditor/test/browser_se_shaders-edit-01.js +++ b/devtools/client/shadereditor/test/browser_se_shaders-edit-01.js @@ -5,18 +5,18 @@ * Tests if editing a vertex and a fragment shader works properly. */ -async function ifWebGLSupported() { - let { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, panel } = yield initShaderEditor(SIMPLE_CANVAS_URL); let { gFront, $, EVENTS, ShadersEditorsView } = panel.panelWin; reload(target); - await promise.all([ + yield promise.all([ once(gFront, "program-linked"), once(panel.panelWin, EVENTS.SOURCES_SHOWN) ]); - let vsEditor = await ShadersEditorsView._getEditor("vs"); - let fsEditor = await ShadersEditorsView._getEditor("fs"); + let vsEditor = yield ShadersEditorsView._getEditor("vs"); + let fsEditor = yield ShadersEditorsView._getEditor("fs"); is(vsEditor.getText().indexOf("gl_Position"), 170, "The vertex shader editor contains the correct text."); @@ -28,9 +28,9 @@ async function ifWebGLSupported() { is($("#fs-editor-label").hasAttribute("selected"), false, "The vertex shader editor shouldn't be initially selected."); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(gFront, { x: 128, y: 128 }, { r: 191, g: 64, b: 0, a: 255 }, true); - await ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 128, y: 128 }, { r: 191, g: 64, b: 0, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); vsEditor.focus(); @@ -40,13 +40,13 @@ async function ifWebGLSupported() { "The vertex shader editor shouldn't still not be selected."); vsEditor.replaceText("2.0", { line: 7, ch: 44 }, { line: 7, ch: 47 }); - await once(panel.panelWin, EVENTS.SHADER_COMPILED); + yield once(panel.panelWin, EVENTS.SHADER_COMPILED); ok(true, "Vertex shader was changed."); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(gFront, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true); ok(true, "The vertex shader was recompiled successfully."); @@ -58,16 +58,16 @@ async function ifWebGLSupported() { "The vertex shader editor should now be selected."); fsEditor.replaceText("0.5", { line: 5, ch: 44 }, { line: 5, ch: 47 }); - await once(panel.panelWin, EVENTS.SHADER_COMPILED); + yield once(panel.panelWin, EVENTS.SHADER_COMPILED); ok(true, "Fragment shader was changed."); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(gFront, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 127 }, true); - await ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 127 }, true); + yield ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true); ok(true, "The fragment shader was recompiled successfully."); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/shadereditor/test/browser_se_shaders-edit-02.js b/devtools/client/shadereditor/test/browser_se_shaders-edit-02.js index bb590386f61a..354224e6b771 100644 --- a/devtools/client/shadereditor/test/browser_se_shaders-edit-02.js +++ b/devtools/client/shadereditor/test/browser_se_shaders-edit-02.js @@ -6,22 +6,22 @@ * gets malformed after being edited. */ -async function ifWebGLSupported() { - let { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, panel } = yield initShaderEditor(SIMPLE_CANVAS_URL); let { gFront, EVENTS, ShadersEditorsView } = panel.panelWin; reload(target); - await promise.all([ + yield promise.all([ once(gFront, "program-linked"), once(panel.panelWin, EVENTS.SOURCES_SHOWN) ]); - let vsEditor = await ShadersEditorsView._getEditor("vs"); - let fsEditor = await ShadersEditorsView._getEditor("fs"); + let vsEditor = yield ShadersEditorsView._getEditor("vs"); + let fsEditor = yield ShadersEditorsView._getEditor("fs"); vsEditor.replaceText("vec3", { line: 7, ch: 22 }, { line: 7, ch: 26 }); - let [, error] = await onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); + let [, error] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); ok(error, "The new vertex shader source was compiled with errors."); @@ -42,7 +42,7 @@ async function ifWebGLSupported() { fsEditor.replaceText("vec4", { line: 2, ch: 14 }, { line: 2, ch: 18 }); - [, error] = await onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); + [, error] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); ok(error, "The new fragment shader source was compiled with errors."); @@ -57,20 +57,20 @@ async function ifWebGLSupported() { "A constructor error is contained in the info log."); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); vsEditor.replaceText("vec4", { line: 7, ch: 22 }, { line: 7, ch: 26 }); - [, error] = await onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); + [, error] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); ok(!error, "The new vertex shader source was compiled successfully."); fsEditor.replaceText("vec3", { line: 2, ch: 14 }, { line: 2, ch: 18 }); - [, error] = await onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); + [, error] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); ok(!error, "The new fragment shader source was compiled successfully."); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/shadereditor/test/browser_se_shaders-edit-03.js b/devtools/client/shadereditor/test/browser_se_shaders-edit-03.js index d5cec375c5e5..2c413dd72578 100644 --- a/devtools/client/shadereditor/test/browser_se_shaders-edit-03.js +++ b/devtools/client/shadereditor/test/browser_se_shaders-edit-03.js @@ -6,21 +6,21 @@ * their new source on the backend and reshow it in the frontend when required. */ -async function ifWebGLSupported() { - let { target, panel } = await initShaderEditor(MULTIPLE_CONTEXTS_URL); +function* ifWebGLSupported() { + let { target, panel } = yield initShaderEditor(MULTIPLE_CONTEXTS_URL); let { gFront, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin; reload(target); - await promise.all([ + yield promise.all([ once(gFront, "program-linked"), once(gFront, "program-linked") ]); - await once(panel.panelWin, EVENTS.SOURCES_SHOWN); + yield once(panel.panelWin, EVENTS.SOURCES_SHOWN); - let vsEditor = await ShadersEditorsView._getEditor("vs"); - let fsEditor = await ShadersEditorsView._getEditor("fs"); + let vsEditor = yield ShadersEditorsView._getEditor("vs"); + let fsEditor = yield ShadersEditorsView._getEditor("fs"); is(ShadersListView.selectedIndex, 0, "The first program is currently selected."); @@ -34,26 +34,26 @@ async function ifWebGLSupported() { "The fragment shader editor contains the correct initial text (2)."); vsEditor.replaceText("2.", { line: 5, ch: 44 }, { line: 5, ch: 45 }); - await once(panel.panelWin, EVENTS.SHADER_COMPILED); + yield once(panel.panelWin, EVENTS.SHADER_COMPILED); fsEditor.replaceText(".0", { line: 5, ch: 35 }, { line: 5, ch: 37 }); - await once(panel.panelWin, EVENTS.SHADER_COMPILED); + yield once(panel.panelWin, EVENTS.SHADER_COMPILED); ok(true, "Vertex and fragment shaders were changed."); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 32, y: 32 }, { r: 255, g: 255, b: 0, a: 0 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 255, g: 255, b: 0, a: 0 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 32, y: 32 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 32, y: 32 }, { r: 255, g: 255, b: 0, a: 0 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 255, g: 255, b: 0, a: 0 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 32, y: 32 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The vertex and fragment shaders were recompiled successfully."); EventUtils.sendMouseEvent({ type: "mousedown" }, ShadersListView.items[1].target); - await once(panel.panelWin, EVENTS.SOURCES_SHOWN); + yield once(panel.panelWin, EVENTS.SOURCES_SHOWN); is(ShadersListView.selectedIndex, 1, "The second program is currently selected."); @@ -67,7 +67,7 @@ async function ifWebGLSupported() { "The fragment shader editor contains the correct text (2)."); EventUtils.sendMouseEvent({ type: "mousedown" }, ShadersListView.items[0].target); - await once(panel.panelWin, EVENTS.SOURCES_SHOWN); + yield once(panel.panelWin, EVENTS.SOURCES_SHOWN); is(ShadersListView.selectedIndex, 0, "The first program is currently selected again."); @@ -80,6 +80,6 @@ async function ifWebGLSupported() { is(fsEditor.getText().indexOf(".0);"), 116, "The fragment shader editor contains the correct text (4)."); - await teardown(panel); + yield teardown(panel); finish(); } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-01.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-01.js index 39737a14066e..242018a76823 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-01.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-01.js @@ -5,12 +5,12 @@ * Tests if a WebGL front can be created for a remote tab target. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(SIMPLE_CANVAS_URL); ok(target, "Should have a target available."); ok(front, "Should have a protocol front available."); - await removeTab(target.tab); + yield removeTab(target.tab); finish(); } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-02.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-02.js index b39d440ed1fe..addec87ca000 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-02.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-02.js @@ -6,8 +6,8 @@ * if the front wasn't set up first. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(SIMPLE_CANVAS_URL); once(front, "program-linked").then(() => { ok(false, "A 'program-linked' notification shouldn't have been sent!"); @@ -15,7 +15,7 @@ async function ifWebGLSupported() { ok(true, "Each test requires at least one pass, fail or todo so here is a pass."); - await reload(target); - await removeTab(target.tab); + yield reload(target); + yield removeTab(target.tab); finish(); } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-03.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-03.js index efc2b4d53f45..0381973ec72d 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-03.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-03.js @@ -6,21 +6,21 @@ * after a target navigation. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(SIMPLE_CANVAS_URL); let navigated = once(target, "navigate"); let linked = once(front, "program-linked"); - await front.setup({ reload: true }); + yield front.setup({ reload: true }); ok(true, "The front was setup up successfully."); - await navigated; + yield navigated; ok(true, "Target automatically navigated when the front was set up."); - await linked; + yield linked; ok(true, "A 'program-linked' notification was sent after reloading."); - await removeTab(target.tab); + yield removeTab(target.tab); finish(); } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-04.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-04.js index f5528b66531e..4256a5329784 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-04.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-04.js @@ -6,22 +6,22 @@ * and that the corresponding vertex and fragment actors can be retrieved. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(SIMPLE_CANVAS_URL); front.setup({ reload: true }); - let programActor = await once(front, "program-linked"); + let programActor = yield once(front, "program-linked"); ok(programActor, "A program actor was sent along with the 'program-linked' notification."); - let vertexShader = await programActor.getVertexShader(); + let vertexShader = yield programActor.getVertexShader(); ok(programActor, "A vertex shader actor was retrieved from the program actor."); - let fragmentShader = await programActor.getFragmentShader(); + let fragmentShader = yield programActor.getFragmentShader(); ok(programActor, "A fragment shader actor was retrieved from the program actor."); - await removeTab(target.tab); + yield removeTab(target.tab); finish(); } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-05.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-05.js index 01536344b239..96e445e01b29 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-05.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-05.js @@ -6,22 +6,22 @@ * shader actors. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(SIMPLE_CANVAS_URL); front.setup({ reload: true }); - let programActor = await once(front, "program-linked"); - let vertexShader = await programActor.getVertexShader(); - let fragmentShader = await programActor.getFragmentShader(); + let programActor = yield once(front, "program-linked"); + let vertexShader = yield programActor.getVertexShader(); + let fragmentShader = yield programActor.getFragmentShader(); - let vertSource = await vertexShader.getText(); + let vertSource = yield vertexShader.getText(); ok(vertSource.includes("gl_Position"), "The correct vertex shader source was retrieved."); - let fragSource = await fragmentShader.getText(); + let fragSource = yield fragmentShader.getText(); ok(fragSource.includes("gl_FragColor"), "The correct fragment shader source was retrieved."); - await removeTab(target.tab); + yield removeTab(target.tab); finish(); } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-06.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-06.js index 179309e35c0f..5cbe88a77ccc 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-06.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-06.js @@ -6,59 +6,59 @@ * program actors work as expected. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(SIMPLE_CANVAS_URL); front.setup({ reload: true }); - let programActor = await once(front, "program-linked"); - let vertexShader = await programActor.getVertexShader(); - let fragmentShader = await programActor.getFragmentShader(); + let programActor = yield once(front, "program-linked"); + let vertexShader = yield programActor.getVertexShader(); + let fragmentShader = yield programActor.getFragmentShader(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); - await checkShaderSource("The shader sources are correct before highlighting."); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield checkShaderSource("The shader sources are correct before highlighting."); ok(true, "The corner pixel colors are correct before highlighting."); - await programActor.highlight([0, 1, 0, 1]); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); - await checkShaderSource("The shader sources are preserved after highlighting."); + yield programActor.highlight([0, 1, 0, 1]); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield checkShaderSource("The shader sources are preserved after highlighting."); ok(true, "The corner pixel colors are correct after highlighting."); - await programActor.unhighlight(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); - await checkShaderSource("The shader sources are correct after unhighlighting."); + yield programActor.unhighlight(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield checkShaderSource("The shader sources are correct after unhighlighting."); ok(true, "The corner pixel colors are correct after unhighlighting."); - await programActor.blackbox(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true); - await checkShaderSource("The shader sources are preserved after blackboxing."); + yield programActor.blackbox(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield checkShaderSource("The shader sources are preserved after blackboxing."); ok(true, "The corner pixel colors are correct after blackboxing."); - await programActor.unblackbox(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); - await checkShaderSource("The shader sources are correct after unblackboxing."); + yield programActor.unblackbox(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield checkShaderSource("The shader sources are correct after unblackboxing."); ok(true, "The corner pixel colors are correct after unblackboxing."); function checkShaderSource(aMessage) { - return (async function () { - let newVertexShader = await programActor.getVertexShader(); - let newFragmentShader = await programActor.getFragmentShader(); + return Task.spawn(function* () { + let newVertexShader = yield programActor.getVertexShader(); + let newFragmentShader = yield programActor.getFragmentShader(); is(vertexShader, newVertexShader, "The same vertex shader actor was retrieved."); is(fragmentShader, newFragmentShader, "The same fragment shader actor was retrieved."); - let vertSource = await newVertexShader.getText(); - let fragSource = await newFragmentShader.getText(); + let vertSource = yield newVertexShader.getText(); + let fragSource = yield newFragmentShader.getText(); ok(vertSource.includes("I'm special!") && fragSource.includes("I'm also special!"), aMessage); - })(); + }); } - await removeTab(target.tab); + yield removeTab(target.tab); finish(); } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-07.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-07.js index 75dc5f384385..a7634de44353 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-07.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-07.js @@ -5,57 +5,57 @@ * Tests that vertex and fragment shader sources can be changed. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(SIMPLE_CANVAS_URL); front.setup({ reload: true }); - let programActor = await once(front, "program-linked"); - let vertexShader = await programActor.getVertexShader(); - let fragmentShader = await programActor.getFragmentShader(); + let programActor = yield once(front, "program-linked"); + let vertexShader = yield programActor.getVertexShader(); + let fragmentShader = yield programActor.getFragmentShader(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 128, y: 128 }, { r: 191, g: 64, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 128, y: 128 }, { r: 191, g: 64, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); - let vertSource = await vertexShader.getText(); - let fragSource = await fragmentShader.getText(); + let vertSource = yield vertexShader.getText(); + let fragSource = yield fragmentShader.getText(); ok(!vertSource.includes("2.0"), "The vertex shader source is correct before changing it."); ok(!fragSource.includes("0.5"), "The fragment shader source is correct before changing it."); let newVertSource = vertSource.replace("1.0", "2.0"); - let status = await vertexShader.compile(newVertSource); + let status = yield vertexShader.compile(newVertSource); ok(!status, "The new vertex shader source was compiled without errors."); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true); - vertSource = await vertexShader.getText(); - fragSource = await fragmentShader.getText(); + vertSource = yield vertexShader.getText(); + fragSource = yield fragmentShader.getText(); ok(vertSource.includes("2.0"), "The vertex shader source is correct after changing it."); ok(!fragSource.includes("0.5"), "The fragment shader source is correct after changing the vertex shader."); let newFragSource = fragSource.replace("1.0", "0.5"); - status = await fragmentShader.compile(newFragSource); + status = yield fragmentShader.compile(newFragSource); ok(!status, "The new fragment shader source was compiled without errors."); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 127 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 127 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true); - vertSource = await vertexShader.getText(); - fragSource = await fragmentShader.getText(); + vertSource = yield vertexShader.getText(); + fragSource = yield fragmentShader.getText(); ok(vertSource.includes("2.0"), "The vertex shader source is correct after changing the fragment shader."); ok(fragSource.includes("0.5"), "The fragment shader source is correct after changing it."); - await removeTab(target.tab); + yield removeTab(target.tab); finish(); } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-08.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-08.js index 044afc137941..8025bc7039a3 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-08.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-08.js @@ -6,32 +6,32 @@ * changed in one shader. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(SIMPLE_CANVAS_URL); front.setup({ reload: true }); - let programActor = await once(front, "program-linked"); - let vertexShader = await programActor.getVertexShader(); - let fragmentShader = await programActor.getFragmentShader(); + let programActor = yield once(front, "program-linked"); + let vertexShader = yield programActor.getVertexShader(); + let fragmentShader = yield programActor.getFragmentShader(); - let oldVertSource = await vertexShader.getText(); + let oldVertSource = yield vertexShader.getText(); let newVertSource = oldVertSource.replace("= aVertexColor", "= vec3(0, 0, 1)"); - let status = await vertexShader.compile(newVertSource); + let status = yield vertexShader.compile(newVertSource); ok(!status, "The new vertex shader source was compiled without errors."); - await front.waitForFrame(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 255, a: 255 }, true); - await ensurePixelIs(front, { x: 128, y: 128 }, { r: 0, g: 0, b: 255, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 0, b: 255, a: 255 }, true); + yield front.waitForFrame(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 255, a: 255 }, true); + yield ensurePixelIs(front, { x: 128, y: 128 }, { r: 0, g: 0, b: 255, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 0, b: 255, a: 255 }, true); - let vertSource = await vertexShader.getText(); - let fragSource = await fragmentShader.getText(); + let vertSource = yield vertexShader.getText(); + let fragSource = yield fragmentShader.getText(); ok(vertSource.includes("vFragmentColor = vec3(0, 0, 1);"), "The vertex shader source is correct after changing it."); ok(fragSource.includes("gl_FragColor = vec4(vFragmentColor, 1.0);"), "The fragment shader source is correct after changing the vertex shader."); - await removeTab(target.tab); + yield removeTab(target.tab); finish(); } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-09.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-09.js index 27c4b69280ad..08e9543a77a2 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-09.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-09.js @@ -6,19 +6,19 @@ * defective shader source. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(SIMPLE_CANVAS_URL); front.setup({ reload: true }); - let programActor = await once(front, "program-linked"); - let vertexShader = await programActor.getVertexShader(); - let fragmentShader = await programActor.getFragmentShader(); + let programActor = yield once(front, "program-linked"); + let vertexShader = yield programActor.getVertexShader(); + let fragmentShader = yield programActor.getFragmentShader(); - let oldVertSource = await vertexShader.getText(); + let oldVertSource = yield vertexShader.getText(); let newVertSource = oldVertSource.replace("vec4", "vec3"); try { - await vertexShader.compile(newVertSource); + yield vertexShader.compile(newVertSource); ok(false, "Vertex shader was compiled with a defective source!"); } catch (error) { ok(error, @@ -39,19 +39,19 @@ async function ifWebGLSupported() { "An assignment error is contained in the info log."); } - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); ok(true, "The shader was reverted to the old source."); - let vertSource = await vertexShader.getText(); + let vertSource = yield vertexShader.getText(); ok(vertSource.includes("vec4(aVertexPosition, 1.0);"), "The previous correct vertex shader source was preserved."); - let oldFragSource = await fragmentShader.getText(); + let oldFragSource = yield fragmentShader.getText(); let newFragSource = oldFragSource.replace("vec3", "vec4"); try { - await fragmentShader.compile(newFragSource); + yield fragmentShader.compile(newFragSource); ok(false, "Fragment shader was compiled with a defective source!"); } catch (error) { ok(error, @@ -68,24 +68,24 @@ async function ifWebGLSupported() { "A constructor error is contained in the info log."); } - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); ok(true, "The shader was reverted to the old source."); - let fragSource = await fragmentShader.getText(); + let fragSource = yield fragmentShader.getText(); ok(fragSource.includes("vec3 vFragmentColor;"), "The previous correct fragment shader source was preserved."); - await programActor.highlight([0, 1, 0, 1]); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield programActor.highlight([0, 1, 0, 1]); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); ok(true, "Highlighting worked after setting a defective fragment source."); - await programActor.unhighlight(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield programActor.unhighlight(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); ok(true, "Unhighlighting worked after setting a defective vertex source."); - await removeTab(target.tab); + yield removeTab(target.tab); finish(); } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-10.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-10.js index 8310d4b21857..87dfe35bf6c4 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-10.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-10.js @@ -6,39 +6,39 @@ * target navigates. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(SIMPLE_CANVAS_URL); front.setup({ reload: true }); - await testHighlighting((await once(front, "program-linked"))); + yield testHighlighting((yield once(front, "program-linked"))); ok(true, "Canvas was correctly instrumented on the first navigation."); reload(target); - await testHighlighting((await once(front, "program-linked"))); + yield testHighlighting((yield once(front, "program-linked"))); ok(true, "Canvas was correctly instrumented on the second navigation."); reload(target); - await testHighlighting((await once(front, "program-linked"))); + yield testHighlighting((yield once(front, "program-linked"))); ok(true, "Canvas was correctly instrumented on the third navigation."); - await removeTab(target.tab); + yield removeTab(target.tab); finish(); function testHighlighting(programActor) { - return (async function () { - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + return Task.spawn(function* () { + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); ok(true, "The corner pixel colors are correct before highlighting."); - await programActor.highlight([0, 1, 0, 1]); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield programActor.highlight([0, 1, 0, 1]); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); ok(true, "The corner pixel colors are correct after highlighting."); - await programActor.unhighlight(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield programActor.unhighlight(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); ok(true, "The corner pixel colors are correct after unhighlighting."); - })(); + }); } } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-11.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-11.js index 43f836fcd104..28663057ed08 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-11.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-11.js @@ -6,20 +6,20 @@ * finalize method is called. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(SIMPLE_CANVAS_URL); let linked = once(front, "program-linked"); front.setup({ reload: true }); - await linked; + yield linked; ok(true, "Canvas was correctly instrumented on the first navigation."); once(front, "program-linked").then(() => { ok(false, "A 'program-linked' notification shouldn't have been sent!"); }); - await front.finalize(); - await reload(target); - await removeTab(target.tab); + yield front.finalize(); + yield reload(target); + yield removeTab(target.tab); finish(); } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-12.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-12.js index e6c93483c3f9..f69d5e403fa5 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-12.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-12.js @@ -6,22 +6,22 @@ * regardless of the order in which they were compiled and attached. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(SHADER_ORDER_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(SHADER_ORDER_URL); front.setup({ reload: true }); - let programActor = await once(front, "program-linked"); - let vertexShader = await programActor.getVertexShader(); - let fragmentShader = await programActor.getFragmentShader(); + let programActor = yield once(front, "program-linked"); + let vertexShader = yield programActor.getVertexShader(); + let fragmentShader = yield programActor.getFragmentShader(); - let vertSource = await vertexShader.getText(); - let fragSource = await fragmentShader.getText(); + let vertSource = yield vertexShader.getText(); + let fragSource = yield fragmentShader.getText(); ok(vertSource.includes("I'm a vertex shader!"), "The correct vertex shader text was retrieved."); ok(fragSource.includes("I'm a fragment shader!"), "The correct fragment shader text was retrieved."); - await removeTab(target.tab); + yield removeTab(target.tab); finish(); } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-13.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-13.js index 105068cc45ba..f4730ba39fd3 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-13.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-13.js @@ -5,63 +5,63 @@ * Tests if multiple WebGL contexts are correctly handled. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(MULTIPLE_CONTEXTS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(MULTIPLE_CONTEXTS_URL); front.setup({ reload: true }); - let [firstProgramActor, secondProgramActor] = await getPrograms(front, 2); + let [firstProgramActor, secondProgramActor] = yield getPrograms(front, 2); isnot(firstProgramActor, secondProgramActor, "Two distinct program actors were recevide from two separate contexts."); - let firstVertexShader = await firstProgramActor.getVertexShader(); - let firstFragmentShader = await firstProgramActor.getFragmentShader(); - let secondVertexShader = await secondProgramActor.getVertexShader(); - let secondFragmentShader = await secondProgramActor.getFragmentShader(); + let firstVertexShader = yield firstProgramActor.getVertexShader(); + let firstFragmentShader = yield firstProgramActor.getFragmentShader(); + let secondVertexShader = yield secondProgramActor.getVertexShader(); + let secondFragmentShader = yield secondProgramActor.getFragmentShader(); isnot(firstVertexShader, secondVertexShader, "The two programs should have distinct vertex shaders."); isnot(firstFragmentShader, secondFragmentShader, "The two programs should have distinct fragment shaders."); - let firstVertSource = await firstVertexShader.getText(); - let firstFragSource = await firstFragmentShader.getText(); - let secondVertSource = await secondVertexShader.getText(); - let secondFragSource = await secondFragmentShader.getText(); + let firstVertSource = yield firstVertexShader.getText(); + let firstFragSource = yield firstFragmentShader.getText(); + let secondVertSource = yield secondVertexShader.getText(); + let secondFragSource = yield secondFragmentShader.getText(); is(firstVertSource, secondVertSource, "The vertex shaders should have identical sources."); is(firstFragSource, secondFragSource, "The vertex shaders should have identical sources."); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The two canvases are correctly drawn."); - await firstProgramActor.highlight([1, 0, 0, 1]); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield firstProgramActor.highlight([1, 0, 0, 1]); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The first canvas was correctly filled after highlighting."); - await secondProgramActor.highlight([0, 1, 0, 1]); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2"); + yield secondProgramActor.highlight([0, 1, 0, 1]); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2"); ok(true, "The second canvas was correctly filled after highlighting."); - await firstProgramActor.unhighlight(); - await secondProgramActor.unhighlight(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield firstProgramActor.unhighlight(); + yield secondProgramActor.unhighlight(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The two canvases were correctly filled after unhighlighting."); - await removeTab(target.tab); + yield removeTab(target.tab); finish(); } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-14.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-14.js index 7142c8e02bd0..342bba382b3d 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-14.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-14.js @@ -6,41 +6,41 @@ * changed in one shader of a page with multiple WebGL contexts. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(MULTIPLE_CONTEXTS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(MULTIPLE_CONTEXTS_URL); front.setup({ reload: true }); - let [firstProgramActor, secondProgramActor] = await getPrograms(front, 2); + let [firstProgramActor, secondProgramActor] = yield getPrograms(front, 2); - let firstFragmentShader = await firstProgramActor.getFragmentShader(); - let secondFragmentShader = await secondProgramActor.getFragmentShader(); + let firstFragmentShader = yield firstProgramActor.getFragmentShader(); + let secondFragmentShader = yield secondProgramActor.getFragmentShader(); - let oldFragSource = await firstFragmentShader.getText(); + let oldFragSource = yield firstFragmentShader.getText(); let newFragSource = oldFragSource.replace("vec4(uColor", "vec4(0.25, 0.25, 0.25"); - let status = await firstFragmentShader.compile(newFragSource); + let status = yield firstFragmentShader.compile(newFragSource); ok(!status, "The first new fragment shader source was compiled without errors."); - await front.waitForFrame(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 64, g: 64, b: 64, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 64, g: 64, b: 64, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield front.waitForFrame(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 64, g: 64, b: 64, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 64, g: 64, b: 64, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The first fragment shader was changed."); - oldFragSource = await secondFragmentShader.getText(); + oldFragSource = yield secondFragmentShader.getText(); newFragSource = oldFragSource.replace("vec4(uColor", "vec4(0.75, 0.75, 0.75"); - status = await secondFragmentShader.compile(newFragSource); + status = yield secondFragmentShader.compile(newFragSource); ok(!status, "The second new fragment shader source was compiled without errors."); - await front.waitForFrame(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 64, g: 64, b: 64, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 64, g: 64, b: 64, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 191, g: 191, b: 191, a: 255 }, true, "#canvas2"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 191, g: 191, b: 191, a: 255 }, true, "#canvas2"); + yield front.waitForFrame(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 64, g: 64, b: 64, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 64, g: 64, b: 64, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 191, g: 191, b: 191, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 191, g: 191, b: 191, a: 255 }, true, "#canvas2"); ok(true, "The second fragment shader was changed."); - await removeTab(target.tab); + yield removeTab(target.tab); finish(); } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-15.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-15.js index 4d1ce2cb2af0..0a65dbe0ae72 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-15.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-15.js @@ -5,8 +5,8 @@ * Tests if program actors are cached when navigating in the bfcache. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(SIMPLE_CANVAS_URL); front.setup({ reload: false }); // Attach frame scripts if in e10s to perform @@ -14,58 +14,58 @@ async function ifWebGLSupported() { loadFrameScripts(); reload(target); - let firstProgram = await once(front, "program-linked"); - await checkFirstCachedPrograms(firstProgram); - await checkHighlightingInTheFirstPage(firstProgram); + let firstProgram = yield once(front, "program-linked"); + yield checkFirstCachedPrograms(firstProgram); + yield checkHighlightingInTheFirstPage(firstProgram); ok(true, "The cached programs behave correctly before the navigation."); navigate(target, MULTIPLE_CONTEXTS_URL); - let [secondProgram, thirdProgram] = await getPrograms(front, 2); - await checkSecondCachedPrograms(firstProgram, [secondProgram, thirdProgram]); - await checkHighlightingInTheSecondPage(secondProgram, thirdProgram); + let [secondProgram, thirdProgram] = yield getPrograms(front, 2); + yield checkSecondCachedPrograms(firstProgram, [secondProgram, thirdProgram]); + yield checkHighlightingInTheSecondPage(secondProgram, thirdProgram); ok(true, "The cached programs behave correctly after the navigation."); once(front, "program-linked").then(() => { ok(false, "Shouldn't have received any more program-linked notifications."); }); - await navigateInHistory(target, "back"); - await checkFirstCachedPrograms(firstProgram); - await checkHighlightingInTheFirstPage(firstProgram); + yield navigateInHistory(target, "back"); + yield checkFirstCachedPrograms(firstProgram); + yield checkHighlightingInTheFirstPage(firstProgram); ok(true, "The cached programs behave correctly after navigating back."); - await navigateInHistory(target, "forward"); - await checkSecondCachedPrograms(firstProgram, [secondProgram, thirdProgram]); - await checkHighlightingInTheSecondPage(secondProgram, thirdProgram); + yield navigateInHistory(target, "forward"); + yield checkSecondCachedPrograms(firstProgram, [secondProgram, thirdProgram]); + yield checkHighlightingInTheSecondPage(secondProgram, thirdProgram); ok(true, "The cached programs behave correctly after navigating forward."); - await navigateInHistory(target, "back"); - await checkFirstCachedPrograms(firstProgram); - await checkHighlightingInTheFirstPage(firstProgram); + yield navigateInHistory(target, "back"); + yield checkFirstCachedPrograms(firstProgram); + yield checkHighlightingInTheFirstPage(firstProgram); ok(true, "The cached programs behave correctly after navigating back again."); - await navigateInHistory(target, "forward"); - await checkSecondCachedPrograms(firstProgram, [secondProgram, thirdProgram]); - await checkHighlightingInTheSecondPage(secondProgram, thirdProgram); + yield navigateInHistory(target, "forward"); + yield checkSecondCachedPrograms(firstProgram, [secondProgram, thirdProgram]); + yield checkHighlightingInTheSecondPage(secondProgram, thirdProgram); ok(true, "The cached programs behave correctly after navigating forward again."); - await removeTab(target.tab); + yield removeTab(target.tab); finish(); function checkFirstCachedPrograms(programActor) { - return (async function () { - let programs = await front.getPrograms(); + return Task.spawn(function* () { + let programs = yield front.getPrograms(); is(programs.length, 1, "There should be 1 cached program actor."); is(programs[0], programActor, "The cached program actor was the expected one."); - })(); + }); } function checkSecondCachedPrograms(oldProgramActor, newProgramActors) { - return (async function () { - let programs = await front.getPrograms(); + return Task.spawn(function* () { + let programs = yield front.getPrograms(); is(programs.length, 2, "There should be 2 cached program actors after the navigation."); @@ -78,56 +78,56 @@ async function ifWebGLSupported() { "The old program actor is not equal to the new first program actor."); isnot(newProgramActors[1], oldProgramActor, "The old program actor is not equal to the new second program actor."); - })(); + }); } function checkHighlightingInTheFirstPage(programActor) { - return (async function () { - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + return Task.spawn(function* () { + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); ok(true, "The corner pixel colors are correct before highlighting."); - await programActor.highlight([0, 1, 0, 1]); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield programActor.highlight([0, 1, 0, 1]); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); ok(true, "The corner pixel colors are correct after highlighting."); - await programActor.unhighlight(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield programActor.unhighlight(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); ok(true, "The corner pixel colors are correct after unhighlighting."); - })(); + }); } function checkHighlightingInTheSecondPage(firstProgramActor, secondProgramActor) { - return (async function () { - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + return Task.spawn(function* () { + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The two canvases are correctly drawn before highlighting."); - await firstProgramActor.highlight([1, 0, 0, 1]); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield firstProgramActor.highlight([1, 0, 0, 1]); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The first canvas was correctly filled after highlighting."); - await secondProgramActor.highlight([0, 1, 0, 1]); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2"); + yield secondProgramActor.highlight([0, 1, 0, 1]); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2"); ok(true, "The second canvas was correctly filled after highlighting."); - await firstProgramActor.unhighlight(); - await secondProgramActor.unhighlight(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield firstProgramActor.unhighlight(); + yield secondProgramActor.unhighlight(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The two canvases were correctly filled after unhighlighting."); - })(); + }); } } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-16.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-16.js index 81f16d0a7aa4..e61e73102924 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-16.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-16.js @@ -6,8 +6,8 @@ * removed from the bfcache. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(SIMPLE_CANVAS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(SIMPLE_CANVAS_URL); front.setup({ reload: false }); // Attach frame scripts if in e10s to perform @@ -17,22 +17,22 @@ async function ifWebGLSupported() { // 0. Perform the initial reload. reload(target); - let firstProgram = await once(front, "program-linked"); - let programs = await front.getPrograms(); + let firstProgram = yield once(front, "program-linked"); + let programs = yield front.getPrograms(); is(programs.length, 1, "The first program should be returned by a call to getPrograms()."); is(programs[0], firstProgram, "The first programs was correctly retrieved from the cache."); - let allPrograms = await front._getAllPrograms(); + let allPrograms = yield front._getAllPrograms(); is(allPrograms.length, 1, "Should be only one program in cache."); // 1. Perform a simple navigation. navigate(target, MULTIPLE_CONTEXTS_URL); - let [secondProgram, thirdProgram] = await getPrograms(front, 2); - programs = await front.getPrograms(); + let [secondProgram, thirdProgram] = yield getPrograms(front, 2); + programs = yield front.getPrograms(); is(programs.length, 2, "The second and third programs should be returned by a call to getPrograms()."); is(programs[0], secondProgram, @@ -40,33 +40,33 @@ async function ifWebGLSupported() { is(programs[1], thirdProgram, "The third programs was correctly retrieved from the cache."); - allPrograms = await front._getAllPrograms(); + allPrograms = yield front._getAllPrograms(); is(allPrograms.length, 3, "Should be three programs in cache."); // 2. Perform a bfcache navigation. - await navigateInHistory(target, "back"); + yield navigateInHistory(target, "back"); let globalDestroyed = once(front, "global-created"); let globalCreated = once(front, "global-destroyed"); let programsLinked = once(front, "program-linked"); reload(target); - await promise.all([programsLinked, globalDestroyed, globalCreated]); - allPrograms = await front._getAllPrograms(); + yield promise.all([programsLinked, globalDestroyed, globalCreated]); + allPrograms = yield front._getAllPrograms(); is(allPrograms.length, 3, "Should be 3 programs total in cache."); - programs = await front.getPrograms(); + programs = yield front.getPrograms(); is(programs.length, 1, "There should be 1 cached program actor now."); - await checkHighlightingInTheFirstPage(programs[0]); + yield checkHighlightingInTheFirstPage(programs[0]); ok(true, "The cached programs behave correctly after navigating back and reloading."); // 3. Perform a bfcache navigation and a page reload. - await navigateInHistory(target, "forward"); + yield navigateInHistory(target, "forward"); globalDestroyed = once(front, "global-created"); globalCreated = once(front, "global-destroyed"); @@ -74,68 +74,68 @@ async function ifWebGLSupported() { reload(target); - await promise.all([programsLinked, globalDestroyed, globalCreated]); - allPrograms = await front._getAllPrograms(); + yield promise.all([programsLinked, globalDestroyed, globalCreated]); + allPrograms = yield front._getAllPrograms(); is(allPrograms.length, 3, "Should be 3 programs total in cache."); - programs = await front.getPrograms(); + programs = yield front.getPrograms(); is(programs.length, 2, "There should be 2 cached program actors now."); - await checkHighlightingInTheSecondPage(programs[0], programs[1]); + yield checkHighlightingInTheSecondPage(programs[0], programs[1]); ok(true, "The cached programs behave correctly after navigating forward and reloading."); - await removeTab(target.tab); + yield removeTab(target.tab); finish(); function checkHighlightingInTheFirstPage(programActor) { - return (async function () { - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + return Task.spawn(function* () { + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); ok(true, "The corner pixel colors are correct before highlighting."); - await programActor.highlight([0, 1, 0, 1]); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield programActor.highlight([0, 1, 0, 1]); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); ok(true, "The corner pixel colors are correct after highlighting."); - await programActor.unhighlight(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); + yield programActor.unhighlight(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true); ok(true, "The corner pixel colors are correct after unhighlighting."); - })(); + }); } function checkHighlightingInTheSecondPage(firstProgramActor, secondProgramActor) { - return (async function () { - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + return Task.spawn(function* () { + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The two canvases are correctly drawn before highlighting."); - await firstProgramActor.highlight([1, 0, 0, 1]); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield firstProgramActor.highlight([1, 0, 0, 1]); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The first canvas was correctly filled after highlighting."); - await secondProgramActor.highlight([0, 1, 0, 1]); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2"); + yield secondProgramActor.highlight([0, 1, 0, 1]); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2"); ok(true, "The second canvas was correctly filled after highlighting."); - await firstProgramActor.unhighlight(); - await secondProgramActor.unhighlight(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield firstProgramActor.unhighlight(); + yield secondProgramActor.unhighlight(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1"); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2"); ok(true, "The two canvases were correctly filled after unhighlighting."); - })(); + }); } } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-17.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-17.js index 6c60652b2ce6..92b940d4ab05 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-17.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-17.js @@ -6,41 +6,41 @@ * overlapping geometry. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(OVERLAPPING_GEOMETRY_CANVAS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(OVERLAPPING_GEOMETRY_CANVAS_URL); front.setup({ reload: true }); - let [firstProgramActor, secondProgramActor] = await getPrograms(front, 2); + let [firstProgramActor, secondProgramActor] = yield getPrograms(front, 2); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true); ok(true, "The corner vs. center pixel colors are correct before blackboxing."); - await firstProgramActor.blackbox(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield firstProgramActor.blackbox(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true); ok(true, "The corner vs. center pixel colors are correct after blackboxing (1)."); - await firstProgramActor.unblackbox(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true); + yield firstProgramActor.unblackbox(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true); ok(true, "The corner vs. center pixel colors are correct after unblackboxing (1)."); - await secondProgramActor.blackbox(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 64, y: 64 }, { r: 255, g: 255, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true); + yield secondProgramActor.blackbox(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 64, y: 64 }, { r: 255, g: 255, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true); ok(true, "The corner vs. center pixel colors are correct after blackboxing (2)."); - await secondProgramActor.unblackbox(); - await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true); - await ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true); - await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true); + yield secondProgramActor.unblackbox(); + yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true); + yield ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true); + yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true); ok(true, "The corner vs. center pixel colors are correct after unblackboxing (2)."); - await removeTab(target.tab); + yield removeTab(target.tab); finish(); } diff --git a/devtools/client/shadereditor/test/browser_webgl-actor-test-18.js b/devtools/client/shadereditor/test/browser_webgl-actor-test-18.js index 6d863a6a9f03..977b07d86295 100644 --- a/devtools/client/shadereditor/test/browser_webgl-actor-test-18.js +++ b/devtools/client/shadereditor/test/browser_webgl-actor-test-18.js @@ -5,27 +5,27 @@ * Tests the `getPixel` actor method works across threads. */ -async function ifWebGLSupported() { - let { target, front } = await initBackend(MULTIPLE_CONTEXTS_URL); +function* ifWebGLSupported() { + let { target, front } = yield initBackend(MULTIPLE_CONTEXTS_URL); front.setup({ reload: true }); - await getPrograms(front, 2); + yield getPrograms(front, 2); // Wait a frame to ensure rendering - await front.waitForFrame(); + yield front.waitForFrame(); - let pixel = await front.getPixel({ selector: "#canvas1", position: { x: 0, y: 0 }}); + let pixel = yield front.getPixel({ selector: "#canvas1", position: { x: 0, y: 0 }}); is(pixel.r, 255, "correct `r` value for first canvas."); is(pixel.g, 255, "correct `g` value for first canvas."); is(pixel.b, 0, "correct `b` value for first canvas."); is(pixel.a, 255, "correct `a` value for first canvas."); - pixel = await front.getPixel({ selector: "#canvas2", position: { x: 0, y: 0 }}); + pixel = yield front.getPixel({ selector: "#canvas2", position: { x: 0, y: 0 }}); is(pixel.r, 0, "correct `r` value for second canvas."); is(pixel.g, 255, "correct `g` value for second canvas."); is(pixel.b, 255, "correct `b` value for second canvas."); is(pixel.a, 255, "correct `a` value for second canvas."); - await removeTab(target.tab); + yield removeTab(target.tab); finish(); } diff --git a/devtools/client/shadereditor/test/head.js b/devtools/client/shadereditor/test/head.js index 87ad9793bbff..e150725ed0d2 100644 --- a/devtools/client/shadereditor/test/head.js +++ b/devtools/client/shadereditor/test/head.js @@ -68,13 +68,9 @@ function ifWebGLUnsupported() { finish(); } -async function test() { +function test() { let generator = isWebGLSupported(document) ? ifWebGLSupported : ifWebGLUnsupported; - try { - await generator(); - } catch(e) { - handlError(e); - } + Task.spawn(generator).catch(handleError); } function createCanvas() { @@ -116,21 +112,21 @@ function isApproxColor(aFirst, aSecond, aMargin) { } function ensurePixelIs(aFront, aPosition, aColor, aWaitFlag = false, aSelector = "canvas") { - return (async function () { - let pixel = await aFront.getPixel({ selector: aSelector, position: aPosition }); + return Task.spawn(function* () { + let pixel = yield aFront.getPixel({ selector: aSelector, position: aPosition }); if (isApproxColor(pixel, aColor)) { ok(true, "Expected pixel is shown at: " + aPosition.toSource()); return; } if (aWaitFlag) { - await aFront.waitForFrame(); + yield aFront.waitForFrame(); return ensurePixelIs(aFront, aPosition, aColor, aWaitFlag, aSelector); } ok(false, "Expected pixel was not already shown at: " + aPosition.toSource()); throw new Error("Expected pixel was not already shown at: " + aPosition.toSource()); - })(); + }); } function navigateInHistory(aTarget, aDirection, aWaitForTargetEvent = "navigate") { @@ -159,31 +155,31 @@ function initBackend(aUrl) { DebuggerServer.init(); DebuggerServer.registerAllActors(); - return (async function () { - let tab = await addTab(aUrl); + return Task.spawn(function* () { + let tab = yield addTab(aUrl); let target = TargetFactory.forTab(tab); - await target.makeRemote(); + yield target.makeRemote(); let front = new WebGLFront(target.client, target.form); return { target, front }; - })(); + }); } function initShaderEditor(aUrl) { info("Initializing a shader editor pane."); - return (async function () { - let tab = await addTab(aUrl); + return Task.spawn(function* () { + let tab = yield addTab(aUrl); let target = TargetFactory.forTab(tab); - await target.makeRemote(); + yield target.makeRemote(); Services.prefs.setBoolPref("devtools.shadereditor.enabled", true); - let toolbox = await gDevTools.showToolbox(target, "shadereditor"); + let toolbox = yield gDevTools.showToolbox(target, "shadereditor"); let panel = toolbox.getCurrentPanel(); return { target, panel }; - })(); + }); } function teardown(aPanel) { diff --git a/devtools/client/shared/components/test/browser/browser_notification_box_basic.js b/devtools/client/shared/components/test/browser/browser_notification_box_basic.js index 564602212b21..539977a51467 100644 --- a/devtools/client/shared/components/test/browser/browser_notification_box_basic.js +++ b/devtools/client/shared/components/test/browser/browser_notification_box_basic.js @@ -15,10 +15,10 @@ const TEST_URI = "data:text/html;charset=utf-8,Test page"; /** * Basic test that checks existence of the Notification box. */ -add_task(async function () { +add_task(function* () { info("Test Notification box basic started"); - let toolbox = await openNewTabAndToolbox(TEST_URI, "webconsole"); + let toolbox = yield openNewTabAndToolbox(TEST_URI, "webconsole"); // Append a notification let notificationBox = toolbox.getNotificationBox(); diff --git a/devtools/client/shared/components/test/mochitest/head.js b/devtools/client/shared/components/test/mochitest/head.js index 9ec43e103d6b..c756a65e615a 100644 --- a/devtools/client/shared/components/test/mochitest/head.js +++ b/devtools/client/shared/components/test/mochitest/head.js @@ -16,6 +16,7 @@ var { DebuggerServer } = require("devtools/server/main"); var { DebuggerClient } = require("devtools/shared/client/debugger-client"); var DevToolsUtils = require("devtools/shared/DevToolsUtils"); var flags = require("devtools/shared/flags"); +var { Task } = require("devtools/shared/task"); var { TargetFactory } = require("devtools/client/framework/target"); var { Toolbox } = require("devtools/client/framework/toolbox"); diff --git a/devtools/client/shared/components/test/mochitest/test_HSplitBox_01.html b/devtools/client/shared/components/test/mochitest/test_HSplitBox_01.html index 0dfeba59a1da..d65bbe70bebb 100644 --- a/devtools/client/shared/components/test/mochitest/test_HSplitBox_01.html +++ b/devtools/client/shared/components/test/mochitest/test_HSplitBox_01.html @@ -30,7 +30,7 @@ function aboutEq(a, b) { return Math.abs(a - b) < FUDGE_FACTOR; } -window.onload = async function () { +window.onload = Task.async(function* () { try { const React = browserRequire("devtools/client/shared/vendor/react"); const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom"); @@ -125,7 +125,7 @@ window.onload = async function () { } finally { SimpleTest.finish(); } -}; +}); diff --git a/devtools/client/shared/components/test/mochitest/test_frame_01.html b/devtools/client/shared/components/test/mochitest/test_frame_01.html index 4ba789fb25c4..2128f2fb31ac 100644 --- a/devtools/client/shared/components/test/mochitest/test_frame_01.html +++ b/devtools/client/shared/components/test/mochitest/test_frame_01.html @@ -17,7 +17,7 @@ with optional columns, unknown and non-URL sources.
 
 
 
diff --git a/devtools/client/shared/components/test/mochitest/test_frame_02.html b/devtools/client/shared/components/test/mochitest/test_frame_02.html index e23169ad5d0d..e419e599254b 100644 --- a/devtools/client/shared/components/test/mochitest/test_frame_02.html +++ b/devtools/client/shared/components/test/mochitest/test_frame_02.html @@ -16,7 +16,7 @@ Test that the frame component reacts to source-map pref changse.
 
 
 
diff --git a/devtools/client/shared/components/test/mochitest/test_notification_box_01.html b/devtools/client/shared/components/test/mochitest/test_notification_box_01.html index 3efd648d4c73..dfb7a2c853a3 100644 --- a/devtools/client/shared/components/test/mochitest/test_notification_box_01.html +++ b/devtools/client/shared/components/test/mochitest/test_notification_box_01.html @@ -20,7 +20,7 @@ Test for Notification Box. The test is checking:
 
 
 
 
diff --git a/devtools/client/shared/components/test/mochitest/test_notification_box_03.html b/devtools/client/shared/components/test/mochitest/test_notification_box_03.html index 3594f7b7ef06..70408a1debc0 100644 --- a/devtools/client/shared/components/test/mochitest/test_notification_box_03.html +++ b/devtools/client/shared/components/test/mochitest/test_notification_box_03.html @@ -17,7 +17,7 @@ Test for Notification Box. The test is checking:
 
 
 
diff --git a/devtools/client/shared/components/test/mochitest/test_sidebar_toggle.html b/devtools/client/shared/components/test/mochitest/test_sidebar_toggle.html index 31445beb206d..bb68a8a8b37c 100644 --- a/devtools/client/shared/components/test/mochitest/test_sidebar_toggle.html +++ b/devtools/client/shared/components/test/mochitest/test_sidebar_toggle.html @@ -16,11 +16,11 @@ Test sidebar toggle button
 
 
 
diff --git a/devtools/client/shared/components/test/mochitest/test_stack-trace-source-maps.html b/devtools/client/shared/components/test/mochitest/test_stack-trace-source-maps.html index 20124c104bb4..4a53266a4474 100644 --- a/devtools/client/shared/components/test/mochitest/test_stack-trace-source-maps.html +++ b/devtools/client/shared/components/test/mochitest/test_stack-trace-source-maps.html @@ -27,7 +27,7 @@ window.onload = function () { ); ok(StackTrace, "Got the StackTrace factory"); - add_task(async function () { + add_task(function* () { let stacktrace = [ { filename: "https://bugzilla.mozilla.org/bundle.js", @@ -59,7 +59,7 @@ window.onload = function () { }; let trace = ReactDOM.render(StackTrace(props), window.document.body); - await forceRender(trace); + yield forceRender(trace); let traceEl = ReactDOM.findDOMNode(trace); ok(traceEl, "Rendered StackTrace has an element"); diff --git a/devtools/client/shared/components/test/mochitest/test_stack-trace.html b/devtools/client/shared/components/test/mochitest/test_stack-trace.html index 39489ee729f8..38e7790a7f63 100644 --- a/devtools/client/shared/components/test/mochitest/test_stack-trace.html +++ b/devtools/client/shared/components/test/mochitest/test_stack-trace.html @@ -27,7 +27,7 @@ window.onload = function () { ); ok(StackTrace, "Got the StackTrace factory"); - add_task(async function () { + add_task(function* () { let stacktrace = [ { filename: "http://myfile.com/mahscripts.js", @@ -49,7 +49,7 @@ window.onload = function () { }; let trace = ReactDOM.render(StackTrace(props), window.document.body); - await forceRender(trace); + yield forceRender(trace); let traceEl = ReactDOM.findDOMNode(trace); ok(traceEl, "Rendered StackTrace has an element"); diff --git a/devtools/client/shared/components/test/mochitest/test_tabs_accessibility.html b/devtools/client/shared/components/test/mochitest/test_tabs_accessibility.html index 6cfd5e3565dc..637d462257ac 100644 --- a/devtools/client/shared/components/test/mochitest/test_tabs_accessibility.html +++ b/devtools/client/shared/components/test/mochitest/test_tabs_accessibility.html @@ -16,7 +16,7 @@ Test tabs accessibility.
 
 
 
diff --git a/devtools/client/shared/components/test/mochitest/test_tabs_menu.html b/devtools/client/shared/components/test/mochitest/test_tabs_menu.html index a2b6705ab0ad..c92c896aa153 100644 --- a/devtools/client/shared/components/test/mochitest/test_tabs_menu.html +++ b/devtools/client/shared/components/test/mochitest/test_tabs_menu.html @@ -22,7 +22,7 @@ Test all-tabs menu.
 
 
 
diff --git a/devtools/client/shared/components/test/mochitest/test_tree_01.html b/devtools/client/shared/components/test/mochitest/test_tree_01.html index f643c492d540..6573e46efae2 100644 --- a/devtools/client/shared/components/test/mochitest/test_tree_01.html +++ b/devtools/client/shared/components/test/mochitest/test_tree_01.html @@ -17,7 +17,7 @@ depth.
 
 
 
diff --git a/devtools/client/shared/components/test/mochitest/test_tree_02.html b/devtools/client/shared/components/test/mochitest/test_tree_02.html index 0b318d48ef84..db6f4896526b 100644 --- a/devtools/client/shared/components/test/mochitest/test_tree_02.html +++ b/devtools/client/shared/components/test/mochitest/test_tree_02.html @@ -16,7 +16,7 @@ Test that collapsed subtrees aren't rendered.
 
 
 
diff --git a/devtools/client/shared/components/test/mochitest/test_tree_03.html b/devtools/client/shared/components/test/mochitest/test_tree_03.html index d4d3342396ed..2b384ba0b99e 100644 --- a/devtools/client/shared/components/test/mochitest/test_tree_03.html +++ b/devtools/client/shared/components/test/mochitest/test_tree_03.html @@ -16,7 +16,7 @@ Test Tree's autoExpandDepth.
 
 
 
diff --git a/devtools/client/shared/components/test/mochitest/test_tree_04.html b/devtools/client/shared/components/test/mochitest/test_tree_04.html index e647377a5584..04f2846260a9 100644 --- a/devtools/client/shared/components/test/mochitest/test_tree_04.html +++ b/devtools/client/shared/components/test/mochitest/test_tree_04.html @@ -16,7 +16,7 @@ Test that we only render visible tree items.
 
 
 
diff --git a/devtools/client/shared/components/test/mochitest/test_tree_06.html b/devtools/client/shared/components/test/mochitest/test_tree_06.html index ad1b342f31e8..606d371324b3 100644 --- a/devtools/client/shared/components/test/mochitest/test_tree_06.html +++ b/devtools/client/shared/components/test/mochitest/test_tree_06.html @@ -16,7 +16,7 @@ Test keyboard navigation with the Tree component.
 
 
 
diff --git a/devtools/client/shared/components/test/mochitest/test_tree_07.html b/devtools/client/shared/components/test/mochitest/test_tree_07.html index 0fd1011ba5d7..6d0a11bd1891 100644 --- a/devtools/client/shared/components/test/mochitest/test_tree_07.html +++ b/devtools/client/shared/components/test/mochitest/test_tree_07.html @@ -17,7 +17,7 @@ Test that arrows get the open attribute when their item's children are expanded.
 
 
 
diff --git a/devtools/client/shared/components/test/mochitest/test_tree_08.html b/devtools/client/shared/components/test/mochitest/test_tree_08.html index 2eb00d33f5f2..ad07afc836a5 100644 --- a/devtools/client/shared/components/test/mochitest/test_tree_08.html +++ b/devtools/client/shared/components/test/mochitest/test_tree_08.html @@ -18,7 +18,7 @@ other inputs.
 
 
 
diff --git a/devtools/client/shared/components/test/mochitest/test_tree_09.html b/devtools/client/shared/components/test/mochitest/test_tree_09.html index bc5fecce653e..ea37445c01f8 100644 --- a/devtools/client/shared/components/test/mochitest/test_tree_09.html +++ b/devtools/client/shared/components/test/mochitest/test_tree_09.html @@ -17,7 +17,7 @@ Test that when an item in the Tree component is expanded or collapsed the approp
 
 
 
diff --git a/devtools/client/shared/components/test/mochitest/test_tree_10.html b/devtools/client/shared/components/test/mochitest/test_tree_10.html index 975535e22028..749b2dc4486d 100644 --- a/devtools/client/shared/components/test/mochitest/test_tree_10.html +++ b/devtools/client/shared/components/test/mochitest/test_tree_10.html @@ -17,7 +17,7 @@ Test that when an item in the Tree component is expanded or collapsed the approp
 
 
 
diff --git a/devtools/client/shared/components/test/mochitest/test_tree_11.html b/devtools/client/shared/components/test/mochitest/test_tree_11.html index af2623bfde3f..68bb19d6d253 100644 --- a/devtools/client/shared/components/test/mochitest/test_tree_11.html +++ b/devtools/client/shared/components/test/mochitest/test_tree_11.html @@ -28,7 +28,7 @@ Test that when an item in the Tree component is focused by arrow key, the view i
 
 
 
diff --git a/devtools/client/shared/developer-toolbar.js b/devtools/client/shared/developer-toolbar.js index 57ce94fdd265..68f7c2bf9f31 100644 --- a/devtools/client/shared/developer-toolbar.js +++ b/devtools/client/shared/developer-toolbar.js @@ -11,6 +11,7 @@ const { TargetFactory } = require("devtools/client/framework/target"); const Telemetry = require("devtools/client/shared/telemetry"); const {LocalizationHelper} = require("devtools/shared/l10n"); const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); +const {Task} = require("devtools/shared/task"); const NS_XHTML = "http://www.w3.org/1999/xhtml"; @@ -42,7 +43,7 @@ var CommandUtils = { /** * Utility to execute a command string on a given target */ - async executeOnTarget(target, command) { + executeOnTarget: Task.async(function* (target, command) { let requisitionPromise = this._requisitions.get(target); if (!requisitionPromise) { requisitionPromise = this.createRequisition(target, { @@ -51,9 +52,9 @@ var CommandUtils = { // Store the promise to avoid races by storing the promise immediately this._requisitions.set(target, requisitionPromise); } - let requisition = await requisitionPromise; + let requisition = yield requisitionPromise; requisition.updateExec(command); - }, + }), /** * Utility to ensure that things are loaded in the correct order @@ -370,15 +371,15 @@ DeveloperToolbar.prototype.show = function (focus) { return this._showPromise; } - this._showPromise = ((async function () { + this._showPromise = Task.spawn((function* () { // hide() is async, so ensure we don't need to wait for hide() to // finish. We unconditionally yield here, even if _hidePromise is // null, so that the spawn call returns a promise before starting // to do any real work. - await this._hidePromise; + yield this._hidePromise; // Append the browser-level stylesheet to the browser document. - await gDevToolsBrowser.loadBrowserStyleSheet(this._chromeWindow); + yield gDevToolsBrowser.loadBrowserStyleSheet(this._chromeWindow); this.createToolbar(); @@ -396,7 +397,7 @@ DeveloperToolbar.prototype.show = function (focus) { TooltipPanel.create(this), OutputPanel.create(this) ]; - let panels = await promise.all(panelPromises); + let panels = yield promise.all(panelPromises); [ this.tooltipPanel, this.outputPanel ] = panels; @@ -407,13 +408,13 @@ DeveloperToolbar.prototype.show = function (focus) { environment: CommandUtils.createEnvironment(this, "target"), document: this.outputPanel.document, }; - let requisition = await CommandUtils.createRequisition(this.target, options); + let requisition = yield CommandUtils.createRequisition(this.target, options); this.requisition = requisition; // The `value` may still be undefined on the XUL binding if // we fetch it early let value = this._input.value || ""; - await this.requisition.update(value); + yield this.requisition.update(value); const Inputter = require("gcli/mozui/inputter").Inputter; const Completer = require("gcli/mozui/completer").Completer; @@ -469,7 +470,7 @@ DeveloperToolbar.prototype.show = function (focus) { this._element.hidden = false; if (focus) { - await this.focus(); + yield this.focus(); } this._notify(NOTIFICATIONS.SHOW); @@ -480,7 +481,7 @@ DeveloperToolbar.prototype.show = function (focus) { this.outputPanel); DeveloperToolbar.introShownThisSession = true; } - }).bind(this))(); + }).bind(this)); return this._showPromise; }; diff --git a/devtools/client/shared/doorhanger.js b/devtools/client/shared/doorhanger.js index 57eca8564538..fb73d92aeb1c 100644 --- a/devtools/client/shared/doorhanger.js +++ b/devtools/client/shared/doorhanger.js @@ -6,6 +6,7 @@ const Services = require("Services"); const { DOMHelpers } = require("resource://devtools/client/shared/DOMHelpers.jsm"); +const { Task } = require("devtools/shared/task"); const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; const DEV_EDITION_PROMO_URL = "chrome://devtools/content/framework/dev-edition-promo/dev-edition-promo.xul"; @@ -64,7 +65,7 @@ var panelAttrs = { * The selector that the doorhanger should be appended to within * `window`. Defaults to a XUL Document's `window` element. */ -exports.showDoorhanger = async function ({ window, type, anchor }) { +exports.showDoorhanger = Task.async(function* ({ window, type, anchor }) { let { predicate, success, url, action } = TYPES[type]; // Abort if predicate fails if (!predicate()) { @@ -77,7 +78,7 @@ exports.showDoorhanger = async function ({ window, type, anchor }) { // Wait 200ms to prevent flickering where the popup is displayed // before the underlying window (Windows 7, 64bit) - await wait(200); + yield wait(200); let document = window.document; @@ -93,7 +94,7 @@ exports.showDoorhanger = async function ({ window, type, anchor }) { panel.appendChild(frame); parentEl.appendChild(panel); - await onFrameLoad(frame); + yield onFrameLoad(frame); panel.openPopup(anchor); @@ -111,7 +112,7 @@ exports.showDoorhanger = async function ({ window, type, anchor }) { close(); }); } -}; +}); function setDoorhangerStyle(panel, frame) { Object.keys(panelAttrs).forEach(prop => { diff --git a/devtools/client/shared/redux/middleware/test/test_middleware-task-01.js b/devtools/client/shared/redux/middleware/test/test_middleware-task-01.js index ce5f05b707f6..a52fa55009ae 100644 --- a/devtools/client/shared/redux/middleware/test/test_middleware-task-01.js +++ b/devtools/client/shared/redux/middleware/test/test_middleware-task-01.js @@ -16,26 +16,26 @@ function run_test() { run_next_test(); } -add_task(async function () { +add_task(function* () { let store = applyMiddleware(task)(createStore)(reducer); store.dispatch(fetch1("generator")); - await waitUntilState(store, () => store.getState().length === 1); + yield waitUntilState(store, () => store.getState().length === 1); equal(store.getState()[0].data, "generator", "task middleware async dispatches an action via generator"); store.dispatch(fetch2("sync")); - await waitUntilState(store, () => store.getState().length === 2); + yield waitUntilState(store, () => store.getState().length === 2); equal(store.getState()[1].data, "sync", "task middleware sync dispatches an action via sync"); }); function fetch1(data) { - return async function (dispatch, getState) { + return function* (dispatch, getState) { equal(getState().length, 0, "`getState` is accessible in a generator action"); - let moreData = await new Promise(resolve => resolve(data)); + let moreData = yield new Promise(resolve => resolve(data)); // Ensure it handles more than one yield - moreData = await new Promise(resolve => resolve(data)); + moreData = yield new Promise(resolve => resolve(data)); dispatch({ type: "fetch1", data: moreData }); }; } diff --git a/devtools/client/shared/redux/middleware/test/test_middleware-task-02.js b/devtools/client/shared/redux/middleware/test/test_middleware-task-02.js index 5b00d0c80661..a7cb07114d99 100644 --- a/devtools/client/shared/redux/middleware/test/test_middleware-task-02.js +++ b/devtools/client/shared/redux/middleware/test/test_middleware-task-02.js @@ -16,11 +16,11 @@ function run_test() { run_next_test(); } -add_task(async function () { +add_task(function* () { let store = applyMiddleware(task)(createStore)(reducer); store.dispatch(comboAction()); - await waitUntilState(store, () => store.getState().length === 3); + yield waitUntilState(store, () => store.getState().length === 3); equal(store.getState()[0].type, "fetchAsync-start", "Async dispatched actions in a generator task are fired"); @@ -37,10 +37,10 @@ add_task(async function () { }); function comboAction() { - return async function (dispatch, getState) { + return function* (dispatch, getState) { let data = {}; - data.async = await dispatch(fetchAsync("async")); - data.sync = await dispatch(fetchSync("sync")); + data.async = yield dispatch(fetchAsync("async")); + data.sync = yield dispatch(fetchSync("sync")); dispatch({ type: "fetch-done", data }); }; } @@ -50,9 +50,9 @@ function fetchSync(data) { } function fetchAsync(data) { - return async function (dispatch) { + return function* (dispatch) { dispatch({ type: "fetchAsync-start" }); - let val = await new Promise(resolve => resolve(data)); + let val = yield new Promise(resolve => resolve(data)); dispatch({ type: "fetchAsync-end" }); return val; }; diff --git a/devtools/client/shared/redux/middleware/test/test_middleware-task-03.js b/devtools/client/shared/redux/middleware/test/test_middleware-task-03.js index a0d4733db570..03c022188527 100644 --- a/devtools/client/shared/redux/middleware/test/test_middleware-task-03.js +++ b/devtools/client/shared/redux/middleware/test/test_middleware-task-03.js @@ -15,11 +15,11 @@ function run_test() { run_next_test(); } -add_task(async function () { +add_task(function* () { let store = applyMiddleware(task)(createStore)(reducer); store.dispatch(generatorError()); - await waitUntilState(store, () => store.getState().length === 1); + yield waitUntilState(store, () => store.getState().length === 1); equal(store.getState()[0].type, ERROR_TYPE, "generator errors dispatch ERROR_TYPE actions"); equal(store.getState()[0].error, "task-middleware-error-generator", diff --git a/devtools/client/shared/test/browser_css_angle.js b/devtools/client/shared/test/browser_css_angle.js index 712e626b76bd..42dcd6f4e81f 100644 --- a/devtools/client/shared/test/browser_css_angle.js +++ b/devtools/client/shared/test/browser_css_angle.js @@ -6,9 +6,9 @@ var {angleUtils} = require("devtools/client/shared/css-angle"); -add_task(async function () { - await addTab("about:blank"); - let [host] = await createHost("bottom"); +add_task(function* () { + yield addTab("about:blank"); + let [host] = yield createHost("bottom"); info("Starting the test"); testAngleUtils(); diff --git a/devtools/client/shared/test/browser_css_color.js b/devtools/client/shared/test/browser_css_color.js index e31d7c8e1612..fbba3cfa07bc 100644 --- a/devtools/client/shared/test/browser_css_color.js +++ b/devtools/client/shared/test/browser_css_color.js @@ -7,9 +7,9 @@ var {colorUtils} = require("devtools/shared/css/color"); /* global getFixtureColorData */ loadHelperScript("helper_color_data.js"); -add_task(async function () { - await addTab("about:blank"); - let [host,, doc] = await createHost("bottom"); +add_task(function* () { + yield addTab("about:blank"); + let [host,, doc] = yield createHost("bottom"); info("Creating a test canvas element to test colors"); let canvas = createTestCanvas(doc); diff --git a/devtools/client/shared/test/browser_cubic-bezier-01.js b/devtools/client/shared/test/browser_cubic-bezier-01.js index 647d54ea4504..9c9e5d219548 100644 --- a/devtools/client/shared/test/browser_cubic-bezier-01.js +++ b/devtools/client/shared/test/browser_cubic-bezier-01.js @@ -11,8 +11,8 @@ const {CubicBezierWidget} = const TEST_URI = CHROME_URL_ROOT + "doc_cubic-bezier-01.html"; -add_task(async function () { - let [host,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [host,, doc] = yield createHost("bottom", TEST_URI); info("Checking that the graph markup is created in the parent"); let container = doc.querySelector("#cubic-bezier-container"); diff --git a/devtools/client/shared/test/browser_cubic-bezier-02.js b/devtools/client/shared/test/browser_cubic-bezier-02.js index d2c98482b24c..fc4e26263752 100644 --- a/devtools/client/shared/test/browser_cubic-bezier-02.js +++ b/devtools/client/shared/test/browser_cubic-bezier-02.js @@ -14,8 +14,8 @@ const {PREDEFINED} = require("devtools/client/shared/widgets/CubicBezierPresets" // in order to remove its margin and prevent shifted positions const TEST_URI = CHROME_URL_ROOT + "doc_cubic-bezier-02.html"; -add_task(async function () { - let [host, win, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [host, win, doc] = yield createHost("bottom", TEST_URI); // Required or widget will be clipped inside of 'bottom' // host by -14. Setting `fixed` zeroes this which is needed for @@ -30,15 +30,15 @@ add_task(async function () { rect.graphBottom = rect.height - rect.graphTop; rect.graphHeight = rect.graphBottom - rect.graphTop; - await pointsCanBeDragged(w, win, doc, rect); - await curveCanBeClicked(w, win, doc, rect); - await pointsCanBeMovedWithKeyboard(w, win, doc, rect); + yield pointsCanBeDragged(w, win, doc, rect); + yield curveCanBeClicked(w, win, doc, rect); + yield pointsCanBeMovedWithKeyboard(w, win, doc, rect); w.destroy(); host.destroy(); }); -async function pointsCanBeDragged(widget, win, doc, offsets) { +function* pointsCanBeDragged(widget, win, doc, offsets) { info("Checking that the control points can be dragged with the mouse"); info("Listening for the update event"); @@ -49,7 +49,7 @@ async function pointsCanBeDragged(widget, win, doc, offsets) { doc.onmousemove({pageX: offsets.left, pageY: offsets.graphTop}); doc.onmouseup(); - let bezier = await onUpdated; + let bezier = yield onUpdated; ok(true, "The widget fired the updated event"); ok(bezier, "The updated event contains a bezier argument"); is(bezier.P1[0], 0, "The new P1 time coordinate is correct"); @@ -63,12 +63,12 @@ async function pointsCanBeDragged(widget, win, doc, offsets) { doc.onmousemove({pageX: offsets.right, pageY: offsets.graphBottom}); doc.onmouseup(); - bezier = await onUpdated; + bezier = yield onUpdated; is(bezier.P2[0], 1, "The new P2 time coordinate is correct"); is(bezier.P2[1], 0, "The new P2 progress coordinate is correct"); } -async function curveCanBeClicked(widget, win, doc, offsets) { +function* curveCanBeClicked(widget, win, doc, offsets) { info("Checking that clicking on the curve moves the closest control point"); info("Listening for the update event"); @@ -79,7 +79,7 @@ async function curveCanBeClicked(widget, win, doc, offsets) { let y = offsets.graphTop + (offsets.graphHeight / 4.0); widget._onCurveClick({pageX: x, pageY: y}); - let bezier = await onUpdated; + let bezier = yield onUpdated; ok(true, "The widget fired the updated event"); is(bezier.P1[0], 0.25, "The new P1 time coordinate is correct"); is(bezier.P1[1], 0.75, "The new P1 progress coordinate is correct"); @@ -94,14 +94,14 @@ async function curveCanBeClicked(widget, win, doc, offsets) { y = offsets.graphBottom - (offsets.graphHeight / 4); widget._onCurveClick({pageX: x, pageY: y}); - bezier = await onUpdated; + bezier = yield onUpdated; is(bezier.P2[0], 0.75, "The new P2 time coordinate is correct"); is(bezier.P2[1], 0.25, "The new P2 progress coordinate is correct"); is(bezier.P1[0], 0.25, "P1 time coordinate remained unchanged"); is(bezier.P1[1], 0.75, "P1 progress coordinate remained unchanged"); } -async function pointsCanBeMovedWithKeyboard(widget, win, doc, offsets) { +function* pointsCanBeMovedWithKeyboard(widget, win, doc, offsets) { info("Checking that points respond to keyboard events"); let singleStep = 3; @@ -114,7 +114,7 @@ async function pointsCanBeMovedWithKeyboard(widget, win, doc, offsets) { let onUpdated = widget.once("updated"); widget._onPointKeyDown(getKeyEvent(widget.p1, 37)); - let bezier = await onUpdated; + let bezier = yield onUpdated; is(bezier.P1[0], x, "The new P1 time coordinate is correct"); is(bezier.P1[1], 0.75, "The new P1 progress coordinate is correct"); @@ -126,7 +126,7 @@ async function pointsCanBeMovedWithKeyboard(widget, win, doc, offsets) { onUpdated = widget.once("updated"); widget._onPointKeyDown(getKeyEvent(widget.p1, 37, true)); - bezier = await onUpdated; + bezier = yield onUpdated; is(bezier.P1[0], x, "The new P1 time coordinate is correct"); is(bezier.P1[1], 0.75, "The new P1 progress coordinate is correct"); @@ -137,7 +137,7 @@ async function pointsCanBeMovedWithKeyboard(widget, win, doc, offsets) { onUpdated = widget.once("updated"); widget._onPointKeyDown(getKeyEvent(widget.p1, 39, true)); - bezier = await onUpdated; + bezier = yield onUpdated; is(bezier.P1[0], x, "The new P1 time coordinate is correct"); is(bezier.P1[1], 0.75, "The new P1 progress coordinate is correct"); @@ -148,7 +148,7 @@ async function pointsCanBeMovedWithKeyboard(widget, win, doc, offsets) { onUpdated = widget.once("updated"); widget._onPointKeyDown(getKeyEvent(widget.p1, 40)); - bezier = await onUpdated; + bezier = yield onUpdated; is(bezier.P1[0], x, "The new P1 time coordinate is correct"); is(bezier.P1[1], y, "The new P1 progress coordinate is correct"); @@ -159,7 +159,7 @@ async function pointsCanBeMovedWithKeyboard(widget, win, doc, offsets) { onUpdated = widget.once("updated"); widget._onPointKeyDown(getKeyEvent(widget.p1, 40, true)); - bezier = await onUpdated; + bezier = yield onUpdated; is(bezier.P1[0], x, "The new P1 time coordinate is correct"); is(bezier.P1[1], y, "The new P1 progress coordinate is correct"); @@ -170,7 +170,7 @@ async function pointsCanBeMovedWithKeyboard(widget, win, doc, offsets) { onUpdated = widget.once("updated"); widget._onPointKeyDown(getKeyEvent(widget.p1, 38, true)); - bezier = await onUpdated; + bezier = yield onUpdated; is(bezier.P1[0], x, "The new P1 time coordinate is correct"); is(bezier.P1[1], y, "The new P1 progress coordinate is correct"); @@ -182,7 +182,7 @@ async function pointsCanBeMovedWithKeyboard(widget, win, doc, offsets) { onUpdated = widget.once("updated"); widget._onPointKeyDown(getKeyEvent(widget.p2, 37)); - bezier = await onUpdated; + bezier = yield onUpdated; is(bezier.P2[0], x, "The new P2 time coordinate is correct"); is(bezier.P2[1], 0.25, "The new P2 progress coordinate is correct"); } diff --git a/devtools/client/shared/test/browser_cubic-bezier-03.js b/devtools/client/shared/test/browser_cubic-bezier-03.js index 1664e15d9a0d..a28e94d1ff32 100644 --- a/devtools/client/shared/test/browser_cubic-bezier-03.js +++ b/devtools/client/shared/test/browser_cubic-bezier-03.js @@ -12,27 +12,27 @@ const {PREDEFINED} = require("devtools/client/shared/widgets/CubicBezierPresets" const TEST_URI = CHROME_URL_ROOT + "doc_cubic-bezier-01.html"; -add_task(async function () { - let [host,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [host,, doc] = yield createHost("bottom", TEST_URI); let container = doc.querySelector("#cubic-bezier-container"); let w = new CubicBezierWidget(container, PREDEFINED.linear); - await coordinatesCanBeChangedByProvidingAnArray(w); - await coordinatesCanBeChangedByProvidingAValue(w); + yield coordinatesCanBeChangedByProvidingAnArray(w); + yield coordinatesCanBeChangedByProvidingAValue(w); w.destroy(); host.destroy(); }); -async function coordinatesCanBeChangedByProvidingAnArray(widget) { +function* coordinatesCanBeChangedByProvidingAnArray(widget) { info("Listening for the update event"); let onUpdated = widget.once("updated"); info("Setting new coordinates"); widget.coordinates = [0, 1, 1, 0]; - let bezier = await onUpdated; + let bezier = yield onUpdated; ok(true, "The updated event was fired as a result of setting coordinates"); is(bezier.P1[0], 0, "The new P1 time coordinate is correct"); @@ -41,13 +41,13 @@ async function coordinatesCanBeChangedByProvidingAnArray(widget) { is(bezier.P2[1], 0, "The new P2 progress coordinate is correct"); } -async function coordinatesCanBeChangedByProvidingAValue(widget) { +function* coordinatesCanBeChangedByProvidingAValue(widget) { info("Listening for the update event"); let onUpdated = widget.once("updated"); info("Setting linear css value"); widget.cssCubicBezierValue = "linear"; - let bezier = await onUpdated; + let bezier = yield onUpdated; ok(true, "The updated event was fired as a result of setting cssValue"); is(bezier.P1[0], 0, "The new P1 time coordinate is correct"); @@ -58,7 +58,7 @@ async function coordinatesCanBeChangedByProvidingAValue(widget) { info("Setting a custom cubic-bezier css value"); onUpdated = widget.once("updated"); widget.cssCubicBezierValue = "cubic-bezier(.25,-0.5, 1, 1.25)"; - bezier = await onUpdated; + bezier = yield onUpdated; ok(true, "The updated event was fired as a result of setting cssValue"); is(bezier.P1[0], .25, "The new P1 time coordinate is correct"); diff --git a/devtools/client/shared/test/browser_cubic-bezier-04.js b/devtools/client/shared/test/browser_cubic-bezier-04.js index 8020a82951bc..b96c5de429b8 100644 --- a/devtools/client/shared/test/browser_cubic-bezier-04.js +++ b/devtools/client/shared/test/browser_cubic-bezier-04.js @@ -12,8 +12,8 @@ const {PRESETS} = require("devtools/client/shared/widgets/CubicBezierPresets"); const TEST_URI = CHROME_URL_ROOT + "doc_cubic-bezier-01.html"; -add_task(async function () { - let [host,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [host,, doc] = yield createHost("bottom", TEST_URI); let container = doc.querySelector("#cubic-bezier-container"); let w = new CubicBezierPresetWidget(container); diff --git a/devtools/client/shared/test/browser_cubic-bezier-05.js b/devtools/client/shared/test/browser_cubic-bezier-05.js index ee2327ab8407..cbf0345021a6 100644 --- a/devtools/client/shared/test/browser_cubic-bezier-05.js +++ b/devtools/client/shared/test/browser_cubic-bezier-05.js @@ -13,8 +13,8 @@ const {PREDEFINED, PRESETS, DEFAULT_PRESET_CATEGORY} = const TEST_URI = CHROME_URL_ROOT + "doc_cubic-bezier-01.html"; -add_task(async function () { - let [host,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [host,, doc] = yield createHost("bottom", TEST_URI); let container = doc.querySelector("#cubic-bezier-container"); let w = new CubicBezierPresetWidget(container); diff --git a/devtools/client/shared/test/browser_cubic-bezier-06.js b/devtools/client/shared/test/browser_cubic-bezier-06.js index af0b2890f963..285574875ea4 100644 --- a/devtools/client/shared/test/browser_cubic-bezier-06.js +++ b/devtools/client/shared/test/browser_cubic-bezier-06.js @@ -13,8 +13,8 @@ const {PRESETS} = require("devtools/client/shared/widgets/CubicBezierPresets"); const TEST_URI = CHROME_URL_ROOT + "doc_cubic-bezier-01.html"; -add_task(async function () { - let [host, win, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [host, win, doc] = yield createHost("bottom", TEST_URI); let container = doc.querySelector("#cubic-bezier-container"); let w = new CubicBezierWidget(container, @@ -24,14 +24,14 @@ add_task(async function () { let rect = w.curve.getBoundingClientRect(); rect.graphTop = rect.height * w.bezierCanvas.padding[0]; - await adjustingBezierUpdatesPreset(w, win, doc, rect); - await selectingPresetUpdatesBezier(w, win, doc, rect); + yield adjustingBezierUpdatesPreset(w, win, doc, rect); + yield selectingPresetUpdatesBezier(w, win, doc, rect); w.destroy(); host.destroy(); }); -function adjustingBezierUpdatesPreset(widget, win, doc, rect) { +function* adjustingBezierUpdatesPreset(widget, win, doc, rect) { info("Checking that changing the bezier refreshes the preset menu"); is(widget.presets.activeCategory, @@ -55,7 +55,7 @@ function adjustingBezierUpdatesPreset(widget, win, doc, rect) { "There is no active preset"); } -async function selectingPresetUpdatesBezier(widget, win, doc, rect) { +function* selectingPresetUpdatesBezier(widget, win, doc, rect) { info("Checking that selecting a preset updates bezier curve"); info("Listening for the new coordinates event"); @@ -66,10 +66,10 @@ async function selectingPresetUpdatesBezier(widget, win, doc, rect) { let preset = doc.querySelector("#ease-in-sine"); widget.presets._onPresetClick({currentTarget: preset}); - await onNewCoordinates; + yield onNewCoordinates; ok(true, "The preset widget fired the new-coordinates event"); - let bezier = await onUpdated; + let bezier = yield onUpdated; ok(true, "The bezier canvas fired the updated event"); is(bezier.P1[0], preset.coordinates[0], "The new P1 time coordinate is correct"); diff --git a/devtools/client/shared/test/browser_cubic-bezier-07.js b/devtools/client/shared/test/browser_cubic-bezier-07.js index 7962b27feeaf..2f1ba186e685 100644 --- a/devtools/client/shared/test/browser_cubic-bezier-07.js +++ b/devtools/client/shared/test/browser_cubic-bezier-07.js @@ -12,26 +12,26 @@ const {PREDEFINED} = require("devtools/client/shared/widgets/CubicBezierPresets" const TEST_URI = CHROME_URL_ROOT + "doc_cubic-bezier-01.html"; -add_task(async function () { - let [host,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [host,, doc] = yield createHost("bottom", TEST_URI); let container = doc.querySelector("#cubic-bezier-container"); let w = new CubicBezierWidget(container, PREDEFINED.linear); - await previewDotReactsToChanges(w, [0.6, -0.28, 0.74, 0.05]); - await previewDotReactsToChanges(w, [0.9, 0.03, 0.69, 0.22]); - await previewDotReactsToChanges(w, [0.68, -0.55, 0.27, 1.55]); - await previewDotReactsToChanges(w, PREDEFINED.ease, "ease"); - await previewDotReactsToChanges(w, PREDEFINED["ease-in-out"], "ease-in-out"); + yield previewDotReactsToChanges(w, [0.6, -0.28, 0.74, 0.05]); + yield previewDotReactsToChanges(w, [0.9, 0.03, 0.69, 0.22]); + yield previewDotReactsToChanges(w, [0.68, -0.55, 0.27, 1.55]); + yield previewDotReactsToChanges(w, PREDEFINED.ease, "ease"); + yield previewDotReactsToChanges(w, PREDEFINED["ease-in-out"], "ease-in-out"); w.destroy(); host.destroy(); }); -async function previewDotReactsToChanges(widget, coords, expectedEasing) { +function* previewDotReactsToChanges(widget, coords, expectedEasing) { let onUpdated = widget.once("updated"); widget.coordinates = coords; - await onUpdated; + yield onUpdated; let animatedDot = widget.timingPreview.dot; let animations = animatedDot.getAnimations(); diff --git a/devtools/client/shared/test/browser_devices.js b/devtools/client/shared/test/browser_devices.js index 51953d9f7d46..0bf52fe8e9cf 100644 --- a/devtools/client/shared/test/browser_devices.js +++ b/devtools/client/shared/test/browser_devices.js @@ -9,11 +9,11 @@ const { addDevice } = require("devtools/client/shared/devices"); -add_task(async function () { +add_task(function* () { Services.prefs.setCharPref("devtools.devices.url", TEST_URI_ROOT + "browser_devices.json"); - let devices = await getDevices(); + let devices = yield getDevices(); is(devices.TYPES.length, 1, "Found 1 device type."); @@ -34,7 +34,7 @@ add_task(async function () { firefoxOS: true }; addDevice(device1, type1); - devices = await getDevices(); + devices = yield getDevices(); is(devices[type1].length, 3, "Added new device of type #1."); ok(devices[type1].filter(d => d.name === device1.name), "Found the new device."); @@ -50,7 +50,7 @@ add_task(async function () { firefoxOS: true }; addDevice(device2, type2); - devices = await getDevices(); + devices = yield getDevices(); is(devices.TYPES.length, 2, "Added device type #2."); is(devices[type2].length, 1, "Added new device of type #2."); diff --git a/devtools/client/shared/test/browser_filter-editor-01.js b/devtools/client/shared/test/browser_filter-editor-01.js index 01fbe7814667..c8baa6de25b4 100644 --- a/devtools/client/shared/test/browser_filter-editor-01.js +++ b/devtools/client/shared/test/browser_filter-editor-01.js @@ -24,8 +24,8 @@ function verifyURL(string) { return lexer.nextToken() === null; } -add_task(async function () { - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [,, doc] = yield createHost("bottom", TEST_URI); const cssIsValid = getClientCssProperties().getValidityChecker(doc); const container = doc.querySelector("#filter-container"); diff --git a/devtools/client/shared/test/browser_filter-editor-02.js b/devtools/client/shared/test/browser_filter-editor-02.js index 23a599432fb0..d230306087db 100644 --- a/devtools/client/shared/test/browser_filter-editor-02.js +++ b/devtools/client/shared/test/browser_filter-editor-02.js @@ -14,8 +14,8 @@ const L10N = new LocalizationHelper(STRINGS_URI); const TEST_URI = CHROME_URL_ROOT + "doc_filter-editor-01.html"; -add_task(async function () { - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [,, doc] = yield createHost("bottom", TEST_URI); const cssIsValid = getClientCssProperties().getValidityChecker(doc); const TEST_DATA = [ diff --git a/devtools/client/shared/test/browser_filter-editor-03.js b/devtools/client/shared/test/browser_filter-editor-03.js index 62a2037a0c34..34bdf358068f 100644 --- a/devtools/client/shared/test/browser_filter-editor-03.js +++ b/devtools/client/shared/test/browser_filter-editor-03.js @@ -12,8 +12,8 @@ const INVERT_MIN = 0; const TEST_URI = CHROME_URL_ROOT + "doc_filter-editor-01.html"; -add_task(async function () { - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [,, doc] = yield createHost("bottom", TEST_URI); const cssIsValid = getClientCssProperties().getValidityChecker(doc); const container = doc.querySelector("#filter-container"); diff --git a/devtools/client/shared/test/browser_filter-editor-04.js b/devtools/client/shared/test/browser_filter-editor-04.js index 54e504c57805..22f6cfc76b47 100644 --- a/devtools/client/shared/test/browser_filter-editor-04.js +++ b/devtools/client/shared/test/browser_filter-editor-04.js @@ -11,8 +11,8 @@ const LIST_ITEM_HEIGHT = 32; const TEST_URI = CHROME_URL_ROOT + "doc_filter-editor-01.html"; -add_task(async function () { - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [,, doc] = yield createHost("bottom", TEST_URI); const cssIsValid = getClientCssProperties().getValidityChecker(doc); const container = doc.querySelector("#filter-container"); diff --git a/devtools/client/shared/test/browser_filter-editor-05.js b/devtools/client/shared/test/browser_filter-editor-05.js index 33364cfe244c..6df4111bfc5a 100644 --- a/devtools/client/shared/test/browser_filter-editor-05.js +++ b/devtools/client/shared/test/browser_filter-editor-05.js @@ -19,8 +19,8 @@ const GRAYSCALE_MAX = 100, const TEST_URI = CHROME_URL_ROOT + "doc_filter-editor-01.html"; -add_task(async function () { - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [,, doc] = yield createHost("bottom", TEST_URI); const cssIsValid = getClientCssProperties().getValidityChecker(doc); const container = doc.querySelector("#filter-container"); diff --git a/devtools/client/shared/test/browser_filter-editor-06.js b/devtools/client/shared/test/browser_filter-editor-06.js index 91d12d535a56..6c8e2bd18bc7 100644 --- a/devtools/client/shared/test/browser_filter-editor-06.js +++ b/devtools/client/shared/test/browser_filter-editor-06.js @@ -14,8 +14,8 @@ const L10N = new LocalizationHelper(STRINGS_URI); const TEST_URI = CHROME_URL_ROOT + "doc_filter-editor-01.html"; -add_task(async function () { - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [,, doc] = yield createHost("bottom", TEST_URI); const cssIsValid = getClientCssProperties().getValidityChecker(doc); const container = doc.querySelector("#filter-container"); diff --git a/devtools/client/shared/test/browser_filter-editor-07.js b/devtools/client/shared/test/browser_filter-editor-07.js index 3b439f03a532..c965e6d24eb7 100644 --- a/devtools/client/shared/test/browser_filter-editor-07.js +++ b/devtools/client/shared/test/browser_filter-editor-07.js @@ -10,8 +10,8 @@ const {getClientCssProperties} = require("devtools/shared/fronts/css-properties" const TEST_URI = CHROME_URL_ROOT + "doc_filter-editor-01.html"; -add_task(async function () { - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [,, doc] = yield createHost("bottom", TEST_URI); const cssIsValid = getClientCssProperties().getValidityChecker(doc); const container = doc.querySelector("#filter-container"); diff --git a/devtools/client/shared/test/browser_filter-editor-08.js b/devtools/client/shared/test/browser_filter-editor-08.js index 2f413fda7ea7..59b5d1562510 100644 --- a/devtools/client/shared/test/browser_filter-editor-08.js +++ b/devtools/client/shared/test/browser_filter-editor-08.js @@ -15,8 +15,8 @@ const DEFAULT_VALUE_MULTIPLIER = 1; const TEST_URI = CHROME_URL_ROOT + "doc_filter-editor-01.html"; -add_task(async function () { - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [,, doc] = yield createHost("bottom", TEST_URI); const cssIsValid = getClientCssProperties().getValidityChecker(doc); const container = doc.querySelector("#filter-container"); diff --git a/devtools/client/shared/test/browser_filter-editor-09.js b/devtools/client/shared/test/browser_filter-editor-09.js index 4c4f6615cd39..b167d20740ae 100644 --- a/devtools/client/shared/test/browser_filter-editor-09.js +++ b/devtools/client/shared/test/browser_filter-editor-09.js @@ -15,8 +15,8 @@ const DEFAULT_VALUE_MULTIPLIER = 1; const TEST_URI = CHROME_URL_ROOT + "doc_filter-editor-01.html"; -add_task(async function () { - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [,, doc] = yield createHost("bottom", TEST_URI); const cssIsValid = getClientCssProperties().getValidityChecker(doc); const container = doc.querySelector("#filter-container"); diff --git a/devtools/client/shared/test/browser_filter-editor-10.js b/devtools/client/shared/test/browser_filter-editor-10.js index f3d6650e8c91..09e14dbfb697 100644 --- a/devtools/client/shared/test/browser_filter-editor-10.js +++ b/devtools/client/shared/test/browser_filter-editor-10.js @@ -13,8 +13,8 @@ const DEFAULT_VALUE_MULTIPLIER = 1; const TEST_URI = CHROME_URL_ROOT + "doc_filter-editor-01.html"; -add_task(async function () { - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [,, doc] = yield createHost("bottom", TEST_URI); const cssIsValid = getClientCssProperties().getValidityChecker(doc); const container = doc.querySelector("#filter-container"); diff --git a/devtools/client/shared/test/browser_filter-presets-01.js b/devtools/client/shared/test/browser_filter-presets-01.js index b41dafa3e0f0..65f048b62da0 100644 --- a/devtools/client/shared/test/browser_filter-presets-01.js +++ b/devtools/client/shared/test/browser_filter-presets-01.js @@ -10,19 +10,19 @@ const {getClientCssProperties} = require("devtools/shared/fronts/css-properties" const TEST_URI = CHROME_URL_ROOT + "doc_filter-editor-01.html"; -add_task(async function () { - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [,, doc] = yield createHost("bottom", TEST_URI); const cssIsValid = getClientCssProperties().getValidityChecker(doc); const container = doc.querySelector("#filter-container"); let widget = new CSSFilterEditorWidget(container, "none", cssIsValid); // First render - await widget.once("render"); + yield widget.once("render"); const VALUE = "blur(2px) contrast(150%)"; const NAME = "Test"; - await showFilterPopupPresetsAndCreatePreset(widget, NAME, VALUE); + yield showFilterPopupPresetsAndCreatePreset(widget, NAME, VALUE); let preset = widget.el.querySelector(".preset"); is(preset.querySelector("label").textContent, NAME, @@ -30,7 +30,7 @@ add_task(async function () { is(preset.querySelector("span").textContent, VALUE, "Should show preset value preview correctly"); - let list = await widget.getPresets(); + let list = yield widget.getPresets(); let input = widget.el.querySelector(".presets-list .footer input"); let data = list[0]; @@ -45,12 +45,12 @@ add_task(async function () { widget.setCssValue(VALUE_2); - await savePreset(widget); + yield savePreset(widget); is(widget.el.querySelectorAll(".preset").length, 1, "Should override the preset with the same name - render"); - list = await widget.getPresets(); + list = yield widget.getPresets(); data = list[0]; is(list.length, 1, @@ -61,14 +61,14 @@ add_task(async function () { is(data.value, VALUE_2, "Should override the preset with the same name - prop value"); - await widget.setPresets([]); + yield widget.setPresets([]); info("Test saving a preset without name"); input.value = ""; - await savePreset(widget, "preset-save-error"); + yield savePreset(widget, "preset-save-error"); - list = await widget.getPresets(); + list = yield widget.getPresets(); is(list.length, 0, "Should not add a preset without name"); @@ -77,9 +77,9 @@ add_task(async function () { input.value = NAME; widget.setCssValue("none"); - await savePreset(widget, "preset-save-error"); + yield savePreset(widget, "preset-save-error"); - list = await widget.getPresets(); + list = yield widget.getPresets(); is(list.length, 0, "Should not add a preset without filters (value: none)"); }); diff --git a/devtools/client/shared/test/browser_filter-presets-02.js b/devtools/client/shared/test/browser_filter-presets-02.js index 4119346c5f6d..9a063d3e750d 100644 --- a/devtools/client/shared/test/browser_filter-presets-02.js +++ b/devtools/client/shared/test/browser_filter-presets-02.js @@ -10,24 +10,24 @@ const {getClientCssProperties} = require("devtools/shared/fronts/css-properties" const TEST_URI = CHROME_URL_ROOT + "doc_filter-editor-01.html"; -add_task(async function () { - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [,, doc] = yield createHost("bottom", TEST_URI); const cssIsValid = getClientCssProperties().getValidityChecker(doc); const container = doc.querySelector("#filter-container"); let widget = new CSSFilterEditorWidget(container, "none", cssIsValid); // First render - await widget.once("render"); + yield widget.once("render"); const VALUE = "blur(2px) contrast(150%)"; const NAME = "Test"; - await showFilterPopupPresetsAndCreatePreset(widget, NAME, VALUE); + yield showFilterPopupPresetsAndCreatePreset(widget, NAME, VALUE); let onRender = widget.once("render"); // reset value widget.setCssValue("saturate(100%) brightness(150%)"); - await onRender; + yield onRender; let preset = widget.el.querySelector(".preset"); @@ -36,7 +36,7 @@ add_task(async function () { target: preset }); - await onRender; + yield onRender; is(widget.getCssValue(), VALUE, "Should set widget's value correctly"); diff --git a/devtools/client/shared/test/browser_filter-presets-03.js b/devtools/client/shared/test/browser_filter-presets-03.js index 75ad970c8a0d..2672aff02b6c 100644 --- a/devtools/client/shared/test/browser_filter-presets-03.js +++ b/devtools/client/shared/test/browser_filter-presets-03.js @@ -10,19 +10,19 @@ const {getClientCssProperties} = require("devtools/shared/fronts/css-properties" const TEST_URI = CHROME_URL_ROOT + "doc_filter-editor-01.html"; -add_task(async function () { - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [,, doc] = yield createHost("bottom", TEST_URI); const cssIsValid = getClientCssProperties().getValidityChecker(doc); const container = doc.querySelector("#filter-container"); let widget = new CSSFilterEditorWidget(container, "none", cssIsValid); // First render - await widget.once("render"); + yield widget.once("render"); const NAME = "Test"; const VALUE = "blur(2px) contrast(150%)"; - await showFilterPopupPresetsAndCreatePreset(widget, NAME, VALUE); + yield showFilterPopupPresetsAndCreatePreset(widget, NAME, VALUE); let removeButton = widget.el.querySelector(".preset .remove-button"); let onRender = widget.once("render"); @@ -30,11 +30,11 @@ add_task(async function () { target: removeButton }); - await onRender; + yield onRender; is(widget.el.querySelector(".preset"), null, "Should re-render after removing preset"); - let list = await widget.getPresets(); + let list = yield widget.getPresets(); is(list.length, 0, "Should remove presets from asyncStorage"); }); diff --git a/devtools/client/shared/test/browser_flame-graph-01.js b/devtools/client/shared/test/browser_flame-graph-01.js index d49112647c39..a32fb9fd3710 100644 --- a/devtools/client/shared/test/browser_flame-graph-01.js +++ b/devtools/client/shared/test/browser_flame-graph-01.js @@ -7,14 +7,14 @@ const {FlameGraph} = require("devtools/client/shared/widgets/FlameGraph"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); doc.body.setAttribute("style", "position: fixed; width: 100%; height: 100%; margin: 0;"); @@ -25,12 +25,12 @@ async function performTest() { readyEventEmitted = true; }); - await graph.ready(); + yield graph.ready(); ok(readyEventEmitted, "The 'ready' event should have been emitted"); testGraph(host, graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_flame-graph-02.js b/devtools/client/shared/test/browser_flame-graph-02.js index 5f11c9a34fae..e15c3efe0876 100644 --- a/devtools/client/shared/test/browser_flame-graph-02.js +++ b/devtools/client/shared/test/browser_flame-graph-02.js @@ -7,14 +7,14 @@ const {FlameGraph} = require("devtools/client/shared/widgets/FlameGraph"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); doc.body.setAttribute("style", "position: fixed; width: 100%; height: 100%; margin: 0;"); @@ -22,10 +22,10 @@ async function performTest() { graph.fixedWidth = 200; graph.fixedHeight = 100; - await graph.ready(); + yield graph.ready(); testGraph(host, graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_flame-graph-03a.js b/devtools/client/shared/test/browser_flame-graph-03a.js index 95d5d01e8e82..2d8810a412da 100644 --- a/devtools/client/shared/test/browser_flame-graph-03a.js +++ b/devtools/client/shared/test/browser_flame-graph-03a.js @@ -26,14 +26,14 @@ const TEST_HEIGHT = 100; const {FlameGraph} = require("devtools/client/shared/widgets/FlameGraph"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); doc.body.setAttribute("style", "position: fixed; width: 100%; height: 100%; margin: 0;"); @@ -43,11 +43,11 @@ async function performTest() { graph.horizontalPanThreshold = 0; graph.verticalPanThreshold = 0; - await graph.ready(); + yield graph.ready(); testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_flame-graph-03b.js b/devtools/client/shared/test/browser_flame-graph-03b.js index fd2421ce9222..26604ce9dd94 100644 --- a/devtools/client/shared/test/browser_flame-graph-03b.js +++ b/devtools/client/shared/test/browser_flame-graph-03b.js @@ -27,14 +27,14 @@ const TEST_DPI_DENSITIY = 2; var {FlameGraph} = require("devtools/client/shared/widgets/FlameGraph"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); doc.body.setAttribute("style", "position: fixed; width: 100%; height: 100%; margin: 0;"); @@ -42,11 +42,11 @@ async function performTest() { graph.fixedWidth = TEST_WIDTH; graph.fixedHeight = TEST_HEIGHT; - await graph.ready(); + yield graph.ready(); testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_flame-graph-03c.js b/devtools/client/shared/test/browser_flame-graph-03c.js index e2bc132ddf78..3a6bf80ae26d 100644 --- a/devtools/client/shared/test/browser_flame-graph-03c.js +++ b/devtools/client/shared/test/browser_flame-graph-03c.js @@ -27,14 +27,14 @@ const TEST_DPI_DENSITIY = 2; const {FlameGraph} = require("devtools/client/shared/widgets/FlameGraph"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); doc.body.setAttribute("style", "position: fixed; width: 100%; height: 100%; margin: 0;"); @@ -42,11 +42,11 @@ async function performTest() { graph.fixedWidth = TEST_WIDTH; graph.fixedHeight = TEST_HEIGHT; - await graph.ready(); + yield graph.ready(); testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_flame-graph-04.js b/devtools/client/shared/test/browser_flame-graph-04.js index a1197444e537..5bcc112ec4c9 100644 --- a/devtools/client/shared/test/browser_flame-graph-04.js +++ b/devtools/client/shared/test/browser_flame-graph-04.js @@ -11,20 +11,20 @@ const {FlameGraph} = require("devtools/client/shared/widgets/FlameGraph"); const {FLAME_GRAPH_BLOCK_TEXT_FONT_SIZE} = require("devtools/client/shared/widgets/FlameGraph"); const {FLAME_GRAPH_BLOCK_TEXT_FONT_FAMILY} = require("devtools/client/shared/widgets/FlameGraph"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new FlameGraph(doc.body, 1); - await graph.ready(); + yield graph.ready(); testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_flame-graph-05.js b/devtools/client/shared/test/browser_flame-graph-05.js index 95e61f25f60b..80e7df777a9a 100644 --- a/devtools/client/shared/test/browser_flame-graph-05.js +++ b/devtools/client/shared/test/browser_flame-graph-05.js @@ -30,27 +30,27 @@ const KEY_CODE_RIGHT = 39; var {FlameGraph} = require("devtools/client/shared/widgets/FlameGraph"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); doc.body.setAttribute("style", "position: fixed; width: 100%; height: 100%; margin: 0;"); let graph = new FlameGraph(doc.body, TEST_DPI_DENSITIY); - await graph.ready(); + yield graph.ready(); - await testGraph(host, graph); + yield testGraph(host, graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } -async function testGraph(host, graph) { +function* testGraph(host, graph) { graph.setData({ data: TEST_DATA, bounds: TEST_BOUNDS }); is(graph._selection.start, 0, @@ -58,7 +58,7 @@ async function testGraph(host, graph) { is(graph._selection.end, TEST_BOUNDS.endTime * TEST_DPI_DENSITIY, "The graph's selection end value is initially correct."); - await pressKeyForTime(graph, KEY_CODE_LEFT, 1000); + yield pressKeyForTime(graph, KEY_CODE_LEFT, 1000); is(graph._selection.start, 0, "The graph's selection start value is correct after pressing LEFT."); @@ -69,7 +69,7 @@ async function testGraph(host, graph) { graph._selection.end = TEST_BOUNDS.endTime * TEST_DPI_DENSITIY; info("Graph selection was reset (1)."); - await pressKeyForTime(graph, KEY_CODE_RIGHT, 1000); + yield pressKeyForTime(graph, KEY_CODE_RIGHT, 1000); ok(graph._selection.start > 0, "The graph's selection start value is correct after pressing RIGHT."); @@ -80,7 +80,7 @@ async function testGraph(host, graph) { graph._selection.end = TEST_BOUNDS.endTime * TEST_DPI_DENSITIY; info("Graph selection was reset (2)."); - await pressKeyForTime(graph, KEY_CODE_UP, 1000); + yield pressKeyForTime(graph, KEY_CODE_UP, 1000); ok(graph._selection.start > 0, "The graph's selection start value is correct after pressing UP."); diff --git a/devtools/client/shared/test/browser_flame-graph-utils-01.js b/devtools/client/shared/test/browser_flame-graph-utils-01.js index 739591816725..6871e234cfb5 100644 --- a/devtools/client/shared/test/browser_flame-graph-utils-01.js +++ b/devtools/client/shared/test/browser_flame-graph-utils-01.js @@ -9,13 +9,13 @@ const {FlameGraphUtils} = require("devtools/client/shared/widgets/FlameGraph"); const {PALLETTE_SIZE} = require("devtools/client/shared/widgets/FlameGraph"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -function performTest() { +function* performTest() { let out = FlameGraphUtils.createFlameGraphDataFromThread(TEST_DATA); ok(out, "Some data was outputted properly"); diff --git a/devtools/client/shared/test/browser_flame-graph-utils-02.js b/devtools/client/shared/test/browser_flame-graph-utils-02.js index 3e6621deee83..15e9d19338fe 100644 --- a/devtools/client/shared/test/browser_flame-graph-utils-02.js +++ b/devtools/client/shared/test/browser_flame-graph-utils-02.js @@ -8,13 +8,13 @@ const {FlameGraphUtils} = require("devtools/client/shared/widgets/FlameGraph"); const {PALLETTE_SIZE} = require("devtools/client/shared/widgets/FlameGraph"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -function performTest() { +function* performTest() { let out = FlameGraphUtils.createFlameGraphDataFromThread(TEST_DATA, { flattenRecursion: true }); diff --git a/devtools/client/shared/test/browser_flame-graph-utils-03.js b/devtools/client/shared/test/browser_flame-graph-utils-03.js index 87a7e538ab0e..0f28c0afc991 100644 --- a/devtools/client/shared/test/browser_flame-graph-utils-03.js +++ b/devtools/client/shared/test/browser_flame-graph-utils-03.js @@ -8,13 +8,13 @@ const {FlameGraphUtils} = require("devtools/client/shared/widgets/FlameGraph"); const {PALLETTE_SIZE} = require("devtools/client/shared/widgets/FlameGraph"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -function performTest() { +function* performTest() { let out = FlameGraphUtils.createFlameGraphDataFromThread(TEST_DATA, { contentOnly: true }); diff --git a/devtools/client/shared/test/browser_flame-graph-utils-04.js b/devtools/client/shared/test/browser_flame-graph-utils-04.js index 6a957600d13d..1bf6c1f595d6 100644 --- a/devtools/client/shared/test/browser_flame-graph-utils-04.js +++ b/devtools/client/shared/test/browser_flame-graph-utils-04.js @@ -8,13 +8,13 @@ const {FlameGraphUtils} = require("devtools/client/shared/widgets/FlameGraph"); const {PALLETTE_SIZE} = require("devtools/client/shared/widgets/FlameGraph"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -function performTest() { +function* performTest() { let out = FlameGraphUtils.createFlameGraphDataFromThread(TEST_DATA, { flattenRecursion: true, contentOnly: true, diff --git a/devtools/client/shared/test/browser_flame-graph-utils-05.js b/devtools/client/shared/test/browser_flame-graph-utils-05.js index dbc1118df441..5abdd708a901 100644 --- a/devtools/client/shared/test/browser_flame-graph-utils-05.js +++ b/devtools/client/shared/test/browser_flame-graph-utils-05.js @@ -7,13 +7,13 @@ const {FlameGraphUtils} = require("devtools/client/shared/widgets/FlameGraph"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -function performTest() { +function* performTest() { let out1 = FlameGraphUtils.createFlameGraphDataFromThread(TEST_DATA); let out2 = FlameGraphUtils.createFlameGraphDataFromThread(TEST_DATA); is(out1, out2, "The outputted data is identical."); diff --git a/devtools/client/shared/test/browser_flame-graph-utils-06.js b/devtools/client/shared/test/browser_flame-graph-utils-06.js index 4c3a7b3a7965..886a1035b882 100644 --- a/devtools/client/shared/test/browser_flame-graph-utils-06.js +++ b/devtools/client/shared/test/browser_flame-graph-utils-06.js @@ -11,13 +11,13 @@ const {PALLETTE_SIZE} = require("devtools/client/shared/widgets/FlameGraph"); const MANGLED_FN = "__Z3FooIiEvv"; const UNMANGLED_FN = "void Foo()"; -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -function performTest() { +function* performTest() { let out = FlameGraphUtils.createFlameGraphDataFromThread(TEST_DATA, { flattenRecursion: true }); diff --git a/devtools/client/shared/test/browser_graphs-01.js b/devtools/client/shared/test/browser_graphs-01.js index 4c882fc11341..c4f5640d90d1 100644 --- a/devtools/client/shared/test/browser_graphs-01.js +++ b/devtools/client/shared/test/browser_graphs-01.js @@ -7,15 +7,15 @@ const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); finish(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); doc.body.setAttribute("style", "position: fixed; width: 100%; height: 100%; margin: 0;"); @@ -26,12 +26,12 @@ async function performTest() { readyEventEmitted = true; }); - await graph.ready(); + yield graph.ready(); ok(readyEventEmitted, "The 'ready' event should have been emitted"); testGraph(host, graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_graphs-02.js b/devtools/client/shared/test/browser_graphs-02.js index c86754e80cb7..def7287227ab 100644 --- a/devtools/client/shared/test/browser_graphs-02.js +++ b/devtools/client/shared/test/browser_graphs-02.js @@ -30,21 +30,21 @@ const TEST_DATA = [ const TEST_REGIONS = [{ start: 320, end: 460 }, { start: 780, end: 860 }]; const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); - await graph.once("ready"); + yield graph.once("ready"); testDataAndRegions(graph); testHighlights(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_graphs-03.js b/devtools/client/shared/test/browser_graphs-03.js index 757f4868c211..b44d4620ac46 100644 --- a/devtools/client/shared/test/browser_graphs-03.js +++ b/devtools/client/shared/test/browser_graphs-03.js @@ -8,25 +8,25 @@ const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); - await graph.once("ready"); + yield graph.once("ready"); - await testSelection(graph); - await testCursor(graph); + yield testSelection(graph); + yield testCursor(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } -async function testSelection(graph) { +function* testSelection(graph) { ok(graph.getSelection().start === null, "The graph's selection should initially have a null start value."); ok(graph.getSelection().end === null, @@ -37,7 +37,7 @@ async function testSelection(graph) { let selected = graph.once("selecting"); graph.setSelection({ start: 100, end: 200 }); - await selected; + yield selected; ok(true, "A 'selecting' event has been fired."); ok(graph.hasSelection(), @@ -61,7 +61,7 @@ async function testSelection(graph) { let deselected = graph.once("deselecting"); graph.dropSelection(); - await deselected; + yield deselected; ok(true, "A 'deselecting' event has been fired."); ok(!graph.hasSelection(), @@ -72,7 +72,7 @@ async function testSelection(graph) { "The graph's selection now has a null end value."); } -function testCursor(graph) { +function* testCursor(graph) { ok(graph.getCursor().x === null, "The graph's cursor should initially have a null X value."); ok(graph.getCursor().y === null, diff --git a/devtools/client/shared/test/browser_graphs-04.js b/devtools/client/shared/test/browser_graphs-04.js index 7ecf8ce50448..452b27c4a127 100644 --- a/devtools/client/shared/test/browser_graphs-04.js +++ b/devtools/client/shared/test/browser_graphs-04.js @@ -7,20 +7,20 @@ const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); - await graph.once("ready"); + yield graph.once("ready"); testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_graphs-05.js b/devtools/client/shared/test/browser_graphs-05.js index 1e63a1eacff0..bd3da912884d 100644 --- a/devtools/client/shared/test/browser_graphs-05.js +++ b/devtools/client/shared/test/browser_graphs-05.js @@ -30,20 +30,20 @@ const TEST_DATA = [ const TEST_REGIONS = [{ start: 320, end: 460 }, { start: 780, end: 860 }]; const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); - await graph.once("ready"); + yield graph.once("ready"); testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_graphs-06.js b/devtools/client/shared/test/browser_graphs-06.js index ee94ac4856f1..596fe7702527 100644 --- a/devtools/client/shared/test/browser_graphs-06.js +++ b/devtools/client/shared/test/browser_graphs-06.js @@ -30,20 +30,20 @@ const TEST_DATA = [ const TEST_REGIONS = [{ start: 320, end: 460 }, { start: 780, end: 860 }]; const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); - await graph.once("ready"); + yield graph.once("ready"); testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_graphs-07a.js b/devtools/client/shared/test/browser_graphs-07a.js index dd47dbf4c207..44e166cc53bb 100644 --- a/devtools/client/shared/test/browser_graphs-07a.js +++ b/devtools/client/shared/test/browser_graphs-07a.js @@ -29,23 +29,23 @@ const TEST_DATA = [ ]; const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); - await graph.once("ready"); + yield graph.once("ready"); testGraph(graph, normalDragStop); - await graph.destroy(); + yield graph.destroy(); let graph2 = new LineGraphWidget(doc.body, "fps"); - await graph2.once("ready"); + yield graph2.once("ready"); testGraph(graph2, buggyDragStop); - await graph2.destroy(); + yield graph2.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_graphs-07b.js b/devtools/client/shared/test/browser_graphs-07b.js index 9a3e9e75fd27..3b4bc5740db8 100644 --- a/devtools/client/shared/test/browser_graphs-07b.js +++ b/devtools/client/shared/test/browser_graphs-07b.js @@ -29,20 +29,20 @@ const TEST_DATA = [ ]; var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); - await graph.once("ready"); + yield graph.once("ready"); testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_graphs-07c.js b/devtools/client/shared/test/browser_graphs-07c.js index 64f789f066c4..1791ced120f1 100644 --- a/devtools/client/shared/test/browser_graphs-07c.js +++ b/devtools/client/shared/test/browser_graphs-07c.js @@ -31,18 +31,18 @@ const TEST_DATA = [ ]; const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); - await graph.once("ready"); + yield graph.once("ready"); testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_graphs-07d.js b/devtools/client/shared/test/browser_graphs-07d.js index e3f7756da750..8a64f7d75a29 100644 --- a/devtools/client/shared/test/browser_graphs-07d.js +++ b/devtools/client/shared/test/browser_graphs-07d.js @@ -30,20 +30,20 @@ const TEST_DATA = [ const TEST_REGIONS = [{ start: 320, end: 460 }, { start: 780, end: 860 }]; const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); - await graph.once("ready"); + yield graph.once("ready"); testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_graphs-07e.js b/devtools/client/shared/test/browser_graphs-07e.js index c294b925dbc3..814284b9de7f 100644 --- a/devtools/client/shared/test/browser_graphs-07e.js +++ b/devtools/client/shared/test/browser_graphs-07e.js @@ -30,16 +30,16 @@ const TEST_DATA = [ const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); let CURRENT_ZOOM = 1; -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); - await graph.once("ready"); + yield graph.once("ready"); graph.setData(TEST_DATA); info("Testing with normal zoom."); @@ -53,7 +53,7 @@ async function performTest() { setZoom(host.frame, 2); testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_graphs-08.js b/devtools/client/shared/test/browser_graphs-08.js index 280cd2a60783..ae6b54fb58b5 100644 --- a/devtools/client/shared/test/browser_graphs-08.js +++ b/devtools/client/shared/test/browser_graphs-08.js @@ -29,20 +29,20 @@ const TEST_DATA = [ ]; const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); - await graph.once("ready"); + yield graph.once("ready"); testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_graphs-09a.js b/devtools/client/shared/test/browser_graphs-09a.js index 57b89f57409b..8e6e65c242ef 100644 --- a/devtools/client/shared/test/browser_graphs-09a.js +++ b/devtools/client/shared/test/browser_graphs-09a.js @@ -29,26 +29,26 @@ const TEST_DATA = [ ]; const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, { metric: "fps" }); - await testGraph(graph); + yield testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } -async function testGraph(graph) { +function* testGraph(graph) { info("Should be able to set the graph data before waiting for the ready event."); - await graph.setDataWhenReady(TEST_DATA); + yield graph.setDataWhenReady(TEST_DATA); ok(graph.hasData(), "Data was set successfully."); is(graph._gutter.hidden, false, diff --git a/devtools/client/shared/test/browser_graphs-09b.js b/devtools/client/shared/test/browser_graphs-09b.js index 27faf981fb5e..58dc552fb876 100644 --- a/devtools/client/shared/test/browser_graphs-09b.js +++ b/devtools/client/shared/test/browser_graphs-09b.js @@ -29,26 +29,26 @@ const TEST_DATA = [ ]; const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); graph.withTooltipArrows = false; graph.withFixedTooltipPositions = true; - await testGraph(graph); + yield testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } -async function testGraph(graph) { - await graph.setDataWhenReady(TEST_DATA); +function* testGraph(graph) { + yield graph.setDataWhenReady(TEST_DATA); is(graph._gutter.hidden, false, "The gutter should be visible even if the tooltips don't have arrows."); diff --git a/devtools/client/shared/test/browser_graphs-09c.js b/devtools/client/shared/test/browser_graphs-09c.js index 74c4e1fbc934..ba3d3c1c4411 100644 --- a/devtools/client/shared/test/browser_graphs-09c.js +++ b/devtools/client/shared/test/browser_graphs-09c.js @@ -8,24 +8,24 @@ const TEST_DATA = []; const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); - await testGraph(graph); + yield testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } -async function testGraph(graph) { - await graph.setDataWhenReady(TEST_DATA); +function* testGraph(graph) { + yield graph.setDataWhenReady(TEST_DATA); is(graph._gutter.hidden, true, "The gutter should be hidden, since there's no data available."); diff --git a/devtools/client/shared/test/browser_graphs-09d.js b/devtools/client/shared/test/browser_graphs-09d.js index 1109f485e6a4..7d0c01c15f68 100644 --- a/devtools/client/shared/test/browser_graphs-09d.js +++ b/devtools/client/shared/test/browser_graphs-09d.js @@ -9,24 +9,24 @@ const TEST_DATA = [{ delta: 100, value: 60 }, { delta: 200, value: 59.9 }]; const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); - await testGraph(graph); + yield testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } -async function testGraph(graph) { - await graph.setDataWhenReady(TEST_DATA); +function* testGraph(graph) { + yield graph.setDataWhenReady(TEST_DATA); is(graph._gutter.hidden, false, "The gutter should not be hidden."); diff --git a/devtools/client/shared/test/browser_graphs-09e.js b/devtools/client/shared/test/browser_graphs-09e.js index a73abe42494e..72f2f7bdd1bd 100644 --- a/devtools/client/shared/test/browser_graphs-09e.js +++ b/devtools/client/shared/test/browser_graphs-09e.js @@ -32,24 +32,24 @@ const TEST_DATA = [ const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); - await testGraph(graph); + yield testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } -async function testGraph(graph) { - await graph.setDataWhenReady(NO_DATA); +function* testGraph(graph) { + yield graph.setDataWhenReady(NO_DATA); is(graph._gutter.hidden, true, "The gutter should be hidden when there's no data available."); @@ -60,7 +60,7 @@ async function testGraph(graph) { is(graph._minTooltip.hidden, true, "The min tooltip should be hidden when there's no data available."); - await graph.setDataWhenReady(TEST_DATA); + yield graph.setDataWhenReady(TEST_DATA); is(graph._gutter.hidden, false, "The gutter should be visible now."); @@ -71,7 +71,7 @@ async function testGraph(graph) { is(graph._minTooltip.hidden, false, "The min tooltip should be visible now."); - await graph.setDataWhenReady(NO_DATA); + yield graph.setDataWhenReady(NO_DATA); is(graph._gutter.hidden, true, "The gutter should be hidden again."); diff --git a/devtools/client/shared/test/browser_graphs-09f.js b/devtools/client/shared/test/browser_graphs-09f.js index 0b32675d88dd..32b5819b2552 100644 --- a/devtools/client/shared/test/browser_graphs-09f.js +++ b/devtools/client/shared/test/browser_graphs-09f.js @@ -9,28 +9,28 @@ const TEST_DATA = [{ delta: 100, value: 60 }, { delta: 200, value: 1 }]; const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); - await testGraph(doc.body, { avg: false }); - await testGraph(doc.body, { min: false }); - await testGraph(doc.body, { max: false }); - await testGraph(doc.body, { min: false, max: false, avg: false }); - await testGraph(doc.body, {}); + yield testGraph(doc.body, { avg: false }); + yield testGraph(doc.body, { min: false }); + yield testGraph(doc.body, { max: false }); + yield testGraph(doc.body, { min: false, max: false, avg: false }); + yield testGraph(doc.body, {}); host.destroy(); } -async function testGraph(parent, options) { +function* testGraph(parent, options) { options.metric = "fps"; let graph = new LineGraphWidget(parent, options); - await graph.setDataWhenReady(TEST_DATA); + yield graph.setDataWhenReady(TEST_DATA); let shouldGutterShow = options.min === false && options.max === false; is(graph._gutter.hidden, shouldGutterShow, @@ -49,5 +49,5 @@ async function testGraph(parent, options) { is(graph._avgGutterLine.hidden, options.avg === false, `The avg gutter should ${options.avg === false ? "not " : ""}be shown`); - await graph.destroy(); + yield graph.destroy(); } diff --git a/devtools/client/shared/test/browser_graphs-10a.js b/devtools/client/shared/test/browser_graphs-10a.js index 68977970da2c..7f66156f455e 100644 --- a/devtools/client/shared/test/browser_graphs-10a.js +++ b/devtools/client/shared/test/browser_graphs-10a.js @@ -29,37 +29,37 @@ const TEST_DATA = [ ]; const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost("window"); +function* performTest() { + let [host,, doc] = yield createHost("window"); doc.body.setAttribute("style", "position: fixed; width: 100%; height: 100%; margin: 0;"); let graph = new LineGraphWidget(doc.body, "fps"); - await graph.once("ready"); + yield graph.once("ready"); let refreshCount = 0; graph.on("refresh", () => refreshCount++); - await testGraph(host, graph); + yield testGraph(host, graph); is(refreshCount, 2, "The graph should've been refreshed 2 times."); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } -async function testGraph(host, graph) { +function* testGraph(host, graph) { graph.setData(TEST_DATA); let initialBounds = host.frame.getBoundingClientRect(); host._window.resizeBy(-100, -100); - await graph.once("refresh"); + yield graph.once("refresh"); let newBounds = host.frame.getBoundingClientRect(); is(initialBounds.width - newBounds.width, 100, @@ -99,7 +99,7 @@ async function testGraph(host, graph) { "The current selection end value is correct (3)."); host._window.resizeBy(100, 100); - await graph.once("refresh"); + yield graph.once("refresh"); let newerBounds = host.frame.getBoundingClientRect(); is(initialBounds.width - newerBounds.width, 0, diff --git a/devtools/client/shared/test/browser_graphs-10b.js b/devtools/client/shared/test/browser_graphs-10b.js index 4b9428c2b1ec..a29bdfd253da 100644 --- a/devtools/client/shared/test/browser_graphs-10b.js +++ b/devtools/client/shared/test/browser_graphs-10b.js @@ -30,42 +30,42 @@ const TEST_DATA = [ ]; const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost("window"); +function* performTest() { + let [host,, doc] = yield createHost("window"); doc.body.setAttribute("style", "position: fixed; width: 100%; height: 100%; margin: 0;"); let graph = new LineGraphWidget(doc.body, "fps"); graph.fixedWidth = 200; graph.fixedHeight = 100; - await graph.once("ready"); + yield graph.once("ready"); let refreshCount = 0; let refreshCancelledCount = 0; graph.on("refresh", () => refreshCount++); graph.on("refresh-cancelled", () => refreshCancelledCount++); - await testGraph(host, graph); + yield testGraph(host, graph); is(refreshCount, 0, "The graph shouldn't have been refreshed at all."); is(refreshCancelledCount, 2, "The graph should've had 2 refresh attempts."); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } -async function testGraph(host, graph) { +function* testGraph(host, graph) { graph.setData(TEST_DATA); host._window.resizeBy(-100, -100); - await graph.once("refresh-cancelled"); + yield graph.once("refresh-cancelled"); host._window.resizeBy(100, 100); - await graph.once("refresh-cancelled"); + yield graph.once("refresh-cancelled"); } diff --git a/devtools/client/shared/test/browser_graphs-10c.js b/devtools/client/shared/test/browser_graphs-10c.js index f0188054e068..f68a3e804e5c 100644 --- a/devtools/client/shared/test/browser_graphs-10c.js +++ b/devtools/client/shared/test/browser_graphs-10c.js @@ -27,36 +27,36 @@ const TEST_DATA = [ ]; const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost("window"); +function* performTest() { + let [host,, doc] = yield createHost("window"); doc.body.setAttribute("style", "position: fixed; width: 100%; height: 100%; margin: 0;"); let graph = new LineGraphWidget(doc.body, "fps"); - await graph.once("ready"); + yield graph.once("ready"); let refreshCount = 0; graph.on("refresh", () => refreshCount++); - await testGraph(host, graph); + yield testGraph(host, graph); is(refreshCount, 2, "The graph should've been refreshed 2 times."); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } -async function testGraph(host, graph) { +function* testGraph(host, graph) { graph.setData(TEST_DATA); host._window.resizeTo(500, 500); - await graph.once("refresh"); + yield graph.once("refresh"); let oldBounds = host.frame.getBoundingClientRect(); is(graph._width, oldBounds.width * window.devicePixelRatio, @@ -75,7 +75,7 @@ async function testGraph(host, graph) { info("Making sure the selection updates when the window is resized"); host._window.resizeTo(250, 250); - await graph.once("refresh"); + yield graph.once("refresh"); let newBounds = host.frame.getBoundingClientRect(); is(graph._width, newBounds.width * window.devicePixelRatio, diff --git a/devtools/client/shared/test/browser_graphs-11a.js b/devtools/client/shared/test/browser_graphs-11a.js index 21309fe95629..27e5b292ce14 100644 --- a/devtools/client/shared/test/browser_graphs-11a.js +++ b/devtools/client/shared/test/browser_graphs-11a.js @@ -13,20 +13,20 @@ const CATEGORIES = [ { color: "#70bf53", label: "Baz" } ]; -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new BarGraphWidget(doc.body); - await graph.once("ready"); + yield graph.once("ready"); testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_graphs-11b.js b/devtools/client/shared/test/browser_graphs-11b.js index bc964b327edd..4df1c4495fa1 100644 --- a/devtools/client/shared/test/browser_graphs-11b.js +++ b/devtools/client/shared/test/browser_graphs-11b.js @@ -13,14 +13,14 @@ const CATEGORIES = [ { color: "#70bf53", label: "Baz" } ]; -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); doc.body.setAttribute("style", "position: fixed; width: 100%; height: 100%; margin: 0;"); @@ -28,14 +28,14 @@ async function performTest() { graph.fixedWidth = 200; graph.fixedHeight = 100; - await graph.once("ready"); - await testGraph(graph); + yield graph.once("ready"); + yield testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } -async function testGraph(graph) { +function* testGraph(graph) { graph.format = CATEGORIES; graph.dataOffsetX = 1000; graph.setData([{ @@ -60,19 +60,19 @@ async function testGraph(graph) { is(legendItems.length, 3, "Three legend items should exist in the entire graph."); - await testLegend(graph, 0, { + yield testLegend(graph, 0, { highlights: "[{type:0, start:34.33333333333333, end:66.66666666666666, top:85, bottom:100}, {type:0, start:67.66666666666666, end:100, top:70, bottom:100}, {type:0, start:134.33333333333331, end:166.66666666666666, top:55, bottom:100}, {type:0, start:167.66666666666666, end:200, top:55, bottom:100}]", selection: "({start:34.33333333333333, end:200})", leftmost: "({type:0, start:34.33333333333333, end:66.66666666666666, top:85, bottom:100})", rightmost: "({type:0, start:167.66666666666666, end:200, top:55, bottom:100})" }); - await testLegend(graph, 1, { + yield testLegend(graph, 1, { highlights: "[{type:1, start:0, end:33.33333333333333, top:70, bottom:100}, {type:1, start:67.66666666666666, end:100, top:54, bottom:69}, {type:1, start:101, end:133.33333333333331, top:55, bottom:100}, {type:1, start:167.66666666666666, end:200, top:24, bottom:54}]", selection: "({start:0, end:200})", leftmost: "({type:1, start:0, end:33.33333333333333, top:70, bottom:100})", rightmost: "({type:1, start:167.66666666666666, end:200, top:24, bottom:54})" }); - await testLegend(graph, 2, { + yield testLegend(graph, 2, { highlights: "[{type:2, start:0, end:33.33333333333333, top:24, bottom:69}, {type:2, start:34.33333333333333, end:66.66666666666666, top:54, bottom:84}, {type:2, start:101, end:133.33333333333331, top:39, bottom:54}, {type:2, start:134.33333333333331, end:166.66666666666666, top:24, bottom:54}]", selection: "({start:0, end:166.66666666666666})", leftmost: "({type:2, start:0, end:33.33333333333333, top:24, bottom:69})", @@ -81,7 +81,7 @@ async function testGraph(graph) { /* eslint-enable max-len */ } -async function testLegend(graph, index, { highlights, selection, leftmost, rightmost }) { +function* testLegend(graph, index, { highlights, selection, leftmost, rightmost }) { // Hover. let legendItems = graph._document.querySelectorAll(".bar-graph-widget-legend-item"); @@ -91,7 +91,7 @@ async function testLegend(graph, index, { highlights, selection, leftmost, right graph._onLegendMouseOver({ target: colorBlock }); ok(!graph.hasMask(), "The graph shouldn't get highlights immediately."); - let [type, rects] = await debounced; + let [type, rects] = yield debounced; ok(graph.hasMask(), "The graph should now have highlights."); is(type, index, @@ -105,7 +105,7 @@ async function testLegend(graph, index, { highlights, selection, leftmost, right graph._onLegendMouseOut(); ok(!graph.hasMask(), "The graph shouldn't have highlights anymore."); - await unhovered; + yield unhovered; ok(true, "The 'legend-mouseout' event was emitted."); // Select. @@ -115,7 +115,7 @@ async function testLegend(graph, index, { highlights, selection, leftmost, right ok(graph.hasSelection(), "The graph should now have a selection."); is(graph.getSelection().toSource(), selection, "The graph has a correct selection."); - let [left, right] = await selected; + let [left, right] = yield selected; is(left.toSource(), leftmost, "The correct leftmost data block was found."); is(right.toSource(), rightmost, "The correct rightmost data block was found."); diff --git a/devtools/client/shared/test/browser_graphs-12.js b/devtools/client/shared/test/browser_graphs-12.js index 80c7456d5b8c..1836d016c083 100644 --- a/devtools/client/shared/test/browser_graphs-12.js +++ b/devtools/client/shared/test/browser_graphs-12.js @@ -9,14 +9,14 @@ const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget" const BarGraphWidget = require("devtools/client/shared/widgets/BarGraphWidget"); const {CanvasGraphUtils} = require("devtools/client/shared/widgets/Graphs"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); doc.body.setAttribute("style", "position: fixed; width: 100%; height: 100%; margin: 0;"); @@ -34,13 +34,13 @@ async function performTest() { CanvasGraphUtils.linkAnimation(graph1, graph2); CanvasGraphUtils.linkSelection(graph1, graph2); - await graph1.ready(); - await graph2.ready(); + yield graph1.ready(); + yield graph2.ready(); testGraphs(graph1, graph2); - await graph1.destroy(); - await graph2.destroy(); + yield graph1.destroy(); + yield graph2.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_graphs-13.js b/devtools/client/shared/test/browser_graphs-13.js index cd02e2620bbe..d671291edd8d 100644 --- a/devtools/client/shared/test/browser_graphs-13.js +++ b/devtools/client/shared/test/browser_graphs-13.js @@ -7,14 +7,14 @@ const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); doc.body.setAttribute("style", "position: fixed; width: 100%; height: 100%; margin: 0;"); @@ -22,10 +22,10 @@ async function performTest() { graph.fixedWidth = 200; graph.fixedHeight = 100; - await graph.ready(); + yield graph.ready(); testGraph(host, graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_graphs-14.js b/devtools/client/shared/test/browser_graphs-14.js index 71b5419ee413..4001f8e6d22c 100644 --- a/devtools/client/shared/test/browser_graphs-14.js +++ b/devtools/client/shared/test/browser_graphs-14.js @@ -29,23 +29,23 @@ const TEST_DATA = [ ]; const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); - await testGraph(graph); + yield testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } -async function testGraph(graph) { +function* testGraph(graph) { let mouseDownEvents = 0; let mouseUpEvents = 0; let scrollEvents = 0; @@ -53,7 +53,7 @@ async function testGraph(graph) { graph.on("mouseup", () => mouseUpEvents++); graph.on("scroll", () => scrollEvents++); - await graph.setDataWhenReady(TEST_DATA); + yield graph.setDataWhenReady(TEST_DATA); info("Making a selection."); diff --git a/devtools/client/shared/test/browser_graphs-15.js b/devtools/client/shared/test/browser_graphs-15.js index 021fba8ce094..af2c9875eeb9 100644 --- a/devtools/client/shared/test/browser_graphs-15.js +++ b/devtools/client/shared/test/browser_graphs-15.js @@ -25,25 +25,25 @@ for (let frameRate of FRAMES) { const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget"); -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new LineGraphWidget(doc.body, "fps"); - await testGraph(graph); + yield testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } -async function testGraph(graph) { +function* testGraph(graph) { console.log("test data", TEST_DATA); - await graph.setDataFromTimestamps(TEST_DATA, INTERVAL, DURATION); + yield graph.setDataFromTimestamps(TEST_DATA, INTERVAL, DURATION); is(graph._avgTooltip.querySelector("[text=value]").textContent, "50", "The average tooltip displays the correct value."); } diff --git a/devtools/client/shared/test/browser_graphs-16.js b/devtools/client/shared/test/browser_graphs-16.js index 7e2479b2e4cf..194cb751c9d9 100644 --- a/devtools/client/shared/test/browser_graphs-16.js +++ b/devtools/client/shared/test/browser_graphs-16.js @@ -21,20 +21,20 @@ const SECTIONS = [ { color: "blue" } ]; -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host,, doc] = await createHost(); +function* performTest() { + let [host,, doc] = yield createHost(); let graph = new MountainGraphWidget(doc.body); - await graph.once("ready"); + yield graph.once("ready"); testGraph(graph); - await graph.destroy(); + yield graph.destroy(); host.destroy(); } diff --git a/devtools/client/shared/test/browser_html_tooltip-01.js b/devtools/client/shared/test/browser_html_tooltip-01.js index a6e425e7a46e..8d3c67e753ee 100644 --- a/devtools/client/shared/test/browser_html_tooltip-01.js +++ b/devtools/client/shared/test/browser_html_tooltip-01.js @@ -24,20 +24,20 @@ function getTooltipContent(doc) { return div; } -add_task(async function () { - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [,, doc] = yield createHost("bottom", TEST_URI); info("Run tests for a Tooltip without using a XUL panel"); useXulWrapper = false; - await runTests(doc); + yield runTests(doc); info("Run tests for a Tooltip with a XUL panel"); useXulWrapper = true; - await runTests(doc); + yield runTests(doc); }); -async function runTests(doc) { - await addTab("about:blank"); +function* runTests(doc) { + yield addTab("about:blank"); let tooltip = new HTMLTooltip(doc, {useXulWrapper}); info("Set tooltip content"); @@ -53,10 +53,10 @@ async function runTests(doc) { let onShown = tooltip.once("shown"); tooltip.show(doc.getElementById("box1")); - await onShown; + yield onShown; is(shown, 1, "Event shown was fired once"); - await waitForReflow(tooltip); + yield waitForReflow(tooltip); is(tooltip.isVisible(), true, "Tooltip is visible"); info("Hide the tooltip and check the expected events are fired."); @@ -67,10 +67,10 @@ async function runTests(doc) { let onPopupHidden = tooltip.once("hidden"); tooltip.hide(); - await onPopupHidden; + yield onPopupHidden; is(hidden, 1, "Event hidden was fired once"); - await waitForReflow(tooltip); + yield waitForReflow(tooltip); is(tooltip.isVisible(), false, "Tooltip is not visible"); tooltip.destroy(); diff --git a/devtools/client/shared/test/browser_html_tooltip-02.js b/devtools/client/shared/test/browser_html_tooltip-02.js index 46c5c5d83891..b4e2bb8a7f51 100644 --- a/devtools/client/shared/test/browser_html_tooltip-02.js +++ b/devtools/client/shared/test/browser_html_tooltip-02.js @@ -15,63 +15,63 @@ loadHelperScript("helper_html_tooltip.js"); let useXulWrapper; -add_task(async function () { - await addTab("about:blank"); - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + yield addTab("about:blank"); + let [,, doc] = yield createHost("bottom", TEST_URI); info("Run tests for a Tooltip without using a XUL panel"); useXulWrapper = false; - await runTests(doc); + yield runTests(doc); info("Run tests for a Tooltip with a XUL panel"); useXulWrapper = true; - await runTests(doc); + yield runTests(doc); }); -async function runTests(doc) { - await testClickInTooltipContent(doc); - await testConsumeOutsideClicksFalse(doc); - await testConsumeOutsideClicksTrue(doc); - await testConsumeWithRightClick(doc); - await testClickInOuterIframe(doc); - await testClickInInnerIframe(doc); +function* runTests(doc) { + yield testClickInTooltipContent(doc); + yield testConsumeOutsideClicksFalse(doc); + yield testConsumeOutsideClicksTrue(doc); + yield testConsumeWithRightClick(doc); + yield testClickInOuterIframe(doc); + yield testClickInInnerIframe(doc); } -async function testClickInTooltipContent(doc) { +function* testClickInTooltipContent(doc) { info("Test a tooltip is not closed when clicking inside itself"); let tooltip = new HTMLTooltip(doc, {useXulWrapper}); tooltip.setContent(getTooltipContent(doc), {width: 100, height: 50}); - await showTooltip(tooltip, doc.getElementById("box1")); + yield showTooltip(tooltip, doc.getElementById("box1")); let onTooltipContainerClick = once(tooltip.container, "click"); EventUtils.synthesizeMouseAtCenter(tooltip.container, {}, doc.defaultView); - await onTooltipContainerClick; + yield onTooltipContainerClick; is(tooltip.isVisible(), true, "Tooltip is still visible"); tooltip.destroy(); } -async function testConsumeOutsideClicksFalse(doc) { +function* testConsumeOutsideClicksFalse(doc) { info("Test closing a tooltip via click with consumeOutsideClicks: false"); let box4 = doc.getElementById("box4"); let tooltip = new HTMLTooltip(doc, {consumeOutsideClicks: false, useXulWrapper}); tooltip.setContent(getTooltipContent(doc), {width: 100, height: 50}); - await showTooltip(tooltip, doc.getElementById("box1")); + yield showTooltip(tooltip, doc.getElementById("box1")); let onBox4Clicked = once(box4, "click"); let onHidden = once(tooltip, "hidden"); EventUtils.synthesizeMouseAtCenter(box4, {}, doc.defaultView); - await onHidden; - await onBox4Clicked; + yield onHidden; + yield onBox4Clicked; is(tooltip.isVisible(), false, "Tooltip is hidden"); tooltip.destroy(); } -async function testConsumeOutsideClicksTrue(doc) { +function* testConsumeOutsideClicksTrue(doc) { info("Test closing a tooltip via click with consumeOutsideClicks: true"); let box4 = doc.getElementById("box4"); @@ -81,11 +81,11 @@ async function testConsumeOutsideClicksTrue(doc) { let tooltip = new HTMLTooltip(doc, {consumeOutsideClicks: true, useXulWrapper}); tooltip.setContent(getTooltipContent(doc), {width: 100, height: 50}); - await showTooltip(tooltip, doc.getElementById("box1")); + yield showTooltip(tooltip, doc.getElementById("box1")); let onHidden = once(tooltip, "hidden"); EventUtils.synthesizeMouseAtCenter(box4, {}, doc.defaultView); - await onHidden; + yield onHidden; is(box4clicks, 0, "box4 catched no click event"); is(tooltip.isVisible(), false, "Tooltip is hidden"); @@ -93,13 +93,13 @@ async function testConsumeOutsideClicksTrue(doc) { tooltip.destroy(); } -async function testConsumeWithRightClick(doc) { +function* testConsumeWithRightClick(doc) { info("Test closing a tooltip with a right-click, with consumeOutsideClicks: true"); let box4 = doc.getElementById("box4"); let tooltip = new HTMLTooltip(doc, {consumeOutsideClicks: true, useXulWrapper}); tooltip.setContent(getTooltipContent(doc), {width: 100, height: 50}); - await showTooltip(tooltip, doc.getElementById("box1")); + yield showTooltip(tooltip, doc.getElementById("box1")); // Only left-click events should be consumed, so we expect to catch a click when using // {button: 2}, which simulates a right-click. @@ -107,31 +107,31 @@ async function testConsumeWithRightClick(doc) { let onBox4Clicked = once(box4, "click"); let onHidden = once(tooltip, "hidden"); EventUtils.synthesizeMouseAtCenter(box4, {button: 2}, doc.defaultView); - await onHidden; - await onBox4Clicked; + yield onHidden; + yield onBox4Clicked; is(tooltip.isVisible(), false, "Tooltip is hidden"); tooltip.destroy(); } -async function testClickInOuterIframe(doc) { +function* testClickInOuterIframe(doc) { info("Test clicking an iframe outside of the tooltip closes the tooltip"); let frame = doc.getElementById("frame"); let tooltip = new HTMLTooltip(doc, {useXulWrapper}); tooltip.setContent(getTooltipContent(doc), {width: 100, height: 50}); - await showTooltip(tooltip, doc.getElementById("box1")); + yield showTooltip(tooltip, doc.getElementById("box1")); let onHidden = once(tooltip, "hidden"); EventUtils.synthesizeMouseAtCenter(frame, {}, doc.defaultView); - await onHidden; + yield onHidden; is(tooltip.isVisible(), false, "Tooltip is hidden"); tooltip.destroy(); } -async function testClickInInnerIframe(doc) { +function* testClickInInnerIframe(doc) { info("Test clicking an iframe inside the tooltip content does not close the tooltip"); let tooltip = new HTMLTooltip(doc, {consumeOutsideClicks: false, useXulWrapper}); @@ -140,11 +140,11 @@ async function testClickInInnerIframe(doc) { iframe.style.width = "100px"; iframe.style.height = "50px"; tooltip.setContent(iframe, {width: 100, height: 50}); - await showTooltip(tooltip, doc.getElementById("box1")); + yield showTooltip(tooltip, doc.getElementById("box1")); let onTooltipContainerClick = once(tooltip.container, "click"); EventUtils.synthesizeMouseAtCenter(tooltip.container, {}, doc.defaultView); - await onTooltipContainerClick; + yield onTooltipContainerClick; is(tooltip.isVisible(), true, "Tooltip is still visible"); diff --git a/devtools/client/shared/test/browser_html_tooltip-03.js b/devtools/client/shared/test/browser_html_tooltip-03.js index 29c4a7cd98ea..1d5e07b57800 100644 --- a/devtools/client/shared/test/browser_html_tooltip-03.js +++ b/devtools/client/shared/test/browser_html_tooltip-03.js @@ -16,81 +16,81 @@ loadHelperScript("helper_html_tooltip.js"); let useXulWrapper; -add_task(async function () { - await addTab("about:blank"); - let [, , doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + yield addTab("about:blank"); + let [, , doc] = yield createHost("bottom", TEST_URI); info("Run tests for a Tooltip without using a XUL panel"); useXulWrapper = false; - await runTests(doc); + yield runTests(doc); info("Run tests for a Tooltip with a XUL panel"); useXulWrapper = true; - await runTests(doc); + yield runTests(doc); }); -async function runTests(doc) { - await testNoAutoFocus(doc); - await testAutoFocus(doc); - await testAutoFocusPreservesFocusChange(doc); +function* runTests(doc) { + yield testNoAutoFocus(doc); + yield testAutoFocus(doc); + yield testAutoFocusPreservesFocusChange(doc); } -async function testNoAutoFocus(doc) { - await focusNode(doc, "#box4-input"); +function* testNoAutoFocus(doc) { + yield focusNode(doc, "#box4-input"); ok(doc.activeElement.closest("#box4-input"), "Focus is in the #box4-input"); info("Test a tooltip without autofocus will not take focus"); - let tooltip = await createTooltip(doc, false); + let tooltip = yield createTooltip(doc, false); - await showTooltip(tooltip, doc.getElementById("box1")); + yield showTooltip(tooltip, doc.getElementById("box1")); ok(doc.activeElement.closest("#box4-input"), "Focus is still in the #box4-input"); - await hideTooltip(tooltip); - await blurNode(doc, "#box4-input"); + yield hideTooltip(tooltip); + yield blurNode(doc, "#box4-input"); tooltip.destroy(); } -async function testAutoFocus(doc) { - await focusNode(doc, "#box4-input"); +function* testAutoFocus(doc) { + yield focusNode(doc, "#box4-input"); ok(doc.activeElement.closest("#box4-input"), "Focus is in the #box4-input"); info("Test autofocus tooltip takes focus when displayed, " + "and restores the focus when hidden"); - let tooltip = await createTooltip(doc, true); + let tooltip = yield createTooltip(doc, true); - await showTooltip(tooltip, doc.getElementById("box1")); + yield showTooltip(tooltip, doc.getElementById("box1")); ok(doc.activeElement.closest(".tooltip-content"), "Focus is in the tooltip"); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); ok(doc.activeElement.closest("#box4-input"), "Focus is in the #box4-input"); info("Blur the textbox before moving to the next test to reset the state."); - await blurNode(doc, "#box4-input"); + yield blurNode(doc, "#box4-input"); tooltip.destroy(); } -async function testAutoFocusPreservesFocusChange(doc) { - await focusNode(doc, "#box4-input"); +function* testAutoFocusPreservesFocusChange(doc) { + yield focusNode(doc, "#box4-input"); ok(doc.activeElement.closest("#box4-input"), "Focus is still in the #box3-input"); info("Test autofocus tooltip takes focus when displayed, " + "but does not try to restore the active element if it is not focused when hidden"); - let tooltip = await createTooltip(doc, true); + let tooltip = yield createTooltip(doc, true); - await showTooltip(tooltip, doc.getElementById("box1")); + yield showTooltip(tooltip, doc.getElementById("box1")); ok(doc.activeElement.closest(".tooltip-content"), "Focus is in the tooltip"); info("Move the focus to #box3-input while the tooltip is displayed"); - await focusNode(doc, "#box3-input"); + yield focusNode(doc, "#box3-input"); ok(doc.activeElement.closest("#box3-input"), "Focus moved to the #box3-input"); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); ok(doc.activeElement.closest("#box3-input"), "Focus is still in the #box3-input"); info("Blur the textbox before moving to the next test to reset the state."); - await blurNode(doc, "#box3-input"); + yield blurNode(doc, "#box3-input"); tooltip.destroy(); } @@ -126,7 +126,7 @@ function blurNode(doc, selector) { * @return {Promise} promise that will resolve the HTMLTooltip instance created when the * tooltip content will be ready. */ -function createTooltip(doc, autofocus) { +function* createTooltip(doc, autofocus) { let tooltip = new HTMLTooltip(doc, {autofocus, useXulWrapper}); let div = doc.createElementNS(HTML_NS, "div"); div.classList.add("tooltip-content"); diff --git a/devtools/client/shared/test/browser_html_tooltip-04.js b/devtools/client/shared/test/browser_html_tooltip-04.js index 671e1b764624..a04f0d502b13 100644 --- a/devtools/client/shared/test/browser_html_tooltip-04.js +++ b/devtools/client/shared/test/browser_html_tooltip-04.js @@ -18,12 +18,12 @@ loadHelperScript("helper_html_tooltip.js"); const TOOLTIP_HEIGHT = 30; const TOOLTIP_WIDTH = 100; -add_task(async function () { +add_task(function* () { // Force the toolbox to be 400px high; - await pushPref("devtools.toolbox.footer.height", 400); + yield pushPref("devtools.toolbox.footer.height", 400); - await addTab("about:blank"); - let [,, doc] = await createHost("bottom", TEST_URI); + yield addTab("about:blank"); + let [,, doc] = yield createHost("bottom", TEST_URI); info("Create HTML tooltip"); let tooltip = new HTMLTooltip(doc, {useXulWrapper: false}); @@ -39,56 +39,56 @@ add_task(async function () { // box1: Can only fit below box1 info("Display the tooltip on box1."); - await showTooltip(tooltip, box1); + yield showTooltip(tooltip, box1); let expectedTooltipGeometry = {position: "bottom", height, width}; checkTooltipGeometry(tooltip, box1, expectedTooltipGeometry); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); info("Try to display the tooltip on top of box1."); - await showTooltip(tooltip, box1, {position: "top"}); + yield showTooltip(tooltip, box1, {position: "top"}); expectedTooltipGeometry = {position: "bottom", height, width}; checkTooltipGeometry(tooltip, box1, expectedTooltipGeometry); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); // box2: Can fit above or below, will default to bottom, more height // available. info("Try to display the tooltip on box2."); - await showTooltip(tooltip, box2); + yield showTooltip(tooltip, box2); expectedTooltipGeometry = {position: "bottom", height, width}; checkTooltipGeometry(tooltip, box2, expectedTooltipGeometry); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); info("Try to display the tooltip on top of box2."); - await showTooltip(tooltip, box2, {position: "top"}); + yield showTooltip(tooltip, box2, {position: "top"}); expectedTooltipGeometry = {position: "top", height, width}; checkTooltipGeometry(tooltip, box2, expectedTooltipGeometry); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); // box3: Can fit above or below, will default to top, more height available. info("Try to display the tooltip on box3."); - await showTooltip(tooltip, box3); + yield showTooltip(tooltip, box3); expectedTooltipGeometry = {position: "top", height, width}; checkTooltipGeometry(tooltip, box3, expectedTooltipGeometry); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); info("Try to display the tooltip on bottom of box3."); - await showTooltip(tooltip, box3, {position: "bottom"}); + yield showTooltip(tooltip, box3, {position: "bottom"}); expectedTooltipGeometry = {position: "bottom", height, width}; checkTooltipGeometry(tooltip, box3, expectedTooltipGeometry); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); // box4: Can only fit above box4 info("Display the tooltip on box4."); - await showTooltip(tooltip, box4); + yield showTooltip(tooltip, box4); expectedTooltipGeometry = {position: "top", height, width}; checkTooltipGeometry(tooltip, box4, expectedTooltipGeometry); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); info("Try to display the tooltip on bottom of box4."); - await showTooltip(tooltip, box4, {position: "bottom"}); + yield showTooltip(tooltip, box4, {position: "bottom"}); expectedTooltipGeometry = {position: "top", height, width}; checkTooltipGeometry(tooltip, box4, expectedTooltipGeometry); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); is(tooltip.isVisible(), false, "Tooltip is not visible"); diff --git a/devtools/client/shared/test/browser_html_tooltip-05.js b/devtools/client/shared/test/browser_html_tooltip-05.js index 00d0f4ecbe36..bd5891d5b78b 100644 --- a/devtools/client/shared/test/browser_html_tooltip-05.js +++ b/devtools/client/shared/test/browser_html_tooltip-05.js @@ -18,11 +18,11 @@ loadHelperScript("helper_html_tooltip.js"); const TOOLTIP_HEIGHT = 200; const TOOLTIP_WIDTH = 200; -add_task(async function () { +add_task(function* () { // Force the toolbox to be 200px high; - await pushPref("devtools.toolbox.footer.height", 200); - await addTab("about:blank"); - let [,, doc] = await createHost("bottom", TEST_URI); + yield pushPref("devtools.toolbox.footer.height", 200); + yield addTab("about:blank"); + let [,, doc] = yield createHost("bottom", TEST_URI); info("Create HTML tooltip"); let tooltip = new HTMLTooltip(doc, {useXulWrapper: false}); @@ -39,58 +39,58 @@ add_task(async function () { // box1: Can not fit above or below box1, default to bottom with a reduced // height of 150px. info("Display the tooltip on box1."); - await showTooltip(tooltip, box1); + yield showTooltip(tooltip, box1); let expectedTooltipGeometry = {position: "bottom", height: 150, width}; checkTooltipGeometry(tooltip, box1, expectedTooltipGeometry); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); info("Try to display the tooltip on top of box1."); - await showTooltip(tooltip, box1, {position: "top"}); + yield showTooltip(tooltip, box1, {position: "top"}); expectedTooltipGeometry = {position: "bottom", height: 150, width}; checkTooltipGeometry(tooltip, box1, expectedTooltipGeometry); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); // box2: Can not fit above or below box2, default to bottom with a reduced // height of 100px. info("Try to display the tooltip on box2."); - await showTooltip(tooltip, box2); + yield showTooltip(tooltip, box2); expectedTooltipGeometry = {position: "bottom", height: 100, width}; checkTooltipGeometry(tooltip, box2, expectedTooltipGeometry); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); info("Try to display the tooltip on top of box2."); - await showTooltip(tooltip, box2, {position: "top"}); + yield showTooltip(tooltip, box2, {position: "top"}); expectedTooltipGeometry = {position: "bottom", height: 100, width}; checkTooltipGeometry(tooltip, box2, expectedTooltipGeometry); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); // box3: Can not fit above or below box3, default to top with a reduced height // of 100px. info("Try to display the tooltip on box3."); - await showTooltip(tooltip, box3); + yield showTooltip(tooltip, box3); expectedTooltipGeometry = {position: "top", height: 100, width}; checkTooltipGeometry(tooltip, box3, expectedTooltipGeometry); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); info("Try to display the tooltip on bottom of box3."); - await showTooltip(tooltip, box3, {position: "bottom"}); + yield showTooltip(tooltip, box3, {position: "bottom"}); expectedTooltipGeometry = {position: "top", height: 100, width}; checkTooltipGeometry(tooltip, box3, expectedTooltipGeometry); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); // box4: Can not fit above or below box4, default to top with a reduced height // of 150px. info("Display the tooltip on box4."); - await showTooltip(tooltip, box4); + yield showTooltip(tooltip, box4); expectedTooltipGeometry = {position: "top", height: 150, width}; checkTooltipGeometry(tooltip, box4, expectedTooltipGeometry); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); info("Try to display the tooltip on bottom of box4."); - await showTooltip(tooltip, box4, {position: "bottom"}); + yield showTooltip(tooltip, box4, {position: "bottom"}); expectedTooltipGeometry = {position: "top", height: 150, width}; checkTooltipGeometry(tooltip, box4, expectedTooltipGeometry); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); is(tooltip.isVisible(), false, "Tooltip is not visible"); diff --git a/devtools/client/shared/test/browser_html_tooltip_arrow-01.js b/devtools/client/shared/test/browser_html_tooltip_arrow-01.js index 38fd5cf56af6..9806e2be500f 100644 --- a/devtools/client/shared/test/browser_html_tooltip_arrow-01.js +++ b/devtools/client/shared/test/browser_html_tooltip_arrow-01.js @@ -17,23 +17,23 @@ loadHelperScript("helper_html_tooltip.js"); let useXulWrapper; -add_task(async function () { +add_task(function* () { // Force the toolbox to be 200px high; - await pushPref("devtools.toolbox.footer.height", 200); + yield pushPref("devtools.toolbox.footer.height", 200); - await addTab("about:blank"); - let [,, doc] = await createHost("bottom", TEST_URI); + yield addTab("about:blank"); + let [,, doc] = yield createHost("bottom", TEST_URI); info("Run tests for a Tooltip without using a XUL panel"); useXulWrapper = false; - await runTests(doc); + yield runTests(doc); info("Run tests for a Tooltip with a XUL panel"); useXulWrapper = true; - await runTests(doc); + yield runTests(doc); }); -async function runTests(doc) { +function* runTests(doc) { info("Create HTML tooltip"); let tooltip = new HTMLTooltip(doc, {type: "arrow", useXulWrapper}); let div = doc.createElementNS(HTML_NS, "div"); @@ -45,7 +45,7 @@ async function runTests(doc) { let elements = [...doc.querySelectorAll(".anchor")]; for (let el of elements) { info("Display the tooltip on an anchor."); - await showTooltip(tooltip, el); + yield showTooltip(tooltip, el); let arrow = tooltip.arrow; ok(arrow, "Tooltip has an arrow"); @@ -67,7 +67,7 @@ async function runTests(doc) { ok(isInPanel, "The tooltip arrow remains inside the tooltip panel horizontally"); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); } tooltip.destroy(); diff --git a/devtools/client/shared/test/browser_html_tooltip_arrow-02.js b/devtools/client/shared/test/browser_html_tooltip_arrow-02.js index d3261543e353..034d2fbd8cef 100644 --- a/devtools/client/shared/test/browser_html_tooltip_arrow-02.js +++ b/devtools/client/shared/test/browser_html_tooltip_arrow-02.js @@ -17,22 +17,22 @@ loadHelperScript("helper_html_tooltip.js"); let useXulWrapper; -add_task(async function () { +add_task(function* () { // Force the toolbox to be 200px high; - await pushPref("devtools.toolbox.footer.height", 200); + yield pushPref("devtools.toolbox.footer.height", 200); - let [,, doc] = await createHost("bottom", TEST_URI); + let [,, doc] = yield createHost("bottom", TEST_URI); info("Run tests for a Tooltip without using a XUL panel"); useXulWrapper = false; - await runTests(doc); + yield runTests(doc); info("Run tests for a Tooltip with a XUL panel"); useXulWrapper = true; - await runTests(doc); + yield runTests(doc); }); -async function runTests(doc) { +function* runTests(doc) { info("Create HTML tooltip"); let tooltip = new HTMLTooltip(doc, {type: "arrow", useXulWrapper}); let div = doc.createElementNS(HTML_NS, "div"); @@ -44,7 +44,7 @@ async function runTests(doc) { let elements = [...doc.querySelectorAll(".anchor")]; for (let el of elements) { info("Display the tooltip on an anchor."); - await showTooltip(tooltip, el); + yield showTooltip(tooltip, el); let arrow = tooltip.arrow; ok(arrow, "Tooltip has an arrow"); @@ -65,7 +65,7 @@ async function runTests(doc) { arrowBounds.right <= panelBounds.right; ok(isInPanel, "The tooltip arrow remains inside the tooltip panel horizontally"); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); } tooltip.destroy(); diff --git a/devtools/client/shared/test/browser_html_tooltip_consecutive-show.js b/devtools/client/shared/test/browser_html_tooltip_consecutive-show.js index 86150df1b269..ea66876117c3 100644 --- a/devtools/client/shared/test/browser_html_tooltip_consecutive-show.js +++ b/devtools/client/shared/test/browser_html_tooltip_consecutive-show.js @@ -22,8 +22,8 @@ function getTooltipContent(doc) { return div; } -add_task(async function () { - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [,, doc] = yield createHost("bottom", TEST_URI); let box1 = doc.getElementById("box1"); let box2 = doc.getElementById("box2"); @@ -54,7 +54,7 @@ add_task(async function () { checkTooltipGeometry(tooltip, box4, {position: "top", width, height}); info("Hide tooltip before leaving test"); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); tooltip.destroy(); }); diff --git a/devtools/client/shared/test/browser_html_tooltip_hover.js b/devtools/client/shared/test/browser_html_tooltip_hover.js index 67ec961bbefe..e762cba079c3 100644 --- a/devtools/client/shared/test/browser_html_tooltip_hover.js +++ b/devtools/client/shared/test/browser_html_tooltip_hover.js @@ -14,10 +14,10 @@ const TEST_URI = CHROME_URL_ROOT + "doc_html_tooltip_hover.xul"; const {HTMLTooltip} = require("devtools/client/shared/widgets/tooltip/HTMLTooltip"); loadHelperScript("helper_html_tooltip.js"); -add_task(async function () { - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [,, doc] = yield createHost("bottom", TEST_URI); // Wait for full page load before synthesizing events on the page. - await waitUntil(() => doc.readyState === "complete"); + yield waitUntil(() => doc.readyState === "complete"); let width = 100, height = 50; let tooltipContent = doc.createElementNS(HTML_NS, "div"); @@ -29,24 +29,24 @@ add_task(async function () { tooltip.startTogglingOnHover(container, () => true); info("Hover on each of the 4 boxes, expect the tooltip to appear"); - async function showAndCheck(boxId, position) { + function* showAndCheck(boxId, position) { info(`Show tooltip on ${boxId}`); let box = doc.getElementById(boxId); let shown = tooltip.once("shown"); EventUtils.synthesizeMouseAtCenter(box, { type: "mousemove" }, doc.defaultView); - await shown; + yield shown; checkTooltipGeometry(tooltip, box, {position, width, height}); } - await showAndCheck("box1", "bottom"); - await showAndCheck("box2", "bottom"); - await showAndCheck("box3", "top"); - await showAndCheck("box4", "top"); + yield showAndCheck("box1", "bottom"); + yield showAndCheck("box2", "bottom"); + yield showAndCheck("box3", "top"); + yield showAndCheck("box4", "top"); info("Move out of the container"); let hidden = tooltip.once("hidden"); EventUtils.synthesizeMouseAtCenter(container, { type: "mousemove" }, doc.defaultView); - await hidden; + yield hidden; info("Destroy the tooltip and finish"); tooltip.destroy(); diff --git a/devtools/client/shared/test/browser_html_tooltip_offset.js b/devtools/client/shared/test/browser_html_tooltip_offset.js index da2aa6c6834c..1ca0b1ee47a0 100644 --- a/devtools/client/shared/test/browser_html_tooltip_offset.js +++ b/devtools/client/shared/test/browser_html_tooltip_offset.js @@ -13,11 +13,11 @@ const TEST_URI = CHROME_URL_ROOT + "doc_html_tooltip.xul"; const {HTMLTooltip} = require("devtools/client/shared/widgets/tooltip/HTMLTooltip"); loadHelperScript("helper_html_tooltip.js"); -add_task(async function () { +add_task(function* () { // Force the toolbox to be 200px high; - await pushPref("devtools.toolbox.footer.height", 200); + yield pushPref("devtools.toolbox.footer.height", 200); - let [,, doc] = await createHost("bottom", TEST_URI); + let [,, doc] = yield createHost("bottom", TEST_URI); info("Test a tooltip is not closed when clicking inside itself"); @@ -35,7 +35,7 @@ add_task(async function () { tooltip.setContent(div, {width: 50, height: 100}); info("Display the tooltip on box1."); - await showTooltip(tooltip, box1, {x: 5, y: 10}); + yield showTooltip(tooltip, box1, {x: 5, y: 10}); let panelRect = tooltip.container.getBoundingClientRect(); let anchorRect = box1.getBoundingClientRect(); @@ -46,7 +46,7 @@ add_task(async function () { is(panelRect.height, 100, "Tooltip height is at 100px as expected"); info("Display the tooltip on box2."); - await showTooltip(tooltip, box2, {x: 5, y: 10}); + yield showTooltip(tooltip, box2, {x: 5, y: 10}); panelRect = tooltip.container.getBoundingClientRect(); anchorRect = box2.getBoundingClientRect(); @@ -58,7 +58,7 @@ add_task(async function () { is(panelRect.height, 90, "Tooltip height is only 90px"); info("Display the tooltip on box3."); - await showTooltip(tooltip, box3, {x: 5, y: 10}); + yield showTooltip(tooltip, box3, {x: 5, y: 10}); panelRect = tooltip.container.getBoundingClientRect(); anchorRect = box3.getBoundingClientRect(); @@ -70,7 +70,7 @@ add_task(async function () { is(panelRect.height, 90, "Tooltip height is only 90px"); info("Display the tooltip on box4."); - await showTooltip(tooltip, box4, {x: 5, y: 10}); + yield showTooltip(tooltip, box4, {x: 5, y: 10}); panelRect = tooltip.container.getBoundingClientRect(); anchorRect = box4.getBoundingClientRect(); @@ -80,7 +80,7 @@ add_task(async function () { is(panelRect.left, anchorRect.left + 5, "Tooltip left has 5px offset"); is(panelRect.height, 100, "Tooltip height is at 100px as expected"); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); tooltip.destroy(); }); diff --git a/devtools/client/shared/test/browser_html_tooltip_rtl.js b/devtools/client/shared/test/browser_html_tooltip_rtl.js index 85aca5c6fc4f..2b9c78b69aed 100644 --- a/devtools/client/shared/test/browser_html_tooltip_rtl.js +++ b/devtools/client/shared/test/browser_html_tooltip_rtl.js @@ -19,11 +19,11 @@ const TOOLBOX_WIDTH = 500; const TOOLTIP_WIDTH = 150; const TOOLTIP_HEIGHT = 30; -add_task(async function () { +add_task(function* () { // Force the toolbox to be 500px wide (min width is 465px); - await pushPref("devtools.toolbox.sidebar.width", TOOLBOX_WIDTH); + yield pushPref("devtools.toolbox.sidebar.width", TOOLBOX_WIDTH); - let [,, doc] = await createHost("side", TEST_URI); + let [,, doc] = yield createHost("side", TEST_URI); info("Test a tooltip is not closed when clicking inside itself"); @@ -33,14 +33,14 @@ add_task(async function () { div.style.cssText = "box-sizing: border-box; border: 1px solid black"; tooltip.setContent(div, {width: TOOLTIP_WIDTH, height: TOOLTIP_HEIGHT}); - await testRtlAnchors(doc, tooltip); - await testLtrAnchors(doc, tooltip); - await hideTooltip(tooltip); + yield testRtlAnchors(doc, tooltip); + yield testLtrAnchors(doc, tooltip); + yield hideTooltip(tooltip); tooltip.destroy(); }); -async function testRtlAnchors(doc, tooltip) { +function* testRtlAnchors(doc, tooltip) { /* * The layout of the test page is as follows: * _______________________________ @@ -60,7 +60,7 @@ async function testRtlAnchors(doc, tooltip) { let box2 = doc.getElementById("box2"); info("Display the tooltip on box1."); - await showTooltip(tooltip, box1, {position: "bottom"}); + yield showTooltip(tooltip, box1, {position: "bottom"}); let panelRect = tooltip.container.getBoundingClientRect(); let anchorRect = box1.getBoundingClientRect(); @@ -72,7 +72,7 @@ async function testRtlAnchors(doc, tooltip) { is(panelRect.height, TOOLTIP_HEIGHT, "Tooltip height is at 100px as expected"); info("Display the tooltip on box2."); - await showTooltip(tooltip, box2, {position: "bottom"}); + yield showTooltip(tooltip, box2, {position: "bottom"}); panelRect = tooltip.container.getBoundingClientRect(); anchorRect = box2.getBoundingClientRect(); @@ -83,7 +83,7 @@ async function testRtlAnchors(doc, tooltip) { is(panelRect.height, TOOLTIP_HEIGHT, "Tooltip height is at 100px as expected"); } -async function testLtrAnchors(doc, tooltip) { +function* testLtrAnchors(doc, tooltip) { /* * The layout of the test page is as follows: * _______________________________ @@ -103,7 +103,7 @@ async function testLtrAnchors(doc, tooltip) { let box4 = doc.getElementById("box4"); info("Display the tooltip on box3."); - await showTooltip(tooltip, box3, {position: "bottom"}); + yield showTooltip(tooltip, box3, {position: "bottom"}); let panelRect = tooltip.container.getBoundingClientRect(); let anchorRect = box3.getBoundingClientRect(); @@ -114,7 +114,7 @@ async function testLtrAnchors(doc, tooltip) { is(panelRect.height, TOOLTIP_HEIGHT, "Tooltip height is at 100px as expected"); info("Display the tooltip on box4."); - await showTooltip(tooltip, box4, {position: "bottom"}); + yield showTooltip(tooltip, box4, {position: "bottom"}); panelRect = tooltip.container.getBoundingClientRect(); anchorRect = box4.getBoundingClientRect(); diff --git a/devtools/client/shared/test/browser_html_tooltip_variable-height.js b/devtools/client/shared/test/browser_html_tooltip_variable-height.js index 44a3c915613b..8f0b369d6690 100644 --- a/devtools/client/shared/test/browser_html_tooltip_variable-height.js +++ b/devtools/client/shared/test/browser_html_tooltip_variable-height.js @@ -18,12 +18,12 @@ const TOOLTIP_HEIGHT = 50; const {HTMLTooltip} = require("devtools/client/shared/widgets/tooltip/HTMLTooltip"); loadHelperScript("helper_html_tooltip.js"); -add_task(async function () { +add_task(function* () { // Force the toolbox to be 400px tall => 50px for each box. - await pushPref("devtools.toolbox.footer.height", 400); + yield pushPref("devtools.toolbox.footer.height", 400); - await addTab("about:blank"); - let [,, doc] = await createHost("bottom", TEST_URI); + yield addTab("about:blank"); + let [,, doc] = yield createHost("bottom", TEST_URI); let tooltip = new HTMLTooltip(doc, {useXulWrapper: false}); info("Set tooltip content 50px tall, but request a container 200px tall"); @@ -32,7 +32,7 @@ add_task(async function () { tooltip.setContent(tooltipContent, {width: CONTAINER_WIDTH, height: Infinity}); info("Show the tooltip and check the container and panel height."); - await showTooltip(tooltip, doc.getElementById("box1")); + yield showTooltip(tooltip, doc.getElementById("box1")); let containerRect = tooltip.container.getBoundingClientRect(); let panelRect = tooltip.panel.getBoundingClientRect(); @@ -43,22 +43,22 @@ add_task(async function () { info("Click below the tooltip panel but in the tooltip filler element."); let onHidden = once(tooltip, "hidden"); EventUtils.synthesizeMouse(tooltip.container, 100, 100, {}, doc.defaultView); - await onHidden; + yield onHidden; info("Show the tooltip one more time, and increase the content height"); - await showTooltip(tooltip, doc.getElementById("box1")); + yield showTooltip(tooltip, doc.getElementById("box1")); tooltipContent.style.height = (2 * CONTAINER_HEIGHT) + "px"; info("Click at the same coordinates as earlier, this time it should hit the tooltip."); let onPanelClick = once(tooltip.panel, "click"); EventUtils.synthesizeMouse(tooltip.container, 100, 100, {}, doc.defaultView); - await onPanelClick; + yield onPanelClick; is(tooltip.isVisible(), true, "Tooltip is still visible"); info("Click above the tooltip container, the tooltip should be closed."); onHidden = once(tooltip, "hidden"); EventUtils.synthesizeMouse(tooltip.container, 100, -10, {}, doc.defaultView); - await onHidden; + yield onHidden; tooltip.destroy(); }); diff --git a/devtools/client/shared/test/browser_html_tooltip_width-auto.js b/devtools/client/shared/test/browser_html_tooltip_width-auto.js index 76607b5b3599..9ac3705338e0 100644 --- a/devtools/client/shared/test/browser_html_tooltip_width-auto.js +++ b/devtools/client/shared/test/browser_html_tooltip_width-auto.js @@ -16,20 +16,20 @@ loadHelperScript("helper_html_tooltip.js"); let useXulWrapper; -add_task(async function () { - await addTab("about:blank"); - let [,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + yield addTab("about:blank"); + let [,, doc] = yield createHost("bottom", TEST_URI); info("Run tests for a Tooltip without using a XUL panel"); useXulWrapper = false; - await runTests(doc); + yield runTests(doc); info("Run tests for a Tooltip with a XUL panel"); useXulWrapper = true; - await runTests(doc); + yield runTests(doc); }); -async function runTests(doc) { +function* runTests(doc) { let tooltip = new HTMLTooltip(doc, {useXulWrapper}); info("Create tooltip content width to 150px"); let tooltipContent = doc.createElementNS(HTML_NS, "div"); @@ -39,12 +39,12 @@ async function runTests(doc) { tooltip.setContent(tooltipContent, {width: "auto", height: 50}); info("Show the tooltip and check the tooltip panel width."); - await showTooltip(tooltip, doc.getElementById("box1")); + yield showTooltip(tooltip, doc.getElementById("box1")); let panelRect = tooltip.panel.getBoundingClientRect(); is(panelRect.width, 150, "Tooltip panel has the expected width."); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); tooltip.destroy(); } diff --git a/devtools/client/shared/test/browser_html_tooltip_xul-wrapper.js b/devtools/client/shared/test/browser_html_tooltip_xul-wrapper.js index 652a2b61d501..31180ee1a16d 100644 --- a/devtools/client/shared/test/browser_html_tooltip_xul-wrapper.js +++ b/devtools/client/shared/test/browser_html_tooltip_xul-wrapper.js @@ -20,11 +20,11 @@ loadHelperScript("helper_html_tooltip.js"); const TOOLTIP_HEIGHT = 160; const TOOLTIP_WIDTH = 200; -add_task(async function () { +add_task(function* () { // Force the toolbox to be 200px high; - await pushPref("devtools.toolbox.footer.height", 200); + yield pushPref("devtools.toolbox.footer.height", 200); - let [, win, doc] = await createHost("bottom", TEST_URI); + let [, win, doc] = yield createHost("bottom", TEST_URI); info("Resize and move the window to have space below."); let originalWidth = win.top.outerWidth; @@ -51,15 +51,15 @@ add_task(async function () { // Above box1: check that the tooltip can overflow onto the content page. info("Display the tooltip above box1."); - await showTooltip(tooltip, box1, {position: "top"}); + yield showTooltip(tooltip, box1, {position: "top"}); checkTooltip(tooltip, "top", TOOLTIP_HEIGHT); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); // Below box1: check that the tooltip can overflow out of the browser window. info("Display the tooltip below box1."); - await showTooltip(tooltip, box1, {position: "bottom"}); + yield showTooltip(tooltip, box1, {position: "bottom"}); checkTooltip(tooltip, "bottom", TOOLTIP_HEIGHT); - await hideTooltip(tooltip); + yield hideTooltip(tooltip); is(tooltip.isVisible(), false, "Tooltip is not visible"); diff --git a/devtools/client/shared/test/browser_inplace-editor-01.js b/devtools/client/shared/test/browser_inplace-editor-01.js index 35cc7af2736e..4eb4aa0af1f2 100644 --- a/devtools/client/shared/test/browser_inplace-editor-01.js +++ b/devtools/client/shared/test/browser_inplace-editor-01.js @@ -9,16 +9,16 @@ loadHelperScript("helper_inplace_editor.js"); // Test the inplace-editor behavior. -add_task(async function () { - await addTab("data:text/html;charset=utf-8,inline editor tests"); - let [host, , doc] = await createHost(); +add_task(function* () { + yield addTab("data:text/html;charset=utf-8,inline editor tests"); + let [host, , doc] = yield createHost(); - await testMultipleInitialization(doc); - await testReturnCommit(doc); - await testBlurCommit(doc); - await testAdvanceCharCommit(doc); - await testAdvanceCharsFunction(doc); - await testEscapeCancel(doc); + yield testMultipleInitialization(doc); + yield testReturnCommit(doc); + yield testBlurCommit(doc); + yield testAdvanceCharCommit(doc); + yield testAdvanceCharsFunction(doc); + yield testEscapeCancel(doc); host.destroy(); gBrowser.removeCurrentTab(); diff --git a/devtools/client/shared/test/browser_inplace-editor-02.js b/devtools/client/shared/test/browser_inplace-editor-02.js index b0f45fa94129..811c30123419 100644 --- a/devtools/client/shared/test/browser_inplace-editor-02.js +++ b/devtools/client/shared/test/browser_inplace-editor-02.js @@ -9,12 +9,12 @@ loadHelperScript("helper_inplace_editor.js"); // Test that the trimOutput option for the inplace editor works correctly. -add_task(async function () { - await addTab("data:text/html;charset=utf-8,inline editor tests"); - let [host, , doc] = await createHost(); +add_task(function* () { + yield addTab("data:text/html;charset=utf-8,inline editor tests"); + let [host, , doc] = yield createHost(); - await testNonTrimmed(doc); - await testTrimmed(doc); + yield testNonTrimmed(doc); + yield testTrimmed(doc); host.destroy(); gBrowser.removeCurrentTab(); diff --git a/devtools/client/shared/test/browser_inplace-editor_autocomplete_01.js b/devtools/client/shared/test/browser_inplace-editor_autocomplete_01.js index 158e480cf835..f8c8d88f0bf7 100644 --- a/devtools/client/shared/test/browser_inplace-editor_autocomplete_01.js +++ b/devtools/client/shared/test/browser_inplace-editor_autocomplete_01.js @@ -42,14 +42,14 @@ const mockGetCSSPropertyList = function () { ]; }; -add_task(async function () { - await addTab("data:text/html;charset=utf-8," + +add_task(function* () { + yield addTab("data:text/html;charset=utf-8," + "inplace editor CSS property autocomplete"); - let [host, win, doc] = await createHost(); + let [host, win, doc] = yield createHost(); let xulDocument = win.top.document; let popup = new AutocompletePopup(xulDocument, { autoSelect: true }); - await new Promise(resolve => { + yield new Promise(resolve => { createInplaceEditorAndClick({ start: runPropertyAutocompletionTest, contentType: InplaceEditor.CONTENT_TYPES.CSS_PROPERTY, @@ -63,13 +63,13 @@ add_task(async function () { gBrowser.removeCurrentTab(); }); -let runPropertyAutocompletionTest = async function (editor) { +let runPropertyAutocompletionTest = Task.async(function* (editor) { info("Starting to test for css property completion"); editor._getCSSPropertyList = mockGetCSSPropertyList; for (let data of testData) { - await testCompletion(data, editor); + yield testCompletion(data, editor); } EventUtils.synthesizeKey("VK_RETURN", {}, editor.input.defaultView); -}; +}); diff --git a/devtools/client/shared/test/browser_inplace-editor_autocomplete_02.js b/devtools/client/shared/test/browser_inplace-editor_autocomplete_02.js index 810aff642795..4f40d0c2be95 100644 --- a/devtools/client/shared/test/browser_inplace-editor_autocomplete_02.js +++ b/devtools/client/shared/test/browser_inplace-editor_autocomplete_02.js @@ -43,15 +43,15 @@ const mockGetCSSValuesForPropertyName = function (propertyName) { return values[propertyName] || []; }; -add_task(async function () { - await addTab("data:text/html;charset=utf-8," + +add_task(function* () { + yield addTab("data:text/html;charset=utf-8," + "inplace editor CSS value autocomplete"); - let [host, win, doc] = await createHost(); + let [host, win, doc] = yield createHost(); let xulDocument = win.top.document; let popup = new AutocompletePopup(xulDocument, { autoSelect: true }); - await new Promise(resolve => { + yield new Promise(resolve => { createInplaceEditorAndClick({ start: runAutocompletionTest, contentType: InplaceEditor.CONTENT_TYPES.CSS_VALUE, @@ -68,13 +68,13 @@ add_task(async function () { gBrowser.removeCurrentTab(); }); -let runAutocompletionTest = async function (editor) { +let runAutocompletionTest = Task.async(function* (editor) { info("Starting to test for css property completion"); editor._getCSSValuesForPropertyName = mockGetCSSValuesForPropertyName; for (let data of testData) { - await testCompletion(data, editor); + yield testCompletion(data, editor); } EventUtils.synthesizeKey("VK_RETURN", {}, editor.input.defaultView); -}; +}); diff --git a/devtools/client/shared/test/browser_inplace-editor_autocomplete_css_variable.js b/devtools/client/shared/test/browser_inplace-editor_autocomplete_css_variable.js index 91c48894f66e..56231588d9d9 100644 --- a/devtools/client/shared/test/browser_inplace-editor_autocomplete_css_variable.js +++ b/devtools/client/shared/test/browser_inplace-editor_autocomplete_css_variable.js @@ -46,15 +46,15 @@ const mockGetCSSVariableNames = function () { ]; }; -add_task(async function () { - await addTab("data:text/html;charset=utf-8," + +add_task(function* () { + yield addTab("data:text/html;charset=utf-8," + "inplace editor CSS variable autocomplete"); - let [host, win, doc] = await createHost(); + let [host, win, doc] = yield createHost(); let xulDocument = win.top.document; let popup = new AutocompletePopup(xulDocument, { autoSelect: true }); - await new Promise(resolve => { + yield new Promise(resolve => { createInplaceEditorAndClick({ start: runAutocompletionTest, contentType: InplaceEditor.CONTENT_TYPES.CSS_VALUE, @@ -71,14 +71,14 @@ add_task(async function () { gBrowser.removeCurrentTab(); }); -let runAutocompletionTest = async function (editor) { +let runAutocompletionTest = Task.async(function* (editor) { info("Starting to test for css variable completion"); editor._getCSSValuesForPropertyName = mockGetCSSValuesForPropertyName; editor._getCSSVariableNames = mockGetCSSVariableNames; for (let data of testData) { - await testCompletion(data, editor); + yield testCompletion(data, editor); } EventUtils.synthesizeKey("VK_RETURN", {}, editor.input.defaultView); -}; +}); diff --git a/devtools/client/shared/test/browser_inplace-editor_autocomplete_offset.js b/devtools/client/shared/test/browser_inplace-editor_autocomplete_offset.js index 1601772786af..9f7cc652675c 100644 --- a/devtools/client/shared/test/browser_inplace-editor_autocomplete_offset.js +++ b/devtools/client/shared/test/browser_inplace-editor_autocomplete_offset.js @@ -59,14 +59,14 @@ const mockGetCSSValuesForPropertyName = function (propertyName) { return values[propertyName] || []; }; -add_task(async function () { - await addTab("data:text/html;charset=utf-8,inplace editor CSS value autocomplete"); - let [host,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + yield addTab("data:text/html;charset=utf-8,inplace editor CSS value autocomplete"); + let [host,, doc] = yield createHost("bottom", TEST_URI); let popup = new AutocompletePopup(doc, { autoSelect: true }); info("Create a CSS_MIXED type autocomplete"); - await new Promise(resolve => { + yield new Promise(resolve => { createInplaceEditorAndClick({ initial: "style=", start: runAutocompletionTest, @@ -81,7 +81,7 @@ add_task(async function () { gBrowser.removeCurrentTab(); }); -let runAutocompletionTest = async function (editor) { +let runAutocompletionTest = Task.async(function* (editor) { info("Starting autocomplete test for inplace-editor popup offset"); editor._getCSSPropertyList = mockGetCSSPropertyList; editor._getCSSValuesForPropertyName = mockGetCSSValuesForPropertyName; @@ -97,12 +97,12 @@ let runAutocompletionTest = async function (editor) { ok(offset > previousOffset, "New popup offset is greater than the previous one"); previousOffset = offset; } else { - await testCompletion(data, editor); + yield testCompletion(data, editor); } } EventUtils.synthesizeKey("VK_RETURN", {}, editor.input.defaultView); -}; +}); /** * Get the autocomplete panel left offset, relative to the provided input's left offset. diff --git a/devtools/client/shared/test/browser_inplace-editor_maxwidth.js b/devtools/client/shared/test/browser_inplace-editor_maxwidth.js index 634f3d23a045..887ac10aaeed 100644 --- a/devtools/client/shared/test/browser_inplace-editor_maxwidth.js +++ b/devtools/client/shared/test/browser_inplace-editor_maxwidth.js @@ -15,12 +15,12 @@ const LONG_TEXT = "I am a long text and I will not fit in a 300px container. " + // Test the inplace-editor behavior with a maxWidth configuration option // defined. -add_task(async function () { - await addTab("data:text/html;charset=utf-8,inplace editor max width tests"); - let [host, , doc] = await createHost(); +add_task(function* () { + yield addTab("data:text/html;charset=utf-8,inplace editor max width tests"); + let [host, , doc] = yield createHost(); info("Testing the maxWidth option in pixels, to precisely check the size"); - await new Promise(resolve => { + yield new Promise(resolve => { createInplaceEditorAndClick({ multiline: true, maxWidth: MAX_WIDTH, @@ -33,7 +33,7 @@ add_task(async function () { gBrowser.removeCurrentTab(); }); -let testMaxWidth = async function (editor) { +let testMaxWidth = Task.async(function* (editor) { is(editor.input.value, START_TEXT, "Span text content should be used"); ok(editor.input.offsetWidth < MAX_WIDTH, "Input width should be strictly smaller than MAX_WIDTH"); @@ -86,7 +86,7 @@ let testMaxWidth = async function (editor) { info("Leave the inplace-editor"); EventUtils.sendKey("RETURN"); -}; +}); /** * Retrieve the current number of lines displayed in the provided textarea. diff --git a/devtools/client/shared/test/browser_key_shortcuts.js b/devtools/client/shared/test/browser_key_shortcuts.js index e88b68e3ec45..61cb62597f62 100644 --- a/devtools/client/shared/test/browser_key_shortcuts.js +++ b/devtools/client/shared/test/browser_key_shortcuts.js @@ -5,28 +5,28 @@ var isOSX = Services.appinfo.OS === "Darwin"; -add_task(async function () { +add_task(function* () { let shortcuts = new KeyShortcuts({ window }); - await testSimple(shortcuts); - await testNonLetterCharacter(shortcuts); - await testPlusCharacter(shortcuts); - await testFunctionKey(shortcuts); - await testMixup(shortcuts); - await testLooseDigits(shortcuts); - await testExactModifiers(shortcuts); - await testLooseShiftModifier(shortcuts); - await testStrictLetterShiftModifier(shortcuts); - await testAltModifier(shortcuts); - await testCommandOrControlModifier(shortcuts); - await testCtrlModifier(shortcuts); - await testInvalidShortcutString(shortcuts); - await testCmdShiftShortcut(shortcuts); + yield testSimple(shortcuts); + yield testNonLetterCharacter(shortcuts); + yield testPlusCharacter(shortcuts); + yield testFunctionKey(shortcuts); + yield testMixup(shortcuts); + yield testLooseDigits(shortcuts); + yield testExactModifiers(shortcuts); + yield testLooseShiftModifier(shortcuts); + yield testStrictLetterShiftModifier(shortcuts); + yield testAltModifier(shortcuts); + yield testCommandOrControlModifier(shortcuts); + yield testCtrlModifier(shortcuts); + yield testInvalidShortcutString(shortcuts); + yield testCmdShiftShortcut(shortcuts); shortcuts.destroy(); - await testTarget(); + yield testTarget(); }); // Test helper to listen to the next key press for a given key, @@ -45,7 +45,7 @@ function once(shortcuts, key, listener) { }); } -async function testSimple(shortcuts) { +function* testSimple(shortcuts) { info("Test simple key shortcuts"); let onKey = once(shortcuts, "0", event => { @@ -56,10 +56,10 @@ async function testSimple(shortcuts) { }); EventUtils.synthesizeKey("0", {}, window); - await onKey; + yield onKey; } -async function testNonLetterCharacter(shortcuts) { +function* testNonLetterCharacter(shortcuts) { info("Test non-naive character key shortcuts"); let onKey = once(shortcuts, "[", event => { @@ -67,10 +67,10 @@ async function testNonLetterCharacter(shortcuts) { }); EventUtils.synthesizeKey("[", {}, window); - await onKey; + yield onKey; } -async function testFunctionKey(shortcuts) { +function* testFunctionKey(shortcuts) { info("Test function key shortcuts"); let onKey = once(shortcuts, "F12", event => { @@ -78,13 +78,13 @@ async function testFunctionKey(shortcuts) { }); EventUtils.synthesizeKey("F12", { keyCode: 123 }, window); - await onKey; + yield onKey; } // Plus is special. It's keycode is the one for "=". That's because it requires // shift to be pressed and is behind "=" key. So it should be considered as a // character key -async function testPlusCharacter(shortcuts) { +function* testPlusCharacter(shortcuts) { info("Test 'Plus' key shortcuts"); let onKey = once(shortcuts, "Plus", event => { @@ -92,11 +92,11 @@ async function testPlusCharacter(shortcuts) { }); EventUtils.synthesizeKey("+", { keyCode: 61, shiftKey: true }, window); - await onKey; + yield onKey; } // Test they listeners are not mixed up between shortcuts -async function testMixup(shortcuts) { +function* testMixup(shortcuts) { info("Test possible listener mixup"); let hitFirst = false, hitSecond = false; @@ -113,25 +113,25 @@ async function testMixup(shortcuts) { // Dispatch the first shortcut and expect only this one to be notified ok(!hitFirst, "First shortcut isn't notified before firing the key event"); EventUtils.synthesizeKey("0", {}, window); - await onFirstKey; + yield onFirstKey; ok(hitFirst, "Got the first shortcut notified"); ok(!hitSecond, "No mixup, second shortcut is still not notified (1/2)"); // Wait an extra time, just to be sure this isn't racy - await new Promise(done => { + yield new Promise(done => { window.setTimeout(done, 0); }); ok(!hitSecond, "No mixup, second shortcut is still not notified (2/2)"); // Finally dispatch the second shortcut EventUtils.synthesizeKey("a", { altKey: true }, window); - await onSecondKey; + yield onSecondKey; ok(hitSecond, "Got the second shortcut notified once it is actually fired"); } // On azerty keyboard, digits are only available by pressing Shift/Capslock, // but we accept them even if we omit doing that. -async function testLooseDigits(shortcuts) { +function* testLooseDigits(shortcuts) { info("Test Loose digits"); let onKey = once(shortcuts, "0", event => { is(event.key, "à"); @@ -146,7 +146,7 @@ async function testLooseDigits(shortcuts) { "à", { keyCode: 48 }, window); - await onKey; + yield onKey; onKey = once(shortcuts, "0", event => { is(event.key, "0"); @@ -160,11 +160,11 @@ async function testLooseDigits(shortcuts) { "0", { keyCode: 48, shiftKey: true }, window); - await onKey; + yield onKey; } // Test that shortcuts is notified only when the modifiers match exactly -async function testExactModifiers(shortcuts) { +function* testExactModifiers(shortcuts) { info("Test exact modifiers match"); let hit = false; @@ -196,7 +196,7 @@ async function testExactModifiers(shortcuts) { window); // Wait an extra time to let a chance to call the listener - await new Promise(done => { + yield new Promise(done => { window.setTimeout(done, 0); }); ok(!hit, "Listener isn't called when modifiers aren't exactly matching"); @@ -204,7 +204,7 @@ async function testExactModifiers(shortcuts) { // Dispatch the expected modifiers EventUtils.synthesizeKey("a", { accelKey: false, altKey: true, shiftKey: false}, window); - await onKey; + yield onKey; ok(hit, "Got shortcut notified once it is actually fired"); } @@ -212,7 +212,7 @@ async function testExactModifiers(shortcuts) { // even if the key didn't explicitely requested Shift modifier. // For example, `%` on french keyboards is only accessible via Shift. // Same thing for `@` on US keybords. -async function testLooseShiftModifier(shortcuts) { +function* testLooseShiftModifier(shortcuts) { info("Test Loose shift modifier"); let onKey = once(shortcuts, "%", event => { is(event.key, "%"); @@ -225,7 +225,7 @@ async function testLooseShiftModifier(shortcuts) { "%", { accelKey: false, altKey: false, ctrlKey: false, shiftKey: true}, window); - await onKey; + yield onKey; onKey = once(shortcuts, "@", event => { is(event.key, "@"); @@ -238,11 +238,11 @@ async function testLooseShiftModifier(shortcuts) { "@", { accelKey: false, altKey: false, ctrlKey: false, shiftKey: true}, window); - await onKey; + yield onKey; } // But Shift modifier is strict on all letter characters (a to Z) -async function testStrictLetterShiftModifier(shortcuts) { +function* testStrictLetterShiftModifier(shortcuts) { info("Test strict shift modifier on letters"); let hitFirst = false; let onKey = once(shortcuts, "a", event => { @@ -264,17 +264,17 @@ async function testStrictLetterShiftModifier(shortcuts) { "a", { shiftKey: true}, window); - await onShiftKey; + yield onShiftKey; ok(!hitFirst, "Didn't fire the explicit shift+a"); EventUtils.synthesizeKey( "a", { shiftKey: false}, window); - await onKey; + yield onKey; } -async function testAltModifier(shortcuts) { +function* testAltModifier(shortcuts) { info("Test Alt modifier"); let onKey = once(shortcuts, "Alt+F1", event => { is(event.keyCode, window.KeyboardEvent.DOM_VK_F1); @@ -287,10 +287,10 @@ async function testAltModifier(shortcuts) { "VK_F1", { altKey: true }, window); - await onKey; + yield onKey; } -async function testCommandOrControlModifier(shortcuts) { +function* testCommandOrControlModifier(shortcuts) { info("Test CommandOrControl modifier"); let onKey = once(shortcuts, "CommandOrControl+F1", event => { is(event.keyCode, window.KeyboardEvent.DOM_VK_F1); @@ -327,11 +327,11 @@ async function testCommandOrControlModifier(shortcuts) { { ctrlKey: true }, window); } - await onKey; - await onKeyAlias; + yield onKey; + yield onKeyAlias; } -async function testCtrlModifier(shortcuts) { +function* testCtrlModifier(shortcuts) { info("Test Ctrl modifier"); let onKey = once(shortcuts, "Ctrl+F1", event => { is(event.keyCode, window.KeyboardEvent.DOM_VK_F1); @@ -351,11 +351,11 @@ async function testCtrlModifier(shortcuts) { "VK_F1", { ctrlKey: true }, window); - await onKey; - await onKeyAlias; + yield onKey; + yield onKeyAlias; } -async function testCmdShiftShortcut(shortcuts) { +function* testCmdShiftShortcut(shortcuts) { if (!isOSX) { // This test is OSX only (Bug 1300458). return; @@ -385,11 +385,11 @@ async function testCmdShiftShortcut(shortcuts) { { metaKey: true }, window); - await onCmdKey; - await onCmdShiftKey; + yield onCmdKey; + yield onCmdShiftKey; } -async function testTarget() { +function* testTarget() { info("Test KeyShortcuts with target argument"); let target = document.createElementNS("http://www.w3.org/1999/xhtml", @@ -406,7 +406,7 @@ async function testTarget() { is(event.target, target); }); EventUtils.synthesizeKey("0", {}, window); - await onKey; + yield onKey; target.remove(); diff --git a/devtools/client/shared/test/browser_layoutHelpers.js b/devtools/client/shared/test/browser_layoutHelpers.js index b9031f2d2eff..a13f1ee6fd50 100644 --- a/devtools/client/shared/test/browser_layoutHelpers.js +++ b/devtools/client/shared/test/browser_layoutHelpers.js @@ -8,8 +8,8 @@ const {scrollIntoViewIfNeeded} = require("devtools/client/shared/scroll"); const TEST_URI = TEST_URI_ROOT + "doc_layoutHelpers.html"; -add_task(async function () { - let [host, win] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [host, win] = yield createHost("bottom", TEST_URI); runTest(win); host.destroy(); }); diff --git a/devtools/client/shared/test/browser_options-view-01.js b/devtools/client/shared/test/browser_options-view-01.js index c27c46706483..0ce4119b7af7 100644 --- a/devtools/client/shared/test/browser_options-view-01.js +++ b/devtools/client/shared/test/browser_options-view-01.js @@ -14,16 +14,16 @@ const PRETTY_PRINT_PREF = "auto-pretty-print"; const originalBlackBox = Services.prefs.getBoolPref(BRANCH + BLACK_BOX_PREF); const originalPrettyPrint = Services.prefs.getBoolPref(BRANCH + PRETTY_PRINT_PREF); -add_task(async function () { +add_task(function* () { info("Setting a couple of preferences"); Services.prefs.setBoolPref(BRANCH + BLACK_BOX_PREF, false); Services.prefs.setBoolPref(BRANCH + PRETTY_PRINT_PREF, true); info("Opening a test tab and a toolbox host to create the options view in"); - await addTab("about:blank"); - let [host, win] = await createHost("bottom", OPTIONS_VIEW_URL); + yield addTab("about:blank"); + let [host, win] = yield createHost("bottom", OPTIONS_VIEW_URL); - await testOptionsView(win); + yield testOptionsView(win); info("Closing the host and current tab"); host.destroy(); @@ -34,10 +34,10 @@ add_task(async function () { Services.prefs.setBoolPref(BRANCH + PRETTY_PRINT_PREF, originalPrettyPrint); }); -async function testOptionsView(win) { +function* testOptionsView(win) { let events = []; let options = createOptionsView(win); - await options.initialize(); + yield options.initialize(); let $ = win.document.querySelector.bind(win.document); @@ -68,12 +68,12 @@ async function testOptionsView(win) { "correct pref passed in 'pref-changed' event (auto-black-box)"); // Test buttons update when clicked and preferences are updated - await click(options, win, ppEl); + yield click(options, win, ppEl); is(ppEl.getAttribute("checked"), "true", "menuitems update when clicked"); is(Services.prefs.getBoolPref(BRANCH + PRETTY_PRINT_PREF), true, "preference updated via click"); - await click(options, win, bbEl); + yield click(options, win, bbEl); is(bbEl.getAttribute("checked"), "", "menuitems update when clicked"); is(Services.prefs.getBoolPref(BRANCH + BLACK_BOX_PREF), false, "preference updated via click"); @@ -85,7 +85,7 @@ async function testOptionsView(win) { is(events[3], "auto-black-box", "correct pref passed in 'pref-changed' event (auto-black-box)"); - await options.destroy(); + yield options.destroy(); } function createOptionsView(win) { @@ -95,16 +95,16 @@ function createOptionsView(win) { }); } -async function click(view, win, menuitem) { +function* click(view, win, menuitem) { let opened = view.once("options-shown"); let closed = view.once("options-hidden"); let button = win.document.querySelector("#options-button"); EventUtils.synthesizeMouseAtCenter(button, {}, win); - await opened; + yield opened; is(button.getAttribute("open"), "true", "button has `open` attribute"); EventUtils.synthesizeMouseAtCenter(menuitem, {}, win); - await closed; + yield closed; ok(!button.hasAttribute("open"), "button does not have `open` attribute"); } diff --git a/devtools/client/shared/test/browser_outputparser.js b/devtools/client/shared/test/browser_outputparser.js index 62c9bd224457..3853b362c37b 100644 --- a/devtools/client/shared/test/browser_outputparser.js +++ b/devtools/client/shared/test/browser_outputparser.js @@ -7,19 +7,19 @@ const OutputParser = require("devtools/client/shared/output-parser"); const {initCssProperties, getCssProperties} = require("devtools/shared/fronts/css-properties"); const CSS_SHAPES_ENABLED_PREF = "devtools.inspector.shapesHighlighter.enabled"; -add_task(async function () { - await addTab("about:blank"); - await performTest(); +add_task(function* () { + yield addTab("about:blank"); + yield performTest(); gBrowser.removeCurrentTab(); }); -async function performTest() { - let [host, , doc] = await createHost("bottom", "data:text/html," + +function* performTest() { + let [host, , doc] = yield createHost("bottom", "data:text/html," + "

browser_outputParser.js

"); // Mock the toolbox that initCssProperties expect so we get the fallback css properties. let toolbox = {target: {client: {}, hasActor: () => false}}; - await initCssProperties(toolbox); + yield initCssProperties(toolbox); let cssProperties = getCssProperties(toolbox); let parser = new OutputParser(doc, cssProperties); diff --git a/devtools/client/shared/test/browser_poller.js b/devtools/client/shared/test/browser_poller.js index 0b252c0e860f..bb21715e7670 100644 --- a/devtools/client/shared/test/browser_poller.js +++ b/devtools/client/shared/test/browser_poller.js @@ -8,7 +8,7 @@ const { Poller } = require("devtools/client/shared/poller"); -add_task(async function () { +add_task(function* () { let count1 = 0, count2 = 0, count3 = 0; let poller1 = new Poller(function () { @@ -26,26 +26,26 @@ add_task(async function () { ok(!poller1.isPolling(), "isPolling() returns false for an off poller"); ok(poller2.isPolling(), "isPolling() returns true for an on poller"); - await waitUntil(() => count2 > 10); + yield waitUntil(() => count2 > 10); ok(count2 > 10, "poller that was turned on polled several times"); ok(count1 === 0, "poller that was never turned on never polled"); - await poller2.off(); + yield poller2.off(); let currentCount2 = count2; // Really high poll time! poller1.on(); poller3.on(); - await waitUntil(() => count1 === 1); + yield waitUntil(() => count1 === 1); ok(true, "Poller calls fn immediately when `immediate` is true"); ok(count3 === 0, "Poller does not call fn immediately when `immediate` is not set"); ok(count2 === currentCount2, "a turned off poller does not continue to poll"); - await poller2.off(); - await poller2.off(); - await poller2.off(); + yield poller2.off(); + yield poller2.off(); + yield poller2.off(); ok(true, "Poller.prototype.off() is idempotent"); // This should still have not polled a second time @@ -55,7 +55,7 @@ add_task(async function () { ok(!poller2.isPolling(), "isPolling() returns false for an off poller"); }); -add_task(async function () { +add_task(function* () { let count = -1; // Create a poller that returns a promise. // The promise is resolved asynchronously after adding 9 to the count, ensuring @@ -77,11 +77,11 @@ add_task(async function () { }); asyncPoller.on(1); - await waitUntil(() => count > 50); - await asyncPoller.off(); + yield waitUntil(() => count > 50); + yield asyncPoller.off(); }); -add_task(async function () { +add_task(function* () { // Create a poller that returns a promise. This poll call // is called immediately, and then subsequently turned off. // The call to `off` should not resolve until the inflight call @@ -99,13 +99,13 @@ add_task(async function () { }, 1, true); asyncPoller.on(); - await asyncPoller.off(); + yield asyncPoller.off(); ok(inflightFinished, "off() method does not resolve until remaining inflight poll calls finish"); is(pollCalls, 1, "should only be one poll call to occur before turning off polling"); }); -add_task(async function () { +add_task(function* () { // Create a poller that returns a promise. This poll call // is called immediately, and then subsequently turned off. // The call to `off` should not resolve until the inflight call @@ -123,7 +123,7 @@ add_task(async function () { }, 1, true); asyncPoller.on(); - await asyncPoller.destroy(); + yield asyncPoller.destroy(); ok(inflightFinished, "destroy() method does not resolve until remaining inflight poll calls finish"); is(pollCalls, 1, "should only be one poll call to occur before destroying polling"); diff --git a/devtools/client/shared/test/browser_spectrum.js b/devtools/client/shared/test/browser_spectrum.js index 46752c624b2c..b75e58accfff 100644 --- a/devtools/client/shared/test/browser_spectrum.js +++ b/devtools/client/shared/test/browser_spectrum.js @@ -10,16 +10,16 @@ const {Spectrum} = require("devtools/client/shared/widgets/Spectrum"); const TEST_URI = CHROME_URL_ROOT + "doc_spectrum.html"; -add_task(async function () { - let [host,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + let [host,, doc] = yield createHost("bottom", TEST_URI); let container = doc.getElementById("spectrum-container"); - await testCreateAndDestroyShouldAppendAndRemoveElements(container); - await testPassingAColorAtInitShouldSetThatColor(container); - await testSettingAndGettingANewColor(container); - await testChangingColorShouldEmitEvents(container); - await testSettingColorShoudUpdateTheUI(container); + yield testCreateAndDestroyShouldAppendAndRemoveElements(container); + yield testPassingAColorAtInitShouldSetThatColor(container); + yield testSettingAndGettingANewColor(container); + yield testChangingColorShouldEmitEvents(container); + yield testSettingColorShoudUpdateTheUI(container); host.destroy(); }); diff --git a/devtools/client/shared/test/browser_tableWidget_basic.js b/devtools/client/shared/test/browser_tableWidget_basic.js index a0f8268ded29..e64a9890a14c 100644 --- a/devtools/client/shared/test/browser_tableWidget_basic.js +++ b/devtools/client/shared/test/browser_tableWidget_basic.js @@ -10,9 +10,9 @@ const TEST_URI = CHROME_URL_ROOT + "doc_tableWidget_basic.html"; const {TableWidget} = require("devtools/client/shared/widgets/TableWidget"); -add_task(async function () { - await addTab("about:blank"); - let [host, , doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + yield addTab("about:blank"); + let [host, , doc] = yield createHost("bottom", TEST_URI); let table = new TableWidget(doc.querySelector("box"), { initialColumns: { diff --git a/devtools/client/shared/test/browser_tableWidget_keyboard_interaction.js b/devtools/client/shared/test/browser_tableWidget_keyboard_interaction.js index dc7e1c9bc49f..5b81a4efab3c 100644 --- a/devtools/client/shared/test/browser_tableWidget_keyboard_interaction.js +++ b/devtools/client/shared/test/browser_tableWidget_keyboard_interaction.js @@ -44,11 +44,11 @@ function endTests() { finish(); } -var startTests = async function () { +var startTests = Task.async(function* () { populateTable(); - await testKeyboardInteraction(); + yield testKeyboardInteraction(); endTests(); -}; +}); function populateTable() { table.push({ @@ -131,35 +131,35 @@ function getNodeByValue(value) { * Tests if pressing navigation keys on the table items does the expected * behavior. */ -var testKeyboardInteraction = async function () { +var testKeyboardInteraction = Task.async(function* () { info("Testing keyboard interaction with the table"); info("clicking on the row containing id2"); let node = getNodeByValue("id2"); let event = table.once(TableWidget.EVENTS.ROW_SELECTED); click(node); - await event; + yield event; - await testRow("id3", "DOWN", "next row"); - await testRow("id4", "DOWN", "next row"); - await testRow("id3", "UP", "previous row"); - await testRow("id4", "DOWN", "next row"); - await testRow("id5", "DOWN", "next row"); - await testRow("id6", "DOWN", "next row"); - await testRow("id5", "UP", "previous row"); - await testRow("id4", "UP", "previous row"); - await testRow("id3", "UP", "previous row"); + yield testRow("id3", "DOWN", "next row"); + yield testRow("id4", "DOWN", "next row"); + yield testRow("id3", "UP", "previous row"); + yield testRow("id4", "DOWN", "next row"); + yield testRow("id5", "DOWN", "next row"); + yield testRow("id6", "DOWN", "next row"); + yield testRow("id5", "UP", "previous row"); + yield testRow("id4", "UP", "previous row"); + yield testRow("id3", "UP", "previous row"); // selecting last item node to test edge navigation cycling case table.selectedRow = "id9"; // pressing down on last row should move to first row. - await testRow("id1", "DOWN", "first row"); + yield testRow("id1", "DOWN", "first row"); // pressing up now should move to last row. - await testRow("id9", "UP", "last row"); -}; + yield testRow("id9", "UP", "last row"); +}); -async function testRow(id, key, destination) { +function* testRow(id, key, destination) { let node = getNodeByValue(id); // node should not have selected class ok(!node.classList.contains("theme-selected"), @@ -169,7 +169,7 @@ async function testRow(id, key, destination) { let event = table.once(TableWidget.EVENTS.ROW_SELECTED); EventUtils.sendKey(key, doc.defaultView); - let uniqueId = await event; + let uniqueId = yield event; is(id, uniqueId, `Correct row was selected after pressing ${key}`); ok(node.classList.contains("theme-selected"), "row has selected class"); diff --git a/devtools/client/shared/test/browser_tableWidget_mouse_interaction.js b/devtools/client/shared/test/browser_tableWidget_mouse_interaction.js index 7b53978d44ba..726151b6fa2a 100644 --- a/devtools/client/shared/test/browser_tableWidget_mouse_interaction.js +++ b/devtools/client/shared/test/browser_tableWidget_mouse_interaction.js @@ -45,11 +45,11 @@ function endTests() { finish(); } -var startTests = async function () { +var startTests = Task.async(function* () { populateTable(); - await testMouseInteraction(); + yield testMouseInteraction(); endTests(); -}; +}); function populateTable() { table.push({ @@ -127,7 +127,7 @@ function click(node, button = 0) { /** * Tests if clicking the table items does the expected behavior */ -var testMouseInteraction = async function () { +var testMouseInteraction = Task.async(function* () { info("Testing mouse interaction with the table"); ok(!table.selectedRow, "Nothing should be selected beforehand"); @@ -137,7 +137,7 @@ var testMouseInteraction = async function () { ok(!firstColumnFirstRowCell.classList.contains("theme-selected"), "Node should not have selected class before clicking"); click(firstColumnFirstRowCell); - let id = await event; + let id = yield event; ok(firstColumnFirstRowCell.classList.contains("theme-selected"), "Node has selected class after click"); is(id, "id1", "Correct row was selected"); @@ -149,7 +149,7 @@ var testMouseInteraction = async function () { ok(!firstColumnSecondRowCell.classList.contains("theme-selected"), "New node should not have selected class before clicking"); click(firstColumnSecondRowCell); - id = await event; + id = yield event; ok(firstColumnSecondRowCell.classList.contains("theme-selected"), "New node has selected class after clicking"); is(id, "id2", "Correct table path is emitted for new node"); @@ -166,7 +166,7 @@ var testMouseInteraction = async function () { ok(!firstColumnThirdRowCell.classList.contains("theme-selected"), "New node should not have selected class before clicking"); click(firstColumnThirdRowCellInnerNode); - id = await event; + id = yield event; ok(firstColumnThirdRowCell.classList.contains("theme-selected"), "New node has selected class after clicking the cell content"); is(id, "id3", "Correct table path is emitted for new node"); @@ -181,7 +181,7 @@ var testMouseInteraction = async function () { "Although, something else should be sorted on"); isnot(doc.querySelector("[sorted]"), node, "Which is not equal to this node"); click(node); - id = await event; + id = yield event; is(id, "col4", "Correct column was sorted on"); ok(node.hasAttribute("sorted"), "Node should now have sorted attribute after clicking"); @@ -196,7 +196,7 @@ var testMouseInteraction = async function () { node = table.tbody.firstChild.firstChild.firstChild; let onPopupShown = once(table.menupopup, "popupshown"); click(node, 2); - await onPopupShown; + yield onPopupShown; is(table.menupopup.querySelectorAll("[disabled]").length, 1, "Only 1 menuitem is disabled"); @@ -212,8 +212,8 @@ var testMouseInteraction = async function () { ok(!table.tbody.children[2].hasAttribute("hidden"), "Column is not hidden before hiding it"); click(node); - id = await event; - await onPopupHidden; + id = yield event; + yield onPopupHidden; is(id, "col2", "Correct column was triggered to be hidden"); is(table.tbody.children[2].getAttribute("hidden"), "true", "Column is hidden after hiding it"); @@ -224,7 +224,7 @@ var testMouseInteraction = async function () { node = table.tbody.firstChild.firstChild.firstChild; onPopupShown = once(table.menupopup, "popupshown"); click(node, 2); - await onPopupShown; + yield onPopupShown; is(table.menupopup.querySelectorAll("[disabled]").length, 1, "Only 1 menuitem is disabled"); @@ -237,8 +237,8 @@ var testMouseInteraction = async function () { ok(!table.tbody.children[4].hasAttribute("hidden"), "Column is not hidden before hiding it"); click(node); - id = await event; - await onPopupHidden; + id = yield event; + yield onPopupHidden; is(id, "col3", "Correct column was triggered to be hidden"); is(table.tbody.children[4].getAttribute("hidden"), "true", "Column is hidden after hiding it"); @@ -249,7 +249,7 @@ var testMouseInteraction = async function () { node = table.tbody.firstChild.firstChild.firstChild; onPopupShown = once(table.menupopup, "popupshown"); click(node, 2); - await onPopupShown; + yield onPopupShown; is(table.menupopup.querySelectorAll("[disabled]").length, 2, "2 menuitems are disabled now as only 2 columns remain visible"); @@ -270,8 +270,8 @@ var testMouseInteraction = async function () { is(table.tbody.children[2].getAttribute("hidden"), "true", "Column is hidden before unhiding it"); click(node); - id = await event; - await onPopupHidden; + id = yield event; + yield onPopupHidden; is(id, "col2", "Correct column was triggered to be hidden"); ok(!table.tbody.children[2].hasAttribute("hidden"), "Column is not hidden after unhiding it"); @@ -282,7 +282,7 @@ var testMouseInteraction = async function () { node = table.tbody.firstChild.firstChild.firstChild; onPopupShown = once(table.menupopup, "popupshown"); click(node, 2); - await onPopupShown; + yield onPopupShown; // popup should be open now // clicking on second column label @@ -293,8 +293,8 @@ var testMouseInteraction = async function () { is(table.tbody.children[4].getAttribute("hidden"), "true", "Column is hidden before unhiding it"); click(node); - id = await event; - await onPopupHidden; + id = yield event; + yield onPopupHidden; is(id, "col3", "Correct column was triggered to be hidden"); ok(!table.tbody.children[4].hasAttribute("hidden"), "Column is not hidden after unhiding it"); @@ -302,4 +302,4 @@ var testMouseInteraction = async function () { // reset table state table.clearSelection(); table.sortBy("col1"); -}; +}); diff --git a/devtools/client/shared/test/browser_telemetry_button_eyedropper.js b/devtools/client/shared/test/browser_telemetry_button_eyedropper.js index 3f68ec23b6a0..95966bd2ee5b 100644 --- a/devtools/client/shared/test/browser_telemetry_button_eyedropper.js +++ b/devtools/client/shared/test/browser_telemetry_button_eyedropper.js @@ -6,27 +6,27 @@ const TEST_URI = "data:text/html;charset=utf-8," + "

browser_telemetry_button_eyedropper.js

test
"; const EYEDROPPER_OPENED = "devtools.toolbar.eyedropper.opened"; -add_task(async function () { - await addTab(TEST_URI); +add_task(function* () { + yield addTab(TEST_URI); let Telemetry = loadTelemetryAndRecordLogs(); let target = TargetFactory.forTab(gBrowser.selectedTab); - let toolbox = await gDevTools.showToolbox(target, "inspector"); + let toolbox = yield gDevTools.showToolbox(target, "inspector"); info("inspector opened"); info("testing the eyedropper button"); - await testButton(toolbox, Telemetry); + yield testButton(toolbox, Telemetry); stopRecordingTelemetryLogs(Telemetry); - await gDevTools.closeToolbox(target); + yield gDevTools.closeToolbox(target); gBrowser.removeCurrentTab(); }); -async function testButton(toolbox, Telemetry) { +function* testButton(toolbox, Telemetry) { info("Calling the eyedropper button's callback"); // We call the button callback directly because we don't need to test the UI here, we're // only concerned about testing the telemetry probe. - await toolbox.getPanel("inspector").showEyeDropper(); + yield toolbox.getPanel("inspector").showEyeDropper(); checkTelemetryResults(Telemetry); } diff --git a/devtools/client/shared/test/browser_telemetry_button_paintflashing.js b/devtools/client/shared/test/browser_telemetry_button_paintflashing.js index 3c94dc8da83b..20da52b424a7 100644 --- a/devtools/client/shared/test/browser_telemetry_button_paintflashing.js +++ b/devtools/client/shared/test/browser_telemetry_button_paintflashing.js @@ -11,36 +11,36 @@ const TEST_URI = "data:text/html;charset=utf-8," + // opened we make use of setTimeout() to create tool active times. const TOOL_DELAY = 200; -add_task(async function () { - await addTab(TEST_URI); +add_task(function* () { + yield addTab(TEST_URI); let Telemetry = loadTelemetryAndRecordLogs(); - await pushPref("devtools.command-button-paintflashing.enabled", true); + yield pushPref("devtools.command-button-paintflashing.enabled", true); let target = TargetFactory.forTab(gBrowser.selectedTab); - let toolbox = await gDevTools.showToolbox(target, "inspector"); + let toolbox = yield gDevTools.showToolbox(target, "inspector"); info("inspector opened"); info("testing the paintflashing button"); - await testButton(toolbox, Telemetry); + yield testButton(toolbox, Telemetry); stopRecordingTelemetryLogs(Telemetry); - await gDevTools.closeToolbox(target); + yield gDevTools.closeToolbox(target); gBrowser.removeCurrentTab(); }); -async function testButton(toolbox, Telemetry) { +function* testButton(toolbox, Telemetry) { info("Testing command-button-paintflashing"); let button = toolbox.doc.querySelector("#command-button-paintflashing"); ok(button, "Captain, we have the button"); - await delayedClicks(toolbox, button, 4); + yield* delayedClicks(toolbox, button, 4); checkResults("_PAINTFLASHING_", Telemetry); } -async function delayedClicks(toolbox, node, clicks) { +function* delayedClicks(toolbox, node, clicks) { for (let i = 0; i < clicks; i++) { - await new Promise(resolve => { + yield new Promise(resolve => { // See TOOL_DELAY for why we need setTimeout here setTimeout(() => resolve(), TOOL_DELAY); }); @@ -58,7 +58,7 @@ async function delayedClicks(toolbox, node, clicks) { info("Clicking button " + node.id); node.click(); - await clicked; + yield clicked; } } diff --git a/devtools/client/shared/test/browser_telemetry_button_responsive.js b/devtools/client/shared/test/browser_telemetry_button_responsive.js index ea4fc160e90f..2e17511d88cc 100644 --- a/devtools/client/shared/test/browser_telemetry_button_responsive.js +++ b/devtools/client/shared/test/browser_telemetry_button_responsive.js @@ -32,29 +32,29 @@ registerCleanupFunction(() => { loader.lazyRequireGetter(this, "ResponsiveUIManager", "devtools/client/responsive.html/manager", true); -add_task(async function () { - await addTab(TEST_URI); +add_task(function* () { + yield addTab(TEST_URI); let Telemetry = loadTelemetryAndRecordLogs(); let target = TargetFactory.forTab(gBrowser.selectedTab); - let toolbox = await gDevTools.showToolbox(target, "inspector"); + let toolbox = yield gDevTools.showToolbox(target, "inspector"); info("inspector opened"); info("testing the responsivedesign button"); - await testButton(toolbox, Telemetry); + yield testButton(toolbox, Telemetry); stopRecordingTelemetryLogs(Telemetry); - await gDevTools.closeToolbox(target); + yield gDevTools.closeToolbox(target); gBrowser.removeCurrentTab(); }); -async function testButton(toolbox, Telemetry) { +function* testButton(toolbox, Telemetry) { info("Testing command-button-responsive"); let button = toolbox.doc.querySelector("#command-button-responsive"); ok(button, "Captain, we have the button"); - await delayedClicks(button, 4); + yield delayedClicks(button, 4); checkResults("_RESPONSIVE_", Telemetry); } @@ -71,16 +71,16 @@ function waitForToggle() { }); } -var delayedClicks = async function (node, clicks) { +var delayedClicks = Task.async(function* (node, clicks) { for (let i = 0; i < clicks; i++) { info("Clicking button " + node.id); let toggled = waitForToggle(); node.click(); - await toggled; + yield toggled; // See TOOL_DELAY for why we need setTimeout here - await DevToolsUtils.waitForTime(TOOL_DELAY); + yield DevToolsUtils.waitForTime(TOOL_DELAY); } -}; +}); function checkResults(histIdFocus, Telemetry) { let result = Telemetry.prototype.telemetryInfo; diff --git a/devtools/client/shared/test/browser_telemetry_button_scratchpad.js b/devtools/client/shared/test/browser_telemetry_button_scratchpad.js index 83ce23ebe167..94309f603943 100644 --- a/devtools/client/shared/test/browser_telemetry_button_scratchpad.js +++ b/devtools/client/shared/test/browser_telemetry_button_scratchpad.js @@ -11,26 +11,26 @@ const TEST_URI = "data:text/html;charset=utf-8," + // opened we make use of setTimeout() to create tool active times. const TOOL_DELAY = 200; -add_task(async function () { - await addTab(TEST_URI); +add_task(function* () { + yield addTab(TEST_URI); let Telemetry = loadTelemetryAndRecordLogs(); - await pushPref("devtools.command-button-scratchpad.enabled", true); + yield pushPref("devtools.command-button-scratchpad.enabled", true); let target = TargetFactory.forTab(gBrowser.selectedTab); - let toolbox = await gDevTools.showToolbox(target, "inspector"); + let toolbox = yield gDevTools.showToolbox(target, "inspector"); info("inspector opened"); let onAllWindowsOpened = trackScratchpadWindows(); info("testing the scratchpad button"); - await testButton(toolbox, Telemetry); - await onAllWindowsOpened; + yield testButton(toolbox, Telemetry); + yield onAllWindowsOpened; checkResults("_SCRATCHPAD_", Telemetry); stopRecordingTelemetryLogs(Telemetry); - await gDevTools.closeToolbox(target); + yield gDevTools.closeToolbox(target); gBrowser.removeCurrentTab(); }); @@ -68,12 +68,12 @@ function trackScratchpadWindows() { }); } -async function testButton(toolbox, Telemetry) { +function* testButton(toolbox, Telemetry) { info("Testing command-button-scratchpad"); let button = toolbox.doc.querySelector("#command-button-scratchpad"); ok(button, "Captain, we have the button"); - await delayedClicks(button, 4); + yield delayedClicks(button, 4); } function delayedClicks(node, clicks) { diff --git a/devtools/client/shared/test/browser_telemetry_sidebar.js b/devtools/client/shared/test/browser_telemetry_sidebar.js index e855e7e49933..021409f65f47 100644 --- a/devtools/client/shared/test/browser_telemetry_sidebar.js +++ b/devtools/client/shared/test/browser_telemetry_sidebar.js @@ -10,23 +10,23 @@ const TEST_URI = "data:text/html;charset=utf-8,

browser_telemetry_sidebar.js { let toolbar = gDevToolsBrowser.getDeveloperToolbar(window); -add_task(async function showToolbar() { - await addTab(TEST_URI); +add_task(function* showToolbar() { + yield addTab(TEST_URI); info("Starting browser_toolbar_tooltip.js"); @@ -26,14 +26,14 @@ add_task(async function showToolbar() { let showPromise = observeOnce(toolbar.NOTIFICATIONS.SHOW); document.getElementById("menu_devToolbar").doCommand(); - await showPromise; + yield showPromise; }); -add_task(async function testDimensions() { +add_task(function* testDimensions() { let tooltipPanel = toolbar.tooltipPanel; toolbar.focusManager.helpRequest(); - await toolbar.inputter.setInput("help help"); + yield toolbar.inputter.setInput("help help"); toolbar.inputter.setCursor({ start: "help help".length }); is(tooltipPanel._dimensions.start, "help ".length, @@ -56,35 +56,35 @@ add_task(async function testDimensions() { ok(getLeftMargin() > 9, "tooltip offset, when cursor at start"); }); -add_task(async function testThemes() { +add_task(function* testThemes() { let tooltipPanel = toolbar.tooltipPanel; ok(tooltipPanel.document, "Tooltip panel is initialized"); Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark"); - await toolbar.inputter.setInput(""); - await toolbar.inputter.setInput("help help"); + yield toolbar.inputter.setInput(""); + yield toolbar.inputter.setInput("help help"); is(tooltipPanel.document.documentElement.getAttribute("devtoolstheme"), "dark", "Tooltip panel has correct theme"); Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "light"); - await toolbar.inputter.setInput(""); - await toolbar.inputter.setInput("help help"); + yield toolbar.inputter.setInput(""); + yield toolbar.inputter.setInput("help help"); is(tooltipPanel.document.documentElement.getAttribute("devtoolstheme"), "light", "Tooltip panel has correct theme"); }); -add_task(async function hideToolbar() { +add_task(function* hideToolbar() { info("Ending browser_toolbar_tooltip.js"); - await toolbar.inputter.setInput(""); + yield toolbar.inputter.setInput(""); ok(toolbar.visible, "DeveloperToolbar is visible in hideToolbar"); info("Hide toolbar"); let hidePromise = observeOnce(toolbar.NOTIFICATIONS.HIDE); document.getElementById("menu_devToolbar").doCommand(); - await hidePromise; + yield hidePromise; ok(!toolbar.visible, "DeveloperToolbar is not visible in hideToolbar"); diff --git a/devtools/client/shared/test/browser_treeWidget_basic.js b/devtools/client/shared/test/browser_treeWidget_basic.js index 52b651711dda..b1d7772f7255 100644 --- a/devtools/client/shared/test/browser_treeWidget_basic.js +++ b/devtools/client/shared/test/browser_treeWidget_basic.js @@ -10,9 +10,9 @@ const TEST_URI = "data:text/html;charset=utf-8," + "ets.css'>

"; const {TreeWidget} = require("devtools/client/shared/widgets/TreeWidget"); -add_task(async function () { - await addTab("about:blank"); - let [host,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + yield addTab("about:blank"); + let [host,, doc] = yield createHost("bottom", TEST_URI); let tree = new TreeWidget(doc.querySelector("div"), { defaultType: "store" diff --git a/devtools/client/shared/test/browser_treeWidget_mouse_interaction.js b/devtools/client/shared/test/browser_treeWidget_mouse_interaction.js index 3efd8e000cf9..ce3d047ad75d 100644 --- a/devtools/client/shared/test/browser_treeWidget_mouse_interaction.js +++ b/devtools/client/shared/test/browser_treeWidget_mouse_interaction.js @@ -11,16 +11,16 @@ const TEST_URI = "data:text/html;charset=utf-8," + "ets.css'>
"; const {TreeWidget} = require("devtools/client/shared/widgets/TreeWidget"); -add_task(async function () { - await addTab("about:blank"); - let [host,, doc] = await createHost("bottom", TEST_URI); +add_task(function* () { + yield addTab("about:blank"); + let [host,, doc] = yield createHost("bottom", TEST_URI); let tree = new TreeWidget(doc.querySelector("div"), { defaultType: "store" }); populateTree(tree, doc); - await testMouseInteraction(tree); + yield testMouseInteraction(tree); tree.destroy(); host.destroy(); @@ -83,7 +83,7 @@ function click(node) { /** * Tests if clicking the tree items does the expected behavior */ -async function testMouseInteraction(tree) { +function* testMouseInteraction(tree) { info("Testing mouse interaction with the tree"); let event; let pass = (d, a) => event.resolve([d, a]); @@ -97,7 +97,7 @@ async function testMouseInteraction(tree) { ok(!node.classList.contains("theme-selected"), "Node should not have selected class before clicking"); click(node); - let [data, attachment] = await event.promise; + let [data, attachment] = yield event.promise; ok(node.classList.contains("theme-selected"), "Node has selected class after click"); is(data[0], "level1.2", "Correct tree path is emitted"); @@ -113,7 +113,7 @@ async function testMouseInteraction(tree) { ok(!node2.hasAttribute("expanded"), "New node is not expanded before clicking"); tree.once("select", pass); click(node2); - [data, attachment] = await event.promise; + [data, attachment] = yield event.promise; ok(node2.classList.contains("theme-selected"), "New node has selected class after clicking"); is(data[0], "level1", "Correct tree path is emitted for new node"); @@ -130,6 +130,6 @@ async function testMouseInteraction(tree) { executeSoon(() => event.resolve(null)); }, { once: true }); click(node2); - await event.promise; + yield event.promise; ok(!node2.hasAttribute("expanded"), "New node collapsed after click again"); } diff --git a/devtools/client/shared/test/frame-script-utils.js b/devtools/client/shared/test/frame-script-utils.js index 752c7056ba9b..5dc1b4d92ee9 100644 --- a/devtools/client/shared/test/frame-script-utils.js +++ b/devtools/client/shared/test/frame-script-utils.js @@ -6,6 +6,7 @@ /* global addMessageListener, sendAsyncMessage, content */ "use strict"; const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {}); +const { Task } = require("devtools/shared/task"); const Services = require("Services"); addMessageListener("devtools:test:history", function ({ data }) { @@ -100,17 +101,17 @@ function promiseXHR(data) { * response: XMLHttpRequest.response * } */ -addMessageListener("devtools:test:xhr", async function ({ data }) { +addMessageListener("devtools:test:xhr", Task.async(function* ({ data }) { let requests = Array.isArray(data) ? data : [data]; let responses = []; for (let request of requests) { - let response = await promiseXHR(request); + let response = yield promiseXHR(request); responses.push(response); } sendAsyncMessage("devtools:test:xhr", responses); -}); +})); addMessageListener("devtools:test:profiler", function ({ data }) { let { method, args, id } = data; diff --git a/devtools/client/shared/test/head.js b/devtools/client/shared/test/head.js index 2b71eef1fedd..adbc5506e0ac 100644 --- a/devtools/client/shared/test/head.js +++ b/devtools/client/shared/test/head.js @@ -105,18 +105,18 @@ function oneTimeObserve(name, callback) { } let createHost = -async function (type = "bottom", src = CHROME_URL_ROOT + "dummy.html") { +Task.async(function* (type = "bottom", src = CHROME_URL_ROOT + "dummy.html") { let host = new Hosts[type](gBrowser.selectedTab); - let iframe = await host.create(); + let iframe = yield host.create(); - await new Promise(resolve => { + yield new Promise(resolve => { let domHelper = new DOMHelpers(iframe.contentWindow); iframe.setAttribute("src", src); domHelper.onceDOMReady(resolve); }); return [host, iframe.contentWindow, iframe.contentDocument]; -}; +}); /** * Check the correctness of the data recorded in Telemetry after @@ -155,17 +155,17 @@ function checkTelemetryResults(Telemetry) { * @param {Number} usageTime in milliseconds * @param {String} toolId */ -async function openAndCloseToolbox(nbOfTimes, usageTime, toolId) { +function* openAndCloseToolbox(nbOfTimes, usageTime, toolId) { for (let i = 0; i < nbOfTimes; i++) { info("Opening toolbox " + (i + 1)); let target = TargetFactory.forTab(gBrowser.selectedTab); - await gDevTools.showToolbox(target, toolId); + yield gDevTools.showToolbox(target, toolId); // We use a timeout to check the toolbox's active time - await new Promise(resolve => setTimeout(resolve, usageTime)); + yield new Promise(resolve => setTimeout(resolve, usageTime)); info("Closing toolbox " + (i + 1)); - await gDevTools.closeToolbox(target); + yield gDevTools.closeToolbox(target); } } @@ -225,12 +225,12 @@ function showFilterPopupPresets(widget) { * @return {Promise} */ let showFilterPopupPresetsAndCreatePreset = -async function (widget, name, value) { - await showFilterPopupPresets(widget); +Task.async(function* (widget, name, value) { + yield showFilterPopupPresets(widget); let onRender = widget.once("render"); widget.setCssValue(value); - await onRender; + yield onRender; let footer = widget.el.querySelector(".presets-list .footer"); footer.querySelector("input").value = name; @@ -240,5 +240,5 @@ async function (widget, name, value) { preventDefault: () => {} }); - await onRender; -}; + yield onRender; +}); diff --git a/devtools/client/shared/test/helper_html_tooltip.js b/devtools/client/shared/test/helper_html_tooltip.js index ef8bab5a0c60..ffc6945f3059 100644 --- a/devtools/client/shared/test/helper_html_tooltip.js +++ b/devtools/client/shared/test/helper_html_tooltip.js @@ -20,10 +20,10 @@ * @return {Promise} promise that resolves when "shown" has been fired, reflow * and repaint done. */ -async function showTooltip(tooltip, anchor, {position, x, y} = {}) { +function* showTooltip(tooltip, anchor, {position, x, y} = {}) { let onShown = tooltip.once("shown"); tooltip.show(anchor, {position, x, y}); - await onShown; + yield onShown; return waitForReflow(tooltip); } @@ -36,10 +36,10 @@ async function showTooltip(tooltip, anchor, {position, x, y} = {}) { * @return {Promise} promise that resolves when "hidden" has been fired, reflow * and repaint done. */ -async function hideTooltip(tooltip) { +function* hideTooltip(tooltip) { let onPopupHidden = tooltip.once("hidden"); tooltip.hide(); - await onPopupHidden; + yield onPopupHidden; return waitForReflow(tooltip); } diff --git a/devtools/client/shared/test/helper_inplace_editor.js b/devtools/client/shared/test/helper_inplace_editor.js index f4e1acc0b170..623c2208ae05 100644 --- a/devtools/client/shared/test/helper_inplace_editor.js +++ b/devtools/client/shared/test/helper_inplace_editor.js @@ -23,7 +23,7 @@ const { editableField } = require("devtools/client/shared/inplace-editor"); * @param {String} textContent * (optional) String that will be used as the text content of the span. */ -const createInplaceEditorAndClick = async function (options, doc, textContent) { +const createInplaceEditorAndClick = Task.async(function* (options, doc, textContent) { let span = options.element = createSpan(doc); if (textContent) { span.textContent = textContent; @@ -34,7 +34,7 @@ const createInplaceEditorAndClick = async function (options, doc, textContent) { info("Clicking on the inplace-editor field to turn to edit mode"); span.click(); -}; +}); /** * Helper to create a span in the provided document. @@ -75,7 +75,7 @@ function createSpan(doc) { * @param {InplaceEditor} editor * The InplaceEditor instance being tested */ -async function testCompletion([key, completion, index, total], editor) { +function* testCompletion([key, completion, index, total], editor) { info("Pressing key " + key); info("Expecting " + completion); @@ -97,9 +97,9 @@ async function testCompletion([key, completion, index, total], editor) { info("Synthesizing key " + key); EventUtils.synthesizeKey(key, {}, editor.input.defaultView); - await onSuggest; - await onVisibilityChange; - await waitForTime(5); + yield onSuggest; + yield onVisibilityChange; + yield waitForTime(5); info("Checking the state"); if (completion !== null) { diff --git a/devtools/client/shared/test/shared-head.js b/devtools/client/shared/test/shared-head.js index 1dee0f56dce2..56def015c860 100644 --- a/devtools/client/shared/test/shared-head.js +++ b/devtools/client/shared/test/shared-head.js @@ -29,6 +29,7 @@ const flags = require("devtools/shared/flags"); let promise = require("promise"); let defer = require("devtools/shared/defer"); const Services = require("Services"); +const {Task} = require("devtools/shared/task"); const KeyShortcuts = require("devtools/client/shared/key-shortcuts"); const TEST_DIR = gTestPath.substr(0, gTestPath.lastIndexOf("/")); @@ -119,9 +120,9 @@ registerCleanupFunction(() => { Services.prefs.clearUserPref("devtools.toolbox.splitconsoleHeight"); }); -registerCleanupFunction(async function cleanup() { +registerCleanupFunction(function* cleanup() { while (gBrowser.tabs.length > 1) { - await closeTabAndToolbox(gBrowser.selectedTab); + yield closeTabAndToolbox(gBrowser.selectedTab); } }); @@ -135,7 +136,7 @@ registerCleanupFunction(async function cleanup() { * - {String} preferredRemoteType * @return a promise that resolves to the tab object when the url is loaded */ -var addTab = async function (url, options = { background: false, window: window }) { +var addTab = Task.async(function* (url, options = { background: false, window: window }) { info("Adding a new tab with URL: " + url); let { background } = options; @@ -147,28 +148,28 @@ var addTab = async function (url, options = { background: false, window: window if (!background) { gBrowser.selectedTab = tab; } - await BrowserTestUtils.browserLoaded(tab.linkedBrowser); + yield BrowserTestUtils.browserLoaded(tab.linkedBrowser); info("Tab added and finished loading"); return tab; -}; +}); /** * Remove the given tab. * @param {Object} tab The tab to be removed. * @return Promise resolved when the tab is successfully removed. */ -var removeTab = async function (tab) { +var removeTab = Task.async(function* (tab) { info("Removing tab."); let { gBrowser } = tab.ownerDocument.defaultView; let onClose = once(gBrowser.tabContainer, "TabClose"); gBrowser.removeTab(tab); - await onClose; + yield onClose; info("Tab removed and finished closing"); -}; +}); /** * Refresh the provided tab. @@ -377,12 +378,12 @@ function wait(ms) { * @param {String} hostType Optional. The type of toolbox host to be used. * @return {Promise} Resolves with the toolbox, when it has been opened. */ -var openToolboxForTab = async function (tab, toolId, hostType) { +var openToolboxForTab = Task.async(function* (tab, toolId, hostType) { info("Opening the toolbox"); let toolbox; let target = TargetFactory.forTab(tab); - await target.makeRemote(); + yield target.makeRemote(); // Check if the toolbox is already loaded. toolbox = gDevTools.getToolbox(target); @@ -394,15 +395,15 @@ var openToolboxForTab = async function (tab, toolId, hostType) { } // If not, load it now. - toolbox = await gDevTools.showToolbox(target, toolId, hostType); + toolbox = yield gDevTools.showToolbox(target, toolId, hostType); // Make sure that the toolbox frame is focused. - await new Promise(resolve => waitForFocus(resolve, toolbox.win)); + yield new Promise(resolve => waitForFocus(resolve, toolbox.win)); info("Toolbox opened and focused"); return toolbox; -}; +}); /** * Add a new tab and open the toolbox in it. @@ -412,10 +413,10 @@ var openToolboxForTab = async function (tab, toolId, hostType) { * @return {Promise} Resolves when the tab has been added, loaded and the * toolbox has been opened. Resolves to the toolbox. */ -var openNewTabAndToolbox = async function (url, toolId, hostType) { - let tab = await addTab(url); +var openNewTabAndToolbox = Task.async(function* (url, toolId, hostType) { + let tab = yield addTab(url); return openToolboxForTab(tab, toolId, hostType); -}; +}); /** * Close a tab and if necessary, the toolbox that belongs to it @@ -423,14 +424,14 @@ var openNewTabAndToolbox = async function (url, toolId, hostType) { * @return {Promise} Resolves when the toolbox and tab have been destroyed and * closed. */ -var closeTabAndToolbox = async function (tab = gBrowser.selectedTab) { +var closeTabAndToolbox = Task.async(function* (tab = gBrowser.selectedTab) { let target = TargetFactory.forTab(tab); if (target) { - await gDevTools.closeToolbox(target); + yield gDevTools.closeToolbox(target); } - await removeTab(tab); -}; + yield removeTab(tab); +}); /** * Close a toolbox and the current tab. @@ -438,10 +439,10 @@ var closeTabAndToolbox = async function (tab = gBrowser.selectedTab) { * @return {Promise} Resolves when the toolbox and tab have been destroyed and * closed. */ -var closeToolboxAndTab = async function (toolbox) { - await toolbox.destroy(); - await removeTab(gBrowser.selectedTab); -}; +var closeToolboxAndTab = Task.async(function* (toolbox) { + yield toolbox.destroy(); + yield removeTab(gBrowser.selectedTab); +}); /** * Waits until a predicate returns true. @@ -578,10 +579,10 @@ function lookupPath(obj, path) { return segments.reduce((prev, current) => prev[current], obj); } -var closeToolbox = async function () { +var closeToolbox = Task.async(function* () { let target = TargetFactory.forTab(gBrowser.selectedTab); - await gDevTools.closeToolbox(target); -}; + yield gDevTools.closeToolbox(target); +}); /** * Load the Telemetry utils, then stub Telemetry.prototype.log and @@ -683,12 +684,12 @@ function createTestHTTPServer() { const {HttpServer} = ChromeUtils.import("resource://testing-common/httpd.js", {}); let server = new HttpServer(); - registerCleanupFunction(async function cleanup() { + registerCleanupFunction(function* cleanup() { let destroyed = defer(); server.stop(() => { destroyed.resolve(); }); - await destroyed.promise; + yield destroyed.promise; }); server.start(-1); @@ -706,7 +707,7 @@ function createTestHTTPServer() { * Reference to the browser in which we load content task */ async function injectEventUtilsInContentTask(browser) { - await ContentTask.spawn(browser, {}, async function () { + await ContentTask.spawn(browser, {}, function* () { if ("EventUtils" in this) { return; } diff --git a/devtools/client/shared/test/test-actor-registry.js b/devtools/client/shared/test/test-actor-registry.js index ff3d6e9e4269..949548611948 100644 --- a/devtools/client/shared/test/test-actor-registry.js +++ b/devtools/client/shared/test/test-actor-registry.js @@ -8,14 +8,15 @@ const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {}); const { fetch } = require("devtools/shared/DevToolsUtils"); + const { Task } = require("devtools/shared/task"); const TEST_URL_ROOT = "http://example.com/browser/devtools/client/shared/test/"; const ACTOR_URL = TEST_URL_ROOT + "test-actor.js"; // Register a test actor that can operate on the remote document - exports.registerTestActor = async function (client) { + exports.registerTestActor = Task.async(function* (client) { // First, instanciate ActorRegistryFront to be able to dynamically register an actor - let response = await client.listTabs(); + let response = yield client.listTabs(); let { ActorRegistryFront } = require("devtools/shared/fronts/actor-registry"); let registryFront = ActorRegistryFront(client, response); @@ -25,20 +26,20 @@ constructor: "TestActor", prefix: "testActor" }; - let testActorFront = await registryFront.registerActor(ACTOR_URL, options); + let testActorFront = yield registryFront.registerActor(ACTOR_URL, options); return testActorFront; - }; + }); // Load the test actor in a custom sandbox as we can't use SDK module loader with URIs - let loadFront = async function () { - let sourceText = await request(ACTOR_URL); + let loadFront = Task.async(function* () { + let sourceText = yield request(ACTOR_URL); const principal = CC("@mozilla.org/systemprincipal;1", "nsIPrincipal")(); const sandbox = Cu.Sandbox(principal); sandbox.exports = {}; sandbox.require = require; Cu.evalInSandbox(sourceText, sandbox, "1.8", ACTOR_URL, 1); return sandbox.exports; - }; + }); // Ensure fetching a live TabActor form for the targeted app // (helps fetching the test actor registered dynamically) @@ -48,14 +49,14 @@ }; // Spawn an instance of the test actor for the given toolbox - exports.getTestActor = async function (toolbox) { + exports.getTestActor = Task.async(function* (toolbox) { let client = toolbox.target.client; return getTestActor(client, toolbox.target.tab, toolbox); - }; + }); // Sometimes, we need the test actor before opening or without a toolbox then just // create a front for the given `tab` - exports.getTestActorWithoutToolbox = async function (tab) { + exports.getTestActorWithoutToolbox = Task.async(function* (tab) { let { DebuggerServer } = require("devtools/server/main"); let { DebuggerClient } = require("devtools/shared/client/debugger-client"); @@ -65,26 +66,26 @@ DebuggerServer.registerAllActors(); let client = new DebuggerClient(DebuggerServer.connectPipe()); - await client.connect(); + yield client.connect(); // We also need to make sure the test actor is registered on the server. - await exports.registerTestActor(client); + yield exports.registerTestActor(client); return getTestActor(client, tab); - }; + }); // Fetch the content of a URI let request = function (uri) { return fetch(uri).then(({ content }) => content); }; - let getTestActor = async function (client, tab, toolbox) { + let getTestActor = Task.async(function* (client, tab, toolbox) { // We may have to update the form in order to get the dynamically registered // test actor. - let form = await getUpdatedForm(client, tab); + let form = yield getUpdatedForm(client, tab); - let { TestActorFront } = await loadFront(); + let { TestActorFront } = yield loadFront(); return new TestActorFront(client, form, toolbox); - }; + }); })(this); diff --git a/devtools/client/shared/test/test-actor.js b/devtools/client/shared/test/test-actor.js index 77b4174dd0ee..5ca8ac193795 100644 --- a/devtools/client/shared/test/test-actor.js +++ b/devtools/client/shared/test/test-actor.js @@ -14,6 +14,7 @@ const { getRect, getAdjustedQuads, getWindowDimensions } = require("devtools/shared/layout/utils"); const defer = require("devtools/shared/defer"); +const {Task} = require("devtools/shared/task"); const { isContentStylesheet, getCSSStyleRules @@ -702,16 +703,16 @@ var TestActor = exports.TestActor = protocol.ActorClassWithSpec(testSpec, { return deferred.promise; }, - async getNodeRect(selector) { + getNodeRect: Task.async(function* (selector) { let node = this._querySelector(selector); return getRect(this.content, node, this.content); - }, + }), - async getTextNodeRect(parentSelector, childNodeIndex) { + getTextNodeRect: Task.async(function* (parentSelector, childNodeIndex) { let parentNode = this._querySelector(parentSelector); let node = parentNode.childNodes[childNodeIndex]; return getAdjustedQuads(this.content, node)[0].bounds; - }, + }), /** * Get information about a DOM element, identified by a selector. @@ -850,11 +851,11 @@ var TestActorFront = exports.TestActorFront = protocol.FrontClassWithSpec(testSp * @param {String} prefix An optional prefix for logging information to the * console. */ - async isNodeCorrectlyHighlighted(selector, is, prefix = "") { + isNodeCorrectlyHighlighted: Task.async(function* (selector, is, prefix = "") { prefix += (prefix ? " " : "") + selector + " "; - let boxModel = await this._getBoxModelStatus(); - let regions = await this.getAllAdjustedQuads(selector); + let boxModel = yield this._getBoxModelStatus(); + let regions = yield this.getAllAdjustedQuads(selector); for (let boxType of ["content", "padding", "border", "margin"]) { let [quad] = regions[boxType]; @@ -865,13 +866,13 @@ var TestActorFront = exports.TestActorFront = protocol.FrontClassWithSpec(testSp prefix + boxType + " point " + point + " y coordinate is correct"); } } - }, + }), /** * Get the current rect of the border region of the box-model highlighter */ - async getSimpleBorderRect(toolbox) { - let {border} = await this._getBoxModelStatus(toolbox); + getSimpleBorderRect: Task.async(function* (toolbox) { + let {border} = yield this._getBoxModelStatus(toolbox); let {p1, p2, p4} = border.points; return { @@ -880,32 +881,32 @@ var TestActorFront = exports.TestActorFront = protocol.FrontClassWithSpec(testSp width: p2.x - p1.x, height: p4.y - p1.y }; - }, + }), /** * Get the current positions and visibility of the various box-model highlighter * elements. */ - async _getBoxModelStatus() { - let isVisible = await this.isHighlighting(); + _getBoxModelStatus: Task.async(function* () { + let isVisible = yield this.isHighlighting(); let ret = { visible: isVisible }; for (let region of ["margin", "border", "padding", "content"]) { - let points = await this._getPointsForRegion(region); - let visible = await this._isRegionHidden(region); + let points = yield this._getPointsForRegion(region); + let visible = yield this._isRegionHidden(region); ret[region] = {points, visible}; } ret.guides = {}; for (let guide of ["top", "right", "bottom", "left"]) { - ret.guides[guide] = await this._getGuideStatus(guide); + ret.guides[guide] = yield this._getGuideStatus(guide); } return ret; - }, + }), /** * Check that the box-model highlighter is currently highlighting the node matching the @@ -913,10 +914,10 @@ var TestActorFront = exports.TestActorFront = protocol.FrontClassWithSpec(testSp * @param {String} selector * @return {Boolean} */ - async assertHighlightedNode(selector) { - let rect = await this.getNodeRect(selector); - return this.isNodeRectHighlighted(rect); - }, + assertHighlightedNode: Task.async(function* (selector) { + let rect = yield this.getNodeRect(selector); + return yield this.isNodeRectHighlighted(rect); + }), /** * Check that the box-model highlighter is currently highlighting the text node that can @@ -926,18 +927,18 @@ var TestActorFront = exports.TestActorFront = protocol.FrontClassWithSpec(testSp * @param {Number} childNodeIndex * @return {Boolean} */ - async assertHighlightedTextNode(parentSelector, childNodeIndex) { - let rect = await this.getTextNodeRect(parentSelector, childNodeIndex); - return this.isNodeRectHighlighted(rect); - }, + assertHighlightedTextNode: Task.async(function* (parentSelector, childNodeIndex) { + let rect = yield this.getTextNodeRect(parentSelector, childNodeIndex); + return yield this.isNodeRectHighlighted(rect); + }), /** * Check that the box-model highlighter is currently highlighting the given rect. * @param {Object} rect * @return {Boolean} */ - async isNodeRectHighlighted({ left, top, width, height }) { - let {visible, border} = await this._getBoxModelStatus(); + isNodeRectHighlighted: Task.async(function* ({ left, top, width, height }) { + let {visible, border} = yield this._getBoxModelStatus(); let points = border.points; if (!visible) { return false; @@ -960,14 +961,14 @@ var TestActorFront = exports.TestActorFront = protocol.FrontClassWithSpec(testSp isInside([right, top], points) && isInside([right, bottom], points) && isInside([left, bottom], points); - }, + }), /** * Get the coordinate (points attribute) from one of the polygon elements in the * box model highlighter. */ - async _getPointsForRegion(region) { - let d = await this.getHighlighterNodeAttribute("box-model-" + region, "d"); + _getPointsForRegion: Task.async(function* (region) { + let d = yield this.getHighlighterNodeAttribute("box-model-" + region, "d"); let polygons = d.match(/M[^M]+/g); if (!polygons) { @@ -996,25 +997,25 @@ var TestActorFront = exports.TestActorFront = protocol.FrontClassWithSpec(testSp y: parseFloat(points[3][1]) } }; - }, + }), /** * Is a given region polygon element of the box-model highlighter currently * hidden? */ - async _isRegionHidden(region) { - let value = await this.getHighlighterNodeAttribute("box-model-" + region, "hidden"); + _isRegionHidden: Task.async(function* (region) { + let value = yield this.getHighlighterNodeAttribute("box-model-" + region, "hidden"); return value !== null; - }, + }), - async _getGuideStatus(location) { + _getGuideStatus: Task.async(function* (location) { let id = "box-model-guide-" + location; - let hidden = await this.getHighlighterNodeAttribute(id, "hidden"); - let x1 = await this.getHighlighterNodeAttribute(id, "x1"); - let y1 = await this.getHighlighterNodeAttribute(id, "y1"); - let x2 = await this.getHighlighterNodeAttribute(id, "x2"); - let y2 = await this.getHighlighterNodeAttribute(id, "y2"); + let hidden = yield this.getHighlighterNodeAttribute(id, "hidden"); + let x1 = yield this.getHighlighterNodeAttribute(id, "x1"); + let y1 = yield this.getHighlighterNodeAttribute(id, "y1"); + let x2 = yield this.getHighlighterNodeAttribute(id, "x2"); + let y2 = yield this.getHighlighterNodeAttribute(id, "y2"); return { visible: !hidden, @@ -1023,7 +1024,7 @@ var TestActorFront = exports.TestActorFront = protocol.FrontClassWithSpec(testSp x2: x2, y2: y2 }; - }, + }), /** * Get the coordinates of the rectangle that is defined by the 4 guides displayed @@ -1031,11 +1032,11 @@ var TestActorFront = exports.TestActorFront = protocol.FrontClassWithSpec(testSp * @return {Object} Null if at least one guide is hidden. Otherwise an object * with p1, p2, p3, p4 properties being {x, y} objects. */ - async getGuidesRectangle() { - let tGuide = await this._getGuideStatus("top"); - let rGuide = await this._getGuideStatus("right"); - let bGuide = await this._getGuideStatus("bottom"); - let lGuide = await this._getGuideStatus("left"); + getGuidesRectangle: Task.async(function* () { + let tGuide = yield this._getGuideStatus("top"); + let rGuide = yield this._getGuideStatus("right"); + let bGuide = yield this._getGuideStatus("bottom"); + let lGuide = yield this._getGuideStatus("left"); if (!tGuide.visible || !rGuide.visible || !bGuide.visible || !lGuide.visible) { return null; @@ -1047,7 +1048,7 @@ var TestActorFront = exports.TestActorFront = protocol.FrontClassWithSpec(testSp p3: {x: +rGuide.x1 + 1, y: +bGuide.y1 + 1}, p4: {x: lGuide.x1, y: +bGuide.y1 + 1} }; - }, + }), waitForHighlighterEvent: protocol.custom(function (event) { return this._waitForHighlighterEvent(event, this.toolbox.highlighter.actorID); @@ -1065,8 +1066,8 @@ var TestActorFront = exports.TestActorFront = protocol.FrontClassWithSpec(testSp * - points {Array} an array of all the polygons defined by the path. Each box * is itself an Array of points, themselves being [x,y] coordinates arrays. */ - async getHighlighterRegionPath(region, highlighter) { - let d = await this.getHighlighterNodeAttribute( + getHighlighterRegionPath: Task.async(function* (region, highlighter) { + let d = yield this.getHighlighterNodeAttribute( `box-model-${region}`, "d", highlighter ); if (!d) { @@ -1086,7 +1087,7 @@ var TestActorFront = exports.TestActorFront = protocol.FrontClassWithSpec(testSp } return {d, points}; - } + }) }); /** diff --git a/devtools/client/shared/view-source.js b/devtools/client/shared/view-source.js index fb6822ab93a4..94a6dffa2281 100644 --- a/devtools/client/shared/view-source.js +++ b/devtools/client/shared/view-source.js @@ -4,6 +4,8 @@ "use strict"; +var { Task } = require("devtools/shared/task"); + var Services = require("Services"); var { gDevTools } = require("devtools/client/framework/devtools"); var { getSourceText } = require("devtools/client/debugger/content/queries"); @@ -21,19 +23,19 @@ var { getSourceText } = require("devtools/client/debugger/content/queries"); * * @return {Promise} */ -exports.viewSourceInStyleEditor = async function (toolbox, sourceURL, +exports.viewSourceInStyleEditor = Task.async(function* (toolbox, sourceURL, sourceLine) { - let panel = await toolbox.loadTool("styleeditor"); + let panel = yield toolbox.loadTool("styleeditor"); try { - await panel.selectStyleSheet(sourceURL, sourceLine); - await toolbox.selectTool("styleeditor"); + yield panel.selectStyleSheet(sourceURL, sourceLine); + yield toolbox.selectTool("styleeditor"); return true; } catch (e) { exports.viewSource(toolbox, sourceURL, sourceLine); return false; } -}; +}); /** * Tries to open a JavaScript file in the Debugger. If the file is not found, @@ -48,18 +50,18 @@ exports.viewSourceInStyleEditor = async function (toolbox, sourceURL, * * @return {Promise} */ -exports.viewSourceInDebugger = async function (toolbox, sourceURL, sourceLine) { +exports.viewSourceInDebugger = Task.async(function* (toolbox, sourceURL, sourceLine) { // If the Debugger was already open, switch to it and try to show the // source immediately. Otherwise, initialize it and wait for the sources // to be added first. let debuggerAlreadyOpen = toolbox.getPanel("jsdebugger"); - let dbg = await toolbox.loadTool("jsdebugger"); + let dbg = yield toolbox.loadTool("jsdebugger"); // New debugger frontend if (Services.prefs.getBoolPref("devtools.debugger.new-debugger-frontend")) { const source = dbg.getSource(sourceURL); if (source) { - await toolbox.selectTool("jsdebugger"); + yield toolbox.selectTool("jsdebugger"); dbg.selectSource(sourceURL, sourceLine); return true; } @@ -72,7 +74,7 @@ exports.viewSourceInDebugger = async function (toolbox, sourceURL, sourceLine) { // Old debugger frontend if (!debuggerAlreadyOpen) { - await win.DebuggerController.waitForSourcesLoaded(); + yield win.DebuggerController.waitForSourcesLoaded(); } let { DebuggerView } = win; @@ -80,7 +82,7 @@ exports.viewSourceInDebugger = async function (toolbox, sourceURL, sourceLine) { let item = Sources.getItemForAttachment(a => a.source.url === sourceURL); if (item) { - await toolbox.selectTool("jsdebugger"); + yield toolbox.selectTool("jsdebugger"); // Determine if the source has already finished loading. There's two cases // in which we need to wait for the source to be shown: @@ -110,7 +112,7 @@ exports.viewSourceInDebugger = async function (toolbox, sourceURL, sourceLine) { // Wait for it to load if (!isSelected || isLoading) { - await win.DebuggerController.waitForSourceShown(sourceURL); + yield win.DebuggerController.waitForSourceShown(sourceURL); } return true; } @@ -118,7 +120,7 @@ exports.viewSourceInDebugger = async function (toolbox, sourceURL, sourceLine) { // If not found, still attempt to open in View Source exports.viewSource(toolbox, sourceURL, sourceLine); return false; -}; +}); /** * Tries to open a JavaScript file in the corresponding Scratchpad. @@ -128,7 +130,7 @@ exports.viewSourceInDebugger = async function (toolbox, sourceURL, sourceLine) { * * @return {Promise} */ -exports.viewSourceInScratchpad = async function (sourceURL, sourceLine) { +exports.viewSourceInScratchpad = Task.async(function* (sourceURL, sourceLine) { // Check for matching top level scratchpad window. let wins = Services.wm.getEnumerator("devtools:scratchpad"); @@ -156,7 +158,7 @@ exports.viewSourceInScratchpad = async function (sourceURL, sourceLine) { } } } -}; +}); /** * Open a link in Firefox's View Source. @@ -167,10 +169,10 @@ exports.viewSourceInScratchpad = async function (sourceURL, sourceLine) { * * @return {Promise} */ -exports.viewSource = async function (toolbox, sourceURL, sourceLine) { +exports.viewSource = Task.async(function* (toolbox, sourceURL, sourceLine) { let utils = toolbox.gViewSourceUtils; utils.viewSource({ URL: sourceURL, lineNumber: sourceLine || 0, }); -}; +}); diff --git a/devtools/client/shared/widgets/ColorWidget.js b/devtools/client/shared/widgets/ColorWidget.js index b20b55683c09..7566012ee6a8 100644 --- a/devtools/client/shared/widgets/ColorWidget.js +++ b/devtools/client/shared/widgets/ColorWidget.js @@ -9,6 +9,7 @@ "use strict"; +const {Task} = require("devtools/shared/task"); const EventEmitter = require("devtools/shared/event-emitter"); const {colorUtils} = require("devtools/shared/css/color"); const {LocalizationHelper} = require("devtools/shared/l10n"); @@ -385,7 +386,7 @@ ColorWidget.prototype = { this.hslaValue.addEventListener("input", this.onHslaInputChange); }, - async show() { + show: Task.async(function* () { this.initializeColorWidget(); this.element.classList.add("colorwidget-show"); @@ -399,12 +400,12 @@ ColorWidget.prototype = { if (this.inspector && this.inspector.selection.nodeFront && this.contrastEnabled) { let node = this.inspector.selection.nodeFront; - this.closestBackgroundColor = await node.getClosestBackgroundColor(); + this.closestBackgroundColor = yield node.getClosestBackgroundColor(); } this.updateContrast(); this.updateUI(); - }, + }), onElementClick: function (e) { e.stopPropagation(); diff --git a/devtools/client/shared/widgets/FlameGraph.js b/devtools/client/shared/widgets/FlameGraph.js index 13913f3d647a..60b44ba64e60 100644 --- a/devtools/client/shared/widgets/FlameGraph.js +++ b/devtools/client/shared/widgets/FlameGraph.js @@ -3,6 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; +const { Task } = require("devtools/shared/task"); const { ViewHelpers, setNamedTimeout } = require("devtools/client/shared/widgets/view-helpers"); const { ELLIPSIS } = require("devtools/shared/l10n"); @@ -231,8 +232,8 @@ FlameGraph.prototype = { /** * Destroys this graph. */ - async destroy() { - await this.ready(); + destroy: Task.async(function* () { + yield this.ready(); this._window.removeEventListener("keydown", this._onKeyDown); this._window.removeEventListener("keyup", this._onKeyUp); @@ -261,7 +262,7 @@ FlameGraph.prototype = { this._data = null; this.emit("destroyed"); - }, + }), /** * Makes sure the canvas graph is of the specified width or height, and @@ -311,10 +312,10 @@ FlameGraph.prototype = { * @return promise * A promise resolved once the data is set. */ - async setDataWhenReady(data) { - await this.ready(); + setDataWhenReady: Task.async(function* (data) { + yield this.ready(); this.setData(data); - }, + }), /** * Gets whether or not this graph has a data source. diff --git a/devtools/client/shared/widgets/Graphs.js b/devtools/client/shared/widgets/Graphs.js index b5ccd1a4d73a..b10cec5bebb5 100644 --- a/devtools/client/shared/widgets/Graphs.js +++ b/devtools/client/shared/widgets/Graphs.js @@ -3,6 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; +const { Task } = require("devtools/shared/task"); const { setNamedTimeout } = require("devtools/client/shared/widgets/view-helpers"); const { getCurrentZoom } = require("devtools/shared/layout/utils"); @@ -185,8 +186,8 @@ AbstractCanvasGraph.prototype = { /** * Destroys this graph. */ - async destroy() { - await this.ready(); + destroy: Task.async(function* () { + yield this.ready(); this._topWindow.removeEventListener("mousemove", this._onMouseMove); this._topWindow.removeEventListener("mouseup", this._onMouseUp); @@ -220,7 +221,7 @@ AbstractCanvasGraph.prototype = { gCachedStripePattern.clear(); this.emit("destroyed"); - }, + }), /** * Rendering options. Subclasses should override these. @@ -296,10 +297,10 @@ AbstractCanvasGraph.prototype = { * @return promise * A promise resolved once the data is set. */ - async setDataWhenReady(data) { - await this.ready(); + setDataWhenReady: Task.async(function* (data) { + yield this.ready(); this.setData(data); - }, + }), /** * Adds a mask to this graph. @@ -1315,12 +1316,12 @@ this.CanvasGraphUtils = { /** * Merges the animation loop of two graphs. */ - async linkAnimation(graph1, graph2) { + linkAnimation: Task.async(function* (graph1, graph2) { if (!graph1 || !graph2) { return; } - await graph1.ready(); - await graph2.ready(); + yield graph1.ready(); + yield graph2.ready(); let window = graph1._window; window.cancelAnimationFrame(graph1._animationId); @@ -1333,7 +1334,7 @@ this.CanvasGraphUtils = { }; window.requestAnimationFrame(loop); - }, + }), /** * Makes sure selections in one graph are reflected in another. diff --git a/devtools/client/shared/widgets/LineGraphWidget.js b/devtools/client/shared/widgets/LineGraphWidget.js index 91422ebb2241..a5622a723d30 100644 --- a/devtools/client/shared/widgets/LineGraphWidget.js +++ b/devtools/client/shared/widgets/LineGraphWidget.js @@ -1,5 +1,6 @@ "use strict"; +const { Task } = require("devtools/shared/task"); const { extend } = require("devtools/shared/extend"); const { AbstractCanvasGraph, CanvasGraphUtils } = require("devtools/client/shared/widgets/Graphs"); const { LocalizationHelper } = require("devtools/shared/l10n"); @@ -145,17 +146,17 @@ LineGraphWidget.prototype = extend(AbstractCanvasGraph.prototype, { * @param number duration * The duration of the recording in milliseconds. */ - async setDataFromTimestamps(timestamps, interval, duration) { + setDataFromTimestamps: Task.async(function* (timestamps, interval, duration) { let { plottedData, plottedMinMaxSum - } = await CanvasGraphUtils._performTaskInWorker("plotTimestampsGraph", { + } = yield CanvasGraphUtils._performTaskInWorker("plotTimestampsGraph", { timestamps, interval, duration }); this._tempMinMaxSum = plottedMinMaxSum; this.setData(plottedData); - }, + }), /** * Renders the graph's data source. diff --git a/devtools/client/shared/widgets/VariablesView.jsm b/devtools/client/shared/widgets/VariablesView.jsm index ccdfa4212db8..167fbd051818 100644 --- a/devtools/client/shared/widgets/VariablesView.jsm +++ b/devtools/client/shared/widgets/VariablesView.jsm @@ -24,6 +24,7 @@ const defer = require("devtools/shared/defer"); const { extend } = require("devtools/shared/extend"); const { ViewHelpers, setNamedTimeout } = require("devtools/client/shared/widgets/view-helpers"); +const { Task } = require("devtools/shared/task"); const nodeConstants = require("devtools/shared/dom-node-constants"); const {KeyCodes} = require("devtools/client/shared/keycodes"); const {PluralForm} = require("devtools/shared/plural-form"); @@ -2775,23 +2776,23 @@ Variable.prototype = extend(Scope.prototype, { event && event.stopPropagation(); - return (async function () { - await this.toolbox.initInspector(); + return Task.spawn(function* () { + yield this.toolbox.initInspector(); let nodeFront = this._nodeFront; if (!nodeFront) { - nodeFront = await this.toolbox.walker.getNodeActorFromObjectActor(this._valueGrip.actor); + nodeFront = yield this.toolbox.walker.getNodeActorFromObjectActor(this._valueGrip.actor); } if (nodeFront) { - await this.toolbox.selectTool("inspector"); + yield this.toolbox.selectTool("inspector"); let inspectorReady = defer(); this.toolbox.getPanel("inspector").once("inspector-updated", inspectorReady.resolve); - await this.toolbox.selection.setNodeFront(nodeFront, "variables-view"); - await inspectorReady.promise; + yield this.toolbox.selection.setNodeFront(nodeFront, "variables-view"); + yield inspectorReady.promise; } - }.bind(this))(); + }.bind(this)); }, /** diff --git a/devtools/client/shared/widgets/tooltip/HTMLTooltip.js b/devtools/client/shared/widgets/tooltip/HTMLTooltip.js index 6c1ea90c8313..f607c1db69dc 100644 --- a/devtools/client/shared/widgets/tooltip/HTMLTooltip.js +++ b/devtools/client/shared/widgets/tooltip/HTMLTooltip.js @@ -9,6 +9,7 @@ const EventEmitter = require("devtools/shared/event-emitter"); const {TooltipToggle} = require("devtools/client/shared/widgets/tooltip/TooltipToggle"); const {listenOnce} = require("devtools/shared/async-utils"); +const {Task} = require("devtools/shared/task"); const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; const XHTML_NS = "http://www.w3.org/1999/xhtml"; @@ -323,7 +324,7 @@ HTMLTooltip.prototype = { * - {Number} x: optional, horizontal offset between the anchor and the tooltip * - {Number} y: optional, vertical offset between the anchor and the tooltip */ - async show(anchor, {position, x = 0, y = 0} = {}) { + show: Task.async(function* (anchor, {position, x = 0, y = 0} = {}) { // Get anchor geometry let anchorRect = getRelativeRect(anchor, this.doc); if (this.useXulWrapper) { @@ -372,7 +373,7 @@ HTMLTooltip.prototype = { } if (this.useXulWrapper) { - await this._showXulWrapperAt(left, top); + yield this._showXulWrapperAt(left, top); } else { this.container.style.left = left + "px"; this.container.style.top = top + "px"; @@ -391,7 +392,7 @@ HTMLTooltip.prototype = { this.topWindow.addEventListener("click", this._onClick, true); this.emit("shown"); }, 0); - }, + }), /** * Calculate the rect of the viewport that limits the tooltip dimensions. When using a @@ -445,7 +446,7 @@ HTMLTooltip.prototype = { * Hide the current tooltip. The event "hidden" will be fired when the tooltip * is hidden. */ - async hide() { + hide: Task.async(function* () { this.doc.defaultView.clearTimeout(this.attachEventsTimer); if (!this.isVisible()) { this.emit("hidden"); @@ -455,7 +456,7 @@ HTMLTooltip.prototype = { this.topWindow.removeEventListener("click", this._onClick, true); this.container.classList.remove("tooltip-visible"); if (this.useXulWrapper) { - await this._hideXulWrapper(); + yield this._hideXulWrapper(); } this.emit("hidden"); @@ -465,7 +466,7 @@ HTMLTooltip.prototype = { this._focusedElement.focus(); this._focusedElement = null; } - }, + }), /** * Check if the tooltip is currently displayed. diff --git a/devtools/client/shared/widgets/tooltip/TooltipToggle.js b/devtools/client/shared/widgets/tooltip/TooltipToggle.js index 80f5e8b14471..11a4f68e775d 100644 --- a/devtools/client/shared/widgets/tooltip/TooltipToggle.js +++ b/devtools/client/shared/widgets/tooltip/TooltipToggle.js @@ -6,6 +6,8 @@ "use strict"; +const {Task} = require("devtools/shared/task"); + const DEFAULT_TOGGLE_DELAY = 50; /** @@ -142,14 +144,14 @@ TooltipToggle.prototype = { * @return {Promise} a promise that will resolve the anchor to use for the * tooltip or null if no valid target was found. */ - async isValidHoverTarget(target) { - let res = await this._targetNodeCb(target, this.tooltip); + isValidHoverTarget: Task.async(function* (target) { + let res = yield this._targetNodeCb(target, this.tooltip); if (res) { return res.nodeName ? res : target; } return null; - }, + }), _onMouseOut: function (event) { // Only hide the tooltip if the mouse leaves baseNode. diff --git a/devtools/client/sourceeditor/test/browser_editor_autocomplete_events.js b/devtools/client/sourceeditor/test/browser_editor_autocomplete_events.js index c0a1aa3463b7..509014a0df66 100644 --- a/devtools/client/sourceeditor/test/browser_editor_autocomplete_events.js +++ b/devtools/client/sourceeditor/test/browser_editor_autocomplete_events.js @@ -8,30 +8,30 @@ const {InspectorFront} = require("devtools/shared/fronts/inspector"); const TEST_URI = "data:text/html;charset=UTF-8," + "
"; -add_task(async function () { - await addTab(TEST_URI); - await runTests(); +add_task(function* () { + yield addTab(TEST_URI); + yield runTests(); }); -async function runTests() { +function* runTests() { let target = TargetFactory.forTab(gBrowser.selectedTab); - await target.makeRemote(); + yield target.makeRemote(); let inspector = InspectorFront(target.client, target.form); - let walker = await inspector.getWalker(); - let {ed, win, edWin} = await setup(null, { + let walker = yield inspector.getWalker(); + let {ed, win, edWin} = yield setup(null, { autocomplete: true, mode: Editor.modes.css, autocompleteOpts: {walker: walker, cssProperties: getClientCssProperties()} }); - await testMouse(ed, edWin); - await testKeyboard(ed, edWin); - await testKeyboardCycle(ed, edWin); - await testKeyboardCycleForPrefixedString(ed, edWin); - await testKeyboardCSSComma(ed, edWin); + yield testMouse(ed, edWin); + yield testKeyboard(ed, edWin); + yield testKeyboardCycle(ed, edWin); + yield testKeyboardCycleForPrefixedString(ed, edWin); + yield testKeyboardCSSComma(ed, edWin); teardown(ed, win); } -async function testKeyboard(ed, win) { +function* testKeyboard(ed, win) { ed.focus(); ed.setText("b"); ed.setCursor({line: 1, ch: 1}); @@ -43,13 +43,13 @@ async function testKeyboard(ed, win) { EventUtils.synthesizeKey("VK_" + autocompleteKey, { ctrlKey: true }, win); info("Waiting for popup to be opened"); - await popupOpened; + yield popupOpened; EventUtils.synthesizeKey("VK_RETURN", { }, win); is(ed.getText(), "bar", "Editor text has been updated"); } -async function testKeyboardCycle(ed, win) { +function* testKeyboardCycle(ed, win) { ed.focus(); ed.setText("b"); ed.setCursor({line: 1, ch: 1}); @@ -61,7 +61,7 @@ async function testKeyboardCycle(ed, win) { EventUtils.synthesizeKey("VK_" + autocompleteKey, { ctrlKey: true }, win); info("Waiting for popup to be opened"); - await popupOpened; + yield popupOpened; EventUtils.synthesizeKey("VK_DOWN", { }, win); is(ed.getText(), "bar", "Editor text has been updated"); @@ -73,7 +73,7 @@ async function testKeyboardCycle(ed, win) { is(ed.getText(), "#baz", "Editor text has been updated"); } -async function testKeyboardCycleForPrefixedString(ed, win) { +function* testKeyboardCycleForPrefixedString(ed, win) { ed.focus(); ed.setText("#b"); ed.setCursor({line: 1, ch: 2}); @@ -85,13 +85,13 @@ async function testKeyboardCycleForPrefixedString(ed, win) { EventUtils.synthesizeKey("VK_" + autocompleteKey, { ctrlKey: true }, win); info("Waiting for popup to be opened"); - await popupOpened; + yield popupOpened; EventUtils.synthesizeKey("VK_DOWN", { }, win); is(ed.getText(), "#baz", "Editor text has been updated"); } -async function testKeyboardCSSComma(ed, win) { +function* testKeyboardCSSComma(ed, win) { ed.focus(); ed.setText("b"); ed.setCursor({line: 1, ch: 1}); @@ -104,12 +104,12 @@ async function testKeyboardCSSComma(ed, win) { EventUtils.synthesizeKey(",", { }, win); - await wait(500); + yield wait(500); ok(!isPopupOpened, "Autocompletion shouldn't be opened"); } -async function testMouse(ed, win) { +function* testMouse(ed, win) { ed.focus(); ed.setText("b"); ed.setCursor({line: 1, ch: 1}); @@ -121,7 +121,7 @@ async function testMouse(ed, win) { EventUtils.synthesizeKey("VK_" + autocompleteKey, { ctrlKey: true }, win); info("Waiting for popup to be opened"); - await popupOpened; + yield popupOpened; ed.getAutocompletionPopup()._list.children[2].click(); is(ed.getText(), "#baz", "Editor text has been updated"); } diff --git a/devtools/client/sourceeditor/test/browser_editor_find_again.js b/devtools/client/sourceeditor/test/browser_editor_find_again.js index 147f39702c92..47f0e19c2a7d 100644 --- a/devtools/client/sourceeditor/test/browser_editor_find_again.js +++ b/devtools/client/sourceeditor/test/browser_editor_find_again.js @@ -70,7 +70,7 @@ function testFindAgain(ed, inputLine, expectCursor, isFindPrev = false) { "find: " + inputLine + " expects cursor: " + expectCursor.toSource()); } -const testSearchBoxTextIsSelected = async function (ed) { +const testSearchBoxTextIsSelected = Task.async(function* (ed) { let edDoc = ed.container.contentDocument; let edWin = edDoc.defaultView; @@ -93,7 +93,7 @@ const testSearchBoxTextIsSelected = async function (ed) { input = edDoc.querySelector("input[type=search]"); ok(input, "find command key opens the search box"); - await dispatchAndWaitForFocus(input); + yield dispatchAndWaitForFocus(input); let { selectionStart, selectionEnd, value } = input; @@ -112,9 +112,9 @@ const testSearchBoxTextIsSelected = async function (ed) { // Close search box EventUtils.synthesizeKey("VK_ESCAPE", {}, edWin); -}; +}); -const testReplaceBoxTextIsSelected = async function (ed) { +const testReplaceBoxTextIsSelected = Task.async(function* (ed) { let edDoc = ed.container.contentDocument; let edWin = edDoc.defaultView; @@ -135,7 +135,7 @@ const testReplaceBoxTextIsSelected = async function (ed) { // it seems that during the tests can be lost input.focus(); - await dispatchAndWaitForFocus(input); + yield dispatchAndWaitForFocus(input); let { selectionStart, selectionEnd, value } = input; @@ -151,10 +151,10 @@ const testReplaceBoxTextIsSelected = async function (ed) { // Close dialog box EventUtils.synthesizeKey("VK_ESCAPE", {}, edWin); -}; +}); -add_task(async function () { - let { ed, win } = await setup(); +add_task(function* () { + let { ed, win } = yield setup(); ed.setText([ "// line 1", @@ -164,7 +164,7 @@ add_task(async function () { "// line 5" ].join("\n")); - await promiseWaitForFocus(); + yield promiseWaitForFocus(); openSearchBox(ed); @@ -204,12 +204,12 @@ add_task(async function () { ]; for (let v of testVectors) { - await testFindAgain(ed, ...v); + yield testFindAgain(ed, ...v); } - await testSearchBoxTextIsSelected(ed); + yield testSearchBoxTextIsSelected(ed); - await testReplaceBoxTextIsSelected(ed); + yield testReplaceBoxTextIsSelected(ed); teardown(ed, win); }); diff --git a/devtools/client/sourceeditor/test/browser_editor_script_injection.js b/devtools/client/sourceeditor/test/browser_editor_script_injection.js index 8a4c368196ec..05487b4f21eb 100644 --- a/devtools/client/sourceeditor/test/browser_editor_script_injection.js +++ b/devtools/client/sourceeditor/test/browser_editor_script_injection.js @@ -6,16 +6,16 @@ "use strict"; -add_task(async function () { - await runTest(); +add_task(function* () { + yield runTest(); }); -async function runTest() { +function* runTest() { const baseURL = "chrome://mochitests/content/browser/devtools/client/sourceeditor/test"; const injectedText = "Script successfully injected!"; - let {ed, win} = await setup(null, { + let {ed, win} = yield setup(null, { mode: "ruby", externalScripts: [`${baseURL}/cm_script_injection_test.js`, `${baseURL}/cm_mode_ruby.js`] diff --git a/devtools/client/storage/test/browser_storage_basic.js b/devtools/client/storage/test/browser_storage_basic.js index 254fdc3b4a8f..0a309bb4edc9 100644 --- a/devtools/client/storage/test/browser_storage_basic.js +++ b/devtools/client/storage/test/browser_storage_basic.js @@ -102,7 +102,7 @@ function testTree() { /** * Test that correct table entries are shown for each of the tree item */ -async function testTables() { +function* testTables() { let doc = gPanelWindow.document; // Expand all nodes so that the synthesized click event actually works gUI.tree.expandAll(); @@ -115,7 +115,7 @@ async function testTables() { // Click rest of the tree items and wait for the table to be updated for (let [treeItem, items] of testCases.slice(1)) { - await selectTreeItem(treeItem); + yield selectTreeItem(treeItem); // Check whether correct number of items are present in the table is(doc.querySelectorAll( @@ -130,11 +130,11 @@ async function testTables() { } } -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); testTree(); - await testTables(); + yield testTables(); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_basic_usercontextid_1.js b/devtools/client/storage/test/browser_storage_basic_usercontextid_1.js index e07a164fa549..06dff6360cd7 100644 --- a/devtools/client/storage/test/browser_storage_basic_usercontextid_1.js +++ b/devtools/client/storage/test/browser_storage_basic_usercontextid_1.js @@ -87,7 +87,7 @@ function testTree(tests) { /** * Test that correct table entries are shown for each of the tree item */ -async function testTables(tests) { +function* testTables(tests) { let doc = gPanelWindow.document; // Expand all nodes so that the synthesized click event actually works gUI.tree.expandAll(); @@ -100,7 +100,7 @@ async function testTables(tests) { // Click rest of the tree items and wait for the table to be updated for (let [treeItem, items] of tests.slice(1)) { - await selectTreeItem(treeItem); + yield selectTreeItem(treeItem); // Check whether correct number of items are present in the table is(doc.querySelectorAll( @@ -115,11 +115,11 @@ async function testTables(tests) { } } -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); testTree(testCases); - await testTables(testCases); + yield testTables(testCases); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_basic_usercontextid_2.js b/devtools/client/storage/test/browser_storage_basic_usercontextid_2.js index c4eb0bfdafdc..80a7b937b34e 100644 --- a/devtools/client/storage/test/browser_storage_basic_usercontextid_2.js +++ b/devtools/client/storage/test/browser_storage_basic_usercontextid_2.js @@ -81,7 +81,7 @@ function testTree(tests) { /** * Test that correct table entries are shown for each of the tree item */ -async function testTables(tests) { +function* testTables(tests) { let doc = gPanelWindow.document; // Expand all nodes so that the synthesized click event actually works gUI.tree.expandAll(); @@ -94,7 +94,7 @@ async function testTables(tests) { // Click rest of the tree items and wait for the table to be updated for (let [treeItem, items] of tests.slice(1)) { - await selectTreeItem(treeItem); + yield selectTreeItem(treeItem); // Check whether correct number of items are present in the table is(doc.querySelectorAll( @@ -109,12 +109,12 @@ async function testTables(tests) { } } -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings-usercontextid.html", +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings-usercontextid.html", {userContextId: 1}); testTree(testCasesUserContextId); - await testTables(testCasesUserContextId); + yield testTables(testCasesUserContextId); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_basic_with_fragment.js b/devtools/client/storage/test/browser_storage_basic_with_fragment.js index e012ef82abf6..2353b4384711 100644 --- a/devtools/client/storage/test/browser_storage_basic_with_fragment.js +++ b/devtools/client/storage/test/browser_storage_basic_with_fragment.js @@ -105,7 +105,7 @@ function testTree() { /** * Test that correct table entries are shown for each of the tree item */ -async function testTables() { +function* testTables() { let doc = gPanelWindow.document; // Expand all nodes so that the synthesized click event actually works gUI.tree.expandAll(); @@ -118,7 +118,7 @@ async function testTables() { // Click rest of the tree items and wait for the table to be updated for (let [treeItem, items] of testCases.slice(1)) { - await selectTreeItem(treeItem); + yield selectTreeItem(treeItem); // Check whether correct number of items are present in the table is(doc.querySelectorAll( @@ -133,12 +133,12 @@ async function testTables() { } } -add_task(async function () { - await openTabAndSetupStorage( +add_task(function* () { + yield openTabAndSetupStorage( MAIN_DOMAIN + "storage-listings-with-fragment.html#abc"); testTree(); - await testTables(); + yield testTables(); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_cache_delete.js b/devtools/client/storage/test/browser_storage_cache_delete.js index 0577582f3376..fe99d28bcdd3 100644 --- a/devtools/client/storage/test/browser_storage_cache_delete.js +++ b/devtools/client/storage/test/browser_storage_cache_delete.js @@ -8,8 +8,8 @@ // Test deleting a Cache object from the tree using context menu -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); let contextMenu = gPanelWindow.document.getElementById("storage-tree-popup"); let menuDeleteItem = contextMenu.querySelector("#storage-tree-popup-delete"); @@ -17,7 +17,7 @@ add_task(async function () { let cacheToDelete = ["Cache", "http://test1.example.org", "plop"]; info("test state before delete"); - await selectTreeItem(cacheToDelete); + yield selectTreeItem(cacheToDelete); ok(gUI.tree.isSelected(cacheToDelete), "Cache item is present in the tree"); info("do the delete"); @@ -27,7 +27,7 @@ add_task(async function () { let target = gPanelWindow.document.querySelector(selector); ok(target, "Cache item's tree element is present"); - await waitForContextMenu(contextMenu, target, () => { + yield waitForContextMenu(contextMenu, target, () => { info("Opened tree context menu"); menuDeleteItem.click(); @@ -36,11 +36,11 @@ add_task(async function () { `Context menu item label contains '${cacheName}')`); }); - await eventWait; + yield eventWait; info("test state after delete"); - await selectTreeItem(cacheToDelete); + yield selectTreeItem(cacheToDelete); ok(!gUI.tree.isSelected(cacheToDelete), "Cache item is no longer present in the tree"); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_cache_error.js b/devtools/client/storage/test/browser_storage_cache_error.js index 04310dba5d53..dfc6056a704a 100644 --- a/devtools/client/storage/test/browser_storage_cache_error.js +++ b/devtools/client/storage/test/browser_storage_cache_error.js @@ -6,14 +6,14 @@ // Test handling errors in CacheStorage -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-cache-error.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-cache-error.html"); const cacheItemId = ["Cache", "javascript:parent.frameContent"]; - await selectTreeItem(cacheItemId); + yield selectTreeItem(cacheItemId); ok(gUI.tree.isSelected(cacheItemId), `The item ${cacheItemId.join(" > ")} is present in the tree`); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_cookies_add.js b/devtools/client/storage/test/browser_storage_cookies_add.js index 1fca43b3b064..ac66eb92cbf1 100644 --- a/devtools/client/storage/test/browser_storage_cookies_add.js +++ b/devtools/client/storage/test/browser_storage_cookies_add.js @@ -6,15 +6,15 @@ "use strict"; -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies.html"); showAllColumns(true); - await performAdd(["cookies", "http://test1.example.org"]); - await performAdd(["cookies", "http://test1.example.org"]); - await performAdd(["cookies", "http://test1.example.org"]); - await performAdd(["cookies", "http://test1.example.org"]); - await performAdd(["cookies", "http://test1.example.org"]); + yield performAdd(["cookies", "http://test1.example.org"]); + yield performAdd(["cookies", "http://test1.example.org"]); + yield performAdd(["cookies", "http://test1.example.org"]); + yield performAdd(["cookies", "http://test1.example.org"]); + yield performAdd(["cookies", "http://test1.example.org"]); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_cookies_delete_all.js b/devtools/client/storage/test/browser_storage_cookies_delete_all.js index 2df30f768bef..b8c0418f895d 100644 --- a/devtools/client/storage/test/browser_storage_cookies_delete_all.js +++ b/devtools/client/storage/test/browser_storage_cookies_delete_all.js @@ -8,7 +8,7 @@ // Test deleting all cookies -async function performDelete(store, rowName, action) { +function* performDelete(store, rowName, action) { let contextMenu = gPanelWindow.document.getElementById( "storage-table-popup"); let menuDeleteAllItem = contextMenu.querySelector( @@ -20,12 +20,12 @@ async function performDelete(store, rowName, action) { let storeName = store.join(" > "); - await selectTreeItem(store); + yield selectTreeItem(store); let eventWait = gUI.once("store-objects-updated"); let cells = getRowCells(rowName, true); - await waitForContextMenu(contextMenu, cells.name, () => { + yield waitForContextMenu(contextMenu, cells.name, () => { info(`Opened context menu in ${storeName}, row '${rowName}'`); switch (action) { case "deleteAll": @@ -43,14 +43,14 @@ async function performDelete(store, rowName, action) { } }); - await eventWait; + yield eventWait; } -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); info("test state before delete"); - await checkState([ + yield checkState([ [ ["cookies", "http://test1.example.org"], [ getCookieId("c1", "test1.example.org", "/browser"), @@ -78,10 +78,10 @@ add_task(async function () { info("delete all from domain"); // delete only cookies that match the host exactly let id = getCookieId("c1", "test1.example.org", "/browser"); - await performDelete(["cookies", "http://test1.example.org"], id, "deleteAllFrom"); + yield performDelete(["cookies", "http://test1.example.org"], id, "deleteAllFrom"); info("test state after delete all from domain"); - await checkState([ + yield checkState([ // Domain cookies (.example.org) must not be deleted. [ ["cookies", "http://test1.example.org"], @@ -110,11 +110,11 @@ add_task(async function () { info("delete all session cookies"); // delete only session cookies id = getCookieId("cs2", ".example.org", "/"); - await performDelete(["cookies", "http://sectest1.example.org"], id, + yield performDelete(["cookies", "http://sectest1.example.org"], id, "deleteAllSessionCookies"); info("test state after delete all session cookies"); - await checkState([ + yield checkState([ // Cookies with expiry date must not be deleted. [ ["cookies", "http://test1.example.org"], @@ -137,15 +137,15 @@ add_task(async function () { info("delete all"); // delete all cookies for host, including domain cookies id = getCookieId("uc2", ".example.org", "/"); - await performDelete(["cookies", "http://sectest1.example.org"], id, "deleteAll"); + yield performDelete(["cookies", "http://sectest1.example.org"], id, "deleteAll"); info("test state after delete all"); - await checkState([ + yield checkState([ // Domain cookies (.example.org) are deleted too, so deleting in sectest1 // also removes stuff from test1. [["cookies", "http://test1.example.org"], []], [["cookies", "https://sectest1.example.org"], []], ]); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_cookies_domain.js b/devtools/client/storage/test/browser_storage_cookies_domain.js index 369df8a73727..e78756471249 100644 --- a/devtools/client/storage/test/browser_storage_cookies_domain.js +++ b/devtools/client/storage/test/browser_storage_cookies_domain.js @@ -9,10 +9,10 @@ // Test that cookies with domain equal to full host name are listed. // E.g., ".example.org" vs. example.org). Bug 1149497. -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies.html"); - await checkState([ + yield checkState([ [ ["cookies", "http://test1.example.org"], [ @@ -25,5 +25,5 @@ add_task(async function () { ], ]); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_cookies_domain_port.js b/devtools/client/storage/test/browser_storage_cookies_domain_port.js index 05091657cc40..55fcb571894c 100644 --- a/devtools/client/storage/test/browser_storage_cookies_domain_port.js +++ b/devtools/client/storage/test/browser_storage_cookies_domain_port.js @@ -9,10 +9,10 @@ // Test that cookies with domain equal to full host name and port are listed. // E.g., ".example.org:8000" vs. example.org:8000). -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN_WITH_PORT + "storage-cookies.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN_WITH_PORT + "storage-cookies.html"); - await checkState([ + yield checkState([ [ ["cookies", "http://test1.example.org:8000"], [ @@ -25,5 +25,5 @@ add_task(async function () { ], ]); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_cookies_edit.js b/devtools/client/storage/test/browser_storage_cookies_edit.js index 12a2899ecdb0..14944b398522 100644 --- a/devtools/client/storage/test/browser_storage_cookies_edit.js +++ b/devtools/client/storage/test/browser_storage_cookies_edit.js @@ -6,24 +6,24 @@ "use strict"; -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies.html"); showAllColumns(true); let id = getCookieId("test3", ".test1.example.org", "/browser"); - await editCell(id, "name", "newTest3"); + yield editCell(id, "name", "newTest3"); id = getCookieId("newTest3", ".test1.example.org", "/browser"); - await editCell(id, "host", "test1.example.org"); + yield editCell(id, "host", "test1.example.org"); id = getCookieId("newTest3", "test1.example.org", "/browser"); - await editCell(id, "path", "/"); + yield editCell(id, "path", "/"); id = getCookieId("newTest3", "test1.example.org", "/"); - await editCell(id, "expires", "Tue, 14 Feb 2040 17:41:14 GMT"); - await editCell(id, "value", "newValue3"); - await editCell(id, "isSecure", "true"); - await editCell(id, "isHttpOnly", "true"); + yield editCell(id, "expires", "Tue, 14 Feb 2040 17:41:14 GMT"); + yield editCell(id, "value", "newValue3"); + yield editCell(id, "isSecure", "true"); + yield editCell(id, "isHttpOnly", "true"); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_cookies_edit_keyboard.js b/devtools/client/storage/test/browser_storage_cookies_edit_keyboard.js index 5f185d7964ee..4d1f3b3aaba2 100644 --- a/devtools/client/storage/test/browser_storage_cookies_edit_keyboard.js +++ b/devtools/client/storage/test/browser_storage_cookies_edit_keyboard.js @@ -6,20 +6,20 @@ "use strict"; -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies.html"); showAllColumns(true); showColumn("uniqueKey", false); let id = getCookieId("test4", "test1.example.org", "/browser"); - await startCellEdit(id, "name"); - await typeWithTerminator("test6", "KEY_Tab"); - await typeWithTerminator(".example.org", "KEY_Tab"); - await typeWithTerminator("/", "KEY_Tab"); - await typeWithTerminator("Tue, 25 Dec 2040 12:00:00 GMT", "KEY_Tab"); - await typeWithTerminator("test6value", "KEY_Tab"); - await typeWithTerminator("false", "KEY_Tab"); - await typeWithTerminator("false", "KEY_Tab"); + yield startCellEdit(id, "name"); + yield typeWithTerminator("test6", "KEY_Tab"); + yield typeWithTerminator(".example.org", "KEY_Tab"); + yield typeWithTerminator("/", "KEY_Tab"); + yield typeWithTerminator("Tue, 25 Dec 2040 12:00:00 GMT", "KEY_Tab"); + yield typeWithTerminator("test6value", "KEY_Tab"); + yield typeWithTerminator("false", "KEY_Tab"); + yield typeWithTerminator("false", "KEY_Tab"); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_cookies_samesite.js b/devtools/client/storage/test/browser_storage_cookies_samesite.js index 1417072487ba..bde7be1607f5 100644 --- a/devtools/client/storage/test/browser_storage_cookies_samesite.js +++ b/devtools/client/storage/test/browser_storage_cookies_samesite.js @@ -8,8 +8,8 @@ // Test that the samesite cookie attribute is displayed correctly. -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies-samesite.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies-samesite.html"); let id1 = getCookieId("test1", "test1.example.org", "/browser/devtools/client/storage/test/"); @@ -18,7 +18,7 @@ add_task(async function () { let id3 = getCookieId("test3", "test1.example.org", "/browser/devtools/client/storage/test/"); - await checkState([ + yield checkState([ [ ["cookies", "http://test1.example.org"], [ id1, id2, id3 ] @@ -33,5 +33,5 @@ add_task(async function () { is(sameSite2, "Lax", `sameSite2 is "Lax"`); is(sameSite3, "Strict", `sameSite3 is "Strict"`); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_cookies_tab_navigation.js b/devtools/client/storage/test/browser_storage_cookies_tab_navigation.js index 5e320ca97ac4..5da359b8d643 100644 --- a/devtools/client/storage/test/browser_storage_cookies_tab_navigation.js +++ b/devtools/client/storage/test/browser_storage_cookies_tab_navigation.js @@ -6,12 +6,12 @@ "use strict"; -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies.html"); showAllColumns(true); let id = getCookieId("test1", ".test1.example.org", "/browser"); - await startCellEdit(id, "name"); + yield startCellEdit(id, "name"); PressKeyXTimes("VK_TAB", 18); is(getCurrentEditorValue(), "value3", @@ -21,5 +21,5 @@ add_task(async function () { is(getCurrentEditorValue(), "test1", "We have shift-tabbed to the correct cell."); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_delete.js b/devtools/client/storage/test/browser_storage_delete.js index b0d46046080d..f154c6a6827c 100644 --- a/devtools/client/storage/test/browser_storage_delete.js +++ b/devtools/client/storage/test/browser_storage_delete.js @@ -23,8 +23,8 @@ const TEST_CASES = [ MAIN_DOMAIN + "404_cached_file.js", "url"], ]; -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); let contextMenu = gPanelWindow.document.getElementById("storage-table-popup"); let menuDeleteItem = contextMenu.querySelector("#storage-table-popup-delete"); @@ -33,14 +33,14 @@ add_task(async function () { let treeItemName = treeItem.join(" > "); info(`Selecting tree item ${treeItemName}`); - await selectTreeItem(treeItem); + yield selectTreeItem(treeItem); let row = getRowCells(rowName); ok(gUI.table.items.has(rowName), `There is a row '${rowName}' in ${treeItemName}`); let eventWait = gUI.once("store-objects-updated"); - await waitForContextMenu(contextMenu, row[cellToClick], () => { + yield waitForContextMenu(contextMenu, row[cellToClick], () => { info(`Opened context menu in ${treeItemName}, row '${rowName}'`); menuDeleteItem.click(); let truncatedRowName = String(rowName).replace(SEPARATOR_GUID, "-").substr(0, 16); @@ -48,11 +48,11 @@ add_task(async function () { `Context menu item label contains '${rowName}' (maybe truncated)`); }); - await eventWait; + yield eventWait; ok(!gUI.table.items.has(rowName), `There is no row '${rowName}' in ${treeItemName} after deletion`); } - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_delete_all.js b/devtools/client/storage/test/browser_storage_delete_all.js index c427266cee82..9fd6b3f01fa2 100644 --- a/devtools/client/storage/test/browser_storage_delete_all.js +++ b/devtools/client/storage/test/browser_storage_delete_all.js @@ -8,8 +8,8 @@ // Test deleting all storage items -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); let contextMenu = gPanelWindow.document.getElementById("storage-table-popup"); let menuDeleteAllItem = contextMenu.querySelector( @@ -35,7 +35,7 @@ add_task(async function () { [MAIN_DOMAIN + "404_cached_file.js", MAIN_DOMAIN + "browser_storage_basic.js"]], ]; - await checkState(beforeState); + yield checkState(beforeState); info("do the delete"); const deleteHosts = [ @@ -49,17 +49,17 @@ add_task(async function () { for (let [store, rowName, cellToClick] of deleteHosts) { let storeName = store.join(" > "); - await selectTreeItem(store); + yield selectTreeItem(store); let eventWait = gUI.once("store-objects-cleared"); let cell = getRowCells(rowName)[cellToClick]; - await waitForContextMenu(contextMenu, cell, () => { + yield waitForContextMenu(contextMenu, cell, () => { info(`Opened context menu in ${storeName}, row '${rowName}'`); menuDeleteAllItem.click(); }); - await eventWait; + yield eventWait; } info("test state after delete"); @@ -84,7 +84,7 @@ add_task(async function () { []], ]; - await checkState(afterState); + yield checkState(afterState); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_delete_tree.js b/devtools/client/storage/test/browser_storage_delete_tree.js index a7570a211544..32fd410a0d84 100644 --- a/devtools/client/storage/test/browser_storage_delete_tree.js +++ b/devtools/client/storage/test/browser_storage_delete_tree.js @@ -8,15 +8,15 @@ // Test deleting all storage items from the tree. -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); let contextMenu = gPanelWindow.document.getElementById("storage-tree-popup"); let menuDeleteAllItem = contextMenu.querySelector( "#storage-tree-popup-delete-all"); info("test state before delete"); - await checkState([ + yield checkState([ [ ["cookies", "http://test1.example.org"], [ @@ -47,7 +47,7 @@ add_task(async function () { for (let store of deleteHosts) { let storeName = store.join(" > "); - await selectTreeItem(store); + yield selectTreeItem(store); let eventName = "store-objects-" + (store[0] == "cookies" ? "updated" : "cleared"); @@ -56,16 +56,16 @@ add_task(async function () { let selector = `[data-id='${JSON.stringify(store)}'] > .tree-widget-item`; let target = gPanelWindow.document.querySelector(selector); ok(target, `tree item found in ${storeName}`); - await waitForContextMenu(contextMenu, target, () => { + yield waitForContextMenu(contextMenu, target, () => { info(`Opened tree context menu in ${storeName}`); menuDeleteAllItem.click(); }); - await eventWait; + yield eventWait; } info("test state after delete"); - await checkState([ + yield checkState([ [["cookies", "http://test1.example.org"], []], [["localStorage", "http://test1.example.org"], []], [["sessionStorage", "http://test1.example.org"], []], @@ -73,5 +73,5 @@ add_task(async function () { [["Cache", "http://test1.example.org", "plop"], []], ]); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_delete_usercontextid.js b/devtools/client/storage/test/browser_storage_delete_usercontextid.js index 988fda8945f9..c9b84771b51d 100644 --- a/devtools/client/storage/test/browser_storage_delete_usercontextid.js +++ b/devtools/client/storage/test/browser_storage_delete_usercontextid.js @@ -105,7 +105,7 @@ function testTree(tests) { /** * Test that correct table entries are shown for each of the tree item */ -async function testTables(tests) { +function* testTables(tests) { let doc = gPanelWindow.document; // Expand all nodes so that the synthesized click event actually works gUI.tree.expandAll(); @@ -118,7 +118,7 @@ async function testTables(tests) { // Click rest of the tree items and wait for the table to be updated for (let [treeItem, items] of tests.slice(1)) { - await selectTreeItem(treeItem); + yield selectTreeItem(treeItem); // Check whether correct number of items are present in the table is(doc.querySelectorAll( @@ -133,14 +133,14 @@ async function testTables(tests) { } } -add_task(async function () { +add_task(function* () { // First, open a tab with the default userContextId and setup its storages. - let tabDefault = await openTab(MAIN_DOMAIN + "storage-listings.html"); + let tabDefault = yield openTab(MAIN_DOMAIN + "storage-listings.html"); // Second, start testing for userContextId 1. // We use the same item name as the default page has to see deleting items // from userContextId 1 will affect default one or not. - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html", {userContextId: 1}); + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html", {userContextId: 1}); let contextMenu = gPanelWindow.document.getElementById("storage-table-popup"); let menuDeleteItem = contextMenu.querySelector("#storage-table-popup-delete"); @@ -149,14 +149,14 @@ add_task(async function () { let treeItemName = treeItem.join(" > "); info(`Selecting tree item ${treeItemName}`); - await selectTreeItem(treeItem); + yield selectTreeItem(treeItem); let row = getRowCells(rowName); ok(gUI.table.items.has(rowName), `There is a row '${rowName}' in ${treeItemName}`); let eventWait = gUI.once("store-objects-updated"); - await waitForContextMenu(contextMenu, row[cellToClick], () => { + yield waitForContextMenu(contextMenu, row[cellToClick], () => { info(`Opened context menu in ${treeItemName}, row '${rowName}'`); menuDeleteItem.click(); let truncatedRowName = String(rowName).replace(SEPARATOR_GUID, "-").substr(0, 16); @@ -164,18 +164,18 @@ add_task(async function () { `Context menu item label contains '${rowName}' (maybe truncated)`); }); - await eventWait; + yield eventWait; ok(!gUI.table.items.has(rowName), `There is no row '${rowName}' in ${treeItemName} after deletion`); } // Final, we see that the default tab is intact or not. - await BrowserTestUtils.switchTab(gBrowser, tabDefault); - await openStoragePanel(); + yield BrowserTestUtils.switchTab(gBrowser, tabDefault); + yield openStoragePanel(); testTree(storageItemsForDefault); - await testTables(storageItemsForDefault); + yield testTables(storageItemsForDefault); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_dom_cache_disabled.js b/devtools/client/storage/test/browser_storage_dom_cache_disabled.js index 2817e8df9132..27f9971a3f02 100644 --- a/devtools/client/storage/test/browser_storage_dom_cache_disabled.js +++ b/devtools/client/storage/test/browser_storage_dom_cache_disabled.js @@ -8,11 +8,11 @@ // Test the storage inspector when dom.caches.enabled=false. -add_task(async function () { +add_task(function* () { // Disable the DOM cache Services.prefs.setBoolPref(DOM_CACHE, false); - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); const state = [ [["localStorage", "http://test1.example.org"], @@ -31,7 +31,7 @@ add_task(async function () { [1, 2, 3]], ]; - await checkState(state); + yield checkState(state); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_dynamic_updates_cookies.js b/devtools/client/storage/test/browser_storage_dynamic_updates_cookies.js index 6fb4d2a3f57b..b4ab388e8820 100644 --- a/devtools/client/storage/test/browser_storage_dynamic_updates_cookies.js +++ b/devtools/client/storage/test/browser_storage_dynamic_updates_cookies.js @@ -6,14 +6,14 @@ // Test dynamic updates in the storage inspector for cookies. -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-updates.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-updates.html"); gUI.tree.expandAll(); ok(gUI.sidebar.hidden, "Sidebar is initially hidden"); let c1id = getCookieId("c1", "test1.example.org", "/browser"); - await selectTableItem(c1id); + yield selectTableItem(c1id); // test that value is something initially let initialValue = [[ @@ -36,12 +36,12 @@ add_task(async function () { ]]; // Check that sidebar shows correct initial value - await findVariableViewProperties(initialValue[0], false); + yield findVariableViewProperties(initialValue[0], false); - await findVariableViewProperties(initialValue[1], true); + yield findVariableViewProperties(initialValue[1], true); // Check if table shows correct initial value - await checkState([ + yield checkState([ [ ["cookies", "http://test1.example.org"], [ @@ -53,13 +53,13 @@ add_task(async function () { checkCell(c1id, "value", "1.2.3.4.5.6.7"); gWindow.addCookie("c1", '{"foo": 4,"bar":6}', "/browser"); - await gUI.once("sidebar-updated"); - await gUI.once("store-objects-updated"); + yield gUI.once("sidebar-updated"); + yield gUI.once("store-objects-updated"); - await findVariableViewProperties(finalValue[0], false); - await findVariableViewProperties(finalValue[1], true); + yield findVariableViewProperties(finalValue[0], false); + yield findVariableViewProperties(finalValue[1], true); - await checkState([ + yield checkState([ [ ["cookies", "http://test1.example.org"], [ @@ -73,9 +73,9 @@ add_task(async function () { // Add a new entry gWindow.addCookie("c3", "booyeah"); - await gUI.once("store-objects-updated"); + yield gUI.once("store-objects-updated"); - await checkState([ + yield checkState([ [ ["cookies", "http://test1.example.org"], [ @@ -94,10 +94,10 @@ add_task(async function () { gWindow.addCookie("c4", "booyeah"); // Wait once for update and another time for value fetching - await gUI.once("store-objects-updated"); - await gUI.once("store-objects-updated"); + yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-updated"); - await checkState([ + yield checkState([ [ ["cookies", "http://test1.example.org"], [ @@ -117,10 +117,10 @@ add_task(async function () { // Removing cookies gWindow.removeCookie("c1", "/browser"); - await gUI.once("sidebar-updated"); - await gUI.once("store-objects-updated"); + yield gUI.once("sidebar-updated"); + yield gUI.once("store-objects-updated"); - await checkState([ + yield checkState([ [ ["cookies", "http://test1.example.org"], [ @@ -136,14 +136,14 @@ add_task(async function () { ok(!gUI.sidebar.hidden, "Sidebar still visible for next row"); // Check if next element's value is visible in sidebar - await findVariableViewProperties([{name: "c2", value: "foobar"}]); + yield findVariableViewProperties([{name: "c2", value: "foobar"}]); // Keep deleting till no rows gWindow.removeCookie("c3"); - await gUI.once("store-objects-updated"); + yield gUI.once("store-objects-updated"); - await checkState([ + yield checkState([ [ ["cookies", "http://test1.example.org"], [ @@ -155,14 +155,14 @@ add_task(async function () { ]); // Check if next element's value is visible in sidebar - await findVariableViewProperties([{name: "c2", value: "foobar"}]); + yield findVariableViewProperties([{name: "c2", value: "foobar"}]); gWindow.removeCookie("c2", "/browser"); - await gUI.once("sidebar-updated"); - await gUI.once("store-objects-updated"); + yield gUI.once("sidebar-updated"); + yield gUI.once("store-objects-updated"); - await checkState([ + yield checkState([ [ ["cookies", "http://test1.example.org"], [ @@ -173,17 +173,17 @@ add_task(async function () { ]); // Check if next element's value is visible in sidebar - await findVariableViewProperties([{name: "c4", value: "booyeah"}]); + yield findVariableViewProperties([{name: "c4", value: "booyeah"}]); gWindow.removeCookie("c4"); - await gUI.once("store-objects-updated"); + yield gUI.once("store-objects-updated"); - await checkState([ + yield checkState([ [["cookies", "http://test1.example.org"], [ ]], ]); ok(gUI.sidebar.hidden, "Sidebar is hidden when no rows"); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_dynamic_updates_localStorage.js b/devtools/client/storage/test/browser_storage_dynamic_updates_localStorage.js index b93fe3b2911d..6980e3e55444 100644 --- a/devtools/client/storage/test/browser_storage_dynamic_updates_localStorage.js +++ b/devtools/client/storage/test/browser_storage_dynamic_updates_localStorage.js @@ -6,14 +6,14 @@ // Test dynamic updates in the storage inspector for localStorage. -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-updates.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-updates.html"); gUI.tree.expandAll(); ok(gUI.sidebar.hidden, "Sidebar is initially hidden"); - await checkState([ + yield checkState([ [ ["localStorage", "http://test1.example.org"], ["ls1", "ls2", "ls3", "ls4", "ls5", "ls6", "ls7"] @@ -22,9 +22,9 @@ add_task(async function () { gWindow.localStorage.removeItem("ls4"); - await gUI.once("store-objects-updated"); + yield gUI.once("store-objects-updated"); - await checkState([ + yield checkState([ [ ["localStorage", "http://test1.example.org"], ["ls1", "ls2", "ls3", "ls5", "ls6", "ls7"] @@ -33,10 +33,10 @@ add_task(async function () { gWindow.localStorage.setItem("ls4", "again"); - await gUI.once("store-objects-updated"); - await gUI.once("store-objects-updated"); + yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-updated"); - await checkState([ + yield checkState([ [ ["localStorage", "http://test1.example.org"], ["ls1", "ls2", "ls3", "ls4", "ls5", "ls6", "ls7"] @@ -45,24 +45,24 @@ add_task(async function () { // Updating a row gWindow.localStorage.setItem("ls2", "ls2-changed"); - await gUI.once("store-objects-updated"); - await gUI.once("store-objects-updated"); + yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-updated"); checkCell("ls2", "value", "ls2-changed"); // Clearing items. - await ContentTask.spawn(gBrowser.selectedBrowser, null, function () { + yield ContentTask.spawn(gBrowser.selectedBrowser, null, function () { content.wrappedJSObject.clear(); }); - await gUI.once("store-objects-cleared"); + yield gUI.once("store-objects-cleared"); - await checkState([ + yield checkState([ [ ["localStorage", "http://test1.example.org"], [ ] ], ]); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_dynamic_updates_sessionStorage.js b/devtools/client/storage/test/browser_storage_dynamic_updates_sessionStorage.js index c00a6cb0e14d..bc2a2204cef9 100644 --- a/devtools/client/storage/test/browser_storage_dynamic_updates_sessionStorage.js +++ b/devtools/client/storage/test/browser_storage_dynamic_updates_sessionStorage.js @@ -6,14 +6,14 @@ // Test dynamic updates in the storage inspector for sessionStorage. -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-updates.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-updates.html"); gUI.tree.expandAll(); ok(gUI.sidebar.hidden, "Sidebar is initially hidden"); - await checkState([ + yield checkState([ [ ["sessionStorage", "http://test1.example.org"], ["ss1", "ss2", "ss3"] @@ -22,10 +22,10 @@ add_task(async function () { gWindow.sessionStorage.setItem("ss4", "new-item"); - await gUI.once("store-objects-updated"); - await gUI.once("store-objects-updated"); + yield gUI.once("store-objects-updated"); + yield gUI.once("store-objects-updated"); - await checkState([ + yield checkState([ [ ["sessionStorage", "http://test1.example.org"], ["ss1", "ss2", "ss3", "ss4"] @@ -36,47 +36,47 @@ add_task(async function () { gWindow.sessionStorage.removeItem("ss3"); - await gUI.once("store-objects-updated"); + yield gUI.once("store-objects-updated"); gWindow.sessionStorage.removeItem("ss1"); - await gUI.once("store-objects-updated"); + yield gUI.once("store-objects-updated"); - await checkState([ + yield checkState([ [ ["sessionStorage", "http://test1.example.org"], ["ss2", "ss4"] ], ]); - await selectTableItem("ss2"); + yield selectTableItem("ss2"); ok(!gUI.sidebar.hidden, "sidebar is visible"); // Checking for correct value in sidebar before update - await findVariableViewProperties([{name: "ss2", value: "foobar"}]); + yield findVariableViewProperties([{name: "ss2", value: "foobar"}]); gWindow.sessionStorage.setItem("ss2", "changed=ss2"); - await gUI.once("sidebar-updated"); + yield gUI.once("sidebar-updated"); checkCell("ss2", "value", "changed=ss2"); - await findVariableViewProperties([{name: "ss2", value: "changed=ss2"}]); + yield findVariableViewProperties([{name: "ss2", value: "changed=ss2"}]); // Clearing items. - await ContentTask.spawn(gBrowser.selectedBrowser, null, function () { + yield ContentTask.spawn(gBrowser.selectedBrowser, null, function () { content.wrappedJSObject.clear(); }); - await gUI.once("store-objects-cleared"); + yield gUI.once("store-objects-cleared"); - await checkState([ + yield checkState([ [ ["sessionStorage", "http://test1.example.org"], [ ] ], ]); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_empty_objectstores.js b/devtools/client/storage/test/browser_storage_empty_objectstores.js index 83b344be0931..e6f259742771 100644 --- a/devtools/client/storage/test/browser_storage_empty_objectstores.js +++ b/devtools/client/storage/test/browser_storage_empty_objectstores.js @@ -46,14 +46,14 @@ function testTree() { /** * Test that correct table entries are shown for each of the tree item */ -let testTables = async function () { +let testTables = function* () { let doc = gPanelWindow.document; // Expand all nodes so that the synthesized click event actually works gUI.tree.expandAll(); // Click the tree items and wait for the table to be updated for (let [item, ids] of storeItems) { - await selectTreeItem(item); + yield selectTreeItem(item); // Check whether correct number of items are present in the table is(doc.querySelectorAll( @@ -68,10 +68,10 @@ let testTables = async function () { } }; -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-empty-objectstores.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-empty-objectstores.html"); testTree(); - await testTables(); - await finishTests(); + yield testTables(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_indexeddb_delete.js b/devtools/client/storage/test/browser_storage_indexeddb_delete.js index ec810ea38e2e..b4f5db7ed63e 100644 --- a/devtools/client/storage/test/browser_storage_indexeddb_delete.js +++ b/devtools/client/storage/test/browser_storage_indexeddb_delete.js @@ -8,21 +8,21 @@ // Test deleting indexedDB database from the tree using context menu -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-empty-objectstores.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-empty-objectstores.html"); let contextMenu = gPanelWindow.document.getElementById("storage-tree-popup"); let menuDeleteDb = contextMenu.querySelector("#storage-tree-popup-delete"); info("test state before delete"); - await checkState([ + yield checkState([ [["indexedDB", "http://test1.example.org"], ["idb1 (default)", "idb2 (default)"]], ]); info("do the delete"); const deletedDb = ["indexedDB", "http://test1.example.org", "idb1 (default)"]; - await selectTreeItem(deletedDb); + yield selectTreeItem(deletedDb); // Wait once for update and another time for value fetching let eventWait = gUI.once("store-objects-updated").then( @@ -31,17 +31,17 @@ add_task(async function () { let selector = `[data-id='${JSON.stringify(deletedDb)}'] > .tree-widget-item`; let target = gPanelWindow.document.querySelector(selector); ok(target, `tree item found in ${deletedDb.join(" > ")}`); - await waitForContextMenu(contextMenu, target, () => { + yield waitForContextMenu(contextMenu, target, () => { info(`Opened tree context menu in ${deletedDb.join(" > ")}`); menuDeleteDb.click(); }); - await eventWait; + yield eventWait; info("test state after delete"); - await checkState([ + yield checkState([ [["indexedDB", "http://test1.example.org"], ["idb2 (default)"]], ]); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_indexeddb_delete_blocked.js b/devtools/client/storage/test/browser_storage_indexeddb_delete_blocked.js index bb9a0a520d8f..b4c42bf288d0 100644 --- a/devtools/client/storage/test/browser_storage_indexeddb_delete_blocked.js +++ b/devtools/client/storage/test/browser_storage_indexeddb_delete_blocked.js @@ -8,51 +8,51 @@ // Test what happens when deleting indexedDB database is blocked -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-idb-delete-blocked.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-idb-delete-blocked.html"); info("test state before delete"); - await checkState([ + yield checkState([ [["indexedDB", "http://test1.example.org"], ["idb (default)"]] ]); info("do the delete"); - await selectTreeItem(["indexedDB", "http://test1.example.org"]); + yield selectTreeItem(["indexedDB", "http://test1.example.org"]); let front = gUI.getCurrentFront(); - let result = await front.removeDatabase("http://test1.example.org", "idb (default)"); + let result = yield front.removeDatabase("http://test1.example.org", "idb (default)"); ok(result.blocked, "removeDatabase attempt is blocked"); info("test state after blocked delete"); - await checkState([ + yield checkState([ [["indexedDB", "http://test1.example.org"], ["idb (default)"]] ]); let eventWait = gUI.once("store-objects-updated"); info("telling content to close the db"); - await ContentTask.spawn(gBrowser.selectedBrowser, null, async function () { + yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () { let win = content.wrappedJSObject; - await win.closeDb(); + yield win.closeDb(); }); info("waiting for store update events"); - await eventWait; + yield eventWait; info("test state after real delete"); - await checkState([ + yield checkState([ [["indexedDB", "http://test1.example.org"], []] ]); info("try to delete database from nonexistent host"); let errorThrown = false; try { - result = await front.removeDatabase("http://test2.example.org", "idb (default)"); + result = yield front.removeDatabase("http://test2.example.org", "idb (default)"); } catch (ex) { errorThrown = true; } ok(errorThrown, "error was reported when trying to delete"); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_indexeddb_duplicate_names.js b/devtools/client/storage/test/browser_storage_indexeddb_duplicate_names.js index 7a2e1afd882a..8316d22c5424 100644 --- a/devtools/client/storage/test/browser_storage_indexeddb_duplicate_names.js +++ b/devtools/client/storage/test/browser_storage_indexeddb_duplicate_names.js @@ -7,14 +7,14 @@ "use strict"; -add_task(async function () { +add_task(function* () { const TESTPAGE = MAIN_DOMAIN + "storage-indexeddb-duplicate-names.html"; setPermission(TESTPAGE, "indexedDB"); - await openTabAndSetupStorage(TESTPAGE); + yield openTabAndSetupStorage(TESTPAGE); - await checkState([ + yield checkState([ [ ["indexedDB", "http://test1.example.org"], [ "idb1 (default)", @@ -27,5 +27,5 @@ add_task(async function () { ] ]); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_localstorage_add.js b/devtools/client/storage/test/browser_storage_localstorage_add.js index 9f489fc25dc2..de40957b8848 100644 --- a/devtools/client/storage/test/browser_storage_localstorage_add.js +++ b/devtools/client/storage/test/browser_storage_localstorage_add.js @@ -6,15 +6,15 @@ "use strict"; -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-localstorage.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-localstorage.html"); showAllColumns(true); - await performAdd(["localStorage", "http://test1.example.org"]); - await performAdd(["localStorage", "http://test1.example.org"]); - await performAdd(["localStorage", "http://test1.example.org"]); - await performAdd(["localStorage", "http://test1.example.org"]); - await performAdd(["localStorage", "http://test1.example.org"]); + yield performAdd(["localStorage", "http://test1.example.org"]); + yield performAdd(["localStorage", "http://test1.example.org"]); + yield performAdd(["localStorage", "http://test1.example.org"]); + yield performAdd(["localStorage", "http://test1.example.org"]); + yield performAdd(["localStorage", "http://test1.example.org"]); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_localstorage_edit.js b/devtools/client/storage/test/browser_storage_localstorage_edit.js index 54baa392cdf3..86409e0ac626 100644 --- a/devtools/client/storage/test/browser_storage_localstorage_edit.js +++ b/devtools/client/storage/test/browser_storage_localstorage_edit.js @@ -6,19 +6,19 @@ "use strict"; -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-localstorage.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-localstorage.html"); - await selectTreeItem(["localStorage", "http://test1.example.org"]); + yield selectTreeItem(["localStorage", "http://test1.example.org"]); - await editCell("TestLS1", "name", "newTestLS1"); - await editCell("newTestLS1", "value", "newValueLS1"); + yield editCell("TestLS1", "name", "newTestLS1"); + yield editCell("newTestLS1", "value", "newValueLS1"); - await editCell("TestLS3", "name", "newTestLS3"); - await editCell("newTestLS3", "value", "newValueLS3"); + yield editCell("TestLS3", "name", "newTestLS3"); + yield editCell("newTestLS3", "value", "newValueLS3"); - await editCell("TestLS5", "name", "newTestLS5"); - await editCell("newTestLS5", "value", "newValueLS5"); + yield editCell("TestLS5", "name", "newTestLS5"); + yield editCell("newTestLS5", "value", "newValueLS5"); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_localstorage_error.js b/devtools/client/storage/test/browser_storage_localstorage_error.js index 70cb94e7b979..923ca6ca958b 100644 --- a/devtools/client/storage/test/browser_storage_localstorage_error.js +++ b/devtools/client/storage/test/browser_storage_localstorage_error.js @@ -7,8 +7,8 @@ // Test that for pages where local/sessionStorage is not available (like about:home), // the host still appears in the storage tree and no unhandled exception is thrown. -add_task(async function () { - await openTabAndSetupStorage("about:home"); +add_task(function* () { + yield openTabAndSetupStorage("about:home"); let itemsToOpen = [ ["localStorage", "about:home"], @@ -16,9 +16,9 @@ add_task(async function () { ]; for (let item of itemsToOpen) { - await selectTreeItem(item); + yield selectTreeItem(item); ok(gUI.tree.isSelected(item), `Item ${item.join(" > ")} is present in the tree`); } - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_overflow.js b/devtools/client/storage/test/browser_storage_overflow.js index b2aad85416d9..0dd7f2551423 100644 --- a/devtools/client/storage/test/browser_storage_overflow.js +++ b/devtools/client/storage/test/browser_storage_overflow.js @@ -4,17 +4,17 @@ const ITEMS_PER_PAGE = 50; -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-overflow.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-overflow.html"); gUI.tree.expandAll(); - await selectTreeItem(["localStorage", "http://test1.example.org"]); + yield selectTreeItem(["localStorage", "http://test1.example.org"]); checkCellLength(ITEMS_PER_PAGE); - await scroll(); + yield scroll(); checkCellLength(ITEMS_PER_PAGE * 2); - await scroll(); + yield scroll(); checkCellLength(ITEMS_PER_PAGE * 3); // Check that the columns are sorted in a human readable way (ascending). @@ -26,7 +26,7 @@ add_task(async function () { // Check that the columns are sorted in a human readable way (descending). checkCellValues("DEC"); - await finishTests(); + yield finishTests(); }); function checkCellLength(len) { @@ -46,7 +46,7 @@ function checkCellValues(order) { }); } -async function scroll() { +function* scroll() { let $ = id => gPanelWindow.document.querySelector(id); let table = $("#storage-table .table-widget-body"); let cell = $("#name .table-widget-cell"); @@ -54,5 +54,5 @@ async function scroll() { let onStoresUpdate = gUI.once("store-objects-updated"); table.scrollTop += cellHeight * 50; - await onStoresUpdate; + yield onStoresUpdate; } diff --git a/devtools/client/storage/test/browser_storage_search.js b/devtools/client/storage/test/browser_storage_search.js index 445515fa0009..148f2eeb5e77 100644 --- a/devtools/client/storage/test/browser_storage_search.js +++ b/devtools/client/storage/test/browser_storage_search.js @@ -1,11 +1,11 @@ // Tests the filter search box in the storage inspector "use strict"; -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-search.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-search.html"); gUI.tree.expandAll(); - await selectTreeItem(["cookies", "http://test1.example.org"]); + yield selectTreeItem(["cookies", "http://test1.example.org"]); showColumn("expires", false); showColumn("host", false); @@ -113,7 +113,7 @@ add_task(async function () { showColumn("value", false); runTests(testcasesAfterHiding); - await finishTests(); + yield finishTests(); }); function runTests(testcases) { diff --git a/devtools/client/storage/test/browser_storage_search_keyboard_trap.js b/devtools/client/storage/test/browser_storage_search_keyboard_trap.js index c74cd1737aad..71dfd32c0030 100644 --- a/devtools/client/storage/test/browser_storage_search_keyboard_trap.js +++ b/devtools/client/storage/test/browser_storage_search_keyboard_trap.js @@ -1,15 +1,15 @@ // Test ability to focus search field by using keyboard "use strict"; -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-search.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-search.html"); gUI.tree.expandAll(); - await selectTreeItem(["localStorage", "http://test1.example.org"]); + yield selectTreeItem(["localStorage", "http://test1.example.org"]); - await focusSearchBoxUsingShortcut(gPanelWindow); + yield focusSearchBoxUsingShortcut(gPanelWindow); ok(containsFocus(gPanelWindow.document, gUI.searchBox), "Focus is in a searchbox"); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_sessionstorage_add.js b/devtools/client/storage/test/browser_storage_sessionstorage_add.js index 974f4dbc55c1..8f220bc81eb9 100644 --- a/devtools/client/storage/test/browser_storage_sessionstorage_add.js +++ b/devtools/client/storage/test/browser_storage_sessionstorage_add.js @@ -6,15 +6,15 @@ "use strict"; -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-sessionstorage.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-sessionstorage.html"); showAllColumns(true); - await performAdd(["sessionStorage", "http://test1.example.org"]); - await performAdd(["sessionStorage", "http://test1.example.org"]); - await performAdd(["sessionStorage", "http://test1.example.org"]); - await performAdd(["sessionStorage", "http://test1.example.org"]); - await performAdd(["sessionStorage", "http://test1.example.org"]); + yield performAdd(["sessionStorage", "http://test1.example.org"]); + yield performAdd(["sessionStorage", "http://test1.example.org"]); + yield performAdd(["sessionStorage", "http://test1.example.org"]); + yield performAdd(["sessionStorage", "http://test1.example.org"]); + yield performAdd(["sessionStorage", "http://test1.example.org"]); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_sessionstorage_edit.js b/devtools/client/storage/test/browser_storage_sessionstorage_edit.js index 8405f57dbf7d..9629eec0b523 100644 --- a/devtools/client/storage/test/browser_storage_sessionstorage_edit.js +++ b/devtools/client/storage/test/browser_storage_sessionstorage_edit.js @@ -6,19 +6,19 @@ "use strict"; -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-sessionstorage.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-sessionstorage.html"); - await selectTreeItem(["sessionStorage", "http://test1.example.org"]); + yield selectTreeItem(["sessionStorage", "http://test1.example.org"]); - await editCell("TestSS1", "name", "newTestSS1"); - await editCell("newTestSS1", "value", "newValueSS1"); + yield editCell("TestSS1", "name", "newTestSS1"); + yield editCell("newTestSS1", "value", "newValueSS1"); - await editCell("TestSS3", "name", "newTestSS3"); - await editCell("newTestSS3", "value", "newValueSS3"); + yield editCell("TestSS3", "name", "newTestSS3"); + yield editCell("newTestSS3", "value", "newValueSS3"); - await editCell("TestSS5", "name", "newTestSS5"); - await editCell("newTestSS5", "value", "newValueSS5"); + yield editCell("TestSS5", "name", "newTestSS5"); + yield editCell("newTestSS5", "value", "newValueSS5"); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_sidebar.js b/devtools/client/storage/test/browser_storage_sidebar.js index 820aacc452f0..bc5f130d7b91 100644 --- a/devtools/client/storage/test/browser_storage_sidebar.js +++ b/devtools/client/storage/test/browser_storage_sidebar.js @@ -97,8 +97,8 @@ const testCases = [ } ]; -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); for (let test of testCases) { let { location, sidebarHidden, sendEscape } = test; @@ -106,9 +106,9 @@ add_task(async function () { info("running " + JSON.stringify(test)); if (Array.isArray(location)) { - await selectTreeItem(location); + yield selectTreeItem(location); } else if (location) { - await selectTableItem(location); + yield selectTableItem(location); } if (sendEscape) { @@ -121,5 +121,5 @@ add_task(async function () { info("-".repeat(80)); } - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_sidebar_toggle.js b/devtools/client/storage/test/browser_storage_sidebar_toggle.js index c69beb3e6276..cecc67c15b1b 100644 --- a/devtools/client/storage/test/browser_storage_sidebar_toggle.js +++ b/devtools/client/storage/test/browser_storage_sidebar_toggle.js @@ -26,8 +26,8 @@ const testCases = [ } ]; -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); for (let test of testCases) { let { location, sidebarHidden, clickToggle, toggleButtonVisible } = test; @@ -35,9 +35,9 @@ add_task(async function () { info("running " + JSON.stringify(test)); if (Array.isArray(location)) { - await selectTreeItem(location); + yield selectTreeItem(location); } else if (location) { - await selectTableItem(location); + yield selectTableItem(location); } if (clickToggle) { @@ -53,5 +53,5 @@ add_task(async function () { info("-".repeat(80)); } - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_sidebar_update.js b/devtools/client/storage/test/browser_storage_sidebar_update.js index 992f457f242d..92547815a425 100644 --- a/devtools/client/storage/test/browser_storage_sidebar_update.js +++ b/devtools/client/storage/test/browser_storage_sidebar_update.js @@ -8,16 +8,16 @@ "use strict"; -add_task(async function () { +add_task(function* () { const ITEM_NAME = "ls1"; const UPDATE_COUNT = 3; - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-complex-values.html"); + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-complex-values.html"); let updated = gUI.once("sidebar-updated"); - await selectTreeItem(["localStorage", "http://test1.example.org"]); - await selectTableItem(ITEM_NAME); - await updated; + yield selectTreeItem(["localStorage", "http://test1.example.org"]); + yield selectTableItem(ITEM_NAME); + yield updated; is(gUI.sidebar.hidden, false, "sidebar is visible"); @@ -28,7 +28,7 @@ add_task(async function () { updates.push(gUI.once("sidebar-updated")); gUI.updateObjectSidebar(); } - await promise.all(updates); + yield promise.all(updates); info("Updates performed, going to verify result"); let parsedScope = gUI.view.getScopeAtIndex(1); @@ -37,5 +37,5 @@ add_task(async function () { is(elements.length, 1, `There is only one displayed variable named '${ITEM_NAME}'`); - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/browser_storage_values.js b/devtools/client/storage/test/browser_storage_values.js index 748ece67634b..1d3e9ff76e7b 100644 --- a/devtools/client/storage/test/browser_storage_values.js +++ b/devtools/client/storage/test/browser_storage_values.js @@ -147,8 +147,8 @@ const testCases = [ ], true] ]; -add_task(async function () { - await openTabAndSetupStorage(MAIN_DOMAIN + "storage-complex-values.html"); +add_task(function* () { + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-complex-values.html"); gUI.tree.expandAll(); @@ -156,14 +156,14 @@ add_task(async function () { info("clicking for item " + item); if (Array.isArray(item[0])) { - await selectTreeItem(item[0]); + yield selectTreeItem(item[0]); continue; } else if (item[0]) { - await selectTableItem(item[0]); + yield selectTableItem(item[0]); } - await findVariableViewProperties(item[1], item[2]); + yield findVariableViewProperties(item[1], item[2]); } - await finishTests(); + yield finishTests(); }); diff --git a/devtools/client/storage/test/head.js b/devtools/client/storage/test/head.js index 041b5e364cea..5d51c855c09b 100644 --- a/devtools/client/storage/test/head.js +++ b/devtools/client/storage/test/head.js @@ -55,14 +55,14 @@ registerCleanupFunction(() => { * * @return {Promise} A promise that resolves after the tab is ready */ -async function openTab(url, options = {}) { - let tab = await addTab(url, options); +function* openTab(url, options = {}) { + let tab = yield addTab(url, options); let content = tab.linkedBrowser.contentWindowAsCPOW; gWindow = content.wrappedJSObject; // Setup the async storages in main window and for all its iframes - await ContentTask.spawn(gBrowser.selectedBrowser, null, async function () { + yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () { /** * Get all windows including frames recursively. * @@ -92,7 +92,7 @@ async function openTab(url, options = {}) { let readyState = win.document.readyState; info(`Found a window: ${readyState}`); if (readyState != "complete") { - await new Promise(resolve => { + yield new Promise(resolve => { let onLoad = () => { win.removeEventListener("load", onLoad); resolve(); @@ -101,7 +101,7 @@ async function openTab(url, options = {}) { }); } if (win.setup) { - await win.setup(); + yield win.setup(); } } }); @@ -120,12 +120,12 @@ async function openTab(url, options = {}) { * * @return {Promise} A promise that resolves after storage inspector is ready */ -async function openTabAndSetupStorage(url, options = {}) { +function* openTabAndSetupStorage(url, options = {}) { // open tab - await openTab(url, options); + yield openTab(url, options); // open storage inspector - return openStoragePanel(); + return yield openStoragePanel(); } /** @@ -136,7 +136,7 @@ async function openTabAndSetupStorage(url, options = {}) { * * @return {Promise} a promise that resolves when the storage inspector is ready */ -var openStoragePanel = async function (cb) { +var openStoragePanel = Task.async(function* (cb) { info("Opening the storage inspector"); let target = TargetFactory.forTab(gBrowser.selectedTab); @@ -165,7 +165,7 @@ var openStoragePanel = async function (cb) { } info("Opening the toolbox"); - toolbox = await gDevTools.showToolbox(target, "storage"); + toolbox = yield gDevTools.showToolbox(target, "storage"); storage = toolbox.getPanel("storage"); gPanelWindow = storage.panelWindow; gUI = storage.UI; @@ -176,9 +176,9 @@ var openStoragePanel = async function (cb) { gUI.animationsEnabled = false; info("Waiting for the stores to update"); - await gUI.once("store-objects-updated"); + yield gUI.once("store-objects-updated"); - await waitForToolboxFrameFocus(toolbox); + yield waitForToolboxFrameFocus(toolbox); if (cb) { return cb(storage, toolbox); @@ -188,7 +188,7 @@ var openStoragePanel = async function (cb) { toolbox: toolbox, storage: storage }; -}; +}); /** * Wait for the toolbox frame to receive focus after it loads @@ -218,11 +218,11 @@ function forceCollections() { /** * Cleans up and finishes the test */ -async function finishTests() { +function* finishTests() { // Bug 1233497 makes it so that we can no longer yield CPOWs from Tasks. // We work around this by calling clear() via a ContentTask instead. while (gBrowser.tabs.length > 1) { - await ContentTask.spawn(gBrowser.selectedBrowser, null, async function () { + yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () { /** * Get all windows including frames recursively. * @@ -258,12 +258,12 @@ async function finishTests() { } if (win.clear) { - await win.clear(); + yield win.clear(); } } }); - await closeTabAndToolbox(gBrowser.selectedTab); + yield closeTabAndToolbox(gBrowser.selectedTab); } Services.cookies.removeAll(); @@ -272,7 +272,7 @@ async function finishTests() { } // Sends a click event on the passed DOM node in an async manner -function click(node) { +function* click(node) { node.scrollIntoView(); return new Promise(resolve => { @@ -511,7 +511,7 @@ function matchVariablesViewProperty(prop, rule) { * @param {[String]} ids * The array id of the item in the tree */ -async function selectTreeItem(ids) { +function* selectTreeItem(ids) { /* If this item is already selected, return */ if (gUI.tree.isSelected(ids)) { return; @@ -519,7 +519,7 @@ async function selectTreeItem(ids) { let updated = gUI.once("store-objects-updated"); gUI.tree.selectedItem = ids; - await updated; + yield updated; } /** @@ -528,7 +528,7 @@ async function selectTreeItem(ids) { * @param {String} id * The id of the row in the table widget */ -async function selectTableItem(id) { +function* selectTableItem(id) { let table = gUI.table; let selector = ".table-widget-column#" + table.uniqueId + " .table-widget-cell[value='" + id + "']"; @@ -542,8 +542,8 @@ async function selectTableItem(id) { let updated = gUI.once("sidebar-updated"); - await click(target); - await updated; + yield click(target); + yield updated; } /** @@ -703,13 +703,13 @@ function getCellValue(id, column) { * @yield {String} * The uniqueId of the changed row. */ -async function editCell(id, column, newValue, validate = true) { +function* editCell(id, column, newValue, validate = true) { let row = getRowCells(id, true); let editableFieldsEngine = gUI.table._editableFieldsEngine; editableFieldsEngine.edit(row[column]); - await typeWithTerminator(newValue, "KEY_Enter", validate); + yield typeWithTerminator(newValue, "KEY_Enter", validate); } /** @@ -722,7 +722,7 @@ async function editCell(id, column, newValue, validate = true) { * @param {Boolean} selectText * Select text? Default true. */ -function startCellEdit(id, column, selectText = true) { +function* startCellEdit(id, column, selectText = true) { let row = getRowCells(id, true); let editableFieldsEngine = gUI.table._editableFieldsEngine; let cell = row[column]; @@ -812,7 +812,7 @@ function showAllColumns(state) { * @param {Boolean} validate * Validate result? Default true. */ -async function typeWithTerminator(str, terminator, validate = true) { +function* typeWithTerminator(str, terminator, validate = true) { let editableFieldsEngine = gUI.table._editableFieldsEngine; let textbox = editableFieldsEngine.textbox; let colName = textbox.closest(".table-widget-column").id; @@ -831,13 +831,13 @@ async function typeWithTerminator(str, terminator, validate = true) { if (validate) { info("Validating results... waiting for ROW_EDIT event."); - let uniqueId = await gUI.table.once(TableWidget.EVENTS.ROW_EDIT); + let uniqueId = yield gUI.table.once(TableWidget.EVENTS.ROW_EDIT); checkCell(uniqueId, colName, str); return uniqueId; } - return gUI.table.once(TableWidget.EVENTS.ROW_EDIT); + return yield gUI.table.once(TableWidget.EVENTS.ROW_EDIT); } function getCurrentEditorValue() { @@ -872,11 +872,11 @@ function PressKeyXTimes(key, x, modifiers = {}) { * "example.com" host in cookies and then verify there are "c1" and "c2" * cookies (and no other ones). */ -async function checkState(state) { +function* checkState(state) { for (let [store, names] of state) { let storeName = store.join(" > "); info(`Selecting tree item ${storeName}`); - await selectTreeItem(store); + yield selectTreeItem(store); let items = gUI.table.items; @@ -915,7 +915,7 @@ function containsFocus(doc, container) { return false; } -var focusSearchBoxUsingShortcut = async function (panelWin, callback) { +var focusSearchBoxUsingShortcut = Task.async(function* (panelWin, callback) { info("Focusing search box"); let searchBox = panelWin.document.getElementById("storage-searchbox"); let focused = once(searchBox, "focus"); @@ -925,12 +925,12 @@ var focusSearchBoxUsingShortcut = async function (panelWin, callback) { "chrome://devtools/locale/storage.properties"); synthesizeKeyShortcut(strings.GetStringFromName("storage.filter.key")); - await focused; + yield focused; if (callback) { callback(); } -}; +}); function getCookieId(name, domain, path) { return `${name}${SEPARATOR_GUID}${domain}${SEPARATOR_GUID}${path}`; @@ -962,12 +962,12 @@ function sidebarToggleVisible() { * An array containing the path to the store to which we wish to add an * item. */ -async function performAdd(store) { +function* performAdd(store) { let storeName = store.join(" > "); let toolbar = gPanelWindow.document.getElementById("storage-toolbar"); let type = store[0]; - await selectTreeItem(store); + yield selectTreeItem(store); let menuAdd = toolbar.querySelector( "#add-button"); @@ -983,8 +983,8 @@ async function performAdd(store) { menuAdd.click(); - let rowId = await eventEdit; - await eventWait; + let rowId = yield eventEdit; + yield eventWait; let key = type === "cookies" ? "uniqueKey" : "name"; let value = getCellValue(rowId, key); diff --git a/devtools/client/storage/test/storage-complex-values.html b/devtools/client/storage/test/storage-complex-values.html index 82faab8e09bb..91e04c6edf7c 100644 --- a/devtools/client/storage/test/storage-complex-values.html +++ b/devtools/client/storage/test/storage-complex-values.html @@ -1,4 +1,4 @@ - +