http://gamingJS.com/52URL-space. So the
<script>tags look like:
<body></body> <script src="http://gamingJS.com/52/Three.js"></script> <script src="http://gamingJS.com/52/Detector.js"></script> <script src="http://gamingJS.com/52/physi.js"></script> <script src="http://gamingJS.com/52/ChromeFixes.js"></script> <script> // Physics Physijs.scripts.ammo = 'http://gamingJS.com/52/ammo.js'; Physijs.scripts.worker = 'http://gamingJS.com/52/physijs_worker.js';The main selling point of Mr Doob's code editor is that you can see a preview of the code after each change. As I am adding the
/52URL to each of those lines, I can see that everything continues to work just fine… until I change that very last line.
Ugh. Web workers. Why did it have to be web workers? (Very dangerous)
Uncaught Error: INVALID_STATE_ERR: DOM Exception 11I suspect that I am not allowed because the editor (and preview) are located in a different URL path (
http://gamingJS.com/ice) than the web worker (
http://gamingJS.com/52). If I use the old worker that is in the path above the code editor (
http://gamingJS.com/), then it works.
The other possibility is that the new Physijs does something funky that is not being allowed.
/52path. Now, I copy the latest physijs_worker script over the older version in the top-level directory of the site. I reload the page and… it works just fine.
So it does not appear to be the new Physijs worker. Which means that my earlier hypothesis is looking likely. Except that it should not be correct. Per the specification, errors should be thrown if the origin of the site and worker are different. The origin for both is
At something of a loss, I try it out in Firefox, which works:
In that capture, the ball in the preview has fallen onto the board and rolled nearly to the front. In other words physics is working. The rigid platform stopped the ball and the ball fell in gravity. There are no console errors about security. And I am using the
I will ruminate on this and see if I can't come up with a solution. If you are interested, the code in question (without the
/52URL space) is editable at gamingJS.com/ice.