From 7255f6d6a5a5c62510dcd81713e91824f6d19b22 Mon Sep 17 00:00:00 2001 From: quasicomputational Date: Sat, 22 Dec 2018 19:41:19 +0000 Subject: [PATCH 01/10] Bug 1422235 - Implement the 'overflow-block' media query. r=emilio --HG-- extra : histedit_source : b65949871a5687780a199acc1151893766dada48 --- .../mq_overflow-block-ref.html | 6 +++ .../css-mediaqueries/mq_overflow-block.html | 28 +++++++++++++ .../mq_print_iframe_overflow-block-ref.html | 3 ++ .../mq_print_iframe_overflow-block.html | 3 ++ .../mq_print_overflow-block-ref.html | 7 ++++ .../mq_print_overflow-block.html | 29 +++++++++++++ layout/reftests/css-mediaqueries/reftest.list | 4 ++ .../components/style/gecko/media_features.rs | 42 ++++++++++++++++++- .../css/mediaqueries/test_media_queries.html | 13 ++++++ xpcom/ds/StaticAtoms.py | 1 + 10 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 layout/reftests/css-mediaqueries/mq_overflow-block-ref.html create mode 100644 layout/reftests/css-mediaqueries/mq_overflow-block.html create mode 100644 layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block-ref.html create mode 100644 layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block.html create mode 100644 layout/reftests/css-mediaqueries/mq_print_overflow-block-ref.html create mode 100644 layout/reftests/css-mediaqueries/mq_print_overflow-block.html diff --git a/layout/reftests/css-mediaqueries/mq_overflow-block-ref.html b/layout/reftests/css-mediaqueries/mq_overflow-block-ref.html new file mode 100644 index 000000000000..0763991ae038 --- /dev/null +++ b/layout/reftests/css-mediaqueries/mq_overflow-block-ref.html @@ -0,0 +1,6 @@ + + + A + C + D + E diff --git a/layout/reftests/css-mediaqueries/mq_overflow-block.html b/layout/reftests/css-mediaqueries/mq_overflow-block.html new file mode 100644 index 000000000000..10d3d69ebec5 --- /dev/null +++ b/layout/reftests/css-mediaqueries/mq_overflow-block.html @@ -0,0 +1,28 @@ + + + + A + B + C + D + E + F diff --git a/layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block-ref.html b/layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block-ref.html new file mode 100644 index 000000000000..85f8a56803e3 --- /dev/null +++ b/layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block-ref.html @@ -0,0 +1,3 @@ + + + diff --git a/layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block.html b/layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block.html new file mode 100644 index 000000000000..db89aa309f29 --- /dev/null +++ b/layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block.html @@ -0,0 +1,3 @@ + + + diff --git a/layout/reftests/css-mediaqueries/mq_print_overflow-block-ref.html b/layout/reftests/css-mediaqueries/mq_print_overflow-block-ref.html new file mode 100644 index 000000000000..e4bc603000db --- /dev/null +++ b/layout/reftests/css-mediaqueries/mq_print_overflow-block-ref.html @@ -0,0 +1,7 @@ + + + + A + B + C + E diff --git a/layout/reftests/css-mediaqueries/mq_print_overflow-block.html b/layout/reftests/css-mediaqueries/mq_print_overflow-block.html new file mode 100644 index 000000000000..aeff251e1623 --- /dev/null +++ b/layout/reftests/css-mediaqueries/mq_print_overflow-block.html @@ -0,0 +1,29 @@ + + + + A + B + C + D + E + F diff --git a/layout/reftests/css-mediaqueries/reftest.list b/layout/reftests/css-mediaqueries/reftest.list index 797be6de4c34..97c4f0236e5a 100644 --- a/layout/reftests/css-mediaqueries/reftest.list +++ b/layout/reftests/css-mediaqueries/reftest.list @@ -9,6 +9,10 @@ fuzzy-if(Android,0-8,0-454) == mq_print_height.xhtml mq_print-ref.xhtml # bug 11 fuzzy-if(Android,0-8,0-454) == mq_print_orientation.xhtml mq_print_orientation-ref.xhtml fuzzy-if(Android,0-8,0-454) == mq_print_maxheight.xhtml mq_print-ref.xhtml == mq_print_maxwidth.xhtml mq_print-ref.xhtml +== mq_overflow-block.html mq_overflow-block-ref.html +== mq_print_overflow-block.html mq_print_overflow-block-ref.html +# This test doesn't actually work; does the reftest-paged class not deal with iframes? +== mq_print_iframe_overflow-block.html mq_print_iframe_overflow-block-ref.html == mq_print_maxwidth_updown.xhtml mq_print-ref.xhtml == mq_print_maxheight_updown.xhtml mq_print-ref.xhtml diff --git a/servo/components/style/gecko/media_features.rs b/servo/components/style/gecko/media_features.rs index de37629ca285..553757ff1a92 100644 --- a/servo/components/style/gecko/media_features.rs +++ b/servo/components/style/gecko/media_features.rs @@ -10,7 +10,7 @@ use crate::gecko_bindings::structs; use crate::media_queries::media_feature::{AllowsRanges, ParsingRequirements}; use crate::media_queries::media_feature::{Evaluator, MediaFeatureDescription}; use crate::media_queries::media_feature_expression::{AspectRatio, RangeOrOperator}; -use crate::media_queries::Device; +use crate::media_queries::{Device, MediaType}; use crate::values::computed::CSSPixelLength; use crate::values::computed::Resolution; use crate::Atom; @@ -295,6 +295,38 @@ fn eval_prefers_reduced_motion(device: &Device, query_value: Option) -> bool { + // For the time being, assume that printing (including previews) + // is the only time when we paginate, and we are otherwise always + // scrolling. This is true at the moment in Firefox, but may need + // updating in the future (e.g., ebook readers built with Stylo, a + // billboard mode that doesn't support overflow at all). + // + // If this ever changes, don't forget to change eval_overflow_inline too. + let scrolling = device.media_type() != MediaType::print(); + let query_value = match query_value { + Some(v) => v, + None => return true, + }; + + match query_value { + OverflowBlock::None | + OverflowBlock::OptionalPaged => false, + OverflowBlock::Scroll => scrolling, + OverflowBlock::Paged => !scrolling, + } +} + /// https://drafts.csswg.org/mediaqueries-4/#mf-interaction bitflags! { struct PointerCapabilities: u8 { @@ -473,7 +505,7 @@ lazy_static! { /// to support new types in these entries and (2) ensuring that either /// nsPresContext::MediaFeatureValuesChanged is called when the value that /// would be returned by the evaluator function could change. - pub static ref MEDIA_FEATURES: [MediaFeatureDescription; 48] = [ + pub static ref MEDIA_FEATURES: [MediaFeatureDescription; 49] = [ feature!( atom!("width"), AllowsRanges::Yes, @@ -592,6 +624,12 @@ lazy_static! { keyword_evaluator!(eval_prefers_reduced_motion, PrefersReducedMotion), ParsingRequirements::empty(), ), + feature!( + atom!("overflow-block"), + AllowsRanges::No, + keyword_evaluator!(eval_overflow_block, OverflowBlock), + ParsingRequirements::empty(), + ), feature!( atom!("pointer"), AllowsRanges::No, diff --git a/testing/web-platform/tests/css/mediaqueries/test_media_queries.html b/testing/web-platform/tests/css/mediaqueries/test_media_queries.html index 250f9524adea..8b2c933c1617 100644 --- a/testing/web-platform/tests/css/mediaqueries/test_media_queries.html +++ b/testing/web-platform/tests/css/mediaqueries/test_media_queries.html @@ -515,6 +515,19 @@ function run() { should_not_apply("not all and (bogus)") should_not_apply("only all and (bogus)") + // Parsing tests for overflow-block from mediaqueries-4 + expression_should_be_parseable("overflow-block") + expression_should_be_parseable("overflow-block: none") + expression_should_be_parseable("overflow-block: paged") + expression_should_be_parseable("overflow-block: scroll") + expression_should_be_parseable("overflow-block: optional-paged") + expression_should_not_be_parseable("overflow-block: some-random-invalid-thing") + + // Sanity check for overflow-block + var any_overflow_block = query_applies("(overflow-block)"); + var overflow_block_none = query_applies("(overflow-block: none)"); + assert_not_equals(any_overflow_block, overflow_block_none, "overflow-block should be equivalent to not (overflow-block: none)"); + done(); } diff --git a/xpcom/ds/StaticAtoms.py b/xpcom/ds/StaticAtoms.py index 35e4788a3f57..44239e5a7096 100644 --- a/xpcom/ds/StaticAtoms.py +++ b/xpcom/ds/StaticAtoms.py @@ -926,6 +926,7 @@ STATIC_ATOMS = [ Atom("otherwise", "otherwise"), Atom("output", "output"), Atom("overflow", "overflow"), + Atom("overflowBlock", "overflow-block"), Atom("overlay", "overlay"), Atom("p", "p"), Atom("pack", "pack"), From 5dd52348b4e9c483be23ba0a7c84644abe38fb87 Mon Sep 17 00:00:00 2001 From: quasicomputational Date: Sat, 22 Dec 2018 19:41:33 +0000 Subject: [PATCH 02/10] Bug 1422235 - Implement the 'overflow-inline' media query. r=emilio --HG-- extra : histedit_source : 3670195950828e5f78613ed0af03cf3aab75e25d --- .../mq_overflow-inline-ref.html | 4 +++ .../css-mediaqueries/mq_overflow-inline.html | 20 +++++++++++++ .../mq_print_overflow-inline-ref.html | 5 ++++ .../mq_print_overflow-inline.html | 20 +++++++++++++ layout/reftests/css-mediaqueries/reftest.list | 2 ++ .../components/style/gecko/media_features.rs | 30 ++++++++++++++++++- .../css/mediaqueries/test_media_queries.html | 11 +++++++ xpcom/ds/StaticAtoms.py | 1 + 8 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 layout/reftests/css-mediaqueries/mq_overflow-inline-ref.html create mode 100644 layout/reftests/css-mediaqueries/mq_overflow-inline.html create mode 100644 layout/reftests/css-mediaqueries/mq_print_overflow-inline-ref.html create mode 100644 layout/reftests/css-mediaqueries/mq_print_overflow-inline.html diff --git a/layout/reftests/css-mediaqueries/mq_overflow-inline-ref.html b/layout/reftests/css-mediaqueries/mq_overflow-inline-ref.html new file mode 100644 index 000000000000..0c64c8598d49 --- /dev/null +++ b/layout/reftests/css-mediaqueries/mq_overflow-inline-ref.html @@ -0,0 +1,4 @@ + + + A + D diff --git a/layout/reftests/css-mediaqueries/mq_overflow-inline.html b/layout/reftests/css-mediaqueries/mq_overflow-inline.html new file mode 100644 index 000000000000..f5d94d9f53d8 --- /dev/null +++ b/layout/reftests/css-mediaqueries/mq_overflow-inline.html @@ -0,0 +1,20 @@ + + + + A + B + C + D diff --git a/layout/reftests/css-mediaqueries/mq_print_overflow-inline-ref.html b/layout/reftests/css-mediaqueries/mq_print_overflow-inline-ref.html new file mode 100644 index 000000000000..d9a763ff13cc --- /dev/null +++ b/layout/reftests/css-mediaqueries/mq_print_overflow-inline-ref.html @@ -0,0 +1,5 @@ + + + B + C + D diff --git a/layout/reftests/css-mediaqueries/mq_print_overflow-inline.html b/layout/reftests/css-mediaqueries/mq_print_overflow-inline.html new file mode 100644 index 000000000000..15d8fa10b5e5 --- /dev/null +++ b/layout/reftests/css-mediaqueries/mq_print_overflow-inline.html @@ -0,0 +1,20 @@ + + + + A + B + C + D diff --git a/layout/reftests/css-mediaqueries/reftest.list b/layout/reftests/css-mediaqueries/reftest.list index 97c4f0236e5a..4ca5b32ced25 100644 --- a/layout/reftests/css-mediaqueries/reftest.list +++ b/layout/reftests/css-mediaqueries/reftest.list @@ -13,6 +13,8 @@ fuzzy-if(Android,0-8,0-454) == mq_print_maxheight.xhtml mq_print-ref.xhtml == mq_print_overflow-block.html mq_print_overflow-block-ref.html # This test doesn't actually work; does the reftest-paged class not deal with iframes? == mq_print_iframe_overflow-block.html mq_print_iframe_overflow-block-ref.html +== mq_overflow-inline.html mq_overflow-inline-ref.html +== mq_print_overflow-inline.html mq_print_overflow-inline-ref.html == mq_print_maxwidth_updown.xhtml mq_print-ref.xhtml == mq_print_maxheight_updown.xhtml mq_print-ref.xhtml diff --git a/servo/components/style/gecko/media_features.rs b/servo/components/style/gecko/media_features.rs index 553757ff1a92..af166e60986c 100644 --- a/servo/components/style/gecko/media_features.rs +++ b/servo/components/style/gecko/media_features.rs @@ -327,6 +327,28 @@ fn eval_overflow_block(device: &Device, query_value: Option) -> b } } +#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)] +#[repr(u8)] +enum OverflowInline { + None, + Scroll, +} + +/// https://drafts.csswg.org/mediaqueries-4/#mf-overflow-inline +fn eval_overflow_inline(device: &Device, query_value: Option) -> bool { + // See the note in eval_overflow_block. + let scrolling = device.media_type() != MediaType::print(); + let query_value = match query_value { + Some(v) => v, + None => return scrolling, + }; + + match query_value { + OverflowInline::None => !scrolling, + OverflowInline::Scroll => scrolling, + } +} + /// https://drafts.csswg.org/mediaqueries-4/#mf-interaction bitflags! { struct PointerCapabilities: u8 { @@ -505,7 +527,7 @@ lazy_static! { /// to support new types in these entries and (2) ensuring that either /// nsPresContext::MediaFeatureValuesChanged is called when the value that /// would be returned by the evaluator function could change. - pub static ref MEDIA_FEATURES: [MediaFeatureDescription; 49] = [ + pub static ref MEDIA_FEATURES: [MediaFeatureDescription; 50] = [ feature!( atom!("width"), AllowsRanges::Yes, @@ -630,6 +652,12 @@ lazy_static! { keyword_evaluator!(eval_overflow_block, OverflowBlock), ParsingRequirements::empty(), ), + feature!( + atom!("overflow-inline"), + AllowsRanges::No, + keyword_evaluator!(eval_overflow_inline, OverflowInline), + ParsingRequirements::empty(), + ), feature!( atom!("pointer"), AllowsRanges::No, diff --git a/testing/web-platform/tests/css/mediaqueries/test_media_queries.html b/testing/web-platform/tests/css/mediaqueries/test_media_queries.html index 8b2c933c1617..42a8a1e83d6d 100644 --- a/testing/web-platform/tests/css/mediaqueries/test_media_queries.html +++ b/testing/web-platform/tests/css/mediaqueries/test_media_queries.html @@ -528,6 +528,17 @@ function run() { var overflow_block_none = query_applies("(overflow-block: none)"); assert_not_equals(any_overflow_block, overflow_block_none, "overflow-block should be equivalent to not (overflow-block: none)"); + // Parsing tests for overflow-inline from mediaqueries-4 + expression_should_be_parseable("overflow-inline") + expression_should_be_parseable("overflow-inline: none") + expression_should_be_parseable("overflow-inline: scroll") + expression_should_not_be_parseable("overflow-inline: some-random-invalid-thing") + + // Sanity check for overflow-inline + var any_overflow_inline = query_applies("(overflow-inline)"); + var overflow_inline_none = query_applies("(overflow-inline: none)"); + assert_not_equals(any_overflow_inline, overflow_inline_none, "overflow-inline should be equivalent to not (overflow-inline: none)"); + done(); } diff --git a/xpcom/ds/StaticAtoms.py b/xpcom/ds/StaticAtoms.py index 44239e5a7096..42d566aef066 100644 --- a/xpcom/ds/StaticAtoms.py +++ b/xpcom/ds/StaticAtoms.py @@ -927,6 +927,7 @@ STATIC_ATOMS = [ Atom("output", "output"), Atom("overflow", "overflow"), Atom("overflowBlock", "overflow-block"), + Atom("overflowInline", "overflow-inline"), Atom("overlay", "overlay"), Atom("p", "p"), Atom("pack", "pack"), From 5d3f5114a30261ba882803be3034f6e2dda60141 Mon Sep 17 00:00:00 2001 From: Raul Gurzau Date: Sun, 23 Dec 2018 14:37:00 +0200 Subject: [PATCH 03/10] Bug 1440059 - Disabled browser_console_context_menu_entries.js on Linux for all build types. r=jmaher --- devtools/client/webconsole/test/mochitest/browser.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/client/webconsole/test/mochitest/browser.ini b/devtools/client/webconsole/test/mochitest/browser.ini index d2fcb9780a79..c53fd2ef8bdc 100644 --- a/devtools/client/webconsole/test/mochitest/browser.ini +++ b/devtools/client/webconsole/test/mochitest/browser.ini @@ -168,7 +168,7 @@ support-files = skip-if = true # Bug 1437843 [browser_console_consolejsm_output.js] [browser_console_context_menu_entries.js] -skip-if = (os == "linux" && (debug || ccov)) # Bug 1440059 +skip-if = os == "linux" # Bug 1440059, disabled for all build types [browser_console_dead_objects.js] [browser_console_devtools_loader_exception.js] [browser_console_error_source_click.js] From 6b0ba83476866b54ebee0dedb64a7f257b9c620d Mon Sep 17 00:00:00 2001 From: Raul Gurzau Date: Sun, 23 Dec 2018 14:33:00 +0200 Subject: [PATCH 04/10] Bug 1258103 - Disabled test_bug369370.html on Linux. r=jmaher --- dom/html/test/mochitest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/html/test/mochitest.ini b/dom/html/test/mochitest.ini index 85f38785d7d0..b122e3045f5f 100644 --- a/dom/html/test/mochitest.ini +++ b/dom/html/test/mochitest.ini @@ -536,7 +536,7 @@ skip-if = toolkit == 'android' #bug 811644 [test_bug340017.xhtml] [test_bug359657.html] [test_bug369370.html] -skip-if = toolkit == "android" || toolkit == "windows" # disabled on Windows because of bug 1234520 +skip-if = toolkit == "android" || toolkit == "windows" || os == 'linux' # disabled on Windows because of bug 1234520, disabled on linux bug 1258103 [test_bug380383.html] [test_bug402680.html] [test_bug403868.html] From aff4f71c951212e842389605cee7f24532b53cec Mon Sep 17 00:00:00 2001 From: Raul Gurzau Date: Sun, 23 Dec 2018 14:23:00 +0200 Subject: [PATCH 05/10] Bug 1483701 - Disable browser_ext_browserAction_popup_resize.js on Windows, Linux and Mac, debug and verify. r=jmaher --- browser/components/extensions/test/browser/browser-common.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/components/extensions/test/browser/browser-common.ini b/browser/components/extensions/test/browser/browser-common.ini index 1ae78777aba3..55e11d30d7af 100644 --- a/browser/components/extensions/test/browser/browser-common.ini +++ b/browser/components/extensions/test/browser/browser-common.ini @@ -60,7 +60,7 @@ skip-if = (debug && os == 'linux' && bits == 32) || (os == 'win' && !debug) # Bu [browser_ext_browserAction_popup_preload.js] skip-if = (os == 'win' && !debug) || (verify && debug && (os == 'mac')) # bug 1352668 [browser_ext_browserAction_popup_resize.js] -skip-if = (os == 'mac' && debug) # Bug 1482004, also fails in test-verify +skip-if = (os == 'mac' || os == 'win' || os == 'linux') || (verify && debug) #Bug 1482004,1483701 [browser_ext_browserAction_simple.js] [browser_ext_browserAction_telemetry.js] [browser_ext_browserAction_theme_icons.js] From 0d9759945e4bc838f0499ff93341accab003f8ee Mon Sep 17 00:00:00 2001 From: longsonr Date: Mon, 24 Dec 2018 19:24:45 +0000 Subject: [PATCH 06/10] Bug 1516175 - Move nsSMILFloatType into the mozilla namespace r=birtles --HG-- rename : dom/smil/nsSMILFloatType.cpp => dom/smil/SMILFloatType.cpp rename : dom/smil/nsSMILFloatType.h => dom/smil/SMILFloatType.h --- ...{nsSMILFloatType.cpp => SMILFloatType.cpp} | 37 ++++++++++--------- .../{nsSMILFloatType.h => SMILFloatType.h} | 12 ++++-- dom/smil/moz.build | 2 +- dom/svg/nsSVGLength2.cpp | 10 ++--- dom/svg/nsSVGNumber2.cpp | 10 ++--- 5 files changed, 39 insertions(+), 32 deletions(-) rename dom/smil/{nsSMILFloatType.cpp => SMILFloatType.cpp} (65%) rename dom/smil/{nsSMILFloatType.h => SMILFloatType.h} (89%) diff --git a/dom/smil/nsSMILFloatType.cpp b/dom/smil/SMILFloatType.cpp similarity index 65% rename from dom/smil/nsSMILFloatType.cpp rename to dom/smil/SMILFloatType.cpp index 78ba493aeb0e..46753d6acee4 100644 --- a/dom/smil/nsSMILFloatType.cpp +++ b/dom/smil/SMILFloatType.cpp @@ -4,51 +4,52 @@ * 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/. */ -#include "nsSMILFloatType.h" +#include "SMILFloatType.h" #include "nsSMILValue.h" #include "nsDebug.h" #include -void nsSMILFloatType::Init(nsSMILValue& aValue) const { +namespace mozilla { + +void SMILFloatType::Init(nsSMILValue& aValue) const { MOZ_ASSERT(aValue.IsNull(), "Unexpected value type"); aValue.mU.mDouble = 0.0; aValue.mType = this; } -void nsSMILFloatType::Destroy(nsSMILValue& aValue) const { +void SMILFloatType::Destroy(nsSMILValue& aValue) const { MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value"); aValue.mU.mDouble = 0.0; aValue.mType = nsSMILNullType::Singleton(); } -nsresult nsSMILFloatType::Assign(nsSMILValue& aDest, - const nsSMILValue& aSrc) const { +nsresult SMILFloatType::Assign(nsSMILValue& aDest, + const nsSMILValue& aSrc) const { MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types"); MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value"); aDest.mU.mDouble = aSrc.mU.mDouble; return NS_OK; } -bool nsSMILFloatType::IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const { +bool SMILFloatType::IsEqual(const nsSMILValue& aLeft, + const nsSMILValue& aRight) const { MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types"); MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value"); return aLeft.mU.mDouble == aRight.mU.mDouble; } -nsresult nsSMILFloatType::Add(nsSMILValue& aDest, - const nsSMILValue& aValueToAdd, - uint32_t aCount) const { +nsresult SMILFloatType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, + uint32_t aCount) const { MOZ_ASSERT(aValueToAdd.mType == aDest.mType, "Trying to add invalid types"); MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type"); aDest.mU.mDouble += aValueToAdd.mU.mDouble * aCount; return NS_OK; } -nsresult nsSMILFloatType::ComputeDistance(const nsSMILValue& aFrom, - const nsSMILValue& aTo, - double& aDistance) const { +nsresult SMILFloatType::ComputeDistance(const nsSMILValue& aFrom, + const nsSMILValue& aTo, + double& aDistance) const { MOZ_ASSERT(aFrom.mType == aTo.mType, "Trying to compare different types"); MOZ_ASSERT(aFrom.mType == this, "Unexpected source type"); @@ -60,10 +61,10 @@ nsresult nsSMILFloatType::ComputeDistance(const nsSMILValue& aFrom, return NS_OK; } -nsresult nsSMILFloatType::Interpolate(const nsSMILValue& aStartVal, - const nsSMILValue& aEndVal, - double aUnitDistance, - nsSMILValue& aResult) const { +nsresult SMILFloatType::Interpolate(const nsSMILValue& aStartVal, + const nsSMILValue& aEndVal, + double aUnitDistance, + nsSMILValue& aResult) const { MOZ_ASSERT(aStartVal.mType == aEndVal.mType, "Trying to interpolate different types"); MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation"); @@ -76,3 +77,5 @@ nsresult nsSMILFloatType::Interpolate(const nsSMILValue& aStartVal, return NS_OK; } + +} // namespace mozilla diff --git a/dom/smil/nsSMILFloatType.h b/dom/smil/SMILFloatType.h similarity index 89% rename from dom/smil/nsSMILFloatType.h rename to dom/smil/SMILFloatType.h index 8236fafaedf5..eaaceedb722e 100644 --- a/dom/smil/nsSMILFloatType.h +++ b/dom/smil/SMILFloatType.h @@ -10,11 +10,13 @@ #include "mozilla/Attributes.h" #include "nsISMILType.h" -class nsSMILFloatType : public nsISMILType { +namespace mozilla { + +class SMILFloatType : public nsISMILType { public: // Singleton for nsSMILValue objects to hold onto. - static nsSMILFloatType* Singleton() { - static nsSMILFloatType sSingleton; + static SMILFloatType* Singleton() { + static SMILFloatType sSingleton; return &sSingleton; } @@ -38,7 +40,9 @@ class nsSMILFloatType : public nsISMILType { private: // Private constructor: prevent instances beyond my singleton. - constexpr nsSMILFloatType() {} + constexpr SMILFloatType() {} }; +} // namespace mozilla + #endif // NS_SMILFLOATTYPE_H_ diff --git a/dom/smil/moz.build b/dom/smil/moz.build index 821bd41ccffd..27848682ccf0 100644 --- a/dom/smil/moz.build +++ b/dom/smil/moz.build @@ -44,7 +44,6 @@ UNIFIED_SOURCES += [ 'nsSMILCompositor.cpp', 'nsSMILCSSProperty.cpp', 'nsSMILCSSValueType.cpp', - 'nsSMILFloatType.cpp', 'nsSMILInstanceTime.cpp', 'nsSMILInterval.cpp', 'nsSMILKeySpline.cpp', @@ -59,6 +58,7 @@ UNIFIED_SOURCES += [ 'nsSMILValue.cpp', 'SMILBoolType.cpp', 'SMILEnumType.cpp', + 'SMILFloatType.cpp', 'SMILIntegerType.cpp', 'SMILStringType.cpp', 'TimeEvent.cpp', diff --git a/dom/svg/nsSVGLength2.cpp b/dom/svg/nsSVGLength2.cpp index 3dc9fa9aabf6..68d474ad16bf 100644 --- a/dom/svg/nsSVGLength2.cpp +++ b/dom/svg/nsSVGLength2.cpp @@ -11,7 +11,7 @@ #include "mozilla/dom/SVGViewportElement.h" #include "nsContentUtils.h" // NS_ENSURE_FINITE #include "nsIFrame.h" -#include "nsSMILFloatType.h" +#include "SMILFloatType.h" #include "nsSMILValue.h" #include "nsSVGAttrTearoffTable.h" #include "nsSVGIntegrationUtils.h" @@ -436,7 +436,7 @@ nsresult nsSVGLength2::SMILLength::ValueFromString( return NS_ERROR_DOM_SYNTAX_ERR; } - nsSMILValue val(nsSMILFloatType::Singleton()); + nsSMILValue val(SMILFloatType::Singleton()); val.mU.mDouble = value * mVal->GetPixelsPerUnit(mSVGElement, unitType); aValue = val; aPreventCachingOfSandwich = @@ -448,7 +448,7 @@ nsresult nsSVGLength2::SMILLength::ValueFromString( } nsSMILValue nsSVGLength2::SMILLength::GetBaseValue() const { - nsSMILValue val(nsSMILFloatType::Singleton()); + nsSMILValue val(SMILFloatType::Singleton()); val.mU.mDouble = mVal->GetBaseValue(mSVGElement); return val; } @@ -462,9 +462,9 @@ void nsSVGLength2::SMILLength::ClearAnimValue() { } nsresult nsSVGLength2::SMILLength::SetAnimValue(const nsSMILValue& aValue) { - NS_ASSERTION(aValue.mType == nsSMILFloatType::Singleton(), + NS_ASSERTION(aValue.mType == SMILFloatType::Singleton(), "Unexpected type to assign animated value"); - if (aValue.mType == nsSMILFloatType::Singleton()) { + if (aValue.mType == SMILFloatType::Singleton()) { return mVal->SetAnimValue(float(aValue.mU.mDouble), mSVGElement); } return NS_OK; diff --git a/dom/svg/nsSVGNumber2.cpp b/dom/svg/nsSVGNumber2.cpp index 9af2c27c40a9..0abeb6a1d9c1 100644 --- a/dom/svg/nsSVGNumber2.cpp +++ b/dom/svg/nsSVGNumber2.cpp @@ -7,7 +7,7 @@ #include "nsSVGNumber2.h" #include "mozilla/Attributes.h" #include "nsContentUtils.h" // NS_ENSURE_FINITE -#include "nsSMILFloatType.h" +#include "SMILFloatType.h" #include "nsSMILValue.h" #include "nsSVGAttrTearoffTable.h" #include "SVGContentUtils.h" @@ -126,7 +126,7 @@ nsresult nsSVGNumber2::SMILNumber::ValueFromString( return NS_ERROR_DOM_SYNTAX_ERR; } - nsSMILValue val(nsSMILFloatType::Singleton()); + nsSMILValue val(SMILFloatType::Singleton()); val.mU.mDouble = value; aValue = val; aPreventCachingOfSandwich = false; @@ -135,7 +135,7 @@ nsresult nsSVGNumber2::SMILNumber::ValueFromString( } nsSMILValue nsSVGNumber2::SMILNumber::GetBaseValue() const { - nsSMILValue val(nsSMILFloatType::Singleton()); + nsSMILValue val(SMILFloatType::Singleton()); val.mU.mDouble = mVal->mBaseVal; return val; } @@ -149,9 +149,9 @@ void nsSVGNumber2::SMILNumber::ClearAnimValue() { } nsresult nsSVGNumber2::SMILNumber::SetAnimValue(const nsSMILValue& aValue) { - NS_ASSERTION(aValue.mType == nsSMILFloatType::Singleton(), + NS_ASSERTION(aValue.mType == SMILFloatType::Singleton(), "Unexpected type to assign animated value"); - if (aValue.mType == nsSMILFloatType::Singleton()) { + if (aValue.mType == SMILFloatType::Singleton()) { mVal->SetAnimValue(float(aValue.mU.mDouble), mSVGElement); } return NS_OK; From 0b6423fa71876269e57ee8e5aa55aa5dcb36f281 Mon Sep 17 00:00:00 2001 From: Razvan Maries Date: Mon, 24 Dec 2018 22:31:38 +0200 Subject: [PATCH 07/10] Backed out 2 changesets (bug 1422235) for failing reftests: tests/layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block-ref.html. CLOSED TREE Backed out changeset 2f2f235a4cba (bug 1422235) Backed out changeset 849c2b71aae4 (bug 1422235) --HG-- extra : amend_source : 2e2bc07e9548e9423740aeb7b3d1c6a79feee63c --- .../mq_overflow-block-ref.html | 6 -- .../css-mediaqueries/mq_overflow-block.html | 28 -------- .../mq_overflow-inline-ref.html | 4 -- .../css-mediaqueries/mq_overflow-inline.html | 20 ------ .../mq_print_iframe_overflow-block-ref.html | 3 - .../mq_print_iframe_overflow-block.html | 3 - .../mq_print_overflow-block-ref.html | 7 -- .../mq_print_overflow-block.html | 29 -------- .../mq_print_overflow-inline-ref.html | 5 -- .../mq_print_overflow-inline.html | 20 ------ layout/reftests/css-mediaqueries/reftest.list | 6 -- .../components/style/gecko/media_features.rs | 70 +------------------ .../css/mediaqueries/test_media_queries.html | 24 ------- xpcom/ds/StaticAtoms.py | 2 - 14 files changed, 2 insertions(+), 225 deletions(-) delete mode 100644 layout/reftests/css-mediaqueries/mq_overflow-block-ref.html delete mode 100644 layout/reftests/css-mediaqueries/mq_overflow-block.html delete mode 100644 layout/reftests/css-mediaqueries/mq_overflow-inline-ref.html delete mode 100644 layout/reftests/css-mediaqueries/mq_overflow-inline.html delete mode 100644 layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block-ref.html delete mode 100644 layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block.html delete mode 100644 layout/reftests/css-mediaqueries/mq_print_overflow-block-ref.html delete mode 100644 layout/reftests/css-mediaqueries/mq_print_overflow-block.html delete mode 100644 layout/reftests/css-mediaqueries/mq_print_overflow-inline-ref.html delete mode 100644 layout/reftests/css-mediaqueries/mq_print_overflow-inline.html diff --git a/layout/reftests/css-mediaqueries/mq_overflow-block-ref.html b/layout/reftests/css-mediaqueries/mq_overflow-block-ref.html deleted file mode 100644 index 0763991ae038..000000000000 --- a/layout/reftests/css-mediaqueries/mq_overflow-block-ref.html +++ /dev/null @@ -1,6 +0,0 @@ - - - A - C - D - E diff --git a/layout/reftests/css-mediaqueries/mq_overflow-block.html b/layout/reftests/css-mediaqueries/mq_overflow-block.html deleted file mode 100644 index 10d3d69ebec5..000000000000 --- a/layout/reftests/css-mediaqueries/mq_overflow-block.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - A - B - C - D - E - F diff --git a/layout/reftests/css-mediaqueries/mq_overflow-inline-ref.html b/layout/reftests/css-mediaqueries/mq_overflow-inline-ref.html deleted file mode 100644 index 0c64c8598d49..000000000000 --- a/layout/reftests/css-mediaqueries/mq_overflow-inline-ref.html +++ /dev/null @@ -1,4 +0,0 @@ - - - A - D diff --git a/layout/reftests/css-mediaqueries/mq_overflow-inline.html b/layout/reftests/css-mediaqueries/mq_overflow-inline.html deleted file mode 100644 index f5d94d9f53d8..000000000000 --- a/layout/reftests/css-mediaqueries/mq_overflow-inline.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - A - B - C - D diff --git a/layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block-ref.html b/layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block-ref.html deleted file mode 100644 index 85f8a56803e3..000000000000 --- a/layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block-ref.html +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block.html b/layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block.html deleted file mode 100644 index db89aa309f29..000000000000 --- a/layout/reftests/css-mediaqueries/mq_print_iframe_overflow-block.html +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/layout/reftests/css-mediaqueries/mq_print_overflow-block-ref.html b/layout/reftests/css-mediaqueries/mq_print_overflow-block-ref.html deleted file mode 100644 index e4bc603000db..000000000000 --- a/layout/reftests/css-mediaqueries/mq_print_overflow-block-ref.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - A - B - C - E diff --git a/layout/reftests/css-mediaqueries/mq_print_overflow-block.html b/layout/reftests/css-mediaqueries/mq_print_overflow-block.html deleted file mode 100644 index aeff251e1623..000000000000 --- a/layout/reftests/css-mediaqueries/mq_print_overflow-block.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - A - B - C - D - E - F diff --git a/layout/reftests/css-mediaqueries/mq_print_overflow-inline-ref.html b/layout/reftests/css-mediaqueries/mq_print_overflow-inline-ref.html deleted file mode 100644 index d9a763ff13cc..000000000000 --- a/layout/reftests/css-mediaqueries/mq_print_overflow-inline-ref.html +++ /dev/null @@ -1,5 +0,0 @@ - - - B - C - D diff --git a/layout/reftests/css-mediaqueries/mq_print_overflow-inline.html b/layout/reftests/css-mediaqueries/mq_print_overflow-inline.html deleted file mode 100644 index 15d8fa10b5e5..000000000000 --- a/layout/reftests/css-mediaqueries/mq_print_overflow-inline.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - A - B - C - D diff --git a/layout/reftests/css-mediaqueries/reftest.list b/layout/reftests/css-mediaqueries/reftest.list index 4ca5b32ced25..797be6de4c34 100644 --- a/layout/reftests/css-mediaqueries/reftest.list +++ b/layout/reftests/css-mediaqueries/reftest.list @@ -9,12 +9,6 @@ fuzzy-if(Android,0-8,0-454) == mq_print_height.xhtml mq_print-ref.xhtml # bug 11 fuzzy-if(Android,0-8,0-454) == mq_print_orientation.xhtml mq_print_orientation-ref.xhtml fuzzy-if(Android,0-8,0-454) == mq_print_maxheight.xhtml mq_print-ref.xhtml == mq_print_maxwidth.xhtml mq_print-ref.xhtml -== mq_overflow-block.html mq_overflow-block-ref.html -== mq_print_overflow-block.html mq_print_overflow-block-ref.html -# This test doesn't actually work; does the reftest-paged class not deal with iframes? -== mq_print_iframe_overflow-block.html mq_print_iframe_overflow-block-ref.html -== mq_overflow-inline.html mq_overflow-inline-ref.html -== mq_print_overflow-inline.html mq_print_overflow-inline-ref.html == mq_print_maxwidth_updown.xhtml mq_print-ref.xhtml == mq_print_maxheight_updown.xhtml mq_print-ref.xhtml diff --git a/servo/components/style/gecko/media_features.rs b/servo/components/style/gecko/media_features.rs index af166e60986c..de37629ca285 100644 --- a/servo/components/style/gecko/media_features.rs +++ b/servo/components/style/gecko/media_features.rs @@ -10,7 +10,7 @@ use crate::gecko_bindings::structs; use crate::media_queries::media_feature::{AllowsRanges, ParsingRequirements}; use crate::media_queries::media_feature::{Evaluator, MediaFeatureDescription}; use crate::media_queries::media_feature_expression::{AspectRatio, RangeOrOperator}; -use crate::media_queries::{Device, MediaType}; +use crate::media_queries::Device; use crate::values::computed::CSSPixelLength; use crate::values::computed::Resolution; use crate::Atom; @@ -295,60 +295,6 @@ fn eval_prefers_reduced_motion(device: &Device, query_value: Option) -> bool { - // For the time being, assume that printing (including previews) - // is the only time when we paginate, and we are otherwise always - // scrolling. This is true at the moment in Firefox, but may need - // updating in the future (e.g., ebook readers built with Stylo, a - // billboard mode that doesn't support overflow at all). - // - // If this ever changes, don't forget to change eval_overflow_inline too. - let scrolling = device.media_type() != MediaType::print(); - let query_value = match query_value { - Some(v) => v, - None => return true, - }; - - match query_value { - OverflowBlock::None | - OverflowBlock::OptionalPaged => false, - OverflowBlock::Scroll => scrolling, - OverflowBlock::Paged => !scrolling, - } -} - -#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)] -#[repr(u8)] -enum OverflowInline { - None, - Scroll, -} - -/// https://drafts.csswg.org/mediaqueries-4/#mf-overflow-inline -fn eval_overflow_inline(device: &Device, query_value: Option) -> bool { - // See the note in eval_overflow_block. - let scrolling = device.media_type() != MediaType::print(); - let query_value = match query_value { - Some(v) => v, - None => return scrolling, - }; - - match query_value { - OverflowInline::None => !scrolling, - OverflowInline::Scroll => scrolling, - } -} - /// https://drafts.csswg.org/mediaqueries-4/#mf-interaction bitflags! { struct PointerCapabilities: u8 { @@ -527,7 +473,7 @@ lazy_static! { /// to support new types in these entries and (2) ensuring that either /// nsPresContext::MediaFeatureValuesChanged is called when the value that /// would be returned by the evaluator function could change. - pub static ref MEDIA_FEATURES: [MediaFeatureDescription; 50] = [ + pub static ref MEDIA_FEATURES: [MediaFeatureDescription; 48] = [ feature!( atom!("width"), AllowsRanges::Yes, @@ -646,18 +592,6 @@ lazy_static! { keyword_evaluator!(eval_prefers_reduced_motion, PrefersReducedMotion), ParsingRequirements::empty(), ), - feature!( - atom!("overflow-block"), - AllowsRanges::No, - keyword_evaluator!(eval_overflow_block, OverflowBlock), - ParsingRequirements::empty(), - ), - feature!( - atom!("overflow-inline"), - AllowsRanges::No, - keyword_evaluator!(eval_overflow_inline, OverflowInline), - ParsingRequirements::empty(), - ), feature!( atom!("pointer"), AllowsRanges::No, diff --git a/testing/web-platform/tests/css/mediaqueries/test_media_queries.html b/testing/web-platform/tests/css/mediaqueries/test_media_queries.html index 42a8a1e83d6d..250f9524adea 100644 --- a/testing/web-platform/tests/css/mediaqueries/test_media_queries.html +++ b/testing/web-platform/tests/css/mediaqueries/test_media_queries.html @@ -515,30 +515,6 @@ function run() { should_not_apply("not all and (bogus)") should_not_apply("only all and (bogus)") - // Parsing tests for overflow-block from mediaqueries-4 - expression_should_be_parseable("overflow-block") - expression_should_be_parseable("overflow-block: none") - expression_should_be_parseable("overflow-block: paged") - expression_should_be_parseable("overflow-block: scroll") - expression_should_be_parseable("overflow-block: optional-paged") - expression_should_not_be_parseable("overflow-block: some-random-invalid-thing") - - // Sanity check for overflow-block - var any_overflow_block = query_applies("(overflow-block)"); - var overflow_block_none = query_applies("(overflow-block: none)"); - assert_not_equals(any_overflow_block, overflow_block_none, "overflow-block should be equivalent to not (overflow-block: none)"); - - // Parsing tests for overflow-inline from mediaqueries-4 - expression_should_be_parseable("overflow-inline") - expression_should_be_parseable("overflow-inline: none") - expression_should_be_parseable("overflow-inline: scroll") - expression_should_not_be_parseable("overflow-inline: some-random-invalid-thing") - - // Sanity check for overflow-inline - var any_overflow_inline = query_applies("(overflow-inline)"); - var overflow_inline_none = query_applies("(overflow-inline: none)"); - assert_not_equals(any_overflow_inline, overflow_inline_none, "overflow-inline should be equivalent to not (overflow-inline: none)"); - done(); } diff --git a/xpcom/ds/StaticAtoms.py b/xpcom/ds/StaticAtoms.py index 42d566aef066..35e4788a3f57 100644 --- a/xpcom/ds/StaticAtoms.py +++ b/xpcom/ds/StaticAtoms.py @@ -926,8 +926,6 @@ STATIC_ATOMS = [ Atom("otherwise", "otherwise"), Atom("output", "output"), Atom("overflow", "overflow"), - Atom("overflowBlock", "overflow-block"), - Atom("overflowInline", "overflow-inline"), Atom("overlay", "overlay"), Atom("p", "p"), Atom("pack", "pack"), From 52398c4af6158739752f281d8e8dfd4078e9c6b2 Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Fri, 21 Dec 2018 15:00:26 -0800 Subject: [PATCH 08/10] Bug 1515821 - Remove verbose warning in IsThirdPartyWindowOrChannel. r=ehsan --HG-- extra : rebase_source : 1fc29f769fc88a9e59a7c1383b4c14fe7f2a28a6 --- dom/base/nsContentUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index a4cb043e8a46..99dc5b3d08e9 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -8202,7 +8202,7 @@ bool nsContentUtils::IsThirdPartyWindowOrChannel(nsPIDOMWindowInner* aWindow, if (aWindow) { nsresult rv = thirdPartyUtil->IsThirdPartyWindow(aWindow->GetOuterWindow(), aURI, &thirdParty); - if (NS_WARN_IF(NS_FAILED(rv))) { + if (NS_FAILED(rv)) { // Ideally we would do something similar to the channel code path here, // but existing code depends on this behaviour. return false; From b8d85eabb5eb1828924247401ac7797681e60db1 Mon Sep 17 00:00:00 2001 From: Brian Hackett Date: Mon, 24 Dec 2018 05:52:31 -1000 Subject: [PATCH 09/10] Bug 1044074 - Add test that scroll event handlers do not break run-to-completion, no_r. --HG-- extra : rebase_source : 695e1b5ee00ce273599f66d5bbb53c52011ca7e4 --- .../debugger/new/test/mochitest/browser.ini | 2 ++ .../browser_dbg-scroll-run-to-completion.js | 19 +++++++++++++ .../doc-scroll-run-to-completion.html | 27 +++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 devtools/client/debugger/new/test/mochitest/browser_dbg-scroll-run-to-completion.js create mode 100644 devtools/client/debugger/new/test/mochitest/examples/doc-scroll-run-to-completion.html diff --git a/devtools/client/debugger/new/test/mochitest/browser.ini b/devtools/client/debugger/new/test/mochitest/browser.ini index 1bf51600fe1b..a95d03cacf0d 100644 --- a/devtools/client/debugger/new/test/mochitest/browser.ini +++ b/devtools/client/debugger/new/test/mochitest/browser.ini @@ -592,6 +592,7 @@ support-files = examples/fetch.js examples/doc-xhr.html examples/doc-xhr-run-to-completion.html + examples/doc-scroll-run-to-completion.html examples/sum/sum.js examples/sum/sum.min.js examples/sum/sum.min.js.map @@ -662,6 +663,7 @@ support-files = skip-if = (os == "win" && ccov) # Bug 1453549 [browser_dbg-xhr-breakpoints.js] [browser_dbg-xhr-run-to-completion.js] +[browser_dbg-scroll-run-to-completion.js] [browser_dbg-sourcemapped-scopes.js] skip-if = ccov || (verify && debug && (os == 'linux')) # Bug 1441545 [browser_dbg-sourcemapped-stepping.js] diff --git a/devtools/client/debugger/new/test/mochitest/browser_dbg-scroll-run-to-completion.js b/devtools/client/debugger/new/test/mochitest/browser_dbg-scroll-run-to-completion.js new file mode 100644 index 000000000000..b2128c489013 --- /dev/null +++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-scroll-run-to-completion.js @@ -0,0 +1,19 @@ +/* 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 . */ + +add_task(async function() { + const dbg = await initDebugger("doc-scroll-run-to-completion.html"); + invokeInTab("pauseOnce", "doc-scroll-run-to-completion.html"); + await waitForPaused(dbg); + assertPausedLocation(dbg); + + const threadClient = dbg.toolbox.threadClient; + await checkEvaluateInTopFrame(threadClient, 'window.scrollBy(0, 10);', undefined); + + // checkEvaluateInTopFrame does an implicit resume for some reason. + await waitForPaused(dbg); + + resume(dbg); + await once(Services.ppmm, "test passed"); +}); diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-scroll-run-to-completion.html b/devtools/client/debugger/new/test/mochitest/examples/doc-scroll-run-to-completion.html new file mode 100644 index 000000000000..6cc7f123ab78 --- /dev/null +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-scroll-run-to-completion.html @@ -0,0 +1,27 @@ + + + + + From 4419187d6d9b187d97dac52ead857222775f0483 Mon Sep 17 00:00:00 2001 From: Brian Hackett Date: Mon, 24 Dec 2018 08:40:04 -1000 Subject: [PATCH 10/10] Bug 1241958 - Add test for windowless workers, r=jlast. --HG-- extra : rebase_source : c08daf86dc170d9d799f29bbd2ef9c9a4e5b77e3 --- .../debugger/new/test/mochitest/browser.ini | 3 ++ .../browser_dbg-windowless-workers.js | 45 +++++++++++++++++++ .../examples/doc-windowless-workers.html | 19 ++++++++ .../test/mochitest/examples/simple-worker.js | 7 +++ .../debugger/new/test/mochitest/helpers.js | 28 ++++++++++++ 5 files changed, 102 insertions(+) create mode 100644 devtools/client/debugger/new/test/mochitest/browser_dbg-windowless-workers.js create mode 100644 devtools/client/debugger/new/test/mochitest/examples/doc-windowless-workers.html create mode 100644 devtools/client/debugger/new/test/mochitest/examples/simple-worker.js diff --git a/devtools/client/debugger/new/test/mochitest/browser.ini b/devtools/client/debugger/new/test/mochitest/browser.ini index a95d03cacf0d..549ead677bfd 100644 --- a/devtools/client/debugger/new/test/mochitest/browser.ini +++ b/devtools/client/debugger/new/test/mochitest/browser.ini @@ -651,6 +651,8 @@ support-files = examples/script-switching-02.js examples/script-switching-01.js examples/times2.js + examples/doc-windowless-workers.html + examples/simple-worker.js examples/doc_rr_basic.html examples/doc_rr_continuous.html examples/doc_rr_logs.html @@ -764,6 +766,7 @@ skip-if = os == "win" skip-if = os == "win" [browser_dbg-wasm-sourcemaps.js] skip-if = true +[browser_dbg-windowless-workers.js] [browser_dbg_rr_breakpoints-01.js] skip-if = os != "mac" || debug || !nightly_build [browser_dbg_rr_breakpoints-02.js] diff --git a/devtools/client/debugger/new/test/mochitest/browser_dbg-windowless-workers.js b/devtools/client/debugger/new/test/mochitest/browser_dbg-windowless-workers.js new file mode 100644 index 000000000000..5610a28a4b05 --- /dev/null +++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-windowless-workers.js @@ -0,0 +1,45 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Test basic windowless worker functionality: the main thread and worker can be +// separately controlled from the same debugger. +add_task(async function() { + await pushPref("devtools.debugger.features.windowless-workers", true); + + const dbg = await initDebugger("doc-windowless-workers.html"); + const mainThread = dbg.toolbox.threadClient.actor; + + const workers = await getWorkers(dbg); + ok(workers.length == 1, "Got one worker"); + const workerThread = workers[0].actor; + + const mainThreadSource = findSource(dbg, "doc-windowless-workers.html"); + const workerSource = findSource(dbg, "simple-worker.js"); + + assertNotPaused(dbg); + + await dbg.actions.breakOnNext(); + await waitForPaused(dbg, "doc-windowless-workers.html"); + + // We should be paused at the timer in doc-windowless-workers.html + assertPausedAtSourceAndLine(dbg, mainThreadSource.id, 9); + + await dbg.actions.selectThread(workerThread); + assertNotPaused(dbg); + + await dbg.actions.breakOnNext(); + await waitForPaused(dbg, "simple-worker.js"); + + // We should be paused at the timer in simple-worker.js + assertPausedAtSourceAndLine(dbg, workerSource.id, 3); + + await stepOver(dbg); + assertPausedAtSourceAndLine(dbg, workerSource.id, 4); + + await dbg.actions.selectThread(mainThread); + + await stepOver(dbg); + assertPausedAtSourceAndLine(dbg, mainThreadSource.id, 10); +}); diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-windowless-workers.html b/devtools/client/debugger/new/test/mochitest/examples/doc-windowless-workers.html new file mode 100644 index 000000000000..d745e9921e2a --- /dev/null +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-windowless-workers.html @@ -0,0 +1,19 @@ + + + + + + +Hello World! + + diff --git a/devtools/client/debugger/new/test/mochitest/examples/simple-worker.js b/devtools/client/debugger/new/test/mochitest/examples/simple-worker.js new file mode 100644 index 000000000000..b9c806fa8f88 --- /dev/null +++ b/devtools/client/debugger/new/test/mochitest/examples/simple-worker.js @@ -0,0 +1,7 @@ +var count = 0; +function timer() { + var n = ++count; + console.log("WORKER SAYS HELLO! " + n); +} + +setInterval(timer, 1000); diff --git a/devtools/client/debugger/new/test/mochitest/helpers.js b/devtools/client/debugger/new/test/mochitest/helpers.js index b9d37fd55dae..242eef122303 100644 --- a/devtools/client/debugger/new/test/mochitest/helpers.js +++ b/devtools/client/debugger/new/test/mochitest/helpers.js @@ -405,6 +405,34 @@ function isPaused(dbg) { return !!isPaused(getState()); } +// Make sure the debugger is paused at a certain source ID and line. +function assertPausedAtSourceAndLine(dbg, expectedSourceId, expectedLine) { + assertPaused(dbg); + + const { + selectors: { getWorkers, getFrames }, + getState + } = dbg; + + const frames = getFrames(getState()); + ok(frames.length >= 1, "Got at least one frame"); + const { sourceId, line } = frames[0].location; + ok(sourceId == expectedSourceId, "Frame has correct source"); + ok(line == expectedLine, "Frame has correct line"); +} + +// Get any workers associated with the debugger. +async function getWorkers(dbg) { + await dbg.actions.updateWorkers(); + + const { + selectors: { getWorkers }, + getState + } = dbg; + + return getWorkers(getState()).toJS(); +} + async function waitForLoadedScopes(dbg) { const scopes = await waitForElement(dbg, "scopes"); // Since scopes auto-expand, we can assume they are loaded when there is a tree node