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
--- 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>