From: Ian Coleman Date: Wed, 4 Jan 2017 00:30:45 +0000 (+1100) Subject: Generation process stopped when table rows cleared X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git;a=commitdiff_plain;h=40892aba5013cd75927f63e66492f46b2d206ec9;hp=6ea15134a4ff5a443d96de5882bcddbe7300fc6f Generation process stopped when table rows cleared Closes #44 --- diff --git a/bip39-standalone.html b/bip39-standalone.html index 5158b10..afef084 100644 --- a/bip39-standalone.html +++ b/bip39-standalone.html @@ -18664,6 +18664,8 @@ window.Entropy = new (function() { var phraseChangeTimeoutEvent = null; var rootKeyChangedTimeoutEvent = null; + var generationProcesses = []; + var DOM = {}; DOM.network = $(".network"); DOM.phraseNetwork = $("#network-phrase"); @@ -19157,14 +19159,28 @@ window.Entropy = new (function() { } function displayAddresses(start, total) { - for (var i=0; i 0) { + var generation = generationProcesses.shift(); + generation.stop(); + } } function clearKey() { diff --git a/src/js/index.js b/src/js/index.js index c198977..5318800 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -19,6 +19,8 @@ var phraseChangeTimeoutEvent = null; var rootKeyChangedTimeoutEvent = null; + var generationProcesses = []; + var DOM = {}; DOM.network = $(".network"); DOM.phraseNetwork = $("#network-phrase"); @@ -512,14 +514,28 @@ } function displayAddresses(start, total) { - for (var i=0; i 0) { + var generation = generationProcesses.shift(); + generation.stop(); + } } function clearKey() { diff --git a/tests.js b/tests.js index 48e863b..16f1963 100644 --- a/tests.js +++ b/tests.js @@ -3291,6 +3291,50 @@ page.open(url, function(status) { }); }, +// Github issue 44 +// display error switching tabs while addresses are generating +function() { +page.open(url, function(status) { + // set the phrase + page.evaluate(function() { + $(".phrase").val("abandon abandon ability").trigger("input"); + }); + waitForGenerate(function() { + // set to generate 500 more addresses + // generate more addresses + // change tabs which should cancel the previous generating + page.evaluate(function() { + $(".rows-to-add").val("100"); + $(".more").click(); + $("#bip32-tab a").click(); + }); + // check the derivation paths are in order and of the right quantity + waitForGenerate(function() { + var paths = page.evaluate(function() { + return $(".index").map(function(i, e) { + return $(e).text(); + }); + }); + for (var i=0; i