From f946c7af8593b7145498efd81daa9e9536c54d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 2 Apr 2018 13:29:58 +0200 Subject: [PATCH 01/52] Bug 1450654: Remove ResolveTag usage in cocoa code. r=mstange We don't have any binding in the tree that extends="xul:menupopup", which is the only thing that would change the result. Also, I constrained it to the XUL namespace instead of just checking the node name. But again, we don't have non-XUL menupopups. MozReview-Commit-ID: 7M0beoJI86Y --HG-- extra : rebase_source : f50a186d5e78ca808d6c8873ec982663f4bbbde5 --- widget/cocoa/nsMenuX.mm | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/widget/cocoa/nsMenuX.mm b/widget/cocoa/nsMenuX.mm index 694b893e4b10..a8b5bfd104d1 100644 --- a/widget/cocoa/nsMenuX.mm +++ b/widget/cocoa/nsMenuX.mm @@ -639,25 +639,19 @@ void nsMenuX::GetMenuPopupContent(nsIContent** aResult) return; *aResult = nullptr; - int32_t dummy; // Check to see if we are a "menupopup" node (if we are a native menu). - { - RefPtr tag = mContent->OwnerDoc()->BindingManager()->ResolveTag(mContent, &dummy); - if (tag == nsGkAtoms::menupopup) { - NS_ADDREF(*aResult = mContent); - return; - } + if (mContent->IsXULElement(nsGkAtoms::menupopup)) { + NS_ADDREF(*aResult = mContent); + return; } // Otherwise check our child nodes. for (nsIContent* child = mContent->GetFirstChild(); child; child = child->GetNextSibling()) { - RefPtr tag = child->OwnerDoc()->BindingManager()->ResolveTag(child, &dummy); - if (tag == nsGkAtoms::menupopup) { - *aResult = child; - NS_ADDREF(*aResult); + if (child->IsXULElement(nsGkAtoms::menupopup)) { + NS_ADDREF(*aResult = child); return; } } From e920ec0ec74505b57369f73a56f106089983c532 Mon Sep 17 00:00:00 2001 From: Jan Henning Date: Sat, 24 Mar 2018 21:27:06 +0100 Subject: [PATCH 02/52] Bug 1281907 - Part 1 - Include zoom level compensation in clip transform passed to caller. r=botond If we don't do that, in the case of a root scrollbar the clip transform passed to our caller will incorrectly be scaled with the current content resolution. This means that that the position of the clip rect won't match the actual position of the scrollbar if the resolution isn't ~1.0, so the scrollbars will be clipped out of existence when the content is (pinch-) zoomed in or out. MozReview-Commit-ID: 5yXa9EpTJ2g --HG-- extra : rebase_source : 88c3b5a8613a3d6ef0c753116ebf9efe9ffc0022 --- gfx/layers/apz/src/APZCTreeManager.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp index 54b460078c56..d0f83f332804 100644 --- a/gfx/layers/apz/src/APZCTreeManager.cpp +++ b/gfx/layers/apz/src/APZCTreeManager.cpp @@ -3191,18 +3191,15 @@ APZCTreeManager::ComputeTransformForScrollThumb( const Matrix4x4& contentTransform = aScrollableContentTransform; Matrix4x4 contentUntransform = contentTransform.Inverse(); - AsyncTransformComponentMatrix asyncCompensation = - ViewAs( - contentTransform - * asyncUntransform - * contentUntransform); + compensation *= ViewAs( + contentTransform + * asyncUntransform + * contentUntransform); - compensation = compensation * asyncCompensation; - - // Pass the async compensation out to the caller so that it can use it + // Pass the total compensation out to the caller so that it can use it // to transform clip transforms as needed. if (aOutClipTransform) { - *aOutClipTransform = asyncCompensation; + *aOutClipTransform = compensation; } } transform = transform * compensation; From b1dce0964282ad86866dd26f34e311f595b9c61e Mon Sep 17 00:00:00 2001 From: Jan Henning Date: Sun, 1 Apr 2018 17:40:04 +0200 Subject: [PATCH 03/52] Bug 1281907 - Part 2 - Add reftest for scrollbars with pinch-zooming. r=botond MozReview-Commit-ID: K7YoEPQLJzU --HG-- extra : rebase_source : 370eb97fd04384df4f8d7e9bdbc64ff42b89fb57 --- gfx/layers/apz/test/reftest/reftest.list | 5 +++++ .../test/reftest/scrollbar-zoom-resolution-1-ref.html | 9 +++++++++ .../apz/test/reftest/scrollbar-zoom-resolution-1.html | 9 +++++++++ .../test/reftest/scrollbar-zoom-resolution-2-ref.html | 9 +++++++++ .../apz/test/reftest/scrollbar-zoom-resolution-2.html | 9 +++++++++ 5 files changed, 41 insertions(+) create mode 100644 gfx/layers/apz/test/reftest/scrollbar-zoom-resolution-1-ref.html create mode 100644 gfx/layers/apz/test/reftest/scrollbar-zoom-resolution-1.html create mode 100644 gfx/layers/apz/test/reftest/scrollbar-zoom-resolution-2-ref.html create mode 100644 gfx/layers/apz/test/reftest/scrollbar-zoom-resolution-2.html diff --git a/gfx/layers/apz/test/reftest/reftest.list b/gfx/layers/apz/test/reftest/reftest.list index 7d8363ed9e60..3b3ddf014fa8 100644 --- a/gfx/layers/apz/test/reftest/reftest.list +++ b/gfx/layers/apz/test/reftest/reftest.list @@ -13,6 +13,11 @@ fuzzy-if(Android,3,7) skip-if(!Android) pref(apz.allow_zooming,true) == async-sc fuzzy-if(Android,54,20) skip-if(!Android) pref(apz.allow_zooming,true) == async-scrollbar-zoom-1.html async-scrollbar-zoom-1-ref.html fuzzy-if(Android,45,22) skip-if(!Android) pref(apz.allow_zooming,true) == async-scrollbar-zoom-2.html async-scrollbar-zoom-2-ref.html +# Test scrollbars working properly with pinch-zooming, i.e. different document resolutions. +# As above, the end of the scrollthumb won't match perfectly, but the bulk of the scrollbar should be present and identical. +fuzzy-if(Android,54,14) skip-if(!Android) pref(apz.allow_zooming,true) == scrollbar-zoom-resolution-1.html scrollbar-zoom-resolution-1-ref.html +fuzzy-if(Android,51,22) skip-if(!Android) pref(apz.allow_zooming,true) == scrollbar-zoom-resolution-2.html scrollbar-zoom-resolution-2-ref.html + # Meta-viewport tag support skip-if(!Android) pref(apz.allow_zooming,true) == initial-scale-1.html initial-scale-1-ref.html diff --git a/gfx/layers/apz/test/reftest/scrollbar-zoom-resolution-1-ref.html b/gfx/layers/apz/test/reftest/scrollbar-zoom-resolution-1-ref.html new file mode 100644 index 000000000000..5ed970f7644d --- /dev/null +++ b/gfx/layers/apz/test/reftest/scrollbar-zoom-resolution-1-ref.html @@ -0,0 +1,9 @@ + + + + + +
+ + + diff --git a/gfx/layers/apz/test/reftest/scrollbar-zoom-resolution-1.html b/gfx/layers/apz/test/reftest/scrollbar-zoom-resolution-1.html new file mode 100644 index 000000000000..c50f37c2b46d --- /dev/null +++ b/gfx/layers/apz/test/reftest/scrollbar-zoom-resolution-1.html @@ -0,0 +1,9 @@ + + + + + +
+ + + diff --git a/gfx/layers/apz/test/reftest/scrollbar-zoom-resolution-2-ref.html b/gfx/layers/apz/test/reftest/scrollbar-zoom-resolution-2-ref.html new file mode 100644 index 000000000000..5ed970f7644d --- /dev/null +++ b/gfx/layers/apz/test/reftest/scrollbar-zoom-resolution-2-ref.html @@ -0,0 +1,9 @@ + + + + + +
+ + + diff --git a/gfx/layers/apz/test/reftest/scrollbar-zoom-resolution-2.html b/gfx/layers/apz/test/reftest/scrollbar-zoom-resolution-2.html new file mode 100644 index 000000000000..9f064a37d27d --- /dev/null +++ b/gfx/layers/apz/test/reftest/scrollbar-zoom-resolution-2.html @@ -0,0 +1,9 @@ + + + + + +
+ + + From 4b8bbac5c75ce0b919caeee08174059ba1ccff8b Mon Sep 17 00:00:00 2001 From: Daisuke Akatsuka Date: Tue, 3 Apr 2018 12:25:44 +0900 Subject: [PATCH 04/52] Bug 1448732 - Part 0: Modify variables and code format for consistency. r=pbro In this patch, modify the following things: * Modify variable name of test data list to "TEST_DATA" * Modify variable name of testing animation target class name to "targetClass" * Some comments format MozReview-Commit-ID: J33RRcm4chO --HG-- extra : rebase_source : 6cfc7515faf587ee0dfe03377d9529c461ad4ae2 --- ...rowser_animation_animated-property-list.js | 29 ++++---- ...rowser_animation_animated-property-name.js | 22 ++++--- ...rowser_animation_animation-detail_title.js | 19 +++--- .../test/browser_animation_animation-list.js | 6 +- .../browser_animation_animation-target.js | 11 ++-- ...owser_animation_animation-timeline-tick.js | 8 +-- .../browser_animation_current-time-label.js | 1 + ...rowser_animation_empty_on_invalid_nodes.js | 6 +- ...ion_keyframes-graph_computed-value-path.js | 24 +++---- ...s-graph_computed-value-path_easing-hint.js | 41 +++++------- ...imation_keyframes-graph_keyframe-marker.js | 27 ++++---- ...rowser_animation_keyframes-progress-bar.js | 33 +++++----- ...tion_logic_avoid-updating-during-hiding.js | 4 +- .../test/browser_animation_logic_mutations.js | 8 +-- ..._animation_summary-graph_animation-name.js | 29 ++++---- ...wser_animation_summary-graph_compositor.js | 6 +- ...tion_summary-graph_computed-timing-path.js | 66 +++++++++---------- ...omputed-timing-path_different-timescale.js | 2 +- ...wser_animation_summary-graph_delay-sign.js | 31 ++++----- ...mation_summary-graph_effect-timing-path.js | 25 +++---- ..._animation_summary-graph_end-delay-sign.js | 31 ++++----- ...ation_summary-graph_negative-delay-path.js | 21 +++--- ...n_summary-graph_negative-end-delay-path.js | 21 +++--- ...browser_animation_summary-graph_tooltip.js | 59 ++++++++--------- .../animation/test/doc_multi_easings.html | 2 +- .../animation/test/doc_multi_keyframes.html | 2 +- .../animation/test/doc_simple_animation.html | 8 +-- 27 files changed, 251 insertions(+), 291 deletions(-) diff --git a/devtools/client/inspector/animation/test/browser_animation_animated-property-list.js b/devtools/client/inspector/animation/test/browser_animation_animated-property-list.js index 22ebb1c193d4..d8dcfbf71017 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animated-property-list.js +++ b/devtools/client/inspector/animation/test/browser_animation_animated-property-list.js @@ -7,13 +7,13 @@ // 1. Existence for animated property list. // 2. Number of animated property item. -const TEST_CASES = [ +const TEST_DATA = [ { - target: ".animated", + targetClass: "animated", expectedNumber: 1, }, { - target: ".compositor-notall", + targetClass: "compositor-notall", expectedNumber: 3, }, ]; @@ -26,28 +26,27 @@ add_task(async function() { ok(!panel.querySelector(".animated-property-list"), "The animated-property-list should not be in the DOM at initial"); - for (const testCase of TEST_CASES) { - info(`Checking animated-property-list and items existence at ${ testCase.target }`); - const animatedNode = await getNodeFront(testCase.target, inspector); - await selectNodeAndWaitForAnimations(animatedNode, inspector); + for (const { targetClass, expectedNumber } of TEST_DATA) { + info(`Checking animated-property-list and items existence at ${ targetClass }`); + await selectNodeAndWaitForAnimations(`.${ targetClass }`, inspector); ok(panel.querySelector(".animated-property-list"), - `The animated-property-list should be in the DOM at ${ testCase.target }`); + `The animated-property-list should be in the DOM at ${ targetClass }`); const itemEls = panel.querySelectorAll(".animated-property-list .animated-property-item"); - is(itemEls.length, testCase.expectedNumber, - `The number of animated-property-list should be ${ testCase.expectedNumber } ` - + `at ${ testCase.target }`); + is(itemEls.length, expectedNumber, + `The number of animated-property-list should be ${ expectedNumber } ` + + `at ${ targetClass }`); if (itemEls.length < 2) { continue; } - info(`Checking the background color for ` - + `the animated property item at ${ testCase.target }`); + info("Checking the background color for " + + `the animated property item at ${ targetClass }`); const evenColor = panel.ownerGlobal.getComputedStyle(itemEls[0]).backgroundColor; const oddColor = panel.ownerGlobal.getComputedStyle(itemEls[1]).backgroundColor; isnot(evenColor, oddColor, - "Background color of an even animated property item " - + "should be different from odd"); + "Background color of an even animated property item " + + "should be different from odd"); } }); diff --git a/devtools/client/inspector/animation/test/browser_animation_animated-property-name.js b/devtools/client/inspector/animation/test/browser_animation_animated-property-name.js index 7800245e83fb..fe9c4f833c62 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animated-property-name.js +++ b/devtools/client/inspector/animation/test/browser_animation_animated-property-name.js @@ -34,19 +34,23 @@ add_task(async function() { `Number of animated property name elements should be ${ TEST_DATA.length }`); for (const [index, animatedPropertyNameEl] of animatedPropertyNameEls.entries()) { - const testData = TEST_DATA[index]; + const { + property, + isOnCompositor, + isWarning, + } = TEST_DATA[index]; - info(`Checking text content for ${ testData.property }`); + info(`Checking text content for ${ property }`); const spanEl = animatedPropertyNameEl.querySelector("span"); ok(spanEl, - ` element should be in animated-property-name of ${ testData.property }`); - is(spanEl.textContent, testData.property, - `textContent should be ${ testData.property }`); + ` element should be in animated-property-name of ${ property }`); + is(spanEl.textContent, property, + `textContent should be ${ property }`); - info(`Checking compositor sign for ${ testData.property }`); + info(`Checking compositor sign for ${ property }`); - if (testData.isOnCompositor) { + if (isOnCompositor) { ok(animatedPropertyNameEl.classList.contains("compositor"), "animatedPropertyNameEl should has .compositor class"); isnot(getComputedStyle(spanEl, "::before").width, "auto", @@ -58,9 +62,9 @@ add_task(async function() { "width of ::before pseud should be auto"); } - info(`Checking warning for ${ testData.property }`); + info(`Checking warning for ${ property }`); - if (testData.isWarning) { + if (isWarning) { ok(animatedPropertyNameEl.classList.contains("warning"), "animatedPropertyNameEl should has .warning class"); is(getComputedStyle(spanEl).textDecorationStyle, "dotted", diff --git a/devtools/client/inspector/animation/test/browser_animation_animation-detail_title.js b/devtools/client/inspector/animation/test/browser_animation_animation-detail_title.js index 697aa6804f28..448c4d683822 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animation-detail_title.js +++ b/devtools/client/inspector/animation/test/browser_animation_animation-detail_title.js @@ -5,17 +5,17 @@ // Test that whether title in header of animations detail. -const TEST_CASES = [ +const TEST_DATA = [ { - target: ".cssanimation-normal", + targetClass: "cssanimation-normal", expectedTitle: "cssanimation - CSS Animation", }, { - target: ".delay-positive", + targetClass: "delay-positive", expectedTitle: "test-delay-animation - Script Animation", }, { - target: ".easing-step", + targetClass: "easing-step", expectedTitle: "Script Animation", }, ]; @@ -26,12 +26,11 @@ add_task(async function() { info("Checking title in each header of animation detail"); - for (const testCase of TEST_CASES) { - info(`Checking title at ${ testCase.target }`); - const animatedNode = await getNodeFront(testCase.target, inspector); - await selectNodeAndWaitForAnimations(animatedNode, inspector); + for (const { targetClass, expectedTitle } of TEST_DATA) { + info(`Checking title at ${ targetClass }`); + await selectNodeAndWaitForAnimations(`.${ targetClass }`, inspector); const titleEl = panel.querySelector(".animation-detail-title"); - is(titleEl.textContent, testCase.expectedTitle, - `Title of "${ testCase.target }" should be "${ testCase.expectedTitle }"`); + is(titleEl.textContent, expectedTitle, + `Title of "${ targetClass }" should be "${ expectedTitle }"`); } }); diff --git a/devtools/client/inspector/animation/test/browser_animation_animation-list.js b/devtools/client/inspector/animation/test/browser_animation_animation-list.js index 290741883461..24e2d57aaefa 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animation-list.js +++ b/devtools/client/inspector/animation/test/browser_animation_animation-list.js @@ -12,7 +12,7 @@ add_task(async function() { info("Checking animation list and items existence"); ok(panel.querySelector(".animation-list"), - "The animation-list is in the DOM"); + "The animation-list is in the DOM"); is(panel.querySelectorAll(".animation-list .animation-item").length, animationInspector.state.animations.length, "The number of animations displayed matches the number of animations"); @@ -24,11 +24,11 @@ add_task(async function() { const oddColor = panel.ownerGlobal.getComputedStyle(animationItemEls[1]).backgroundColor; isnot(evenColor, oddColor, - "Background color of an even animation should be different from odd"); + "Background color of an even animation should be different from odd"); info("Checking list and items existence after select a element which has an animation"); const animatedNode = await getNodeFront(".animated", inspector); await selectNodeAndWaitForAnimations(animatedNode, inspector); is(panel.querySelectorAll(".animation-list .animation-item").length, 1, - "The number of animations displayed should be 1 for .animated element"); + "The number of animations displayed should be 1 for .animated element"); }); diff --git a/devtools/client/inspector/animation/test/browser_animation_animation-target.js b/devtools/client/inspector/animation/test/browser_animation_animation-target.js index 976ddea581a7..28a4eaf00f81 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animation-target.js +++ b/devtools/client/inspector/animation/test/browser_animation_animation-target.js @@ -15,13 +15,13 @@ add_task(async function() { info("Checking the animation target elements existance"); const animationItemEls = panel.querySelectorAll(".animation-list .animation-item"); is(animationItemEls.length, animationInspector.state.animations.length, - "Number of animation target element should be same to number of animations " - + "that displays"); + "Number of animation target element should be same to number of animations " + + "that displays"); for (const animationItemEl of animationItemEls) { const animationTargetEl = animationItemEl.querySelector(".animation-target"); ok(animationTargetEl, - "The animation target element should be in each animation item element"); + "The animation target element should be in each animation item element"); } info("Checking the content of animation target"); @@ -29,7 +29,6 @@ add_task(async function() { const animationTargetEl = panel.querySelector(".animation-list .animation-item .animation-target"); is(animationTargetEl.textContent, "div.ball.animated", - "The target element's content is correct"); - ok(animationTargetEl.querySelector(".objectBox"), - "objectBox is in the page exists"); + "The target element's content is correct"); + ok(animationTargetEl.querySelector(".objectBox"), "objectBox is in the page exists"); }); diff --git a/devtools/client/inspector/animation/test/browser_animation_animation-timeline-tick.js b/devtools/client/inspector/animation/test/browser_animation_animation-timeline-tick.js index 86df09fe2d24..37c641cf5e1f 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animation-timeline-tick.js +++ b/devtools/client/inspector/animation/test/browser_animation_animation-timeline-tick.js @@ -49,7 +49,7 @@ function assertTimelineTickItems(timeScale, listHeaderEl) { const animationTimelineTickListEl = listHeaderEl.querySelector(".animation-timeline-tick-list"); ok(animationTimelineTickListEl, - "The animation timeline tick list element should be in header"); + "The animation timeline tick list element should be in header"); const width = animationTimelineTickListEl.offsetWidth; const animationDuration = timeScale.getDuration(); @@ -60,14 +60,14 @@ function assertTimelineTickItems(timeScale, listHeaderEl) { const timelineTickItemEls = listHeaderEl.querySelectorAll(".animation-timeline-tick-item"); is(timelineTickItemEls.length, expectedTickItem, - "The expected number of timeline ticks were found"); + "The expected number of timeline ticks were found"); info("Make sure graduations are evenly distributed and show the right times"); for (const [index, tickEl] of timelineTickItemEls.entries()) { const left = parseFloat(tickEl.style.left); const expectedPos = index * interval * 100 / animationDuration; is(Math.round(left), Math.round(expectedPos), - `Graduation ${ index } is positioned correctly`); + `Graduation ${ index } is positioned correctly`); // Note that the distancetoRelativeTime and formatTime functions are tested // separately in xpcshell test test_timeScale.js, so we assume that they @@ -75,6 +75,6 @@ function assertTimelineTickItems(timeScale, listHeaderEl) { const formattedTime = timeScale.formatTime(timeScale.distanceToRelativeTime(expectedPos, width)); is(tickEl.textContent, formattedTime, - `Graduation ${ index } has the right text content`); + `Graduation ${ index } has the right text content`); } } diff --git a/devtools/client/inspector/animation/test/browser_animation_current-time-label.js b/devtools/client/inspector/animation/test/browser_animation_current-time-label.js index 9cd574246cd0..0e8c863cd9c7 100644 --- a/devtools/client/inspector/animation/test/browser_animation_current-time-label.js +++ b/devtools/client/inspector/animation/test/browser_animation_current-time-label.js @@ -50,6 +50,7 @@ function formatStopwatchTime(time) { if (nb < max) { return new Array((max + "").length - (nb + "").length + 1).join("0") + nb; } + return nb; }; diff --git a/devtools/client/inspector/animation/test/browser_animation_empty_on_invalid_nodes.js b/devtools/client/inspector/animation/test/browser_animation_empty_on_invalid_nodes.js index 29a076c2d7c1..0a28690f155d 100644 --- a/devtools/client/inspector/animation/test/browser_animation_empty_on_invalid_nodes.js +++ b/devtools/client/inspector/animation/test/browser_animation_empty_on_invalid_nodes.js @@ -21,14 +21,14 @@ add_task(async function() { ANIMATION_L10N.getStr("panel.noAnimation"), "The correct error message is displayed"); ok(!panel.querySelector(".animation-list"), - "Element which has animations class should not exist for a still node"); + "Element which has animations class should not exist for a still node"); info("Checking animation list and error message existence for a text node"); const commentNode = await inspector.walker.previousSibling(stillNode); await selectNodeAndWaitForAnimations(commentNode, inspector); ok(panel.querySelector(".animation-error-message"), - "Element which has animation-error-message class should exist for a text node"); + "Element which has animation-error-message class should exist for a text node"); ok(!panel.querySelector(".animation-list"), - "Element which has animations class should not exist for a text node"); + "Element which has animations class should not exist for a text node"); }); diff --git a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path.js b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path.js index 7d4edad5c13d..3fe39de4dbc4 100644 --- a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path.js +++ b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path.js @@ -13,7 +13,7 @@ requestLongerTimeout(2); const TEST_DATA = [ { - targetName: "multi-types", + targetClass: "multi-types", properties: [ { name: "background-color", @@ -87,7 +87,7 @@ const TEST_DATA = [ ], }, { - targetName: "multi-types-reverse", + targetClass: "multi-types-reverse", properties: [ { name: "background-color", @@ -161,7 +161,7 @@ const TEST_DATA = [ ], }, { - targetName: "middle-keyframe", + targetClass: "middle-keyframe", properties: [ { name: "background-color", @@ -249,7 +249,7 @@ const TEST_DATA = [ ], }, { - targetName: "steps-keyframe", + targetClass: "steps-keyframe", properties: [ { name: "background-color", @@ -335,7 +335,7 @@ const TEST_DATA = [ ], }, { - targetName: "steps-effect", + targetClass: "steps-effect", properties: [ { name: "opacity", @@ -351,7 +351,7 @@ const TEST_DATA = [ ], }, { - targetName: "frames-keyframe", + targetClass: "frames-keyframe", properties: [ { name: "opacity", @@ -372,7 +372,7 @@ const TEST_DATA = [ ], }, { - targetName: "narrow-offsets", + targetClass: "narrow-offsets", properties: [ { name: "opacity", @@ -391,7 +391,7 @@ const TEST_DATA = [ ], }, { - targetName: "duplicate-offsets", + targetClass: "duplicate-offsets", properties: [ { name: "opacity", @@ -415,9 +415,9 @@ add_task(async function() { const { inspector, panel } = await openAnimationInspector(); - for (const { properties, targetName } of TEST_DATA) { - info(`Checking keyframes graph for ${ targetName }`); - await selectNodeAndWaitForAnimations(`#${ targetName }`, inspector); + for (const { properties, targetClass } of TEST_DATA) { + info(`Checking keyframes graph for ${ targetClass }`); + await selectNodeAndWaitForAnimations(`.${ targetClass }`, inspector); for (const property of properties) { const { @@ -427,7 +427,7 @@ add_task(async function() { expectedStopColors, } = property; - const testTarget = `${ name } in ${ targetName }`; + const testTarget = `${ name } in ${ targetClass }`; info(`Checking keyframes graph for ${ testTarget }`); info(`Checking keyframes graph path existence for ${ testTarget }`); const keyframesGraphPathEl = panel.querySelector(`.${ name }`); diff --git a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path_easing-hint.js b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path_easing-hint.js index 2d6d1b43e50b..8809e8d814ea 100644 --- a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path_easing-hint.js +++ b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path_easing-hint.js @@ -10,7 +10,7 @@ const TEST_DATA = [ { - targetName: "no-easing", + targetClass: "no-easing", properties: [ { name: "opacity", @@ -28,7 +28,7 @@ const TEST_DATA = [ ], }, { - targetName: "effect-easing", + targetClass: "effect-easing", properties: [ { name: "opacity", @@ -46,7 +46,7 @@ const TEST_DATA = [ ], }, { - targetName: "keyframe-easing", + targetClass: "keyframe-easing", properties: [ { name: "opacity", @@ -66,7 +66,7 @@ const TEST_DATA = [ ], }, { - targetName: "both-easing", + targetClass: "both-easing", properties: [ { name: "margin-left", @@ -99,7 +99,7 @@ const TEST_DATA = [ ], }, { - targetName: "narrow-keyframes", + targetClass: "narrow-keyframes", properties: [ { name: "opacity", @@ -130,7 +130,7 @@ const TEST_DATA = [ ], }, { - targetName: "duplicate-keyframes", + targetClass: "duplicate-keyframes", properties: [ { name: "opacity", @@ -162,7 +162,7 @@ const TEST_DATA = [ ], }, { - targetName: "color-keyframes", + targetClass: "color-keyframes", properties: [ { name: "color", @@ -194,23 +194,18 @@ add_task(async function() { const { inspector, panel } = await openAnimationInspector(); - for (const { properties, targetName } of TEST_DATA) { - info(`Checking keyframes graph for ${ targetName }`); - await selectNodeAndWaitForAnimations(`#${ targetName }`, inspector); + for (const { properties, targetClass } of TEST_DATA) { + info(`Checking keyframes graph for ${ targetClass }`); + await selectNodeAndWaitForAnimations(`.${ targetClass }`, inspector); - for (const property of properties) { - const { - name, - expectedHints, - } = property; - - const testTarget = `${ name } in ${ targetName }`; + for (const { name, expectedHints } of properties) { + const testTarget = `${ name } in ${ targetClass }`; info(`Checking easing hint for ${ testTarget }`); info(`Checking easing hint existence for ${ testTarget }`); const hintEls = panel.querySelectorAll(`.${ name } .hint`); is(hintEls.length, expectedHints.length, - `Count of easing hint elements of ${ testTarget } ` - + `should be ${ expectedHints.length }`); + `Count of easing hint elements of ${ testTarget } ` + + `should be ${ expectedHints.length }`); for (let i = 0; i < expectedHints.length; i++) { const hintTarget = `hint[${ i }] of ${ testTarget }`; @@ -248,12 +243,12 @@ add_task(async function() { // Mouse out once from pathEl. EventUtils.synthesizeMouse(interactionEl, -1, -1, { type: "mouseout" }, win); is(win.getComputedStyle(interactionEl).strokeOpacity, 0, - `stroke-opacity of hintEl for ${ hintTarget } should be 0` - + " while mouse is out from the element"); + `stroke-opacity of hintEl for ${ hintTarget } should be 0` + + " while mouse is out from the element"); // Mouse over the pathEl. ok(isStrokeChangedByMouseOver(interactionEl, win), - `stroke-opacity of hintEl for ${ hintTarget } should be 1` - + " while mouse is over the element"); + `stroke-opacity of hintEl for ${ hintTarget } should be 1` + + " while mouse is over the element"); } } } diff --git a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_keyframe-marker.js b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_keyframe-marker.js index 126974654043..47fbe385e2f9 100644 --- a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_keyframe-marker.js +++ b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_keyframe-marker.js @@ -10,7 +10,7 @@ const TEST_DATA = [ { - targetName: "multi-types", + targetClass: "multi-types", properties: [ { name: "background-color", @@ -106,7 +106,7 @@ const TEST_DATA = [ ], }, { - targetName: "narrow-offsets", + targetClass: "narrow-offsets", properties: [ { name: "opacity", @@ -138,23 +138,18 @@ add_task(async function() { const { inspector, panel } = await openAnimationInspector(); - for (const { properties, targetName } of TEST_DATA) { - info(`Checking keyframe marker for ${ targetName }`); - await selectNodeAndWaitForAnimations(`#${ targetName }`, inspector); + for (const { properties, targetClass } of TEST_DATA) { + info(`Checking keyframe marker for ${ targetClass }`); + await selectNodeAndWaitForAnimations(`.${ targetClass }`, inspector); - for (const property of properties) { - const { - name, - expectedValues, - } = property; - - const testTarget = `${ name } in ${ targetName }`; + for (const { name, expectedValues } of properties) { + const testTarget = `${ name } in ${ targetClass }`; info(`Checking keyframe marker for ${ testTarget }`); info(`Checking keyframe marker existence for ${ testTarget }`); const markerEls = panel.querySelectorAll(`.${ name } .keyframe-marker-item`); is(markerEls.length, expectedValues.length, - `Count of keyframe marker elements of ${ testTarget } ` - + `should be ${ expectedValues.length }`); + `Count of keyframe marker elements of ${ testTarget } ` + + `should be ${ expectedValues.length }`); for (let i = 0; i < expectedValues.length; i++) { const hintTarget = `.keyframe-marker-item[${ i }] of ${ testTarget }`; @@ -165,11 +160,11 @@ add_task(async function() { info(`Checking title in ${ hintTarget }`); is(markerEl.getAttribute("title"), expectedValue.title, - `title in ${ hintTarget } should be ${ expectedValue.title }`); + `title in ${ hintTarget } should be ${ expectedValue.title }`); info(`Checking left style in ${ hintTarget }`); is(markerEl.style.left, expectedValue.left, - `left in ${ hintTarget } should be ${ expectedValue.left }`); + `left in ${ hintTarget } should be ${ expectedValue.left }`); } } } diff --git a/devtools/client/inspector/animation/test/browser_animation_keyframes-progress-bar.js b/devtools/client/inspector/animation/test/browser_animation_keyframes-progress-bar.js index 43dad0b07435..b3525957faa0 100644 --- a/devtools/client/inspector/animation/test/browser_animation_keyframes-progress-bar.js +++ b/devtools/client/inspector/animation/test/browser_animation_keyframes-progress-bar.js @@ -11,44 +11,44 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ requestLongerTimeout(5); -const POSITION_TESTCASES = [ +const TEST_DATA = [ { - targetClassName: "cssanimation-linear", + targetClass: "cssanimation-linear", scrubberPositions: [0, 0.25, 0.5, 0.75, 1], expectedPositions: [0, 0.25, 0.5, 0.75, 0], }, { - targetClassName: "easing-step", + targetClass: "easing-step", scrubberPositions: [0, 0.49, 0.5, 0.99], expectedPositions: [0, 0, 0.5, 0.5], }, { - targetClassName: "delay-positive", + targetClass: "delay-positive", scrubberPositions: [0, 0.33, 0.5], expectedPositions: [0, 0, 0.25], }, { - targetClassName: "delay-negative", + targetClass: "delay-negative", scrubberPositions: [0, 0.49, 0.5, 0.75], expectedPositions: [0, 0, 0.5, 0.75], }, { - targetClassName: "enddelay-positive", + targetClass: "enddelay-positive", scrubberPositions: [0, 0.66, 0.67, 0.99], expectedPositions: [0, 0.99, 0, 0], }, { - targetClassName: "enddelay-negative", + targetClass: "enddelay-negative", scrubberPositions: [0, 0.49, 0.5, 0.99], expectedPositions: [0, 0.49, 0, 0], }, { - targetClassName: "direction-reverse-with-iterations-infinity", + targetClass: "direction-reverse-with-iterations-infinity", scrubberPositions: [0, 0.25, 0.5, 0.75, 1], expectedPositions: [1, 0.75, 0.5, 0.25, 1], }, { - targetClassName: "fill-both-width-delay-iterationstart", + targetClass: "fill-both-width-delay-iterationstart", scrubberPositions: [0, 0.33, 0.66, 0.833, 1], expectedPositions: [0.5, 0.5, 0.99, 0.25, 0.5], }, @@ -60,9 +60,15 @@ add_task(async function() { info("Checking progress bar position in multi effect timings"); - for (const testcase of POSITION_TESTCASES) { - info(`Checking progress bar position for ${ testcase.targetClassName }`); - await selectNodeAndWaitForAnimations(`.${ testcase.targetClassName }`, inspector); + for (const testdata of TEST_DATA) { + const { + targetClass, + scrubberPositions, + expectedPositions, + } = testdata; + + info(`Checking progress bar position for ${ targetClass }`); + await selectNodeAndWaitForAnimations(`.${ targetClass }`, inspector); info("Checking progress bar existence"); const areaEl = panel.querySelector(".keyframes-progress-bar-area"); @@ -70,9 +76,6 @@ add_task(async function() { const barEl = areaEl.querySelector(".keyframes-progress-bar"); ok(barEl, "progress bar should exist"); - const scrubberPositions = testcase.scrubberPositions; - const expectedPositions = testcase.expectedPositions; - for (let i = 0; i < scrubberPositions.length; i++) { info(`Scrubber position is ${ scrubberPositions[i] }`); await clickOnCurrentTimeScrubberController(animationInspector, diff --git a/devtools/client/inspector/animation/test/browser_animation_logic_avoid-updating-during-hiding.js b/devtools/client/inspector/animation/test/browser_animation_logic_avoid-updating-during-hiding.js index 17d16a4717eb..d5bcf923582b 100644 --- a/devtools/client/inspector/animation/test/browser_animation_logic_avoid-updating-during-hiding.js +++ b/devtools/client/inspector/animation/test/browser_animation_logic_avoid-updating-during-hiding.js @@ -37,11 +37,11 @@ add_task(async function() { "Should not update after selecting another tool"); await selectAnimationInspector(inspector); is(animationInspector.state.animations.length, 1, - "Should update after selecting animation inspector"); + "Should update after selecting animation inspector"); await assertCurrentTimeUpdated(animationInspector, panel, true); await inspector.toolbox.selectTool("webconsole"); is(animationInspector.state.animations.length, 1, - "Should not update after selecting another tool again"); + "Should not update after selecting another tool again"); await assertCurrentTimeUpdated(animationInspector, panel, false); }); diff --git a/devtools/client/inspector/animation/test/browser_animation_logic_mutations.js b/devtools/client/inspector/animation/test/browser_animation_logic_mutations.js index df7758d8432e..17d380fc3060 100644 --- a/devtools/client/inspector/animation/test/browser_animation_logic_mutations.js +++ b/devtools/client/inspector/animation/test/browser_animation_logic_mutations.js @@ -20,12 +20,12 @@ add_task(async function() { info("Checking added animation existence even the animation name is duplicated"); is(getAnimationNameCount(panel, "no-compositor"), 2, - "Count of animation should be plus one to original count"); + "Count of animation should be plus one to original count"); info("Checking the mutation for remove an animation"); await setClassAttribute(animationInspector, ".compositor-notall", "ball still"); is(animationInspector.state.animations.length, originalAnimationCount, - "Count of animation should be same to original count since we remove an animation"); + "Count of animation should be same to original count since we remove an animation"); info("Checking the mutation for modify an animation"); await selectNodeAndWaitForAnimations(".compositor-all", inspector); @@ -33,8 +33,8 @@ add_task(async function() { await setStyle(animationInspector, ".compositor-all", "animationIterationCount", 1); const summaryGraphPathEl = getSummaryGraphPathElement(panel, "compositor-all"); is(summaryGraphPathEl.viewBox.baseVal.width, 100000, - "Width of summary graph path should be 100000 " + - "after modifing the duration and iteration count"); + "Width of summary graph path should be 100000 " + + "after modifing the duration and iteration count"); await setStyle(animationInspector, ".compositor-all", "animationDelay", "100s"); is(summaryGraphPathEl.viewBox.baseVal.width, 200000, "Width of summary graph path should be 200000 after modifing the delay"); diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_animation-name.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_animation-name.js index fa32f902e467..4ea1d5854c44 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_animation-name.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_animation-name.js @@ -7,25 +7,25 @@ // * element existance // * name text -const TEST_CASES = [ +const TEST_DATA = [ { - targetClassName: "cssanimation-normal", + targetClass: "cssanimation-normal", expectedLabel: "cssanimation", }, { - targetClassName: "cssanimation-linear", + targetClass: "cssanimation-linear", expectedLabel: "cssanimation", }, { - targetClassName: "delay-positive", + targetClass: "delay-positive", expectedLabel: "test-delay-animation", }, { - targetClassName: "delay-negative", + targetClass: "delay-negative", expectedLabel: "test-negative-delay-animation", }, { - targetClassName: "easing-step", + targetClass: "easing-step", }, ]; @@ -34,26 +34,21 @@ add_task(async function() { const { panel } = await openAnimationInspector(); - for (const testCase of TEST_CASES) { - const { - expectedLabel, - targetClassName, - } = testCase; - + for (const { targetClass, expectedLabel } of TEST_DATA) { const animationItemEl = - findAnimationItemElementsByTargetClassName(panel, targetClassName); + findAnimationItemElementsByTargetClassName(panel, targetClass); - info(`Checking animation name element existance for ${ targetClassName }`); + info(`Checking animation name element existance for ${ targetClass }`); const animationNameEl = animationItemEl.querySelector(".animation-name"); if (expectedLabel) { ok(animationNameEl, - "The animation name element should be in animation item element"); + "The animation name element should be in animation item element"); is(animationNameEl.textContent, expectedLabel, - `The animation name should be ${ expectedLabel }`); + `The animation name should be ${ expectedLabel }`); } else { ok(!animationNameEl, - "The animation name element should not be in animation item element"); + "The animation name element should not be in animation item element"); } } }); diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_compositor.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_compositor.js index af4d890e95f4..a3443acc8907 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_compositor.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_compositor.js @@ -16,7 +16,7 @@ add_task(async function() { const summaryGraphEl = panel.querySelector(".animation-summary-graph"); ok(summaryGraphEl.classList.contains("compositor"), - "The element has the compositor css class"); + "The element has the compositor css class"); ok(hasTooltip(summaryGraphEl, ANIMATION_L10N.getStr("player.allPropertiesOnCompositorTooltip")), "The element has the right tooltip content"); @@ -25,7 +25,7 @@ add_task(async function() { await selectNodeAndWaitForAnimations(".no-compositor", inspector); ok(!summaryGraphEl.classList.contains("compositor"), - "The element does not have the compositor css class"); + "The element does not have the compositor css class"); ok(!hasTooltip(summaryGraphEl, ANIMATION_L10N.getStr("player.allPropertiesOnCompositorTooltip")), "The element does not have oncompositor tooltip content"); @@ -37,7 +37,7 @@ add_task(async function() { await selectNodeAndWaitForAnimations(".compositor-notall", inspector); ok(summaryGraphEl.classList.contains("compositor"), - "The element has the compositor css class"); + "The element has the compositor css class"); ok(hasTooltip(summaryGraphEl, ANIMATION_L10N.getStr("player.somePropertiesOnCompositorTooltip")), "The element has the right tooltip content"); diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path.js index caa844f027e8..a4a9aead90d3 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path.js @@ -10,9 +10,9 @@ // * fill: path // * endDelay: path -const TEST_CASES = [ +const TEST_DATA = [ { - targetClassName: "cssanimation-normal", + targetClass: "cssanimation-normal", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -25,7 +25,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "cssanimation-linear", + targetClass: "cssanimation-linear", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -38,7 +38,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "delay-positive", + targetClass: "delay-positive", expectedDelayPath: [ { x: 0, y: 0 }, { x: 500000, y: 0 }, @@ -55,7 +55,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "delay-negative", + targetClass: "delay-negative", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -67,7 +67,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "easing-step", + targetClass: "easing-step", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -79,7 +79,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "enddelay-positive", + targetClass: "enddelay-positive", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -96,7 +96,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "enddelay-negative", + targetClass: "enddelay-negative", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -107,7 +107,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "enddelay-with-fill-forwards", + targetClass: "enddelay-with-fill-forwards", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -132,7 +132,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "enddelay-with-iterations-infinity", + targetClass: "enddelay-with-iterations-infinity", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -154,7 +154,7 @@ const TEST_CASES = [ isInfinity: true, }, { - targetClassName: "direction-alternate-with-iterations-infinity", + targetClass: "direction-alternate-with-iterations-infinity", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -176,7 +176,7 @@ const TEST_CASES = [ isInfinity: true, }, { - targetClassName: "direction-alternate-reverse-with-iterations-infinity", + targetClass: "direction-alternate-reverse-with-iterations-infinity", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -198,7 +198,7 @@ const TEST_CASES = [ isInfinity: true, }, { - targetClassName: "direction-reverse-with-iterations-infinity", + targetClass: "direction-reverse-with-iterations-infinity", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -220,7 +220,7 @@ const TEST_CASES = [ isInfinity: true, }, { - targetClassName: "fill-backwards", + targetClass: "fill-backwards", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -233,7 +233,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "fill-backwards-with-delay-iterationstart", + targetClass: "fill-backwards-with-delay-iterationstart", expectedDelayPath: [ { x: 0, y: 0 }, { x: 0, y: 50 }, @@ -256,7 +256,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "fill-both", + targetClass: "fill-both", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -275,7 +275,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "fill-both-width-delay-iterationstart", + targetClass: "fill-both-width-delay-iterationstart", expectedDelayPath: [ { x: 0, y: 0 }, { x: 0, y: 50 }, @@ -302,7 +302,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "fill-forwards", + targetClass: "fill-forwards", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -321,7 +321,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "iterationstart", + targetClass: "iterationstart", expectedIterationPathList: [ [ { x: 0, y: 50 }, @@ -338,7 +338,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "no-compositor", + targetClass: "no-compositor", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -351,7 +351,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "keyframes-easing-step", + targetClass: "keyframes-easing-step", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -363,7 +363,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "narrow-keyframes", + targetClass: "narrow-keyframes", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -377,7 +377,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "duplicate-offsets", + targetClass: "duplicate-offsets", expectedIterationPathList: [ [ { x: 0, y: 0 }, @@ -394,26 +394,26 @@ add_task(async function() { const { panel } = await openAnimationInspector(); - for (const testCase of TEST_CASES) { + for (const testData of TEST_DATA) { const { expectedDelayPath, expectedEndDelayPath, expectedForwardsPath, expectedIterationPathList, isInfinity, - targetClassName, - } = testCase; + targetClass, + } = testData; const animationItemEl = - findAnimationItemElementsByTargetClassName(panel, targetClassName); + findAnimationItemElementsByTargetClassName(panel, targetClass); - info(`Checking computed timing path existance for ${ targetClassName }`); + info(`Checking computed timing path existance for ${ targetClass }`); const computedTimingPathEl = animationItemEl.querySelector(".animation-computed-timing-path"); ok(computedTimingPathEl, "The computed timing path element should be in each animation item element"); - info(`Checking delay path for ${ targetClassName }`); + info(`Checking delay path for ${ targetClass }`); const delayPathEl = computedTimingPathEl.querySelector(".animation-delay-path"); if (expectedDelayPath) { @@ -423,7 +423,7 @@ add_task(async function() { ok(!delayPathEl, "delay path should not be existance"); } - info(`Checking iteration path list for ${ targetClassName }`); + info(`Checking iteration path list for ${ targetClass }`); const iterationPathEls = computedTimingPathEl.querySelectorAll(".animation-iteration-path"); is(iterationPathEls.length, expectedIterationPathList.length, @@ -432,7 +432,7 @@ add_task(async function() { for (const [j, iterationPathEl] of iterationPathEls.entries()) { assertPathSegments(iterationPathEl, true, expectedIterationPathList[j]); - info(`Checking infinity ${ targetClassName }`); + info(`Checking infinity ${ targetClass }`); if (isInfinity && j >= 1) { ok(iterationPathEl.classList.contains("infinity"), "iteration path should have 'infinity' class"); @@ -442,7 +442,7 @@ add_task(async function() { } } - info(`Checking endDelay path for ${ targetClassName }`); + info(`Checking endDelay path for ${ targetClass }`); const endDelayPathEl = computedTimingPathEl.querySelector(".animation-enddelay-path"); if (expectedEndDelayPath) { @@ -452,7 +452,7 @@ add_task(async function() { ok(!endDelayPathEl, "endDelay path should not be existance"); } - info(`Checking forwards fill path for ${ targetClassName }`); + info(`Checking forwards fill path for ${ targetClass }`); const forwardsPathEl = computedTimingPathEl.querySelector(".animation-fill-forwards-path"); diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path_different-timescale.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path_different-timescale.js index 8885d5487c0c..277edb511fcc 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path_different-timescale.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path_different-timescale.js @@ -14,7 +14,7 @@ add_task(async function() { const pathStringA = panel.querySelector(".animation-iteration-path").getAttribute("d"); info("Select animation which has different time scale from no-compositor"); - await selectNodeAndWaitForAnimations("#endDelayed", inspector); + await selectNodeAndWaitForAnimations(".end-delay", inspector); info("Select no-compositor again"); await selectNodeAndWaitForAnimations(".animated", inspector); diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_delay-sign.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_delay-sign.js index 975cb7555b35..c7c0e95fb4aa 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_delay-sign.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_delay-sign.js @@ -9,16 +9,16 @@ // * width // * additinal class -const TEST_CASES = [ +const TEST_DATA = [ { - targetClassName: "delay-positive", + targetClass: "delay-positive", expectedResult: { left: "25%", width: "25%", }, }, { - targetClassName: "delay-negative", + targetClass: "delay-negative", expectedResult: { additionalClass: "negative", left: "0%", @@ -26,7 +26,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "fill-backwards-with-delay-iterationstart", + targetClass: "fill-backwards-with-delay-iterationstart", expectedResult: { additionalClass: "fill", left: "25%", @@ -34,10 +34,10 @@ const TEST_CASES = [ }, }, { - targetClassName: "fill-both", + targetClass: "fill-both", }, { - targetClassName: "fill-both-width-delay-iterationstart", + targetClass: "fill-both-width-delay-iterationstart", expectedResult: { additionalClass: "fill", left: "25%", @@ -45,7 +45,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "keyframes-easing-step", + targetClass: "keyframes-easing-step", }, ]; @@ -54,29 +54,24 @@ add_task(async function() { const { panel } = await openAnimationInspector(); - for (const testCase of TEST_CASES) { - const { - expectedResult, - targetClassName, - } = testCase; - + for (const { targetClass, expectedResult } of TEST_DATA) { const animationItemEl = - findAnimationItemElementsByTargetClassName(panel, targetClassName); + findAnimationItemElementsByTargetClassName(panel, targetClass); - info(`Checking delay sign existance for ${ targetClassName }`); + info(`Checking delay sign existance for ${ targetClass }`); const delaySignEl = animationItemEl.querySelector(".animation-delay-sign"); if (expectedResult) { ok(delaySignEl, "The delay sign element should be in animation item element"); is(delaySignEl.style.left, expectedResult.left, - `Left position should be ${ expectedResult.left }`); + `Left position should be ${ expectedResult.left }`); is(delaySignEl.style.width, expectedResult.width, - `Width should be ${ expectedResult.width }`); + `Width should be ${ expectedResult.width }`); if (expectedResult.additionalClass) { ok(delaySignEl.classList.contains(expectedResult.additionalClass), - `delay sign element should have ${ expectedResult.additionalClass } class`); + `delay sign element should have ${ expectedResult.additionalClass } class`); } else { ok(!delaySignEl.classList.contains(expectedResult.additionalClass), "delay sign element should not have " + diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_effect-timing-path.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_effect-timing-path.js index 0bc3edded76a..8786313c3a62 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_effect-timing-path.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_effect-timing-path.js @@ -7,15 +7,15 @@ // * element existance // * path -const TEST_CASES = [ +const TEST_DATA = [ { - targetClassName: "cssanimation-linear", + targetClass: "cssanimation-linear", }, { - targetClassName: "delay-negative", + targetClass: "delay-negative", }, { - targetClassName: "easing-step", + targetClass: "easing-step", expectedPath: [ { x: 0, y: 0 }, { x: 499999, y: 0 }, @@ -25,7 +25,7 @@ const TEST_CASES = [ ], }, { - targetClassName: "keyframes-easing-step", + targetClass: "keyframes-easing-step", }, ]; @@ -34,27 +34,22 @@ add_task(async function() { const { panel } = await openAnimationInspector(); - for (const testCase of TEST_CASES) { - const { - expectedPath, - targetClassName, - } = testCase; - + for (const { targetClass, expectedPath } of TEST_DATA) { const animationItemEl = - findAnimationItemElementsByTargetClassName(panel, targetClassName); + findAnimationItemElementsByTargetClassName(panel, targetClass); - info(`Checking effect timing path existance for ${ targetClassName }`); + info(`Checking effect timing path existance for ${ targetClass }`); const effectTimingPathEl = animationItemEl.querySelector(".animation-effect-timing-path"); if (expectedPath) { ok(effectTimingPathEl, - "The effect timing path element should be in animation item element"); + "The effect timing path element should be in animation item element"); const pathEl = effectTimingPathEl.querySelector(".animation-iteration-path"); assertPathSegments(pathEl, false, expectedPath); } else { ok(!effectTimingPathEl, - "The effect timing path element should not be in animation item element"); + "The effect timing path element should not be in animation item element"); } } }); diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_end-delay-sign.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_end-delay-sign.js index 20a06d3da260..87d5b87312a4 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_end-delay-sign.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_end-delay-sign.js @@ -9,16 +9,16 @@ // * width // * additinal class -const TEST_CASES = [ +const TEST_DATA = [ { - targetClassName: "enddelay-positive", + targetClass: "enddelay-positive", expectedResult: { left: "75%", width: "25%", }, }, { - targetClassName: "enddelay-negative", + targetClass: "enddelay-negative", expectedResult: { additionalClass: "negative", left: "50%", @@ -26,7 +26,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "enddelay-with-fill-forwards", + targetClass: "enddelay-with-fill-forwards", expectedResult: { additionalClass: "fill", left: "75%", @@ -34,10 +34,10 @@ const TEST_CASES = [ }, }, { - targetClassName: "enddelay-with-iterations-infinity", + targetClass: "enddelay-with-iterations-infinity", }, { - targetClassName: "keyframes-easing-step", + targetClass: "keyframes-easing-step", }, ]; @@ -46,29 +46,24 @@ add_task(async function() { const { panel } = await openAnimationInspector(); - for (const testCase of TEST_CASES) { - const { - expectedResult, - targetClassName, - } = testCase; - + for (const { targetClass, expectedResult } of TEST_DATA) { const animationItemEl = - findAnimationItemElementsByTargetClassName(panel, targetClassName); + findAnimationItemElementsByTargetClassName(panel, targetClass); - info(`Checking endDelay sign existance for ${ targetClassName }`); + info(`Checking endDelay sign existance for ${ targetClass }`); const endDelaySignEl = animationItemEl.querySelector(".animation-end-delay-sign"); if (expectedResult) { ok(endDelaySignEl, "The endDelay sign element should be in animation item element"); is(endDelaySignEl.style.left, expectedResult.left, - `Left position should be ${ expectedResult.left }`); + `Left position should be ${ expectedResult.left }`); is(endDelaySignEl.style.width, expectedResult.width, - `Width should be ${ expectedResult.width }`); + `Width should be ${ expectedResult.width }`); if (expectedResult.additionalClass) { ok(endDelaySignEl.classList.contains(expectedResult.additionalClass), - `endDelay sign element should have ${ expectedResult.additionalClass } class`); + `endDelay sign element should have ${ expectedResult.additionalClass } class`); } else { ok(!endDelaySignEl.classList.contains(expectedResult.additionalClass), "endDelay sign element should not have " + @@ -76,7 +71,7 @@ add_task(async function() { } } else { ok(!endDelaySignEl, - "The endDelay sign element should not be in animation item element"); + "The endDelay sign element should not be in animation item element"); } } }); diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-delay-path.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-delay-path.js index 61fc504775b9..e8da8afda934 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-delay-path.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-delay-path.js @@ -7,12 +7,12 @@ // * element existance // * path -const TEST_CASES = [ +const TEST_DATA = [ { - targetClassName: "delay-positive", + targetClass: "delay-positive", }, { - targetClassName: "delay-negative", + targetClass: "delay-negative", expectedPath: [ { x: -500000, y: 0 }, { x: -250000, y: 25 }, @@ -27,27 +27,22 @@ add_task(async function() { const { panel } = await openAnimationInspector(); - for (const testCase of TEST_CASES) { - const { - expectedPath, - targetClassName, - } = testCase; - + for (const { targetClass, expectedPath } of TEST_DATA) { const animationItemEl = - findAnimationItemElementsByTargetClassName(panel, targetClassName); + findAnimationItemElementsByTargetClassName(panel, targetClass); - info(`Checking negative delay path existence for ${ targetClassName }`); + info(`Checking negative delay path existence for ${ targetClass }`); const negativeDelayPathEl = animationItemEl.querySelector(".animation-negative-delay-path"); if (expectedPath) { ok(negativeDelayPathEl, - "The negative delay path element should be in animation item element"); + "The negative delay path element should be in animation item element"); const pathEl = negativeDelayPathEl.querySelector("path"); assertPathSegments(pathEl, true, expectedPath); } else { ok(!negativeDelayPathEl, - "The negative delay path element should not be in animation item element"); + "The negative delay path element should not be in animation item element"); } } }); diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-end-delay-path.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-end-delay-path.js index aad114b5e63d..136d6aba6828 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-end-delay-path.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-end-delay-path.js @@ -7,12 +7,12 @@ // * element existance // * path -const TEST_CASES = [ +const TEST_DATA = [ { - targetClassName: "enddelay-positive", + targetClass: "enddelay-positive", }, { - targetClassName: "enddelay-negative", + targetClass: "enddelay-negative", expectedPath: [ { x: 500000, y: 0 }, { x: 500000, y: 50 }, @@ -28,27 +28,22 @@ add_task(async function() { const { panel } = await openAnimationInspector(); - for (const testCase of TEST_CASES) { - const { - expectedPath, - targetClassName, - } = testCase; - + for (const { targetClass, expectedPath } of TEST_DATA) { const animationItemEl = - findAnimationItemElementsByTargetClassName(panel, targetClassName); + findAnimationItemElementsByTargetClassName(panel, targetClass); - info(`Checking negative endDelay path existance for ${ targetClassName }`); + info(`Checking negative endDelay path existance for ${ targetClass }`); const negativeEndDelayPathEl = animationItemEl.querySelector(".animation-negative-end-delay-path"); if (expectedPath) { ok(negativeEndDelayPathEl, - "The negative endDelay path element should be in animation item element"); + "The negative endDelay path element should be in animation item element"); const pathEl = negativeEndDelayPathEl.querySelector("path"); assertPathSegments(pathEl, true, expectedPath); } else { ok(!negativeEndDelayPathEl, - "The negative endDelay path element should not be in animation item element"); + "The negative endDelay path element should not be in animation item element"); } } }); diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_tooltip.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_tooltip.js index 310472718d85..e5a6c1913dd4 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_tooltip.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_tooltip.js @@ -5,16 +5,16 @@ // Test for existance and content of tooltip on summary graph element. -const TEST_CASES = [ +const TEST_DATA = [ { - targetClassName: "cssanimation-normal", + targetClass: "cssanimation-normal", expectedResult: { nameAndType: "cssanimation - CSS Animation", duration: "1,000s", }, }, { - targetClassName: "cssanimation-linear", + targetClass: "cssanimation-linear", expectedResult: { nameAndType: "cssanimation - CSS Animation", duration: "1,000s", @@ -22,7 +22,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "delay-positive", + targetClass: "delay-positive", expectedResult: { nameAndType: "test-delay-animation - Script Animation", delay: "500s", @@ -30,7 +30,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "delay-negative", + targetClass: "delay-negative", expectedResult: { nameAndType: "test-negative-delay-animation - Script Animation", delay: "-500s", @@ -38,7 +38,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "easing-step", + targetClass: "easing-step", expectedResult: { nameAndType: "Script Animation", duration: "1,000s", @@ -46,7 +46,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "enddelay-positive", + targetClass: "enddelay-positive", expectedResult: { nameAndType: "Script Animation", duration: "1,000s", @@ -54,7 +54,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "enddelay-negative", + targetClass: "enddelay-negative", expectedResult: { nameAndType: "Script Animation", duration: "1,000s", @@ -62,7 +62,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "enddelay-with-fill-forwards", + targetClass: "enddelay-with-fill-forwards", expectedResult: { nameAndType: "Script Animation", duration: "1,000s", @@ -71,7 +71,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "enddelay-with-iterations-infinity", + targetClass: "enddelay-with-iterations-infinity", expectedResult: { nameAndType: "Script Animation", duration: "1,000s", @@ -80,7 +80,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "direction-alternate-with-iterations-infinity", + targetClass: "direction-alternate-with-iterations-infinity", expectedResult: { nameAndType: "Script Animation", duration: "1,000s", @@ -89,7 +89,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "direction-alternate-reverse-with-iterations-infinity", + targetClass: "direction-alternate-reverse-with-iterations-infinity", expectedResult: { nameAndType: "Script Animation", duration: "1,000s", @@ -98,7 +98,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "direction-reverse-with-iterations-infinity", + targetClass: "direction-reverse-with-iterations-infinity", expectedResult: { nameAndType: "Script Animation", duration: "1,000s", @@ -107,7 +107,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "fill-backwards", + targetClass: "fill-backwards", expectedResult: { nameAndType: "Script Animation", duration: "1,000s", @@ -115,7 +115,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "fill-backwards-with-delay-iterationstart", + targetClass: "fill-backwards-with-delay-iterationstart", expectedResult: { nameAndType: "Script Animation", delay: "500s", @@ -125,7 +125,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "fill-both", + targetClass: "fill-both", expectedResult: { nameAndType: "Script Animation", duration: "1,000s", @@ -133,7 +133,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "fill-both-width-delay-iterationstart", + targetClass: "fill-both-width-delay-iterationstart", expectedResult: { nameAndType: "Script Animation", delay: "500s", @@ -143,7 +143,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "fill-forwards", + targetClass: "fill-forwards", expectedResult: { nameAndType: "Script Animation", duration: "1,000s", @@ -151,7 +151,7 @@ const TEST_CASES = [ }, }, { - targetClassName: "iterationstart", + targetClass: "iterationstart", expectedResult: { nameAndType: "Script Animation", duration: "1,000s", @@ -159,14 +159,14 @@ const TEST_CASES = [ }, }, { - targetClassName: "no-compositor", + targetClass: "no-compositor", expectedResult: { nameAndType: "Script Animation", duration: "1,000s", }, }, { - targetClassName: "keyframes-easing-step", + targetClass: "keyframes-easing-step", expectedResult: { nameAndType: "Script Animation", duration: "1,000s", @@ -179,19 +179,14 @@ add_task(async function() { const { panel } = await openAnimationInspector(); - for (const testCase of TEST_CASES) { - const { - expectedResult, - targetClassName, - } = testCase; - + for (const { targetClass, expectedResult } of TEST_DATA) { const animationItemEl = - findAnimationItemElementsByTargetClassName(panel, targetClassName); + findAnimationItemElementsByTargetClassName(panel, targetClass); const summaryGraphEl = animationItemEl.querySelector(".animation-summary-graph"); - info(`Checking tooltip for ${ targetClassName }`); + info(`Checking tooltip for ${ targetClass }`); ok(summaryGraphEl.hasAttribute("title"), - "Summary graph should have 'title' attribute"); + "Summary graph should have 'title' attribute"); const tooltip = summaryGraphEl.getAttribute("title"); const { @@ -214,7 +209,7 @@ add_task(async function() { ok(tooltip.includes(expected), `Tooltip should include '${ expected }'`); } else { ok(!tooltip.includes("Animation timing function:"), - "Tooltip should not include animation timing function"); + "Tooltip should not include animation timing function"); } if (delay) { @@ -271,7 +266,7 @@ add_task(async function() { ok(tooltip.includes(expected), `Tooltip should include '${ expected }'`); } else { ok(!tooltip.includes("Iteration start:"), - "Tooltip should not include iterationStart"); + "Tooltip should not include iterationStart"); } } }); diff --git a/devtools/client/inspector/animation/test/doc_multi_easings.html b/devtools/client/inspector/animation/test/doc_multi_easings.html index c133d025908d..416e337aa396 100644 --- a/devtools/client/inspector/animation/test/doc_multi_easings.html +++ b/devtools/client/inspector/animation/test/doc_multi_easings.html @@ -15,7 +15,7 @@ function createAnimation(name, keyframes, effectEasing) { const div = document.createElement("div"); - div.id = name; + div.classList.add(name); document.body.appendChild(div); const effect = { diff --git a/devtools/client/inspector/animation/test/doc_multi_keyframes.html b/devtools/client/inspector/animation/test/doc_multi_keyframes.html index e1fcff91ecab..a28a2448264b 100644 --- a/devtools/client/inspector/animation/test/doc_multi_keyframes.html +++ b/devtools/client/inspector/animation/test/doc_multi_keyframes.html @@ -15,7 +15,7 @@ function createAnimation(name, keyframes, effectEasing) { const div = document.createElement("div"); - div.id = name; + div.classList.add(name); document.body.appendChild(div); const effect = { diff --git a/devtools/client/inspector/animation/test/doc_simple_animation.html b/devtools/client/inspector/animation/test/doc_simple_animation.html index d9daf7b7c516..27da20648753 100644 --- a/devtools/client/inspector/animation/test/doc_simple_animation.html +++ b/devtools/client/inspector/animation/test/doc_simple_animation.html @@ -154,7 +154,7 @@
-
+
@@ -162,12 +162,12 @@ /* globals KeyframeEffect, Animation */ "use strict"; - var el = document.getElementById("endDelayed"); - let effect = new KeyframeEffect(el, [ + const el = document.querySelector(".end-delay"); + const effect = new KeyframeEffect(el, [ { opacity: 0, offset: 0 }, { opacity: 1, offset: 1 } ], { duration: 1000000, endDelay: 500000, fill: "none" }); - let animation = new Animation(effect, document.timeline); + const animation = new Animation(effect, document.timeline); animation.play(); From 53379078dba50e28e923bab5e40bf19a0bf5b775 Mon Sep 17 00:00:00 2001 From: Daisuke Akatsuka Date: Tue, 3 Apr 2018 12:26:10 +0900 Subject: [PATCH 05/52] Bug 1448732 - Part 1: Remove extra animated elements before open animation inspector. r=pbro MozReview-Commit-ID: Ds7fNJKDYc7 --HG-- extra : rebase_source : 78f80b588fa9ff47af4f9b608c7ad6b817a93dfc --- .../inspector/animation/test/browser.ini | 1 + ...rowser_animation_animated-property-list.js | 1 + ..._animated-property-list_unchanged-items.js | 4 +-- ...rowser_animation_animated-property-name.js | 5 ++-- ...animation_animation-detail_close-button.js | 2 +- ...rowser_animation_animation-detail_title.js | 1 + ...r_animation_animation-detail_visibility.js | 4 +-- .../test/browser_animation_animation-list.js | 5 ++-- .../browser_animation_animation-target.js | 1 + ...owser_animation_animation-timeline-tick.js | 1 + .../browser_animation_current-time-label.js | 4 +-- ...browser_animation_current-time-scrubber.js | 4 +-- ...rowser_animation_empty_on_invalid_nodes.js | 2 +- ...ion_keyframes-graph_computed-value-path.js | 1 - ...s-graph_computed-value-path_easing-hint.js | 2 +- ...imation_keyframes-graph_keyframe-marker.js | 2 +- ...rowser_animation_keyframes-progress-bar.js | 1 + .../test/browser_animation_logic_auto-stop.js | 1 + .../test/browser_animation_logic_mutations.js | 2 ++ ..._animation_summary-graph_animation-name.js | 2 +- ...wser_animation_summary-graph_compositor.js | 3 +- ...tion_summary-graph_computed-timing-path.js | 1 - ...omputed-timing-path_different-timescale.js | 1 + ...wser_animation_summary-graph_delay-sign.js | 2 +- ...mation_summary-graph_effect-timing-path.js | 2 +- ..._animation_summary-graph_end-delay-sign.js | 4 +-- ...ation_summary-graph_negative-delay-path.js | 2 +- ...n_summary-graph_negative-end-delay-path.js | 2 +- ...browser_animation_summary-graph_tooltip.js | 2 +- .../animation/test/doc_frame_script.js | 29 +++++++++++++++++++ .../client/inspector/animation/test/head.js | 10 +++++++ 31 files changed, 75 insertions(+), 29 deletions(-) create mode 100644 devtools/client/inspector/animation/test/doc_frame_script.js diff --git a/devtools/client/inspector/animation/test/browser.ini b/devtools/client/inspector/animation/test/browser.ini index d9c9665b65aa..5b4c668a2319 100644 --- a/devtools/client/inspector/animation/test/browser.ini +++ b/devtools/client/inspector/animation/test/browser.ini @@ -3,6 +3,7 @@ tags = devtools subsuite = devtools support-files = doc_custom_playback_rate.html + doc_frame_script.js doc_multi_easings.html doc_multi_keyframes.html doc_multi_timings.html diff --git a/devtools/client/inspector/animation/test/browser_animation_animated-property-list.js b/devtools/client/inspector/animation/test/browser_animation_animated-property-list.js index d8dcfbf71017..b98c55880d78 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animated-property-list.js +++ b/devtools/client/inspector/animation/test/browser_animation_animated-property-list.js @@ -20,6 +20,7 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_simple_animation.html"); + await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${ t.targetClass }`)); const { inspector, panel } = await openAnimationInspector(); info("Checking animated property list and items existence at initial"); diff --git a/devtools/client/inspector/animation/test/browser_animation_animated-property-list_unchanged-items.js b/devtools/client/inspector/animation/test/browser_animation_animated-property-list_unchanged-items.js index 2a7de4ff1b65..ecddeeba257e 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animated-property-list_unchanged-items.js +++ b/devtools/client/inspector/animation/test/browser_animation_animated-property-list_unchanged-items.js @@ -23,10 +23,10 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_simple_animation.html"); - const { inspector, panel } = await openAnimationInspector(); + await removeAnimatedElementsExcept([".longhand"]); + const { panel } = await openAnimationInspector(); info("Checking unchanged animated property item"); - await selectNodeAndWaitForAnimations(".longhand", inspector); const itemEls = panel.querySelectorAll(".animated-property-item"); is(itemEls.length, TEST_DATA.length, `Count of animated property item should be ${ TEST_DATA.length }`); diff --git a/devtools/client/inspector/animation/test/browser_animation_animated-property-name.js b/devtools/client/inspector/animation/test/browser_animation_animated-property-name.js index fe9c4f833c62..409112b9d8c1 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animated-property-name.js +++ b/devtools/client/inspector/animation/test/browser_animation_animated-property-name.js @@ -24,11 +24,10 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_simple_animation.html"); - const { inspector, panel } = await openAnimationInspector(); + await removeAnimatedElementsExcept([".compositor-notall"]); + const { panel } = await openAnimationInspector(); info("Checking animated property name component"); - await selectNodeAndWaitForAnimations(".compositor-notall", inspector); - const animatedPropertyNameEls = panel.querySelectorAll(".animated-property-name"); is(animatedPropertyNameEls.length, TEST_DATA.length, `Number of animated property name elements should be ${ TEST_DATA.length }`); diff --git a/devtools/client/inspector/animation/test/browser_animation_animation-detail_close-button.js b/devtools/client/inspector/animation/test/browser_animation_animation-detail_close-button.js index 63c5cb5e2782..f084c98a0722 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animation-detail_close-button.js +++ b/devtools/client/inspector/animation/test/browser_animation_animation-detail_close-button.js @@ -6,7 +6,7 @@ // Test that whether close button in header of animation detail works. add_task(async function() { - await addTab(URL_ROOT + "doc_multi_timings.html"); + await addTab(URL_ROOT + "doc_custom_playback_rate.html"); const { animationInspector, panel } = await openAnimationInspector(); info("Checking close button in header of animation detail"); diff --git a/devtools/client/inspector/animation/test/browser_animation_animation-detail_title.js b/devtools/client/inspector/animation/test/browser_animation_animation-detail_title.js index 448c4d683822..9d9b6cda45ca 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animation-detail_title.js +++ b/devtools/client/inspector/animation/test/browser_animation_animation-detail_title.js @@ -22,6 +22,7 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_multi_timings.html"); + await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${ t.targetClass }`)); const { inspector, panel } = await openAnimationInspector(); info("Checking title in each header of animation detail"); diff --git a/devtools/client/inspector/animation/test/browser_animation_animation-detail_visibility.js b/devtools/client/inspector/animation/test/browser_animation_animation-detail_visibility.js index 7dac3d573184..083a9b45a735 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animation-detail_visibility.js +++ b/devtools/client/inspector/animation/test/browser_animation_animation-detail_visibility.js @@ -8,7 +8,7 @@ requestLongerTimeout(2); add_task(async function() { - await addTab(URL_ROOT + "doc_multi_timings.html"); + await addTab(URL_ROOT + "doc_custom_playback_rate.html"); const { animationInspector, inspector, panel } = await openAnimationInspector(); info("Checking animation detail visibility if animation was unselected"); @@ -27,7 +27,7 @@ add_task(async function() { "detailEl should be unvisibled after choose html node"); info("Checking animation detail visibility when choose node which has an animation"); - await selectNodeAndWaitForAnimations(".cssanimation-normal", inspector); + await selectNodeAndWaitForAnimations("div", inspector); isnot(win.getComputedStyle(detailEl).display, "none", "detailEl should be visibled after choose .cssanimation-normal node"); }); diff --git a/devtools/client/inspector/animation/test/browser_animation_animation-list.js b/devtools/client/inspector/animation/test/browser_animation_animation-list.js index 24e2d57aaefa..7ed5ce0da240 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animation-list.js +++ b/devtools/client/inspector/animation/test/browser_animation_animation-list.js @@ -7,7 +7,7 @@ add_task(async function() { await addTab(URL_ROOT + "doc_simple_animation.html"); - + await removeAnimatedElementsExcept([".animated", ".long"]); const { animationInspector, inspector, panel } = await openAnimationInspector(); info("Checking animation list and items existence"); @@ -27,8 +27,7 @@ add_task(async function() { "Background color of an even animation should be different from odd"); info("Checking list and items existence after select a element which has an animation"); - const animatedNode = await getNodeFront(".animated", inspector); - await selectNodeAndWaitForAnimations(animatedNode, inspector); + await selectNodeAndWaitForAnimations(".animated", inspector); is(panel.querySelectorAll(".animation-list .animation-item").length, 1, "The number of animations displayed should be 1 for .animated element"); }); diff --git a/devtools/client/inspector/animation/test/browser_animation_animation-target.js b/devtools/client/inspector/animation/test/browser_animation_animation-target.js index 28a4eaf00f81..c0c7b829a792 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animation-target.js +++ b/devtools/client/inspector/animation/test/browser_animation_animation-target.js @@ -10,6 +10,7 @@ add_task(async function() { await addTab(URL_ROOT + "doc_simple_animation.html"); + await removeAnimatedElementsExcept([".animated", ".long"]); const { animationInspector, inspector, panel } = await openAnimationInspector(); info("Checking the animation target elements existance"); diff --git a/devtools/client/inspector/animation/test/browser_animation_animation-timeline-tick.js b/devtools/client/inspector/animation/test/browser_animation_animation-timeline-tick.js index 37c641cf5e1f..8032f33c3999 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animation-timeline-tick.js +++ b/devtools/client/inspector/animation/test/browser_animation_animation-timeline-tick.js @@ -18,6 +18,7 @@ const TIME_GRADUATION_MIN_SPACING = 40; add_task(async function() { await addTab(URL_ROOT + "doc_simple_animation.html"); + await removeAnimatedElementsExcept([".end-delay", ".negative-delay"]); const { animationInspector, inspector, panel } = await openAnimationInspector(); const timeScale = new TimeScale(animationInspector.state.animations); diff --git a/devtools/client/inspector/animation/test/browser_animation_current-time-label.js b/devtools/client/inspector/animation/test/browser_animation_current-time-label.js index 0e8c863cd9c7..c30d683aa7f9 100644 --- a/devtools/client/inspector/animation/test/browser_animation_current-time-label.js +++ b/devtools/client/inspector/animation/test/browser_animation_current-time-label.js @@ -9,14 +9,14 @@ add_task(async function() { await addTab(URL_ROOT + "doc_multi_timings.html"); - const { animationInspector, inspector, panel } = await openAnimationInspector(); + await removeAnimatedElementsExcept([".keyframes-easing-step"]); + const { animationInspector, panel } = await openAnimationInspector(); info("Checking current time label existence"); const labelEl = panel.querySelector(".current-time-label"); ok(labelEl, "current time label should exist"); info("Checking current time label content"); - await selectNodeAndWaitForAnimations(".keyframes-easing-step", inspector); await clickOnCurrentTimeScrubberController(animationInspector, panel, 0.5); assertLabelContent(labelEl, animationInspector.state.animations[0].state.currentTime); await clickOnCurrentTimeScrubberController(animationInspector, panel, 0.2); diff --git a/devtools/client/inspector/animation/test/browser_animation_current-time-scrubber.js b/devtools/client/inspector/animation/test/browser_animation_current-time-scrubber.js index 005ddbe69c87..026e3d5b21b6 100644 --- a/devtools/client/inspector/animation/test/browser_animation_current-time-scrubber.js +++ b/devtools/client/inspector/animation/test/browser_animation_current-time-scrubber.js @@ -11,7 +11,8 @@ add_task(async function() { await addTab(URL_ROOT + "doc_simple_animation.html"); - const { animationInspector, inspector, panel } = await openAnimationInspector(); + await removeAnimatedElementsExcept([".long"]); + const { animationInspector, panel } = await openAnimationInspector(); info("Checking scrubber controller existence"); const controllerEl = panel.querySelector(".current-time-scrubber-controller"); @@ -22,7 +23,6 @@ add_task(async function() { ok(scrubberEl, "scrubber should exist"); info("Checking scrubber changes current time of animation and the position"); - await selectNodeAndWaitForAnimations(".long", inspector); const duration = animationInspector.state.timeScale.getDuration(); await clickOnCurrentTimeScrubberController(animationInspector, panel, 0); assertAnimationsCurrentTime(animationInspector, 0); diff --git a/devtools/client/inspector/animation/test/browser_animation_empty_on_invalid_nodes.js b/devtools/client/inspector/animation/test/browser_animation_empty_on_invalid_nodes.js index 0a28690f155d..50338a0e07d9 100644 --- a/devtools/client/inspector/animation/test/browser_animation_empty_on_invalid_nodes.js +++ b/devtools/client/inspector/animation/test/browser_animation_empty_on_invalid_nodes.js @@ -8,7 +8,7 @@ requestLongerTimeout(2); add_task(async function() { await addTab(URL_ROOT + "doc_simple_animation.html"); - + await removeAnimatedElementsExcept([".animated", ".long", ".still"]); const { inspector, panel } = await openAnimationInspector(); info("Checking animation list and error message existence for a still node"); diff --git a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path.js b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path.js index 3fe39de4dbc4..2e20c22c72d1 100644 --- a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path.js +++ b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path.js @@ -412,7 +412,6 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_multi_keyframes.html"); - const { inspector, panel } = await openAnimationInspector(); for (const { properties, targetClass } of TEST_DATA) { diff --git a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path_easing-hint.js b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path_easing-hint.js index 8809e8d814ea..e83f9086964f 100644 --- a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path_easing-hint.js +++ b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path_easing-hint.js @@ -191,7 +191,7 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_multi_easings.html"); - + await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${ t.targetClass }`)); const { inspector, panel } = await openAnimationInspector(); for (const { properties, targetClass } of TEST_DATA) { diff --git a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_keyframe-marker.js b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_keyframe-marker.js index 47fbe385e2f9..92296b509888 100644 --- a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_keyframe-marker.js +++ b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_keyframe-marker.js @@ -135,7 +135,7 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_multi_keyframes.html"); - + await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${ t.targetClass }`)); const { inspector, panel } = await openAnimationInspector(); for (const { properties, targetClass } of TEST_DATA) { diff --git a/devtools/client/inspector/animation/test/browser_animation_keyframes-progress-bar.js b/devtools/client/inspector/animation/test/browser_animation_keyframes-progress-bar.js index b3525957faa0..214a075ce89f 100644 --- a/devtools/client/inspector/animation/test/browser_animation_keyframes-progress-bar.js +++ b/devtools/client/inspector/animation/test/browser_animation_keyframes-progress-bar.js @@ -56,6 +56,7 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_multi_timings.html"); + await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${ t.targetClass }`)); const { animationInspector, inspector, panel } = await openAnimationInspector(); info("Checking progress bar position in multi effect timings"); diff --git a/devtools/client/inspector/animation/test/browser_animation_logic_auto-stop.js b/devtools/client/inspector/animation/test/browser_animation_logic_auto-stop.js index e46162aa0bce..2133c875c8f1 100644 --- a/devtools/client/inspector/animation/test/browser_animation_logic_auto-stop.js +++ b/devtools/client/inspector/animation/test/browser_animation_logic_auto-stop.js @@ -12,6 +12,7 @@ add_task(async function() { await addTab(URL_ROOT + "doc_simple_animation.html"); + await removeAnimatedElementsExcept([".compositor-all", ".long"]); const { animationInspector, inspector, panel } = await openAnimationInspector(); info("Checking state after end of animation duration"); diff --git a/devtools/client/inspector/animation/test/browser_animation_logic_mutations.js b/devtools/client/inspector/animation/test/browser_animation_logic_mutations.js index 17d380fc3060..87d302161d29 100644 --- a/devtools/client/inspector/animation/test/browser_animation_logic_mutations.js +++ b/devtools/client/inspector/animation/test/browser_animation_logic_mutations.js @@ -10,6 +10,8 @@ add_task(async function() { await addTab(URL_ROOT + "doc_simple_animation.html"); + await removeAnimatedElementsExcept( + [".compositor-all", ".compositor-notall", ".no-compositor", ".still"]); const { animationInspector, inspector, panel } = await openAnimationInspector(); info("Checking the mutation for add an animation"); diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_animation-name.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_animation-name.js index 4ea1d5854c44..bb2885418305 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_animation-name.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_animation-name.js @@ -31,7 +31,7 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_multi_timings.html"); - + await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${ t.targetClass }`)); const { panel } = await openAnimationInspector(); for (const { targetClass, expectedLabel } of TEST_DATA) { diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_compositor.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_compositor.js index a3443acc8907..4af8a273d3e0 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_compositor.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_compositor.js @@ -8,7 +8,8 @@ add_task(async function() { await addTab(URL_ROOT + "doc_simple_animation.html"); - + await removeAnimatedElementsExcept( + [".compositor-all", ".compositor-notall", ".no-compositor"]); const { inspector, panel } = await openAnimationInspector(); info("Select a test node we know has an animation running on the compositor"); diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path.js index a4a9aead90d3..c6ad1b83c7c5 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path.js @@ -391,7 +391,6 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_multi_timings.html"); - const { panel } = await openAnimationInspector(); for (const testData of TEST_DATA) { diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path_different-timescale.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path_different-timescale.js index 277edb511fcc..a5fd85748529 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path_different-timescale.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path_different-timescale.js @@ -7,6 +7,7 @@ add_task(async function() { await addTab(URL_ROOT + "doc_simple_animation.html"); + await removeAnimatedElementsExcept([".animated", ".end-delay"]); const { inspector, panel } = await openAnimationInspector(); info("Checking the path for different time scale"); diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_delay-sign.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_delay-sign.js index c7c0e95fb4aa..564712b90609 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_delay-sign.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_delay-sign.js @@ -51,7 +51,7 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_multi_timings.html"); - + await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${ t.targetClass }`)); const { panel } = await openAnimationInspector(); for (const { targetClass, expectedResult } of TEST_DATA) { diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_effect-timing-path.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_effect-timing-path.js index 8786313c3a62..6dbcf89eddab 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_effect-timing-path.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_effect-timing-path.js @@ -31,7 +31,7 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_multi_timings.html"); - + await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${ t.targetClass }`)); const { panel } = await openAnimationInspector(); for (const { targetClass, expectedPath } of TEST_DATA) { diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_end-delay-sign.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_end-delay-sign.js index 87d5b87312a4..2a2dcdb277c4 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_end-delay-sign.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_end-delay-sign.js @@ -37,13 +37,13 @@ const TEST_DATA = [ targetClass: "enddelay-with-iterations-infinity", }, { - targetClass: "keyframes-easing-step", + targetClass: "delay-negative", }, ]; add_task(async function() { await addTab(URL_ROOT + "doc_multi_timings.html"); - + await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${ t.targetClass }`)); const { panel } = await openAnimationInspector(); for (const { targetClass, expectedResult } of TEST_DATA) { diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-delay-path.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-delay-path.js index e8da8afda934..e79d6c87d3b5 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-delay-path.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-delay-path.js @@ -24,7 +24,7 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_multi_timings.html"); - + await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${ t.targetClass }`)); const { panel } = await openAnimationInspector(); for (const { targetClass, expectedPath } of TEST_DATA) { diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-end-delay-path.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-end-delay-path.js index 136d6aba6828..73a0cb61ad54 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-end-delay-path.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-end-delay-path.js @@ -25,7 +25,7 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_multi_timings.html"); - + await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${ t.targetClass }`)); const { panel } = await openAnimationInspector(); for (const { targetClass, expectedPath } of TEST_DATA) { diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_tooltip.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_tooltip.js index e5a6c1913dd4..e6c75d637acf 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_tooltip.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_tooltip.js @@ -176,7 +176,7 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_multi_timings.html"); - + await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${ t.targetClass }`)); const { panel } = await openAnimationInspector(); for (const { targetClass, expectedResult } of TEST_DATA) { diff --git a/devtools/client/inspector/animation/test/doc_frame_script.js b/devtools/client/inspector/animation/test/doc_frame_script.js new file mode 100644 index 000000000000..0cf34c43ae32 --- /dev/null +++ b/devtools/client/inspector/animation/test/doc_frame_script.js @@ -0,0 +1,29 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +/* globals addMessageListener, sendAsyncMessage */ + +"use strict"; + +// A helper frame-script for animation inspector. + +addMessageListener("Test:RemoveAnimatedElementsExcept", function(msg) { + const { selectors } = msg.data; + + for (const animation of content.document.getAnimations()) { + if (isRemovableElement(animation, selectors)) { + animation.effect.target.remove(); + } + } + + sendAsyncMessage("Test:RemoveAnimatedElementsExcept"); +}); + +function isRemovableElement(animation, selectors) { + for (const selector of selectors) { + if (animation.effect.target.matches(selector)) { + return false; + } + } + + return true; +} diff --git a/devtools/client/inspector/animation/test/head.js b/devtools/client/inspector/animation/test/head.js index 3679bea9874d..bf6e9871919d 100644 --- a/devtools/client/inspector/animation/test/head.js +++ b/devtools/client/inspector/animation/test/head.js @@ -84,6 +84,16 @@ addTab = async function(url) { return tab; }; +/** + * Remove animated elements from document except given selectors. + * + * @param {Array} selectors + * @return {Promise} + */ +const removeAnimatedElementsExcept = async function(selectors) { + return executeInContent("Test:RemoveAnimatedElementsExcept", { selectors }); +}; + /** * Click on an animation in the timeline to select it. * From b7f7bcc74dfe75d494871519e7b1d739f8d852d3 Mon Sep 17 00:00:00 2001 From: Daisuke Akatsuka Date: Tue, 3 Apr 2018 12:26:36 +0900 Subject: [PATCH 06/52] Bug 1448732 - Part 2: Open detail pane by clicking on summary graph instead of selecting the node. r=pbro MozReview-Commit-ID: CeMj2VJwRR5 --HG-- extra : rebase_source : 98a9bb6339d34872009ce6e57fc81f36b415fa7e --- ...rowser_animation_animated-property-list.js | 5 +- ...rowser_animation_animation-detail_title.js | 5 +- ...ion_keyframes-graph_computed-value-path.js | 5 +- ...s-graph_computed-value-path_easing-hint.js | 5 +- ...imation_keyframes-graph_keyframe-marker.js | 5 +- ..._animation_summary-graph_animation-name.js | 2 +- ...tion_summary-graph_computed-timing-path.js | 2 +- ...wser_animation_summary-graph_delay-sign.js | 2 +- ...mation_summary-graph_effect-timing-path.js | 2 +- ..._animation_summary-graph_end-delay-sign.js | 2 +- ...ation_summary-graph_negative-delay-path.js | 2 +- ...n_summary-graph_negative-end-delay-path.js | 2 +- ...browser_animation_summary-graph_tooltip.js | 2 +- .../client/inspector/animation/test/head.js | 64 +++++++++++++------ 14 files changed, 69 insertions(+), 36 deletions(-) diff --git a/devtools/client/inspector/animation/test/browser_animation_animated-property-list.js b/devtools/client/inspector/animation/test/browser_animation_animated-property-list.js index b98c55880d78..6aaabd663c08 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animated-property-list.js +++ b/devtools/client/inspector/animation/test/browser_animation_animated-property-list.js @@ -21,7 +21,7 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_simple_animation.html"); await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${ t.targetClass }`)); - const { inspector, panel } = await openAnimationInspector(); + const { animationInspector, panel } = await openAnimationInspector(); info("Checking animated property list and items existence at initial"); ok(!panel.querySelector(".animated-property-list"), @@ -29,7 +29,8 @@ add_task(async function() { for (const { targetClass, expectedNumber } of TEST_DATA) { info(`Checking animated-property-list and items existence at ${ targetClass }`); - await selectNodeAndWaitForAnimations(`.${ targetClass }`, inspector); + await clickOnAnimationByTargetSelector(animationInspector, + panel, `.${ targetClass }`); ok(panel.querySelector(".animated-property-list"), `The animated-property-list should be in the DOM at ${ targetClass }`); const itemEls = diff --git a/devtools/client/inspector/animation/test/browser_animation_animation-detail_title.js b/devtools/client/inspector/animation/test/browser_animation_animation-detail_title.js index 9d9b6cda45ca..dbd57598c781 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animation-detail_title.js +++ b/devtools/client/inspector/animation/test/browser_animation_animation-detail_title.js @@ -23,13 +23,14 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_multi_timings.html"); await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${ t.targetClass }`)); - const { inspector, panel } = await openAnimationInspector(); + const { animationInspector, panel } = await openAnimationInspector(); info("Checking title in each header of animation detail"); for (const { targetClass, expectedTitle } of TEST_DATA) { info(`Checking title at ${ targetClass }`); - await selectNodeAndWaitForAnimations(`.${ targetClass }`, inspector); + await clickOnAnimationByTargetSelector(animationInspector, + panel, `.${ targetClass }`); const titleEl = panel.querySelector(".animation-detail-title"); is(titleEl.textContent, expectedTitle, `Title of "${ targetClass }" should be "${ expectedTitle }"`); diff --git a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path.js b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path.js index 2e20c22c72d1..6d9b001f9475 100644 --- a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path.js +++ b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path.js @@ -412,11 +412,12 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_multi_keyframes.html"); - const { inspector, panel } = await openAnimationInspector(); + const { animationInspector, panel } = await openAnimationInspector(); for (const { properties, targetClass } of TEST_DATA) { info(`Checking keyframes graph for ${ targetClass }`); - await selectNodeAndWaitForAnimations(`.${ targetClass }`, inspector); + await clickOnAnimationByTargetSelector(animationInspector, + panel, `.${ targetClass }`); for (const property of properties) { const { diff --git a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path_easing-hint.js b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path_easing-hint.js index e83f9086964f..02719bb91025 100644 --- a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path_easing-hint.js +++ b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path_easing-hint.js @@ -192,11 +192,12 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_multi_easings.html"); await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${ t.targetClass }`)); - const { inspector, panel } = await openAnimationInspector(); + const { animationInspector, panel } = await openAnimationInspector(); for (const { properties, targetClass } of TEST_DATA) { info(`Checking keyframes graph for ${ targetClass }`); - await selectNodeAndWaitForAnimations(`.${ targetClass }`, inspector); + await clickOnAnimationByTargetSelector(animationInspector, + panel, `.${ targetClass }`); for (const { name, expectedHints } of properties) { const testTarget = `${ name } in ${ targetClass }`; diff --git a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_keyframe-marker.js b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_keyframe-marker.js index 92296b509888..7f1198fb0039 100644 --- a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_keyframe-marker.js +++ b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_keyframe-marker.js @@ -136,11 +136,12 @@ const TEST_DATA = [ add_task(async function() { await addTab(URL_ROOT + "doc_multi_keyframes.html"); await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${ t.targetClass }`)); - const { inspector, panel } = await openAnimationInspector(); + const { animationInspector, panel } = await openAnimationInspector(); for (const { properties, targetClass } of TEST_DATA) { info(`Checking keyframe marker for ${ targetClass }`); - await selectNodeAndWaitForAnimations(`.${ targetClass }`, inspector); + await clickOnAnimationByTargetSelector(animationInspector, + panel, `.${ targetClass }`); for (const { name, expectedValues } of properties) { const testTarget = `${ name } in ${ targetClass }`; diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_animation-name.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_animation-name.js index bb2885418305..2b3903153844 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_animation-name.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_animation-name.js @@ -36,7 +36,7 @@ add_task(async function() { for (const { targetClass, expectedLabel } of TEST_DATA) { const animationItemEl = - findAnimationItemElementsByTargetClassName(panel, targetClass); + findAnimationItemElementsByTargetSelector(panel, `.${ targetClass }`); info(`Checking animation name element existance for ${ targetClass }`); const animationNameEl = animationItemEl.querySelector(".animation-name"); diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path.js index c6ad1b83c7c5..f1d252a17ae2 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_computed-timing-path.js @@ -404,7 +404,7 @@ add_task(async function() { } = testData; const animationItemEl = - findAnimationItemElementsByTargetClassName(panel, targetClass); + findAnimationItemElementsByTargetSelector(panel, `.${ targetClass }`); info(`Checking computed timing path existance for ${ targetClass }`); const computedTimingPathEl = diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_delay-sign.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_delay-sign.js index 564712b90609..0922151dfb88 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_delay-sign.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_delay-sign.js @@ -56,7 +56,7 @@ add_task(async function() { for (const { targetClass, expectedResult } of TEST_DATA) { const animationItemEl = - findAnimationItemElementsByTargetClassName(panel, targetClass); + findAnimationItemElementsByTargetSelector(panel, `.${ targetClass }`); info(`Checking delay sign existance for ${ targetClass }`); const delaySignEl = animationItemEl.querySelector(".animation-delay-sign"); diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_effect-timing-path.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_effect-timing-path.js index 6dbcf89eddab..52af1f47b408 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_effect-timing-path.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_effect-timing-path.js @@ -36,7 +36,7 @@ add_task(async function() { for (const { targetClass, expectedPath } of TEST_DATA) { const animationItemEl = - findAnimationItemElementsByTargetClassName(panel, targetClass); + findAnimationItemElementsByTargetSelector(panel, `.${ targetClass }`); info(`Checking effect timing path existance for ${ targetClass }`); const effectTimingPathEl = diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_end-delay-sign.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_end-delay-sign.js index 2a2dcdb277c4..5dbc53f39b4e 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_end-delay-sign.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_end-delay-sign.js @@ -48,7 +48,7 @@ add_task(async function() { for (const { targetClass, expectedResult } of TEST_DATA) { const animationItemEl = - findAnimationItemElementsByTargetClassName(panel, targetClass); + findAnimationItemElementsByTargetSelector(panel, `.${ targetClass }`); info(`Checking endDelay sign existance for ${ targetClass }`); const endDelaySignEl = animationItemEl.querySelector(".animation-end-delay-sign"); diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-delay-path.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-delay-path.js index e79d6c87d3b5..8e25063fbdb4 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-delay-path.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-delay-path.js @@ -29,7 +29,7 @@ add_task(async function() { for (const { targetClass, expectedPath } of TEST_DATA) { const animationItemEl = - findAnimationItemElementsByTargetClassName(panel, targetClass); + findAnimationItemElementsByTargetSelector(panel, `.${ targetClass }`); info(`Checking negative delay path existence for ${ targetClass }`); const negativeDelayPathEl = diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-end-delay-path.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-end-delay-path.js index 73a0cb61ad54..8d1a6952dd8a 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-end-delay-path.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_negative-end-delay-path.js @@ -30,7 +30,7 @@ add_task(async function() { for (const { targetClass, expectedPath } of TEST_DATA) { const animationItemEl = - findAnimationItemElementsByTargetClassName(panel, targetClass); + findAnimationItemElementsByTargetSelector(panel, `.${ targetClass }`); info(`Checking negative endDelay path existance for ${ targetClass }`); const negativeEndDelayPathEl = diff --git a/devtools/client/inspector/animation/test/browser_animation_summary-graph_tooltip.js b/devtools/client/inspector/animation/test/browser_animation_summary-graph_tooltip.js index e6c75d637acf..d2b6293774de 100644 --- a/devtools/client/inspector/animation/test/browser_animation_summary-graph_tooltip.js +++ b/devtools/client/inspector/animation/test/browser_animation_summary-graph_tooltip.js @@ -181,7 +181,7 @@ add_task(async function() { for (const { targetClass, expectedResult } of TEST_DATA) { const animationItemEl = - findAnimationItemElementsByTargetClassName(panel, targetClass); + findAnimationItemElementsByTargetSelector(panel, `.${ targetClass }`); const summaryGraphEl = animationItemEl.querySelector(".animation-summary-graph"); info(`Checking tooltip for ${ targetClass }`); diff --git a/devtools/client/inspector/animation/test/head.js b/devtools/client/inspector/animation/test/head.js index bf6e9871919d..78f130161ffd 100644 --- a/devtools/client/inspector/animation/test/head.js +++ b/devtools/client/inspector/animation/test/head.js @@ -106,14 +106,24 @@ const removeAnimatedElementsExcept = async function(selectors) { const clickOnAnimation = async function(animationInspector, panel, index) { info("Click on animation " + index + " in the timeline"); const summaryGraphEl = panel.querySelectorAll(".animation-summary-graph")[index]; - // Scroll to show the timeBlock since the element may be out of displayed area. - summaryGraphEl.scrollIntoView(false); - const bounds = summaryGraphEl.getBoundingClientRect(); - const x = bounds.width / 2; - const y = bounds.height / 2; - EventUtils.synthesizeMouse(summaryGraphEl, x, y, {}, summaryGraphEl.ownerGlobal); + await clickOnSummaryGraph(animationInspector, panel, summaryGraphEl); +}; - await waitForAnimationDetail(animationInspector); +/** + * Click on an animation by given selector of node which is target element of animation. + * + * @param {AnimationInspector} animationInspector. + * @param {AnimationsPanel} panel + * The panel instance. + * @param {String} selector + * Selector of node which is target element of animation. + */ +const clickOnAnimationByTargetSelector = async function(animationInspector, + panel, selector) { + info(`Click on animation whose selector of target element is '${ selector }'`); + const animationItemEl = findAnimationItemElementsByTargetSelector(panel, selector); + const summaryGraphEl = animationItemEl.querySelector(".animation-summary-graph"); + await clickOnSummaryGraph(animationInspector, panel, summaryGraphEl); }; /** @@ -212,6 +222,25 @@ const clickOnPlaybackRateSelector = async function(animationInspector, panel, ra await waitForSummaryAndDetail(animationInspector); }; +/** + * Click on given summary graph element. + * + * @param {AnimationInspector} animationInspector + * @param {AnimationsPanel} panel + * @param {Element} summaryGraphEl + */ +const clickOnSummaryGraph = async function(animationInspector, panel, summaryGraphEl) { + // Disable pointer-events of the scrubber in order to avoid to click accidently. + const scrubberEl = panel.querySelector(".current-time-scrubber"); + scrubberEl.style.pointerEvents = "none"; + // Scroll to show the timeBlock since the element may be out of displayed area. + summaryGraphEl.scrollIntoView(false); + EventUtils.synthesizeMouseAtCenter(summaryGraphEl, {}, summaryGraphEl.ownerGlobal); + await waitForAnimationDetail(animationInspector); + // Restore the scrubber style. + scrubberEl.style.pointerEvents = "unset"; +}; + /** * Drag on the scrubber to update the animation current time. * @@ -600,22 +629,21 @@ function isPassingThrough(pathSegList, x, y) { } /** - * Return animation item element by target node class. - * This function compares betweem animation-target textContent and given className. - * Also, this function premises one class name. + * Return animation item element by target node selector. + * This function compares betweem animation-target textContent and given selector. + * Then returns matched first item. * * @param {Element} panel - root element of animation inspector. - * @param {String} targetClassName - class name of tested element. + * @param {String} selector - selector of tested element. * @return {Element} animation item element. */ -function findAnimationItemElementsByTargetClassName(panel, targetClassName) { - const animationTargetEls = panel.querySelectorAll(".animation-target"); +function findAnimationItemElementsByTargetSelector(panel, selector) { + const attrNameEls = panel.querySelectorAll(".animation-target .attrName"); + const regexp = new RegExp(`\\${ selector }(\\.|$)`, "gi"); - for (const animationTargetEl of animationTargetEls) { - const className = animationTargetEl.textContent.split(".")[1]; - - if (className === targetClassName) { - return animationTargetEl.closest(".animation-item"); + for (const attrNameEl of attrNameEls) { + if (regexp.exec(attrNameEl.textContent)) { + return attrNameEl.closest(".animation-item"); } } From f8c22850d95d9d9656f80ee515986233055ae82c Mon Sep 17 00:00:00 2001 From: Daisuke Akatsuka Date: Tue, 3 Apr 2018 12:26:57 +0900 Subject: [PATCH 07/52] Bug 1448732 - Part 3: Adjust requestLongerTimeout. r=pbro MozReview-Commit-ID: Ia4mjyHyBci --HG-- extra : rebase_source : b136930a83fd165552ef8c62f529f8d639484f83 --- .../test/browser_animation_animation-detail_visibility.js | 2 -- .../animation/test/browser_animation_empty_on_invalid_nodes.js | 2 -- .../browser_animation_keyframes-graph_computed-value-path.js | 2 -- .../animation/test/browser_animation_keyframes-progress-bar.js | 2 +- 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/devtools/client/inspector/animation/test/browser_animation_animation-detail_visibility.js b/devtools/client/inspector/animation/test/browser_animation_animation-detail_visibility.js index 083a9b45a735..fab0be3c8f04 100644 --- a/devtools/client/inspector/animation/test/browser_animation_animation-detail_visibility.js +++ b/devtools/client/inspector/animation/test/browser_animation_animation-detail_visibility.js @@ -5,8 +5,6 @@ // Test that whether animations detail could be displayed if there is selected animation. -requestLongerTimeout(2); - add_task(async function() { await addTab(URL_ROOT + "doc_custom_playback_rate.html"); const { animationInspector, inspector, panel } = await openAnimationInspector(); diff --git a/devtools/client/inspector/animation/test/browser_animation_empty_on_invalid_nodes.js b/devtools/client/inspector/animation/test/browser_animation_empty_on_invalid_nodes.js index 50338a0e07d9..6c899943c0b4 100644 --- a/devtools/client/inspector/animation/test/browser_animation_empty_on_invalid_nodes.js +++ b/devtools/client/inspector/animation/test/browser_animation_empty_on_invalid_nodes.js @@ -2,8 +2,6 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ "use strict"; -requestLongerTimeout(2); - // Test that the panel shows no animation data for invalid or not animated nodes add_task(async function() { diff --git a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path.js b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path.js index 6d9b001f9475..8022c4961bc6 100644 --- a/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path.js +++ b/devtools/client/inspector/animation/test/browser_animation_keyframes-graph_computed-value-path.js @@ -9,8 +9,6 @@ // * fill color by animation type // * stop color if the animation type is color -requestLongerTimeout(2); - const TEST_DATA = [ { targetClass: "multi-types", diff --git a/devtools/client/inspector/animation/test/browser_animation_keyframes-progress-bar.js b/devtools/client/inspector/animation/test/browser_animation_keyframes-progress-bar.js index 214a075ce89f..1c5dfc360c7d 100644 --- a/devtools/client/inspector/animation/test/browser_animation_keyframes-progress-bar.js +++ b/devtools/client/inspector/animation/test/browser_animation_keyframes-progress-bar.js @@ -9,7 +9,7 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ // * progress bar position after changing playback rate // * progress bar position when select another animation -requestLongerTimeout(5); +requestLongerTimeout(2); const TEST_DATA = [ { From bc4b60c1ad3382f7707bf9cf6024d9b612b2b07f Mon Sep 17 00:00:00 2001 From: MatthieuBaratte Date: Tue, 13 Mar 2018 23:06:26 +0100 Subject: [PATCH 08/52] Bug 1429019 - Remove QT support code's reference. r=glandium MozReview-Commit-ID: 2W0Fg0P76Ln --HG-- extra : rebase_source : 9812dc567501d8c030c75a12338533fb75734b19 --- toolkit/mozapps/installer/upload-files.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/mozapps/installer/upload-files.mk b/toolkit/mozapps/installer/upload-files.mk index 240f07accfce..4133ac5a3bca 100644 --- a/toolkit/mozapps/installer/upload-files.mk +++ b/toolkit/mozapps/installer/upload-files.mk @@ -12,7 +12,7 @@ else ifeq (,$(filter-out SunOS, $(OS_ARCH))) MOZ_PKG_FORMAT = BZ2 else - ifeq (,$(filter-out gtk3 qt, $(MOZ_WIDGET_TOOLKIT))) + ifeq (,$(filter-out gtk3, $(MOZ_WIDGET_TOOLKIT))) MOZ_PKG_FORMAT = BZ2 else ifeq (android,$(MOZ_WIDGET_TOOLKIT)) From 699d7529245b9d72e019956b764eb80808e20a21 Mon Sep 17 00:00:00 2001 From: MatthieuBaratte Date: Tue, 13 Mar 2018 23:09:46 +0100 Subject: [PATCH 09/52] Bug 1429019 - Simplify the comparaison by removing the use of filter-out. r=glandium MozReview-Commit-ID: Fn83DBtVAqV --HG-- extra : rebase_source : f2e704a565c9b9a333e0bf219acfc63ef8549613 --- toolkit/mozapps/installer/upload-files.mk | 42 +++++++++++------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/toolkit/mozapps/installer/upload-files.mk b/toolkit/mozapps/installer/upload-files.mk index 4133ac5a3bca..131fa1e1be53 100644 --- a/toolkit/mozapps/installer/upload-files.mk +++ b/toolkit/mozapps/installer/upload-files.mk @@ -3,27 +3,27 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. ifndef MOZ_PKG_FORMAT -ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) -MOZ_PKG_FORMAT = DMG -else -ifeq (,$(filter-out WINNT, $(OS_ARCH))) -MOZ_PKG_FORMAT = ZIP -else -ifeq (,$(filter-out SunOS, $(OS_ARCH))) - MOZ_PKG_FORMAT = BZ2 -else - ifeq (,$(filter-out gtk3, $(MOZ_WIDGET_TOOLKIT))) - MOZ_PKG_FORMAT = BZ2 - else - ifeq (android,$(MOZ_WIDGET_TOOLKIT)) - MOZ_PKG_FORMAT = APK - else - MOZ_PKG_FORMAT = TGZ - endif - endif -endif -endif -endif + ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) + MOZ_PKG_FORMAT = DMG + else + ifeq (WINNT,$(OS_ARCH)) + MOZ_PKG_FORMAT = ZIP + else + ifeq (SunOS,$(OS_ARCH)) + MOZ_PKG_FORMAT = BZ2 + else + ifeq (gtk3,$(MOZ_WIDGET_TOOLKIT)) + MOZ_PKG_FORMAT = BZ2 + else + ifeq (android,$(MOZ_WIDGET_TOOLKIT)) + MOZ_PKG_FORMAT = APK + else + MOZ_PKG_FORMAT = TGZ + endif + endif + endif + endif + endif endif # MOZ_PKG_FORMAT ifeq ($(OS_ARCH),WINNT) From e9b0682a45ccfc3877c4584853de6bc834ed27cc Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Thu, 29 Mar 2018 10:10:53 +0200 Subject: [PATCH 10/52] Bug 1449864: [snap package] add the removable-media plug to allow saving downloaded files to /media. r=jlorenzo MozReview-Commit-ID: LcKaZOZP6vS --HG-- extra : rebase_source : 52b66130a2d7044f35e0ef7f645469d62f81d0fb --- taskcluster/docker/firefox-snap/snapcraft.yaml.in | 1 + 1 file changed, 1 insertion(+) diff --git a/taskcluster/docker/firefox-snap/snapcraft.yaml.in b/taskcluster/docker/firefox-snap/snapcraft.yaml.in index cd25a14b1f6c..1cd7f14f5ecb 100644 --- a/taskcluster/docker/firefox-snap/snapcraft.yaml.in +++ b/taskcluster/docker/firefox-snap/snapcraft.yaml.in @@ -25,6 +25,7 @@ apps: - network-observe - opengl - pulseaudio + - removable-media - screen-inhibit-control - unity7 - upower-observe From 6d11b10c579291d089e27505dc4971bf7b461ac1 Mon Sep 17 00:00:00 2001 From: Johann Hofmann Date: Sat, 31 Mar 2018 10:27:19 +0200 Subject: [PATCH 11/52] Bug 1450315 - Remove document.allowUnsafeHTML. r=bz This attribute was added in bug 1432966 when we started sanitizing chrome usage of innerHTML to allow devtools to use custom attributes in React via dangerouslySetInnerHTML. Devtools removed its usage of dangerouslySetInnerHTML in bug 1434155, so document.allowUnsafeHTML is no longer used and can be removed. MozReview-Commit-ID: 8xTVZDmPqRa --HG-- extra : rebase_source : 3d427133ccb8975163b4459af57b5d96ef54c93e --- dom/base/nsContentUtils.cpp | 6 ++++-- dom/base/nsDocument.cpp | 8 -------- dom/base/nsIDocument.h | 6 ------ dom/webidl/Document.webidl | 5 ----- 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 7cb03fdf6d28..90eebb0560d8 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -5091,7 +5091,8 @@ nsContentUtils::ParseFragmentHTML(const nsAString& aSourceBuffer, // If this is a chrome-privileged document, create a fragment first, and // sanitize it before insertion. RefPtr fragment; - if (aSanitize != NeverSanitize && !aTargetNode->OwnerDoc()->AllowUnsafeHTML()) { + if (aSanitize != NeverSanitize && + IsSystemPrincipal(aTargetNode->NodePrincipal())) { fragment = new DocumentFragment(aTargetNode->OwnerDoc()->NodeInfoManager()); target = fragment; } @@ -5198,7 +5199,8 @@ nsContentUtils::ParseFragmentXML(const nsAString& aSourceBuffer, // If this is a chrome-privileged document, sanitize the fragment before // returning. - if (aSanitize != NeverSanitize && !aDocument->AllowUnsafeHTML()) { + if (aSanitize != NeverSanitize && + IsSystemPrincipal(aDocument->NodePrincipal())) { // Don't fire mutation events for nodes removed by the sanitizer. nsAutoScriptBlockerSuppressNodeRemoved scriptBlocker; diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index df9b08826707..33ec9c37051c 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -1434,7 +1434,6 @@ nsIDocument::nsIDocument() mEncodingMenuDisabled(false), mIsShadowDOMEnabled(false), mIsSVGGlyphsDocument(false), - mAllowUnsafeHTML(false), mInDestructor(false), mIsGoingAway(false), mInXBLUpdate(false), @@ -5862,13 +5861,6 @@ nsIDocument::CreateAttributeNS(const nsAString& aNamespaceURI, return attribute.forget(); } -bool -nsIDocument::AllowUnsafeHTML() const -{ - return (!nsContentUtils::IsSystemPrincipal(NodePrincipal()) || - mAllowUnsafeHTML); -} - void nsIDocument::ResolveScheduledSVGPresAttrs() { diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index 4a20e844c353..a8b94c0ebac2 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -3211,8 +3211,6 @@ public: CreateAttributeNS(const nsAString& aNamespaceURI, const nsAString& aQualifiedName, mozilla::ErrorResult& rv); - void SetAllowUnsafeHTML(bool aAllow) { mAllowUnsafeHTML = aAllow; } - bool AllowUnsafeHTML() const; void GetInputEncoding(nsAString& aInputEncoding) const; already_AddRefed GetLocation() const; void GetReferrer(nsAString& aReferrer) const; @@ -4044,10 +4042,6 @@ protected: // True if this document is for an SVG-in-OpenType font. bool mIsSVGGlyphsDocument : 1; - // True if unsafe HTML fragments should be allowed in chrome-privileged - // documents. - bool mAllowUnsafeHTML : 1; - // True if the document is being destroyed. bool mInDestructor: 1; diff --git a/dom/webidl/Document.webidl b/dom/webidl/Document.webidl index 29520f483fe5..fff315487b84 100644 --- a/dom/webidl/Document.webidl +++ b/dom/webidl/Document.webidl @@ -106,11 +106,6 @@ interface Document : Node { Attr createAttribute(DOMString name); [NewObject, Throws] Attr createAttributeNS(DOMString? namespace, DOMString name); - - // Allows setting innerHTML without automatic sanitization. - // Do not use this. - [ChromeOnly] - attribute boolean allowUnsafeHTML; }; // https://html.spec.whatwg.org/multipage/dom.html#the-document-object From e843c3d265f2728ad9680b32fe9c58d6205e0246 Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Fri, 23 Mar 2018 14:47:52 +0100 Subject: [PATCH 12/52] Bug 1448320 - bind onDetachedFront in RuleView constructor;r=pbro MozReview-Commit-ID: BuOTYTuregT --HG-- extra : rebase_source : 6c6f668551b6e4fbdb43313d31eca83d715d4f0a --- devtools/client/inspector/rules/rules.js | 1 + 1 file changed, 1 insertion(+) diff --git a/devtools/client/inspector/rules/rules.js b/devtools/client/inspector/rules/rules.js index 5ae98b51441f..7f8646c8b898 100644 --- a/devtools/client/inspector/rules/rules.js +++ b/devtools/client/inspector/rules/rules.js @@ -1750,6 +1750,7 @@ function RuleViewTool(inspector, window) { this.refresh = this.refresh.bind(this); this.onDetachedFront = this.onDetachedFront.bind(this); this.onPanelSelected = this.onPanelSelected.bind(this); + this.onDetachedFront = this.onDetachedFront.bind(this); this.onSelected = this.onSelected.bind(this); this.onViewRefreshed = this.onViewRefreshed.bind(this); From f7c435ecc9b2c7470fef1a66985a6b4b5b99e2a0 Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Tue, 27 Mar 2018 17:39:22 +0100 Subject: [PATCH 13/52] Bug 1447384 - fix narrate styling falling foul of CSP, r=johannh MozReview-Commit-ID: EsMwwxVVyFE --HG-- extra : rebase_source : ce30238fd65d86e279f549d6b9cde36d7f537654 --- .../components/narrate/NarrateControls.jsm | 81 +++++-------------- toolkit/themes/shared/jar.inc.mn | 1 + toolkit/themes/shared/narrate.css | 11 ++- toolkit/themes/shared/narrate/waveform.svg | 46 +++++++++++ 4 files changed, 73 insertions(+), 66 deletions(-) create mode 100644 toolkit/themes/shared/narrate/waveform.svg diff --git a/toolkit/components/narrate/NarrateControls.jsm b/toolkit/components/narrate/NarrateControls.jsm index 7e06b5dace04..1bc78b39e3fb 100644 --- a/toolkit/components/narrate/NarrateControls.jsm +++ b/toolkit/components/narrate/NarrateControls.jsm @@ -27,84 +27,39 @@ function NarrateControls(mm, win, languagePromise) { style.href = "chrome://global/skin/narrate.css"; win.document.head.appendChild(style); - function localize(pieces, ...substitutions) { - let result = pieces[0]; - for (let i = 0; i < substitutions.length; ++i) { - result += gStrings.GetStringFromName(substitutions[i]) + pieces[i + 1]; - } - return result; - } + let elemL10nMap = { + ".narrate-toggle": "narrate", + ".narrate-skip-previous": "back", + ".narrate-start-stop": "start", + ".narrate-skip-next": "forward", + ".narrate-rate-input": "speed", + }; let dropdown = win.document.createElement("ul"); dropdown.className = "dropdown narrate-dropdown"; - // We need inline svg here for the animation to work (bug 908634 & 1190881). - // eslint-disable-next-line no-unsanitized/property dropdown.innerHTML = - localize`
  • - + `
  • +
  • `; + for (let [selector, stringID] of Object.entries(elemL10nMap)) { + dropdown.querySelector(selector).setAttribute("title", + gStrings.GetStringFromName(stringID)); + } + this.narrator = new Narrator(win, languagePromise); let branch = Services.prefs.getBranch("narrate."); diff --git a/toolkit/themes/shared/jar.inc.mn b/toolkit/themes/shared/jar.inc.mn index 7e88036cc1bf..020d38bc1401 100644 --- a/toolkit/themes/shared/jar.inc.mn +++ b/toolkit/themes/shared/jar.inc.mn @@ -55,6 +55,7 @@ toolkit.jar: skin/classic/global/narrate/slow.svg (../../shared/narrate/slow.svg) skin/classic/global/narrate/start.svg (../../shared/narrate/start.svg) skin/classic/global/narrate/stop.svg (../../shared/narrate/stop.svg) + skin/classic/global/narrate/waveform.svg (../../shared/narrate/waveform.svg) skin/classic/global/in-content/check.svg (../../shared/in-content/check.svg) skin/classic/global/in-content/check-partial.svg (../../shared/in-content/check-partial.svg) skin/classic/global/in-content/dropdown.svg (../../shared/in-content/dropdown.svg) diff --git a/toolkit/themes/shared/narrate.css b/toolkit/themes/shared/narrate.css index bfab390cbe95..b75ba3a7950a 100644 --- a/toolkit/themes/shared/narrate.css +++ b/toolkit/themes/shared/narrate.css @@ -52,9 +52,14 @@ body.dark .narrate-word-highlight { --border-color: #e5e5e5; } -.narrate-toggle > svg { - display: block; - margin: 0 8px; +.narrate-toggle { + margin: 0; + background-image: url("chrome://global/skin/narrate/waveform.svg"); +} + +.speaking .narrate-toggle { + /* This shows with an animation. */ + background-image: url("chrome://global/skin/narrate/waveform.svg#waveform"); } .narrate-dropdown > .dropdown-popup button { diff --git a/toolkit/themes/shared/narrate/waveform.svg b/toolkit/themes/shared/narrate/waveform.svg new file mode 100644 index 000000000000..d593ed29000d --- /dev/null +++ b/toolkit/themes/shared/narrate/waveform.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + From d648a9a26195040c367ab820d33ff977e7038c5f Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 27 Mar 2018 15:51:07 +0200 Subject: [PATCH 14/52] Bug 1447925 - Add GetClipboardText() to get text data from clipboard, r=jhorak GetClipboardText() calls gtk_clipboard_request_text() to request text clipboard data from Gtk+ and leave Gtk+ to do clipboard text format conversions. Also unify data getting code for text/data/targets. MozReview-Commit-ID: 9DGSdOACho1 --HG-- extra : rebase_source : f1d95609f8a7587a4abc11739db9d17ec5446a7b --- widget/gtk/nsClipboard.h | 1 + widget/gtk/nsClipboardX11.cpp | 177 +++++++++++++++++++++++----------- widget/gtk/nsClipboardX11.h | 39 +++++--- 3 files changed, 152 insertions(+), 65 deletions(-) diff --git a/widget/gtk/nsClipboard.h b/widget/gtk/nsClipboard.h index 2be635bca10d..fa3b9b6ff087 100644 --- a/widget/gtk/nsClipboard.h +++ b/widget/gtk/nsClipboard.h @@ -21,6 +21,7 @@ public: virtual const char* GetClipboardData(const char* aMimeType, int32_t aWhichClipboard, uint32_t* aContentLength) = 0; + virtual const char* GetClipboardText(int32_t aWhichClipboard) = 0; virtual void ReleaseClipboardData(const char* aClipboardData) = 0; virtual GdkAtom* GetTargets(int32_t aWhichClipboard, diff --git a/widget/gtk/nsClipboardX11.cpp b/widget/gtk/nsClipboardX11.cpp index 6a574069dcc4..e8d8522651c2 100644 --- a/widget/gtk/nsClipboardX11.cpp +++ b/widget/gtk/nsClipboardX11.cpp @@ -62,8 +62,10 @@ selection_request_filter(GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data) nsRetrievalContextX11::nsRetrievalContextX11() : mState(INITIAL) - , mData(nullptr) , mClipboardRequestNumber(0) + , mClipboardData(nullptr) + , mClipboardDataLength(0) + , mTargetMIMEType(gdk_atom_intern("TARGETS", FALSE)) { // A custom event filter to workaround attempting to dereference a null // selection requestor in GTK3 versions before 3.11.3. See bug 1178799. @@ -139,13 +141,11 @@ checkEventProc(Display *display, XEvent *event, XPointer arg) return False; } -void * -nsRetrievalContextX11::Wait() +bool +nsRetrievalContextX11::WaitForX11Content() { if (mState == COMPLETED) { // the request completed synchronously - void *data = mData; - mData = nullptr; - return data; + return true; } GdkDisplay *gdkDisplay = gdk_display_get_default(); @@ -181,9 +181,7 @@ nsRetrievalContextX11::Wait() DispatchPropertyNotifyEvent(context.cbWidget, &xevent); if (mState == COMPLETED) { - void *data = mData; - mData = nullptr; - return data; + return true; } } @@ -200,11 +198,12 @@ nsRetrievalContextX11::Wait() printf("exceeded clipboard timeout\n"); #endif mState = TIMED_OUT; - return nullptr; + return false; } // Call this when data has been retrieved. -void nsRetrievalContextX11::Complete(GtkSelectionData* aData, +void nsRetrievalContextX11::Complete(ClipboardDataType aDataType, + const void* aData, int aDataRequestNumber) { if (mClipboardRequestNumber != aDataRequestNumber) { @@ -214,8 +213,54 @@ void nsRetrievalContextX11::Complete(GtkSelectionData* aData, if (mState == INITIAL) { mState = COMPLETED; - mData = gtk_selection_data_get_length(aData) >= 0 ? - gtk_selection_data_copy(aData) : nullptr; + + MOZ_ASSERT(mClipboardData == nullptr && + mClipboardDataLength == 0, + "We're leaking clipboard data!"); + + switch (aDataType) { + case CLIPBOARD_TEXT: + { + const char* text = static_cast(aData); + if (text) { + mClipboardDataLength = sizeof(char) * (strlen(text) + 1); + mClipboardData = moz_xmalloc(mClipboardDataLength); + memcpy(mClipboardData, text, mClipboardDataLength); + } + } + break; + case CLIPBOARD_TARGETS: + { + const GtkSelectionData *selection = + static_cast(aData); + + gint n_targets = 0; + GdkAtom *targets = nullptr; + + if (!gtk_selection_data_get_targets(selection, &targets, &n_targets) || + !n_targets) { + return; + } + + mClipboardData = targets; + mClipboardDataLength = n_targets; + } + break; + case CLIPBOARD_DATA: + { + const GtkSelectionData *selection = + static_cast(aData); + + gint dataLength = gtk_selection_data_get_length(selection); + if (dataLength > 0) { + mClipboardDataLength = dataLength; + mClipboardData = moz_xmalloc(dataLength); + memcpy(mClipboardData, gtk_selection_data_get_data(selection), + dataLength); + } + } + break; + } } else { // Already timed out MOZ_ASSERT(mState == TIMED_OUT); @@ -233,12 +278,24 @@ clipboard_contents_received(GtkClipboard *clipboard, delete handler; } -GtkSelectionData* -nsRetrievalContextX11::WaitForContents(GtkClipboard *clipboard, - const char *aMimeType) +static void +clipboard_text_received(GtkClipboard *clipboard, + const gchar *text, + gpointer data) +{ + ClipboardRequestHandler *handler = + static_cast(data); + handler->Complete(text); + delete handler; +} + +bool +nsRetrievalContextX11::WaitForClipboardData(ClipboardDataType aDataType, + GtkClipboard *clipboard, + const char *aMimeType) { mState = INITIAL; - NS_ASSERTION(!mData, "Leaking clipboard content!"); + NS_ASSERTION(!mClipboardData, "Leaking clipboard content!"); // Call ClipboardRequestHandler() with unique clipboard request number. // The request number pairs gtk_clipboard_request_contents() data request @@ -246,39 +303,45 @@ nsRetrievalContextX11::WaitForContents(GtkClipboard *clipboard, // is provided by Gtk. mClipboardRequestNumber++; ClipboardRequestHandler* handler = - new ClipboardRequestHandler(this, mClipboardRequestNumber); + new ClipboardRequestHandler(this, aDataType, mClipboardRequestNumber); - gtk_clipboard_request_contents(clipboard, - gdk_atom_intern(aMimeType, FALSE), - clipboard_contents_received, - handler); - return static_cast(Wait()); + switch (aDataType) { + case CLIPBOARD_DATA: + gtk_clipboard_request_contents(clipboard, + gdk_atom_intern(aMimeType, FALSE), clipboard_contents_received, + handler); + break; + case CLIPBOARD_TEXT: + gtk_clipboard_request_text(clipboard, clipboard_text_received, + handler); + break; + case CLIPBOARD_TARGETS: + gtk_clipboard_request_contents(clipboard, + mTargetMIMEType, clipboard_contents_received, + handler); + break; + } + + return WaitForX11Content(); } GdkAtom* nsRetrievalContextX11::GetTargets(int32_t aWhichClipboard, int* aTargetNums) { - *aTargetNums = 0; + GtkClipboard *clipboard = + gtk_clipboard_get(GetSelectionAtom(aWhichClipboard)); - GtkClipboard *clipboard = - gtk_clipboard_get(GetSelectionAtom(aWhichClipboard)); + if (!WaitForClipboardData(CLIPBOARD_TARGETS, clipboard)) + return nullptr; - GtkSelectionData *selection_data = WaitForContents(clipboard, "TARGETS"); - if (!selection_data) - return nullptr; + *aTargetNums = mClipboardDataLength; + GdkAtom* targets = static_cast(mClipboardData); - gint n_targets = 0; - GdkAtom *targets = nullptr; + // We don't hold the target list internally but we transfer the ownership. + mClipboardData = nullptr; + mClipboardDataLength = 0; - if (!gtk_selection_data_get_targets(selection_data, &targets, &n_targets) || - !n_targets) { - return nullptr; - } - - gtk_selection_data_free(selection_data); - - *aTargetNums = n_targets; - return targets; + return targets; } const char* @@ -289,25 +352,31 @@ nsRetrievalContextX11::GetClipboardData(const char* aMimeType, GtkClipboard *clipboard; clipboard = gtk_clipboard_get(GetSelectionAtom(aWhichClipboard)); - GtkSelectionData *selectionData = WaitForContents(clipboard, aMimeType); - if (!selectionData) + if (!WaitForClipboardData(CLIPBOARD_DATA, clipboard, aMimeType)) return nullptr; - char* clipboardData = nullptr; - int contentLength = gtk_selection_data_get_length(selectionData); - if (contentLength > 0) { - clipboardData = reinterpret_cast( - moz_xmalloc(sizeof(char)*contentLength)); - memcpy(clipboardData, gtk_selection_data_get_data(selectionData), - sizeof(char)*contentLength); - } - gtk_selection_data_free(selectionData); + *aContentLength = mClipboardDataLength; + return static_cast(mClipboardData); +} - *aContentLength = contentLength; - return (const char*)clipboardData; +const char* +nsRetrievalContextX11::GetClipboardText(int32_t aWhichClipboard) +{ + GtkClipboard *clipboard; + clipboard = gtk_clipboard_get(GetSelectionAtom(aWhichClipboard)); + + if (!WaitForClipboardData(CLIPBOARD_TEXT, clipboard)) + return nullptr; + + return static_cast(mClipboardData); } void nsRetrievalContextX11::ReleaseClipboardData(const char* aClipboardData) { - free((void *)aClipboardData); + NS_ASSERTION(aClipboardData == mClipboardData, + "Releasing unknown clipboard data!"); + free((void*)aClipboardData); + + mClipboardData = nullptr; + mClipboardDataLength = 0; } diff --git a/widget/gtk/nsClipboardX11.h b/widget/gtk/nsClipboardX11.h index 210f6b1fdbd4..9e89e08445dd 100644 --- a/widget/gtk/nsClipboardX11.h +++ b/widget/gtk/nsClipboardX11.h @@ -11,6 +11,12 @@ #include "nsIClipboard.h" #include +enum ClipboardDataType { + CLIPBOARD_DATA, + CLIPBOARD_TEXT, + CLIPBOARD_TARGETS +}; + class nsRetrievalContextX11 : public nsRetrievalContext { public: @@ -19,48 +25,59 @@ public: virtual const char* GetClipboardData(const char* aMimeType, int32_t aWhichClipboard, uint32_t* aContentLength) override; + virtual const char* GetClipboardText(int32_t aWhichClipboard) override; virtual void ReleaseClipboardData(const char* aClipboardData) override; virtual GdkAtom* GetTargets(int32_t aWhichClipboard, int* aTargetNums) override; - // Call this when data has been retrieved. - void Complete(GtkSelectionData* aData, int aDataRequestNumber); + // Call this when data or text has been retrieved. + void Complete(ClipboardDataType aDataType, + const void* aData, + int aDataRequestNumber); nsRetrievalContextX11(); virtual ~nsRetrievalContextX11() override; private: - GtkSelectionData* WaitForContents(GtkClipboard *clipboard, - const char *aMimeType); + bool WaitForClipboardData(ClipboardDataType aDataType, + GtkClipboard *clipboard, + const char *aMimeType = nullptr); + /** * Spins X event loop until timing out or being completed. Returns * null if we time out, otherwise returns the completed data (passing * ownership to caller). */ - void *Wait(); + bool WaitForX11Content(); - State mState; - void* mData; - int mClipboardRequestNumber; + State mState; + int mClipboardRequestNumber; + void* mClipboardData; + uint32_t mClipboardDataLength; + GdkAtom mTargetMIMEType; }; class ClipboardRequestHandler { public: - ClipboardRequestHandler(nsRetrievalContextX11 *aContext, int aDataRequestNumber) + ClipboardRequestHandler(nsRetrievalContextX11 *aContext, + ClipboardDataType aDataType, + int aDataRequestNumber) : mContext(aContext) , mDataRequestNumber(aDataRequestNumber) + , mDataType(aDataType) {} - void Complete(GtkSelectionData* aData) + void Complete(const void *aData) { - mContext->Complete(aData, mDataRequestNumber); + mContext->Complete(mDataType, aData, mDataRequestNumber); } private: nsRetrievalContextX11 *mContext; int mDataRequestNumber; + ClipboardDataType mDataType; }; #endif /* __nsClipboardX11_h_ */ From 3a5fb9d15546e64142ea363f5efdb390c23fc3ed Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 3 Apr 2018 10:30:37 +0200 Subject: [PATCH 15/52] Bug 1447925 - Use GetClipboardText() to get text data at nsClipboard::GetData(), r=jhorak MozReview-Commit-ID: 3JnLLyk0BOF --HG-- extra : rebase_source : 7bd5faff15d805d19628bdbd9fcd194c89c283a4 --- widget/gtk/nsClipboard.cpp | 7 ++----- widget/gtk/nsClipboard.h | 7 ++++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp index 5e8105987842..36e8d6ad5cee 100644 --- a/widget/gtk/nsClipboard.cpp +++ b/widget/gtk/nsClipboard.cpp @@ -301,11 +301,8 @@ nsClipboard::GetData(nsITransferable *aTransferable, int32_t aWhichClipboard) // Special case text/unicode since we can convert any // string into text/unicode if (flavorStr.EqualsLiteral(kUnicodeMime)) { - uint32_t clipboardDataLength; const char* clipboardData = - mContext->GetClipboardData(GTK_DEFAULT_MIME_TEXT, - aWhichClipboard, - &clipboardDataLength); + mContext->GetClipboardText(aWhichClipboard); if (!clipboardData) { // If the type was text/unicode and we couldn't get // text off the clipboard, run the next loop @@ -314,7 +311,7 @@ nsClipboard::GetData(nsITransferable *aTransferable, int32_t aWhichClipboard) } // Convert utf-8 into our unicode format. - NS_ConvertUTF8toUTF16 ucs2string(clipboardData, clipboardDataLength); + NS_ConvertUTF8toUTF16 ucs2string(clipboardData); const char* unicodeData = (const char *)ToNewUnicode(ucs2string); uint32_t unicodeDataLength = ucs2string.Length() * 2; SetTransferableData(aTransferable, flavorStr, diff --git a/widget/gtk/nsClipboard.h b/widget/gtk/nsClipboard.h index fa3b9b6ff087..9b59bf8176f6 100644 --- a/widget/gtk/nsClipboard.h +++ b/widget/gtk/nsClipboard.h @@ -13,17 +13,18 @@ #include "nsIBinaryOutputStream.h" #include -// Default Gtk MIME for text -#define GTK_DEFAULT_MIME_TEXT "UTF8_STRING" - class nsRetrievalContext { public: + // Get actual clipboard content (GetClipboardData/GetClipboardText) + // which has to be released by ReleaseClipboardData(). virtual const char* GetClipboardData(const char* aMimeType, int32_t aWhichClipboard, uint32_t* aContentLength) = 0; virtual const char* GetClipboardText(int32_t aWhichClipboard) = 0; virtual void ReleaseClipboardData(const char* aClipboardData) = 0; + // Get data mime types which can be obtained from clipboard. + // The returned array has to be released by g_free(). virtual GdkAtom* GetTargets(int32_t aWhichClipboard, int* aTargetNum) = 0; From d0f0657464640e126fae798890f4075d6db97388 Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Mon, 2 Apr 2018 16:53:05 +0000 Subject: [PATCH 16/52] Bug 1443974: add a template to run try jobs at 'low' priority; r=ahal This is gated by the `--chemspill-prio` flag, which should at least make anyone abusing it to get faster results feel sorry for what they've done. MozReview-Commit-ID: J4EwH45IkMX --HG-- extra : rebase_source : 1bfbfafd7de914aaab52f48f0e37c09c0df05dd7 --- taskcluster/taskgraph/templates/chemspill-prio.yml | 8 ++++++++ tools/tryselect/selectors/fuzzy.py | 2 +- tools/tryselect/selectors/syntax.py | 1 + tools/tryselect/templates.py | 14 ++++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 taskcluster/taskgraph/templates/chemspill-prio.yml diff --git a/taskcluster/taskgraph/templates/chemspill-prio.yml b/taskcluster/taskgraph/templates/chemspill-prio.yml new file mode 100644 index 000000000000..b33717d9ef76 --- /dev/null +++ b/taskcluster/taskgraph/templates/chemspill-prio.yml @@ -0,0 +1,8 @@ +task: + $mergeDeep: + - $eval: task + # increase the priority from lowest and very-low -> low, but leave others unchanged + - priority: + $if: task.priority == 'lowest' || task.priority == 'very-low' + then: low + else: {$eval: task.priority} diff --git a/tools/tryselect/selectors/fuzzy.py b/tools/tryselect/selectors/fuzzy.py index 5819567f4250..ac0e5ecf155c 100644 --- a/tools/tryselect/selectors/fuzzy.py +++ b/tools/tryselect/selectors/fuzzy.py @@ -91,7 +91,7 @@ class FuzzyParser(BaseTryParser): }], ] common_groups = ['push', 'task', 'preset'] - templates = ['artifact', 'path', 'env', 'rebuild'] + templates = ['artifact', 'path', 'env', 'rebuild', 'chemspill-prio'] def run(cmd, cwd=None): diff --git a/tools/tryselect/selectors/syntax.py b/tools/tryselect/selectors/syntax.py index 2463347a12d7..2b4448654a5e 100644 --- a/tools/tryselect/selectors/syntax.py +++ b/tools/tryselect/selectors/syntax.py @@ -147,6 +147,7 @@ class SyntaxParser(BaseTryParser): 'help': 'Upload XDB compilation db files generated by hazard build', }, } + templates = ['chemspill-prio'] def __init__(self, *args, **kwargs): BaseTryParser.__init__(self, *args, **kwargs) diff --git a/tools/tryselect/templates.py b/tools/tryselect/templates.py index afc281ad0bb6..9aaf075c87da 100644 --- a/tools/tryselect/templates.py +++ b/tools/tryselect/templates.py @@ -131,9 +131,23 @@ class Rebuild(Template): } +class ChemspillPrio(Template): + + def add_arguments(self, parser): + parser.add_argument('--chemspill-prio', action='store_true', + help='Run at a higher priority than most try jobs (chemspills only).') + + def context(self, chemspill_prio, **kwargs): + if chemspill_prio: + return { + 'chemspill-prio': {} + } + + all_templates = { 'artifact': Artifact, 'path': Path, 'env': Environment, 'rebuild': Rebuild, + 'chemspill-prio': ChemspillPrio, } From c7032b62114e71f9ffdcc64af37c100991391bf3 Mon Sep 17 00:00:00 2001 From: Ionut Goldan Date: Mon, 2 Apr 2018 15:07:20 +0300 Subject: [PATCH 17/52] Bug 1436018 - Disable Stylo microbenchmark on Windows r=jmaher MozReview-Commit-ID: 2AJ0lUxMMZb --HG-- extra : rebase_source : a503d2763c23487a683da8afe926f61b6fb7523b --- layout/style/test/gtest/StyloParsingBench.cpp | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/layout/style/test/gtest/StyloParsingBench.cpp b/layout/style/test/gtest/StyloParsingBench.cpp index e5e18b736e21..136775371321 100644 --- a/layout/style/test/gtest/StyloParsingBench.cpp +++ b/layout/style/test/gtest/StyloParsingBench.cpp @@ -45,13 +45,6 @@ static void ServoParsingBench() { } } -MOZ_GTEST_BENCH(Stylo, Servo_StyleSheet_FromUTF8Bytes_Bench, ServoParsingBench); - - - - - - static void ServoSetPropertyByIdBench(const nsACString& css) { RefPtr block = Servo_DeclarationBlock_CreateEmpty().Consume(); RefPtr data = new URLExtraData( @@ -73,14 +66,6 @@ static void ServoSetPropertyByIdBench(const nsACString& css) { } } -MOZ_GTEST_BENCH(Stylo, Servo_DeclarationBlock_SetPropertyById_Bench, [] { - ServoSetPropertyByIdBench(NS_LITERAL_CSTRING("10px")); -}); - -MOZ_GTEST_BENCH(Stylo, Servo_DeclarationBlock_SetPropertyById_WithInitialSpace_Bench, [] { - ServoSetPropertyByIdBench(NS_LITERAL_CSTRING(" 10px")); -}); - static void ServoGetPropertyValueById() { RefPtr block = Servo_DeclarationBlock_CreateEmpty().Consume(); RefPtr data = new URLExtraData( @@ -110,6 +95,17 @@ static void ServoGetPropertyValueById() { } } +// Bug 1436018 - Disable Stylo microbenchmark on Windows +#if !defined(_WIN32) && !defined(_WIN64) +MOZ_GTEST_BENCH(Stylo, Servo_StyleSheet_FromUTF8Bytes_Bench, ServoParsingBench); + +MOZ_GTEST_BENCH(Stylo, Servo_DeclarationBlock_SetPropertyById_Bench, [] { + ServoSetPropertyByIdBench(NS_LITERAL_CSTRING("10px")); +}); + +MOZ_GTEST_BENCH(Stylo, Servo_DeclarationBlock_SetPropertyById_WithInitialSpace_Bench, [] { + ServoSetPropertyByIdBench(NS_LITERAL_CSTRING(" 10px")); +}); + MOZ_GTEST_BENCH(Stylo, Servo_DeclarationBlock_GetPropertyById_Bench, ServoGetPropertyValueById); - - +#endif From e443c66c373c917d2a4e4ff3b2144bbfaebfd5e5 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 21 Mar 2018 14:35:53 +0100 Subject: [PATCH 18/52] bug 1447642 - no more DNSService restarts r=valentin The DNS service was shutdown and restarted again in several scenarios, for example when one of its prefs changed and by nsIOService when going offline/online. The DNSService restart dragged the resolver, TRRService and others with it and they too were thus restarted. Most notably this hurt TRR resolving, as the restart caused short gaps in time when there was no TRRService available and nsHostResolver defaults to TRR Mode "native" if there's no TRRservice up, causing the name resolver to occasionally use the wrong or unexpected resolver even though TRR is enabled. The resolver restart also flushed the DNS cache which is now avoided. It is also a performance gain. MozReview-Commit-ID: pp4Y8bNQJk --HG-- extra : rebase_source : 9e3b3e6c0df16b8ca6287d8045f594026ae9ad6d --- netwerk/base/nsIOService.cpp | 23 --- netwerk/base/nsIOService.h | 2 - netwerk/dns/nsDNSService2.cpp | 253 ++++++++++++++++++--------------- netwerk/dns/nsDNSService2.h | 8 +- netwerk/dns/nsHostResolver.cpp | 11 ++ netwerk/dns/nsHostResolver.h | 7 + 6 files changed, 164 insertions(+), 140 deletions(-) diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp index e7e918328d0d..adf54941ce56 100644 --- a/netwerk/base/nsIOService.cpp +++ b/netwerk/base/nsIOService.cpp @@ -39,7 +39,6 @@ #include "nsPISocketTransportService.h" #include "nsAsyncRedirectVerifyHelper.h" #include "nsURLHelper.h" -#include "nsPIDNSService.h" #include "nsIProtocolProxyService2.h" #include "MainThreadUtils.h" #include "nsINode.h" @@ -204,18 +203,6 @@ nsIOService::nsIOService() nsresult nsIOService::Init() { - nsresult rv; - - // We need to get references to the DNS service so that we can shut it - // down later. If we wait until the nsIOService is being shut down, - // GetService will fail at that point. - - mDNSService = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv); - if (NS_FAILED(rv)) { - NS_WARNING("failed to get DNS service"); - return rv; - } - // XXX hack until xpidl supports error info directly (bug 13423) nsCOMPtr errorService = do_GetService(NS_ERRORSERVICE_CONTRACTID); if (errorService) { @@ -1146,10 +1133,6 @@ nsIOService::SetOffline(bool offline) } else if (!offline && mOffline) { // go online - if (mDNSService) { - DebugOnly rv = mDNSService->Init(); - NS_ASSERTION(NS_SUCCEEDED(rv), "DNS service init failed"); - } InitializeSocketTransportService(); mOffline = false; // indicate success only AFTER we've // brought up the services @@ -1167,12 +1150,6 @@ nsIOService::SetOffline(bool offline) // Don't notify here, as the above notifications (if used) suffice. if ((mShutdown || mOfflineForProfileChange) && mOffline) { - // be sure to try and shutdown both (even if the first fails)... - // shutdown dns service first, because it has callbacks for socket transport - if (mDNSService) { - DebugOnly rv = mDNSService->Shutdown(); - NS_ASSERTION(NS_SUCCEEDED(rv), "DNS service shutdown failed"); - } if (mSocketTransportService) { DebugOnly rv = mSocketTransportService->Shutdown(mShutdown); NS_ASSERTION(NS_SUCCEEDED(rv), "socket transport service shutdown failed"); diff --git a/netwerk/base/nsIOService.h b/netwerk/base/nsIOService.h index 3683115991dd..a0ae21398c2d 100644 --- a/netwerk/base/nsIOService.h +++ b/netwerk/base/nsIOService.h @@ -38,7 +38,6 @@ class nsINetworkLinkService; class nsIPrefBranch; class nsIProtocolProxyService2; class nsIProxyInfo; -class nsPIDNSService; class nsPISocketTransportService; namespace mozilla { @@ -181,7 +180,6 @@ private: mozilla::Atomic mHttpHandlerAlreadyShutingDown; nsCOMPtr mSocketTransportService; - nsCOMPtr mDNSService; nsCOMPtr mCaptivePortalService; nsCOMPtr mNetworkLinkService; bool mNetworkLinkServiceInitialized; diff --git a/netwerk/dns/nsDNSService2.cpp b/netwerk/dns/nsDNSService2.cpp index b4d1d9564b8f..5b90a3571957 100644 --- a/netwerk/dns/nsDNSService2.cpp +++ b/netwerk/dns/nsDNSService2.cpp @@ -26,7 +26,6 @@ #include "prmon.h" #include "prio.h" #include "plstr.h" -#include "nsIOService.h" #include "nsCharSeparatedTokenizer.h" #include "nsNetAddr.h" #include "nsProxyRelease.h" @@ -56,6 +55,7 @@ static const char kPrefDnsLocalDomains[] = "network.dns.localDomains"; static const char kPrefDnsForceResolve[] = "network.dns.forceResolve"; static const char kPrefDnsOfflineLocalhost[] = "network.dns.offline-localhost"; static const char kPrefDnsNotifyResolution[] = "network.dns.notifyResolution"; +static const char kPrefNetworkProxyType[] = "network.proxy.type"; //----------------------------------------------------------------------------- @@ -495,7 +495,6 @@ nsDNSService::nsDNSService() : mLock("nsDNSServer.mLock") , mDisableIPv6(false) , mDisablePrefetch(false) - , mFirstTime(true) , mNotifyResolution(false) , mOfflineLocalhost(false) , mForceResolveOn(false) @@ -541,116 +540,149 @@ nsDNSService::GetSingleton() return do_AddRef(gDNSService); } +nsresult +nsDNSService::ReadPrefs(const char *name) +{ + bool tmpbool; + uint32_t tmpint; + mResolverPrefsUpdated = false; + + // resolver-specific prefs first + if(!name || !strcmp(name, kPrefDnsCacheEntries)) { + if (NS_SUCCEEDED(Preferences::GetUint(kPrefDnsCacheEntries, &tmpint))) { + if (!name || (tmpint != mResCacheEntries)) { + mResCacheEntries = tmpint; + mResolverPrefsUpdated = true; + } + } + + } + if(!name || !strcmp(name, kPrefDnsCacheExpiration)) { + if (NS_SUCCEEDED(Preferences::GetUint(kPrefDnsCacheExpiration, &tmpint))) { + if (!name || (tmpint != mResCacheExpiration)) { + mResCacheExpiration = tmpint; + mResolverPrefsUpdated = true; + } + } + + } + if(!name || !strcmp(name, kPrefDnsCacheGrace)) { + if (NS_SUCCEEDED(Preferences::GetUint(kPrefDnsCacheGrace, &tmpint))) { + if (!name || (tmpint != mResCacheGrace)) { + mResCacheGrace = tmpint; + mResolverPrefsUpdated = true; + } + } + } + + // DNSservice prefs + if (!name || !strcmp(name, kPrefDisableIPv6)) { + if (NS_SUCCEEDED(Preferences::GetBool(kPrefDisableIPv6, &tmpbool))) { + mDisableIPv6 = tmpbool; + } + } + if (!name || !strcmp(name, kPrefDnsOfflineLocalhost)) { + if (NS_SUCCEEDED(Preferences::GetBool(kPrefDnsOfflineLocalhost, &tmpbool))) { + mOfflineLocalhost = tmpbool; + } + } + if (!name || !strcmp(name, kPrefDisablePrefetch)) { + if (NS_SUCCEEDED(Preferences::GetBool(kPrefDisablePrefetch, &tmpbool))) { + mDisablePrefetch = tmpbool; + } + } + if (!name || !strcmp(name, kPrefBlockDotOnion)) { + if (NS_SUCCEEDED(Preferences::GetBool(kPrefBlockDotOnion, &tmpbool))) { + mBlockDotOnion = tmpbool; + } + } + if (!name || !strcmp(name, kPrefDnsNotifyResolution)) { + if (NS_SUCCEEDED(Preferences::GetBool(kPrefDnsNotifyResolution, &tmpbool))) { + mNotifyResolution = tmpbool; + } + } + if (!name || !strcmp(name, kPrefNetworkProxyType)) { + if (NS_SUCCEEDED(Preferences::GetUint(kPrefNetworkProxyType, &tmpint))) { + mProxyType = tmpint; + } + } + if (!name || !strcmp(name, kPrefIPv4OnlyDomains)) { + Preferences::GetCString(kPrefIPv4OnlyDomains, mIPv4OnlyDomains); + } + if (!name || !strcmp(name, kPrefDnsLocalDomains)) { + nsCString localDomains; + Preferences::GetCString(kPrefDnsLocalDomains, localDomains); + mLocalDomains.Clear(); + if (!localDomains.IsEmpty()) { + nsCCharSeparatedTokenizer tokenizer(localDomains, ',', + nsCCharSeparatedTokenizer::SEPARATOR_OPTIONAL); + while (tokenizer.hasMoreTokens()) { + mLocalDomains.PutEntry(tokenizer.nextToken()); + } + } + } + if (!name || !strcmp(name, kPrefDnsForceResolve)) { + Preferences::GetCString(kPrefDnsForceResolve, mForceResolve); + mForceResolveOn = !mForceResolve.IsEmpty(); + } + + if (mProxyType == nsIProtocolProxyService::PROXYCONFIG_MANUAL) { + // Disable prefetching either by explicit preference or if a + // manual proxy is configured + mDisablePrefetch = true; + } + return NS_OK; +} + NS_IMETHODIMP nsDNSService::Init() { - if (mResolver) - return NS_OK; - NS_ENSURE_TRUE(!mResolver, NS_ERROR_ALREADY_INITIALIZED); - // prefs - uint32_t maxCacheEntries = 400; - uint32_t defaultCacheLifetime = 120; // seconds - uint32_t defaultGracePeriod = 60; // seconds - bool disableIPv6 = false; - bool offlineLocalhost = true; - bool disablePrefetch = false; - bool blockDotOnion = true; - int proxyType = nsIProtocolProxyService::PROXYCONFIG_DIRECT; - bool notifyResolution = false; + MOZ_ASSERT(!mResolver); + MOZ_ASSERT(NS_IsMainThread()); - nsAutoCString ipv4OnlyDomains; - nsAutoCString localDomains; - nsAutoCString forceResolve; - - // read prefs - nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); - if (prefs) { - int32_t val; - if (NS_SUCCEEDED(prefs->GetIntPref(kPrefDnsCacheEntries, &val))) - maxCacheEntries = (uint32_t) val; - if (NS_SUCCEEDED(prefs->GetIntPref(kPrefDnsCacheExpiration, &val))) - defaultCacheLifetime = val; - if (NS_SUCCEEDED(prefs->GetIntPref(kPrefDnsCacheGrace, &val))) - defaultGracePeriod = val; - - // ASSUMPTION: pref branch does not modify out params on failure - prefs->GetBoolPref(kPrefDisableIPv6, &disableIPv6); - prefs->GetCharPref(kPrefIPv4OnlyDomains, ipv4OnlyDomains); - prefs->GetCharPref(kPrefDnsLocalDomains, localDomains); - prefs->GetCharPref(kPrefDnsForceResolve, forceResolve); - prefs->GetBoolPref(kPrefDnsOfflineLocalhost, &offlineLocalhost); - prefs->GetBoolPref(kPrefDisablePrefetch, &disablePrefetch); - prefs->GetBoolPref(kPrefBlockDotOnion, &blockDotOnion); - - // If a manual proxy is in use, disable prefetch implicitly - prefs->GetIntPref("network.proxy.type", &proxyType); - prefs->GetBoolPref(kPrefDnsNotifyResolution, ¬ifyResolution); - - if (mFirstTime) { - mFirstTime = false; - - // register as prefs observer - prefs->AddObserver(kPrefDnsCacheEntries, this, false); - prefs->AddObserver(kPrefDnsCacheExpiration, this, false); - prefs->AddObserver(kPrefDnsCacheGrace, this, false); - prefs->AddObserver(kPrefIPv4OnlyDomains, this, false); - prefs->AddObserver(kPrefDnsLocalDomains, this, false); - prefs->AddObserver(kPrefDnsForceResolve, this, false); - prefs->AddObserver(kPrefDisableIPv6, this, false); - prefs->AddObserver(kPrefDnsOfflineLocalhost, this, false); - prefs->AddObserver(kPrefDisablePrefetch, this, false); - prefs->AddObserver(kPrefBlockDotOnion, this, false); - prefs->AddObserver(kPrefDnsNotifyResolution, this, false); - - // Monitor these to see if there is a change in proxy configuration - // If a manual proxy is in use, disable prefetch implicitly - prefs->AddObserver("network.proxy.type", this, false); - } - } + ReadPrefs(nullptr); nsCOMPtr observerService = mozilla::services::GetObserverService(); if (observerService) { observerService->AddObserver(this, "last-pb-context-exited", false); observerService->AddObserver(this, NS_NETWORK_LINK_TOPIC, false); + observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false); } - nsDNSPrefetch::Initialize(this); - - nsCOMPtr idn = do_GetService(NS_IDNSERVICE_CONTRACTID); - RefPtr res; - nsresult rv = nsHostResolver::Create(maxCacheEntries, - defaultCacheLifetime, - defaultGracePeriod, + nsresult rv = nsHostResolver::Create(mResCacheEntries, + mResCacheExpiration, + mResCacheGrace, getter_AddRefs(res)); if (NS_SUCCEEDED(rv)) { // now, set all of our member variables while holding the lock MutexAutoLock lock(mLock); mResolver = res; - mIDN = idn; - mIPv4OnlyDomains = ipv4OnlyDomains; - mOfflineLocalhost = offlineLocalhost; - mDisableIPv6 = disableIPv6; - mBlockDotOnion = blockDotOnion; - mForceResolve = forceResolve; - mForceResolveOn = !mForceResolve.IsEmpty(); - - // Disable prefetching either by explicit preference or if a manual proxy is configured - mDisablePrefetch = disablePrefetch || (proxyType == nsIProtocolProxyService::PROXYCONFIG_MANUAL); - - mLocalDomains.Clear(); - if (!localDomains.IsVoid()) { - nsCCharSeparatedTokenizer tokenizer(localDomains, ',', - nsCCharSeparatedTokenizer::SEPARATOR_OPTIONAL); - - while (tokenizer.hasMoreTokens()) { - mLocalDomains.PutEntry(tokenizer.nextToken()); - } - } - mNotifyResolution = notifyResolution; } + nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); + if (prefs) { + // register as prefs observer + prefs->AddObserver(kPrefDnsCacheEntries, this, false); + prefs->AddObserver(kPrefDnsCacheExpiration, this, false); + prefs->AddObserver(kPrefDnsCacheGrace, this, false); + prefs->AddObserver(kPrefIPv4OnlyDomains, this, false); + prefs->AddObserver(kPrefDnsLocalDomains, this, false); + prefs->AddObserver(kPrefDnsForceResolve, this, false); + prefs->AddObserver(kPrefDisableIPv6, this, false); + prefs->AddObserver(kPrefDnsOfflineLocalhost, this, false); + prefs->AddObserver(kPrefDisablePrefetch, this, false); + prefs->AddObserver(kPrefBlockDotOnion, this, false); + prefs->AddObserver(kPrefDnsNotifyResolution, this, false); + + // Monitor these to see if there is a change in proxy configuration + // If a manual proxy is in use, disable prefetch implicitly + prefs->AddObserver("network.proxy.type", this, false); + } + + nsDNSPrefetch::Initialize(this); + RegisterWeakMemoryReporter(this); mTrrService = new TRRService(); @@ -658,7 +690,10 @@ nsDNSService::Init() mTrrService = nullptr; } - return rv; + nsCOMPtr idn = do_GetService(NS_IDNSERVICE_CONTRACTID); + mIDN = idn; + + return NS_OK; } NS_IMETHODIMP @@ -681,6 +716,7 @@ nsDNSService::Shutdown() if (observerService) { observerService->RemoveObserver(this, NS_NETWORK_LINK_TOPIC); observerService->RemoveObserver(this, "last-pb-context-exited"); + observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID); } return NS_OK; @@ -1113,13 +1149,6 @@ nsDNSService::GetMyHostName(nsACString &result) NS_IMETHODIMP nsDNSService::Observe(nsISupports *subject, const char *topic, const char16_t *data) { - // We are only getting called if a preference has changed or there's a - // network link event. - NS_ASSERTION(strcmp(topic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) == 0 || - strcmp(topic, "last-pb-context-exited") == 0 || - strcmp(topic, NS_NETWORK_LINK_TOPIC) == 0, - "unexpected observe call"); - bool flushCache = false; if (!strcmp(topic, NS_NETWORK_LINK_TOPIC)) { nsAutoCString converted = NS_ConvertUTF16toUTF8(data); @@ -1128,25 +1157,22 @@ nsDNSService::Observe(nsISupports *subject, const char *topic, const char16_t *d } } else if (!strcmp(topic, "last-pb-context-exited")) { flushCache = true; + } else if (!strcmp(topic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { + ReadPrefs(NS_ConvertUTF16toUTF8(data).get()); + NS_ENSURE_TRUE(mResolver, NS_ERROR_NOT_INITIALIZED); + if (mResolverPrefsUpdated && mResolver) { + mResolver->SetCacheLimits(mResCacheEntries, mResCacheExpiration, + mResCacheGrace); + } + } else if (!strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) { + Shutdown(); } + if (flushCache) { mResolver->FlushCache(); return NS_OK; } - // - // Shutdown and this function are both only called on the UI thread, so we don't - // have to worry about mResolver being cleared out from under us. - // - // NOTE Shutting down and reinitializing the service like this is obviously - // suboptimal if Observe gets called several times in a row, but we don't - // expect that to be the case. - // - - if (mResolver) { - Shutdown(); - } - Init(); return NS_OK; } @@ -1244,4 +1270,3 @@ nsDNSService::CollectReports(nsIHandleReportCallback* aHandleReport, return NS_OK; } - diff --git a/netwerk/dns/nsDNSService2.h b/netwerk/dns/nsDNSService2.h index 9da561a30859..92c32aefce72 100644 --- a/netwerk/dns/nsDNSService2.h +++ b/netwerk/dns/nsDNSService2.h @@ -51,6 +51,7 @@ protected: private: ~nsDNSService(); + nsresult ReadPrefs(const char *name); static already_AddRefed GetSingleton(); uint16_t GetAFForLookup(const nsACString &host, uint32_t flags); @@ -79,12 +80,17 @@ private: bool mDisableIPv6; bool mDisablePrefetch; bool mBlockDotOnion; - bool mFirstTime; bool mNotifyResolution; bool mOfflineLocalhost; bool mForceResolveOn; + uint32_t mProxyType; nsTHashtable mLocalDomains; RefPtr mTrrService; + + uint32_t mResCacheEntries; + uint32_t mResCacheExpiration; + uint32_t mResCacheGrace; + bool mResolverPrefsUpdated; }; #endif //nsDNSService2_h__ diff --git a/netwerk/dns/nsHostResolver.cpp b/netwerk/dns/nsHostResolver.cpp index b491cf0cc79a..f9f46ee93739 100644 --- a/netwerk/dns/nsHostResolver.cpp +++ b/netwerk/dns/nsHostResolver.cpp @@ -1865,6 +1865,17 @@ nsHostResolver::ThreadFunc(void *arg) LOG(("DNS lookup thread - queue empty, thread finished.\n")); } +void +nsHostResolver::SetCacheLimits(uint32_t aMaxCacheEntries, + uint32_t aDefaultCacheEntryLifetime, + uint32_t aDefaultGracePeriod) +{ + MutexAutoLock lock(mLock); + mMaxCacheEntries = aMaxCacheEntries; + mDefaultCacheLifetime = aDefaultCacheEntryLifetime; + mDefaultGracePeriod = aDefaultGracePeriod; +} + nsresult nsHostResolver::Create(uint32_t maxCacheEntries, uint32_t defaultCacheEntryLifetime, diff --git a/netwerk/dns/nsHostResolver.h b/netwerk/dns/nsHostResolver.h index 22cec4dde839..55dfac8d7317 100644 --- a/netwerk/dns/nsHostResolver.h +++ b/netwerk/dns/nsHostResolver.h @@ -309,6 +309,13 @@ public: uint32_t defaultGracePeriod, // seconds nsHostResolver **resolver); + /** + * Set (new) cache limits. + */ + void SetCacheLimits(uint32_t maxCacheEntries, // zero disables cache + uint32_t defaultCacheEntryLifetime, // seconds + uint32_t defaultGracePeriod); // seconds + /** * puts the resolver in the shutdown state, which will cause any pending * callbacks to be detached. any future calls to ResolveHost will fail. From 9b050d739efe072ab13f7d8c7fccb32d9df250bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Fri, 30 Mar 2018 17:36:01 +0200 Subject: [PATCH 19/52] Bug 1450279 - Replace CAN_DRAW_IN_TITLEBAR with a run-time check. r=Gijs MozReview-Commit-ID: Iedpcu5K74m --HG-- extra : rebase_source : 3114680ab149c0005d191b2da650ac287d8105af --- .../content/browser-tabsintitlebar-stub.js | 16 ------- .../base/content/browser-tabsintitlebar.js | 26 +++++++---- browser/base/content/browser.css | 3 -- browser/base/content/browser.xul | 13 ------ browser/base/jar.mn | 4 -- browser/base/moz.build | 3 -- .../customizableui/CustomizeMode.jsm | 43 +++++++++---------- .../content/customizeMode.inc.xul | 2 - browser/components/customizableui/moz.build | 3 -- browser/themes/osx/moz.build | 2 - browser/themes/shared/tabs.inc.css | 2 - browser/themes/windows/moz.build | 1 - toolkit/modules/AppConstants.jsm | 7 --- toolkit/modules/moz.build | 3 -- 14 files changed, 38 insertions(+), 90 deletions(-) delete mode 100644 browser/base/content/browser-tabsintitlebar-stub.js diff --git a/browser/base/content/browser-tabsintitlebar-stub.js b/browser/base/content/browser-tabsintitlebar-stub.js deleted file mode 100644 index 7276cc4751b8..000000000000 --- a/browser/base/content/browser-tabsintitlebar-stub.js +++ /dev/null @@ -1,16 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- - * 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/. */ - -// This file is used as a stub object for platforms which -// don't have CAN_DRAW_IN_TITLEBAR defined. - -var TabsInTitlebar = { - init() {}, - whenWindowLayoutReady() {}, - uninit() {}, - allowedBy() {}, - update() {}, - enabled: false, -}; diff --git a/browser/base/content/browser-tabsintitlebar.js b/browser/base/content/browser-tabsintitlebar.js index 70eeeeaab51f..c1cb43de4213 100644 --- a/browser/base/content/browser-tabsintitlebar.js +++ b/browser/base/content/browser-tabsintitlebar.js @@ -3,19 +3,11 @@ * 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/. */ -// Note: the file browser-tabsintitlebar-stub.js is used instead of -// this one on platforms which don't have CAN_DRAW_IN_TITLEBAR defined. - var TabsInTitlebar = { init() { this._readPref(); Services.prefs.addObserver(this._prefName, this); - // Always disable on unsupported GTK versions. - if (AppConstants.MOZ_WIDGET_TOOLKIT == "gtk3") { - this.allowedBy("gtk", window.matchMedia("(-moz-gtk-csd-available)")); - } - // We need to update the appearance of the titlebar when the menu changes // from the active to the inactive state. We can't, however, rely on // DOMMenuBarInactive, because the menu fires this event and then removes @@ -66,6 +58,21 @@ var TabsInTitlebar = { } }, + get systemSupported() { + let isSupported = false; + switch (AppConstants.MOZ_WIDGET_TOOLKIT) { + case "windows": + case "cocoa": + isSupported = true; + break; + case "gtk3": + isSupported = window.matchMedia("(-moz-gtk-csd-available)"); + break; + } + delete this.systemSupported; + return this.systemSupported = isSupported; + }, + get enabled() { return document.documentElement.getAttribute("tabsintitlebar") == "true"; }, @@ -134,7 +141,8 @@ var TabsInTitlebar = { return; } - let allowed = (Object.keys(this._disallowed)).length == 0; + let allowed = this.systemSupported && + (Object.keys(this._disallowed)).length == 0; if (allowed) { document.documentElement.setAttribute("tabsintitlebar", "true"); if (AppConstants.platform == "macosx") { diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index b08f72ad0d5e..de5229667b67 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -277,7 +277,6 @@ window:not([chromehidden~="toolbar"]) #nav-bar[nonemptyoverflow] > .overflow-but } -%ifdef CAN_DRAW_IN_TITLEBAR %ifdef MENUBAR_CAN_AUTOHIDE #toolbar-menubar:not([autohide=true]) + #TabsToolbar > .titlebar-placeholder, %endif @@ -347,8 +346,6 @@ toolbarpaletteitem { } %endif -%endif - #main-window[inFullscreen][inDOMFullscreen] #navigator-toolbox, #main-window[inFullscreen][inDOMFullscreen] #fullscr-toggler, #main-window[inFullscreen][inDOMFullscreen] #sidebar-box, diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 5f069e03bb8f..d6d770d121fb 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -46,14 +46,12 @@ titlemodifier_normal="&mainWindow.titlemodifier;" titlemodifier_privatebrowsing="&mainWindow.titlemodifier; &mainWindow.titlePrivateBrowsingSuffix;" #endif -#ifdef CAN_DRAW_IN_TITLEBAR #ifdef XP_WIN chromemargin="0,2,2,2" #else chromemargin="0,-1,-1,-1" #endif tabsintitlebar="true" -#endif titlemenuseparator="&mainWindow.titlemodifiermenuseparator;" windowtype="navigator:browser" macanimationtype="document" @@ -598,7 +596,6 @@