Slowdown after tab reload

I am suspecting this is a browser bug, but just in case someone has encountered it before and knows about a workaround, I thought I’d ask here.

I have a three.js app which is fine on first start, but as soon as I reload the tab, performance goes down the drain. 100% reproducible. It seems like something is not cleaned up, and while one would expect the browser to take care of that on tab reload, it obviously doesn’t.

Is there a recommended way to tear down the webgl context in onbeforeunload that may avoid this problem?

(reproducible on AMD and nVidia discrete cards with Firefox, though not with integrated graphics).

Does it help if you execute the following code in the onbeforeunload callback:


That does the trick, thanks!