Bug 1462229 - Part 4: Add test for fast removal. r=gl
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Mon, 28 May 2018 09:28:00 +0900
changeset 420093 443ff1adf8abe46d484d1b18c30bbd3ff007f640
parent 420092 6fa5b5963b06eb4984a59629b1fc1d005579e462
child 420094 316c777cdb203465a2c460949e5538d026d02430
child 420111 a466172aed4bc2afc21169b749b8068a4b98c93f
push id64504
push userdakatsuka@mozilla.com
push dateMon, 28 May 2018 04:53:06 +0000
treeherderautoland@443ff1adf8ab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl
bugs1462229
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1462229 - Part 4: Add test for fast removal. r=gl MozReview-Commit-ID: 2Fr3v7OwkMm
devtools/client/inspector/animation/test/browser.ini
devtools/client/inspector/animation/test/browser_animation_logic_mutations_fast.js
devtools/client/inspector/animation/test/doc_mutations_fast.html
--- a/devtools/client/inspector/animation/test/browser.ini
+++ b/devtools/client/inspector/animation/test/browser.ini
@@ -2,16 +2,17 @@
 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
+  doc_mutations_fast.html
   doc_pseudo.html
   doc_simple_animation.html
   head.js
   !/devtools/client/inspector/test/head.js
   !/devtools/client/inspector/test/shared-head.js
   !/devtools/client/shared/test/frame-script-utils.js
   !/devtools/client/shared/test/shared-head.js
   !/devtools/client/shared/test/telemetry-test-helpers.js
@@ -38,16 +39,17 @@ support-files =
 [browser_animation_keyframes-graph_computed-value-path.js]
 [browser_animation_keyframes-graph_computed-value-path_easing-hint.js]
 [browser_animation_keyframes-graph_keyframe-marker.js]
 [browser_animation_keyframes-progress-bar.js]
 [browser_animation_keyframes-progress-bar_after-resuming.js]
 [browser_animation_logic_auto-stop.js]
 [browser_animation_logic_avoid-updating-during-hiding.js]
 [browser_animation_logic_mutations.js]
+[browser_animation_logic_mutations_fast.js]
 [browser_animation_pause-resume-button.js]
 [browser_animation_pause-resume-button_end-time.js]
 [browser_animation_pause-resume-button_respectively.js]
 [browser_animation_pause-resume-button_spacebar.js]
 [browser_animation_playback-rate-selector.js]
 [browser_animation_pseudo-element.js]
 [browser_animation_rewind-button.js]
 [browser_animation_summary-graph_animation-name.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/inspector/animation/test/browser_animation_logic_mutations_fast.js
@@ -0,0 +1,22 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Test whether the animation inspector will not crash when remove/add animations faster.
+
+add_task(async function() {
+  const tab = await addTab(URL_ROOT + "doc_mutations_fast.html");
+  const { inspector } = await openAnimationInspector();
+
+  info("Check state of the animation inspector after fast mutations");
+  await startFastMutations(tab);
+  ok(inspector.panelWin.document.getElementById("animation-container"),
+    "Animation inspector should be live");
+});
+
+async function startFastMutations(tab) {
+  await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
+    await content.wrappedJSObject.startFastMutations();
+  });
+}
new file mode 100644
--- /dev/null
+++ b/devtools/client/inspector/animation/test/doc_mutations_fast.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="UTF-8">
+    <style>
+    div {
+      background-color: lime;
+      height: 20px;
+      opacity: 1;
+      transition: 0.5s opacity;
+    }
+
+    .transition {
+      opacity: 0;
+    }
+    </style>
+  </head>
+  <body>
+    <div></div>
+    <div></div>
+    <div></div>
+    <div></div>
+    <div></div>
+    <div></div>
+    <div></div>
+    <div></div>
+    <div></div>
+    <div></div>
+
+    <script>
+    "use strict";
+
+    // This function is called from test.
+    // eslint-disable-next-line
+    async function startFastMutations() {
+      const targets = document.querySelectorAll("div");
+
+      for (let i = 0; i < 10; i++) {
+        for (const target of targets) {
+          target.classList.toggle("transition");
+          await wait(15);
+        }
+      }
+    }
+
+    async function wait(ms) {
+      return new Promise(resolve => {
+        setTimeout(resolve, ms);
+      });
+    }
+    </script>
+  </body>
+</html>