Bug 1500833 - Add a test which adds animation then immediately removes that. r=pbro, a=RyanVM
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Thu, 25 Oct 2018 00:41:00 +0000
changeset 498188 52d060761f0c9edacbcc7476b7d6ec919d9ce986
parent 498187 2e302b256039185f559d5ac6f621783bc83cbfa5
child 498189 869a690e1c28c9baf1700cbe0100d58b282b008e
push id10058
push userryanvm@gmail.com
push dateMon, 29 Oct 2018 13:32:17 +0000
treeherdermozilla-beta@52d060761f0c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbro, RyanVM
bugs1500833
milestone64.0
Bug 1500833 - Add a test which adds animation then immediately removes that. r=pbro, a=RyanVM Depends on D9616 Differential Revision: https://phabricator.services.mozilla.com/D9617
devtools/client/inspector/animation/test/browser.ini
devtools/client/inspector/animation/test/browser_animation_logic_mutations_add_remove_immediately.js
devtools/client/inspector/animation/test/doc_mutations_add_remove_immediately.html
--- a/devtools/client/inspector/animation/test/browser.ini
+++ b/devtools/client/inspector/animation/test/browser.ini
@@ -4,16 +4,17 @@ subsuite = devtools
 support-files =
   current-time-scrubber_head.js
   doc_custom_playback_rate.html
   doc_frame_script.js
   doc_infinity_duration.html
   doc_multi_easings.html
   doc_multi_keyframes.html
   doc_multi_timings.html
+  doc_mutations_add_remove_immediately.html
   doc_mutations_fast.html
   doc_negative_playback_rate.html
   doc_overflowed_delay_end_delay.html
   doc_pseudo.html
   doc_short_duration.html
   doc_simple_animation.html
   head.js
   keyframes-graph_keyframe-marker_head.js
@@ -63,16 +64,17 @@ skip-if = (verify && !debug)
 skip-if = (os == "win" && ccov) # Bug 1490981
 [browser_animation_keyframes-progress-bar_after-resuming.js]
 [browser_animation_logic_adjust-time.js]
 [browser_animation_logic_adjust-time-with-playback-rate.js]
 [browser_animation_logic_auto-stop.js]
 [browser_animation_logic_avoid-updating-during-hiding.js]
 [browser_animation_logic_created-time.js]
 [browser_animation_logic_mutations.js]
+[browser_animation_logic_mutations_add_remove_immediately.js]
 [browser_animation_logic_mutations_fast.js]
 [browser_animation_logic_mutations_properties.js]
 [browser_animation_logic_overflowed_delay_end-delay.js]
 skip-if = debug #bug 1480027
 [browser_animation_logic_scroll-amount.js]
 [browser_animation_pause-resume-button.js]
 [browser_animation_pause-resume-button_end-time.js]
 [browser_animation_pause-resume-button_respectively.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/inspector/animation/test/browser_animation_logic_mutations_add_remove_immediately.js
@@ -0,0 +1,25 @@
+/* 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 add animation then remove
+// immediately.
+
+add_task(async function() {
+  const tab = await addTab(URL_ROOT + "doc_mutations_add_remove_immediately.html");
+  const { inspector, panel } = await openAnimationInspector();
+
+  info("Check state of the animation inspector after fast mutations");
+  const onDispatch = waitForDispatch(inspector, "UPDATE_ANIMATIONS", () => 1);
+  await startMutation(tab);
+  await onDispatch;
+  ok(panel.querySelector(".animation-error-message"),
+     "No animations message should display");
+});
+
+async function startMutation(tab) {
+  await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
+    await content.wrappedJSObject.startMutation();
+  });
+}
new file mode 100644
--- /dev/null
+++ b/devtools/client/inspector/animation/test/doc_mutations_add_remove_immediately.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="UTF-8">
+  </head>
+  <body>
+    <div></div>
+
+    <script>
+    "use strict";
+
+    // This function is called from test.
+    // eslint-disable-next-line
+    function startMutation() {
+      const target = document.querySelector("div");
+      const animation = target.animate({ opacity: [1, 0] }, 100000);
+      animation.currentTime = 1;
+      animation.cancel();
+    }
+    </script>
+  </body>
+</html>