summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/webappapis/timers/clearinterval-from-callback.any.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/webappapis/timers/clearinterval-from-callback.any.js')
-rw-r--r--testing/web-platform/tests/html/webappapis/timers/clearinterval-from-callback.any.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/webappapis/timers/clearinterval-from-callback.any.js b/testing/web-platform/tests/html/webappapis/timers/clearinterval-from-callback.any.js
new file mode 100644
index 0000000000..bf4eb7cf5a
--- /dev/null
+++ b/testing/web-platform/tests/html/webappapis/timers/clearinterval-from-callback.any.js
@@ -0,0 +1,19 @@
+async_test((t) => {
+ let wasPreviouslyCalled = false;
+
+ const handle = setInterval(
+ t.step_func(() => {
+ if (!wasPreviouslyCalled) {
+ wasPreviouslyCalled = true;
+
+ clearInterval(handle);
+
+ // Make the test succeed after the callback would've run next.
+ setInterval(t.step_func_done(), 750);
+ } else {
+ assert_unreached();
+ }
+ }),
+ 500
+ );
+}, "Clearing an interval from the callback should still clear it.");