To run this test, copy and paste the script into the JS console of your browser (or use Snippets in Chrome devtools).
The output is:
starting
upgrading
opened1
req1 success
req2 success
req3 success
req4 success
opened2
cursor continue
cursor continue
delete success for 2
cursor continue
cursor continue
delete success for 4
closing2
closing1
done