You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2021/05/09 12:47:04 UTC

[echarts] branch enhance-visual-regression-test updated (dee167a -> 8bcf63c)

This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a change to branch enhance-visual-regression-test
in repository https://gitbox.apache.org/repos/asf/echarts.git.


    from dee167a  test(visual): fix wrong usage of playbackSpeed
     new 3b3cef0  test(visual): fix setTimeout in timeout callback
     new 8bcf63c  test(visual): optimize cases. ignore stream case in SVG

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 test/area-smooth.html            |   1 -
 test/bar-others.html             |   3 -
 test/drag-out.html               |   2 -
 test/gauge-progress.html         |   1 -
 test/geo-update.html             |   1 -
 test/graph-grid-life.html        | 204 +++++++++++++++++++--------------------
 test/graphic-cases.html          |   2 -
 test/hoverFocus2.html            |   1 -
 test/label-layout.html           |   1 -
 test/legend-scroll2plain.html    |   1 -
 test/line-crash.html             |   1 -
 test/pie-richText.html           |   2 -
 test/pie-visual.html             |   1 -
 test/runTest/blacklist.js        |   4 +
 test/runTest/cli.js              |   6 +-
 test/runTest/runtime/timeline.js |  21 ++--
 test/runTest/store.js            |  10 +-
 test/timeScale-formatter.html    |   6 --
 test/tooltip-textStyle.html      |   6 --
 19 files changed, 122 insertions(+), 152 deletions(-)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[echarts] 02/02: test(visual): optimize cases. ignore stream case in SVG

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch enhance-visual-regression-test
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit 8bcf63cf4b1a02539d83352e78dac6efcf7d2cd9
Author: pissang <bm...@gmail.com>
AuthorDate: Sun May 9 20:45:22 2021 +0800

    test(visual): optimize cases. ignore stream case in SVG
---
 test/area-smooth.html         |   1 -
 test/bar-others.html          |   3 -
 test/drag-out.html            |   2 -
 test/gauge-progress.html      |   1 -
 test/geo-update.html          |   1 -
 test/graph-grid-life.html     | 204 ++++++++++++++++++++----------------------
 test/graphic-cases.html       |   2 -
 test/hoverFocus2.html         |   1 -
 test/label-layout.html        |   1 -
 test/legend-scroll2plain.html |   1 -
 test/line-crash.html          |   1 -
 test/pie-richText.html        |   2 -
 test/pie-visual.html          |   1 -
 test/runTest/blacklist.js     |   4 +
 test/runTest/cli.js           |   6 +-
 test/runTest/store.js         |  10 ++-
 test/timeScale-formatter.html |   6 --
 test/tooltip-textStyle.html   |   6 --
 18 files changed, 110 insertions(+), 143 deletions(-)

diff --git a/test/area-smooth.html b/test/area-smooth.html
index 9eebef1..01c2edf 100644
--- a/test/area-smooth.html
+++ b/test/area-smooth.html
@@ -50,7 +50,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             option = {
                 xAxis: {
diff --git a/test/bar-others.html b/test/bar-others.html
index 28e898e..bef6d7e 100644
--- a/test/bar-others.html
+++ b/test/bar-others.html
@@ -47,9 +47,6 @@ under the License.
                 'echarts'/*, 'map/js/china' */
             ], function (echarts) {
 
-                // $.getJSON('./data/nutrients.json', function (data) {
-                // });
-
                 var option = {
                     xAxis: {
                         data: ['a', 'b', 'c', 'd', 'e']
diff --git a/test/drag-out.html b/test/drag-out.html
index bc054ca..98d68b2 100644
--- a/test/drag-out.html
+++ b/test/drag-out.html
@@ -189,7 +189,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             option = {
                 xAxis: {},
@@ -257,7 +256,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             option = {
                 xAxis: {},
diff --git a/test/gauge-progress.html b/test/gauge-progress.html
index c5ca9eb..8223949 100644
--- a/test/gauge-progress.html
+++ b/test/gauge-progress.html
@@ -55,7 +55,6 @@ under the License.
 
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             var option0 = {
                 tooltip: {
diff --git a/test/geo-update.html b/test/geo-update.html
index faea21d..6c57fe3 100644
--- a/test/geo-update.html
+++ b/test/geo-update.html
@@ -50,7 +50,6 @@ under the License.
         <script>
         require(['echarts', 'map/js/world'], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
 
 
diff --git a/test/graph-grid-life.html b/test/graph-grid-life.html
index fd8198f..08d59dd 100644
--- a/test/graph-grid-life.html
+++ b/test/graph-grid-life.html
@@ -45,122 +45,116 @@ under the License.
         <script>
 
             require([
-                'echarts'/*, 'map/js/china' */
-            ], function (echarts) {
-
-                $.getJSON('./data/life-expectancy.json', function (data) {
-
-
-
-                    var option = {
-                        grid: {
-                            left: 0,
-                            bottom: 0,
-                            containLabel: true,
-                            top: 80
-                        },
-                        xAxis: {
-                            type: 'value'
-                        },
-                        yAxis: {
-                            type: 'value',
-                            scale: true
-                        },
-                        toolbox: {
-                            feature: {
-                                dataZoom: {}
+                'echarts',
+                './data/life-expectancy.json'
+            ], function (echarts, data) {
+                var option = {
+                    grid: {
+                        left: 0,
+                        bottom: 0,
+                        containLabel: true,
+                        top: 80
+                    },
+                    xAxis: {
+                        type: 'value'
+                    },
+                    yAxis: {
+                        type: 'value',
+                        scale: true
+                    },
+                    toolbox: {
+                        feature: {
+                            dataZoom: {}
+                        }
+                    },
+                    dataZoom: {
+                        type: 'inside'
+                    },
+                    series: []
+                };
+
+                var series = data.series;
+
+                option.visualMap = {
+                    show: false,
+                    min: 0,
+                    max: 100,
+                    dimension: 1
+                };
+
+                option.legend = {
+                    // data: data.countries.map(function (item) {return item[2];}),
+                    selectedMode: 'single',
+                    right: 100
+                };
+
+                data.countries.forEach(function (country) {
+                    var data = series.map(function (yearData) {
+                        var item = yearData.filter(function (item) {
+                            return item[3] === country[2];
+                        })[0];
+                        return {
+                            label: {
+                                normal: {
+                                    position: 'top',
+                                    show: item[4] % 20 === 0 && item[4] > 1940
+                                },
+                                emphasis: {
+                                    position: 'top',
+                                    show: true
+                                }
+                            },
+                            name: item[4],
+                            value: item
+                        };
+                    });
+                    var links = data.map(function (item, idx) {
+                        return {
+                            source: idx,
+                            target: idx + 1
+                        };
+                    });
+                    links.pop();
+
+                    option.series.push({
+                        name: country[2],
+                        type: 'graph',
+                        coordinateSystem: 'cartesian2d',
+                        data: data,
+                        links: links,
+                        edgeSymbol: ['none', 'arrow'],
+                        edgeSymbolSize: 5,
+                        legendHoverLink: false,
+                        lineStyle: {
+                            normal: {
+                                color: '#333'
                             }
                         },
-                        dataZoom: {
-                            type: 'inside'
+                        itemStyle: {
+                            normal: {
+                                borderWidth: 1,
+                                borderColor: '#333'
+                            }
                         },
-                        series: []
-                    };
-
-                    var series = data.series;
-
-                    option.visualMap = {
-                        show: false,
-                        min: 0,
-                        max: 100,
-                        dimension: 1
-                    };
-
-                    option.legend = {
-                        // data: data.countries.map(function (item) {return item[2];}),
-                        selectedMode: 'single',
-                        right: 100
-                    };
-
-                    data.countries.forEach(function (country) {
-                        var data = series.map(function (yearData) {
-                            var item = yearData.filter(function (item) {
-                                return item[3] === country[2];
-                            })[0];
-                            return {
-                                label: {
-                                    normal: {
-                                        position: 'top',
-                                        show: item[4] % 20 === 0 && item[4] > 1940
-                                    },
-                                    emphasis: {
-                                        position: 'top',
-                                        show: true
-                                    }
-                                },
-                                name: item[4],
-                                value: item
-                            };
-                        });
-                        var links = data.map(function (item, idx) {
-                            return {
-                                source: idx,
-                                target: idx + 1
-                            };
-                        });
-                        links.pop();
-
-                        option.series.push({
-                            name: country[2],
-                            type: 'graph',
-                            coordinateSystem: 'cartesian2d',
-                            data: data,
-                            links: links,
-                            edgeSymbol: ['none', 'arrow'],
-                            edgeSymbolSize: 5,
-                            legendHoverLink: false,
-                            lineStyle: {
-                                normal: {
+                        label: {
+                            normal: {
+                                textStyle: {
                                     color: '#333'
                                 }
-                            },
-                            itemStyle: {
-                                normal: {
-                                    borderWidth: 1,
-                                    borderColor: '#333'
-                                }
-                            },
-                            label: {
-                                normal: {
-                                    textStyle: {
-                                        color: '#333'
-                                    }
-                                }
-                            },
-                            symbolSize: 10,
-                            animationDelay: function (idx) {
-                                return idx * 100;
                             }
-                        });
+                        },
+                        symbolSize: 10,
+                        animationDelay: function (idx) {
+                            return idx * 100;
+                        }
                     });
+                });
 
 
 
-                    testHelper.create(echarts, 'main0', {
-                        option: option
-                    });
+                testHelper.create(echarts, 'main0', {
+                    option: option
                 });
-
             });
 
         </script>
diff --git a/test/graphic-cases.html b/test/graphic-cases.html
index d00c7db..625a1c1 100644
--- a/test/graphic-cases.html
+++ b/test/graphic-cases.html
@@ -46,7 +46,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
 
             const imageURI = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANwAAADcCAYAAAAbWs+BAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gIUARQAHY8+4wAAApBJREFUeNrt3cFqAjEUhlEjvv8rXzciiiBGk/He5JxdN2U649dY+KmnEwAAAAAv2uMXEeGOwERntwAEB4IDBAeCAwQHggPBAYIDwQGCA8GB4ADBgeAAwYHgAMGB4EBwgOCgpkuKq2it/r8Li2hbvGKqP6s/PycnHHv9YvSWEgQHCA4EBwgOBAeCAwQHggMEByXM+QRUE6D3suwuPafDn5MTDg50KXnVPSdxa54y/oYDwQGCA8EBggPBAYIDwYHggBE+X5rY3Y3Tey97Nn2eU+rnlGfaZa6Ft5SA4EBwgOBAcCA4QHAgOEBwIDjg [...]
@@ -132,7 +131,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
 
             const imageURI = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANwAAADcCAYAAAAbWs+BAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gIUARQAHY8+4wAAApBJREFUeNrt3cFqAjEUhlEjvv8rXzciiiBGk/He5JxdN2U649dY+KmnEwAAAAAv2uMXEeGOwERntwAEB4IDBAeCAwQHggPBAYIDwQGCA8GB4ADBgeAAwYHgAMGB4EBwgOCgpkuKq2it/r8Li2hbvGKqP6s/PycnHHv9YvSWEgQHCA4EBwgOBAeCAwQHggMEByXM+QRUE6D3suwuPafDn5MTDg50KXnVPSdxa54y/oYDwQGCA8EBggPBAYIDwYHggBE+X5rY3Y3Tey97Nn2eU+rnlGfaZa6Ft5SA4EBwgOBAcCA4QHAgOEBwIDjg [...]
diff --git a/test/hoverFocus2.html b/test/hoverFocus2.html
index 9ee0d28..4cd8910 100644
--- a/test/hoverFocus2.html
+++ b/test/hoverFocus2.html
@@ -332,7 +332,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             option = {
                 xAxis: {
diff --git a/test/label-layout.html b/test/label-layout.html
index ccb9da4..3dc60bb 100644
--- a/test/label-layout.html
+++ b/test/label-layout.html
@@ -60,7 +60,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
             option = {
                 legend: {
                     data: ['直接访问', '邮件营销','联盟广告','视频广告','搜索引擎']
diff --git a/test/legend-scroll2plain.html b/test/legend-scroll2plain.html
index 8b5dbb8..6b9c447 100644
--- a/test/legend-scroll2plain.html
+++ b/test/legend-scroll2plain.html
@@ -53,7 +53,6 @@ under the License.
     <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             option = {
                 title: {
diff --git a/test/line-crash.html b/test/line-crash.html
index 5f283af..23541b4 100644
--- a/test/line-crash.html
+++ b/test/line-crash.html
@@ -53,7 +53,6 @@ under the License.
             var seriesData1 = [0];
 
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             option = {
                 xAxis: [{
diff --git a/test/pie-richText.html b/test/pie-richText.html
index 95837e7..e388e8e 100644
--- a/test/pie-richText.html
+++ b/test/pie-richText.html
@@ -53,7 +53,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
             var colorList = [{
                 type: 'linear',
                 x: 0,
@@ -258,7 +257,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             var data = [{
                     value: 33310.12,
diff --git a/test/pie-visual.html b/test/pie-visual.html
index ab8e050..723121f 100644
--- a/test/pie-visual.html
+++ b/test/pie-visual.html
@@ -47,7 +47,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
             option = {
                 series: [
                     {
diff --git a/test/runTest/blacklist.js b/test/runTest/blacklist.js
index 5b6a2f4..7de8f1e 100644
--- a/test/runTest/blacklist.js
+++ b/test/runTest/blacklist.js
@@ -51,5 +51,9 @@ module.exports.blacklist = [
 module.exports.SVGBlacklist = [
     'bar-stream-large.html',
     'bar-stream-large1.html',
+    'stream-basic1.html',
+    'stream-basic2.html',
+    'heatmap-large.html',
+    'visualMap-large.html',
     'candlestick-large2.html'
 ];
\ No newline at end of file
diff --git a/test/runTest/cli.js b/test/runTest/cli.js
index 1474e3e..d3844e7 100644
--- a/test/runTest/cli.js
+++ b/test/runTest/cli.js
@@ -213,6 +213,7 @@ async function runTestPage(browser, testOpt, version, runtimeCode, isExpected) {
     await page.evaluateOnNewDocument(runtimeCode);
 
     page.on('console', msg => {
+        // console.log('Page Log: ', msg.text());
         logs.push(msg.text());
     });
     page.on('pageerror', error => {
@@ -284,11 +285,6 @@ async function writePNG(diffPNG, diffPath) {
 };
 
 async function runTest(browser, testOpt, runtimeCode, expectedVersion, actualVersion) {
-    if (program.renderer === 'svg' && testOpt.ignoreSVG) {
-        console.log(testOpt.name + ' don\'t support svg testing.');
-        return;
-    }
-
     if (program.save) {
         testOpt.status === 'running';
 
diff --git a/test/runTest/store.js b/test/runTest/store.js
index cc056fc..f05f3d5 100644
--- a/test/runTest/store.js
+++ b/test/runTest/store.js
@@ -49,9 +49,6 @@ class Test {
         this.fileUrl = fileUrl;
         this.name = testNameFromFile(fileUrl);
 
-        // If this test case ignore svg testing.
-        this.ignoreSVG = false;
-
         this.status = 'unsettled';
 
         // Run results
@@ -140,6 +137,8 @@ module.exports.updateTestsList = async function (
     _testsMap = {};
     _testsExists = {};
 
+    const isSVGRenderer = parseRunHash(runHash).renderer === 'svg';
+
     fse.ensureDirSync(getResultBaseDir());
 
     try {
@@ -164,6 +163,10 @@ module.exports.updateTestsList = async function (
         if (blacklist.includes(fileUrl)) {
             return;
         }
+        if (isSVGRenderer && SVGBlacklist.includes(fileUrl)) {
+            return;
+        }
+
         _testsExists[fileUrl] = true;
 
         if (_testsMap[fileUrl]) {
@@ -171,7 +174,6 @@ module.exports.updateTestsList = async function (
         }
 
         const test = new Test(fileUrl);
-        test.ignoreSVG = SVGBlacklist.includes(fileUrl);
 
         _testsMap[fileUrl] = test;
     });
diff --git a/test/timeScale-formatter.html b/test/timeScale-formatter.html
index 4886a8a..128548b 100644
--- a/test/timeScale-formatter.html
+++ b/test/timeScale-formatter.html
@@ -58,7 +58,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             const time = new Date('2010-01-01 00:00:00');
             const data = [];
@@ -107,7 +106,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             const time = new Date('2010-01-01 00:00:00');
             const data = [[new Date('2009-09-10 11:00:00'), 20]];
@@ -156,7 +154,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             const time = new Date('2010-01-01 00:00:00');
             const data = [[new Date('2009-09-10 11:00:00'), 20]];
@@ -205,7 +202,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             const time = new Date('2010-01-01 00:00:00');
             const data = [];
@@ -247,7 +243,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             const time = new Date('2010-01-01 00:00:00');
             const data = [];
@@ -302,7 +297,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             const time = new Date('2010-01-01 00:00:00');
             const data = [];
diff --git a/test/tooltip-textStyle.html b/test/tooltip-textStyle.html
index 096ffa3..ce4ffec 100644
--- a/test/tooltip-textStyle.html
+++ b/test/tooltip-textStyle.html
@@ -65,7 +65,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             option = {
                 xAxis: {},
@@ -112,7 +111,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             option = {
                 xAxis: {},
@@ -165,7 +163,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             option = {
                 xAxis: {},
@@ -230,7 +227,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             option = {
                 xAxis: {},
@@ -296,7 +292,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             option = {
                 tooltip: {
@@ -378,7 +373,6 @@ under the License.
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option;
-            // $.getJSON('./data/nutrients.json', function (data) {});
 
             option = {
                 tooltip: {

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[echarts] 01/02: test(visual): fix setTimeout in timeout callback

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch enhance-visual-regression-test
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit 3b3cef04017d0cc81c264fb69e95e5b901ae6c81
Author: pissang <bm...@gmail.com>
AuthorDate: Sun May 9 20:35:03 2021 +0800

    test(visual): fix setTimeout in timeout callback
---
 test/runTest/runtime/timeline.js | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/test/runTest/runtime/timeline.js b/test/runTest/runtime/timeline.js
index 2554fc0..772043b 100644
--- a/test/runTest/runtime/timeline.js
+++ b/test/runTest/runtime/timeline.js
@@ -73,6 +73,7 @@ let intervalHandlers = [];
 
 let timeoutId = 1;
 let intervalId = 1;
+
 window.setTimeout = function (cb, timeout) {
     const elapsedFrame = Math.ceil(Math.max(timeout || 0, 1) / FIXED_FRAME_TIME);
     timeoutHandlers.push({
@@ -94,10 +95,14 @@ window.clearTimeout = function (id) {
 }
 
 function flushTimeoutHandlers() {
-    let newTimeoutHandlers = [];
-    for (let i = 0; i < timeoutHandlers.length; i++) {
-        const handler = timeoutHandlers[i];
+    // Copy the array. In case setTimeout/clearTimeout is invoked in the callback.
+    const savedTimeoutHandlers = timeoutHandlers.slice();
+    for (let i = 0; i < savedTimeoutHandlers.length; i++) {
+        const handler = savedTimeoutHandlers[i];
         if (handler.frame === frameIdx) {
+            // Need find index again. In case setTimeout/clearTimeout is invoked in the callback.
+            const idx = timeoutHandlers.indexOf(handler);
+            timeoutHandlers.splice(idx, 1);
             try {
                 handler.callback();
             }
@@ -106,11 +111,7 @@ function flushTimeoutHandlers() {
                 __VRT_LOG_ERRORS__(e.toString());
             }
         }
-        else {
-            newTimeoutHandlers.push(handler);
-        }
     }
-    timeoutHandlers = newTimeoutHandlers;
 }
 
 window.setInterval = function (cb, interval) {
@@ -135,8 +136,10 @@ window.clearInterval = function (id) {
 }
 
 function flushIntervalHandlers() {
-    for (let i = 0; i < intervalHandlers.length; i++) {
-        const handler = intervalHandlers[i];
+    // Copy the array. In case setInterval/clearInterval is invoked in the callback.
+    const savedIntervalHandlers = intervalHandlers.slice();
+    for (let i = 0; i < savedIntervalHandlers.length; i++) {
+        const handler = savedIntervalHandlers[i];
         if (handler.frame === frameIdx) {
             try {
                 handler.callback();

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org