diff --git a/devtools/server/actors/utils/capture-screenshot.js b/devtools/server/actors/utils/capture-screenshot.js index 41a0aad4c956..db62f2179136 100644 --- a/devtools/server/actors/utils/capture-screenshot.js +++ b/devtools/server/actors/utils/capture-screenshot.js @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; -const { Cu, Cc, Ci } = require("chrome"); +const { Cc, Ci } = require("chrome"); const Services = require("Services"); const { LocalizationHelper } = require("devtools/shared/l10n"); @@ -26,9 +26,16 @@ const MAX_IMAGE_HEIGHT = 10000; * The target document. */ function simulateCameraFlash(document) { - const window = document.defaultView; - const frames = Cu.cloneInto({ opacity: [0, 1] }, window); - document.documentElement.animate(frames, CONTAINER_FLASHING_DURATION); + const node = document.documentElement; + + // Don't take a screenshot if the user prefers reduced motion. + if (node.ownerGlobal.matchMedia("(prefers-reduced-motion)").matches) { + return; + } + + node.animate([{ opacity: 0 }, { opacity: 1 }], { + duration: CONTAINER_FLASHING_DURATION, + }); } /**