This is getting strange. I removed all MessageBox()s and alert()s. Without a timeout, it stalls at displaying 2, meaning the plugin receives pcommand twice and calls the js twice, but doesnt receive anything after that. If I change line 10 in the JS above to
window.setTimeout( function() { document.getElementById("link").click(); },1000);
I get the numbers every second, in this order: 2 6 14 30 62 126 254 696
So the first 1000 milliseconds it managed two hits, then 4 in the second, then 8 in the third, 16 in the 4th, 32 in the 5th, etc.
2^n? wtf