<html>
<body>
<audio src="chrome://mochitests/content/chrome/dom/browser-element/mochitest/audio.ogg" id="audio" />
<script>
var audio = document.getElementById('audio');
audio.play();
audio.onended = function() {
  setTimeout(function() {
    audio.play();
  }, 0);
}
</script>

</body>
</html>