From f1bd968c5c9bf7c1c7183d51d6289e8eeb366059 Mon Sep 17 00:00:00 2001 From: Johann Hofmann Date: Thu, 16 Aug 2018 18:30:53 +0000 Subject: [PATCH] Bug 1478637 - Avoid sync style flushes when cancelling the shield animation in the identity block. r=mconley Differential Revision: https://phabricator.services.mozilla.com/D3449 --HG-- extra : moz-landing-system : lando --- browser/base/content/browser-contentblocking.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/browser/base/content/browser-contentblocking.js b/browser/base/content/browser-contentblocking.js index f6522b696f32..005042f9d2ea 100644 --- a/browser/base/content/browser-contentblocking.js +++ b/browser/base/content/browser-contentblocking.js @@ -379,11 +379,18 @@ var ContentBlocking = { }, cancelAnimation() { - let iconAnimation = this.animatedIcon.getAnimations()[0]; - if (iconAnimation && iconAnimation.currentTime) { - iconAnimation.cancel(); + if (!this.iconBox.hasAttribute("animate")) { + return; } - this.iconBox.removeAttribute("animate"); + + window.promiseDocumentFlushed(() => { + return this.animatedIcon.getAnimations()[0]; + }).then(iconAnimation => { + if (iconAnimation && iconAnimation.currentTime) { + iconAnimation.cancel(); + } + this.iconBox.removeAttribute("animate"); + }); }, onSecurityChange(state, webProgress, isSimulated) {