I was trying to repo an error mentioned in another thread
Here's my test
The spec says
WebGL presents its drawing buffer to the HTML page compositor immediately before a compositing operation, but only if the drawing buffer has been modified since the last compositing operation. Before the drawing buffer is presented for compositing the implementation shall ensure that all rendering operations have been flushed to the drawing buffer. By default, after compositing the contents of the drawing buffer shall be cleared to their default values, as shown in the table above.
In the sample I clear the drawing buffer to green. Then 1 second later I issue some GL commands to see what happens. These 6 commands should not effect what is displayed
gl.enable(gl.BLEND);
gl.bindTexture(gl.TEXTURE_2D, gl.createTexture());
gl.viewport(1,1,1,1);
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
var p = new Uint8Array(4);
gl.readPixels(0,0,1,1,gl.RGBA,gl.UNSIGNED_BYTE, p);
What I find is Firefox ends up reflecting that the backbuffer has been cleared if I call gl.readPixels. On other words it recomposites the page with the cleared drawing buffer. As far as I can tell from the spec that's a bug. The drawing buffer has not been modified so it should not be composited again.
In Mozilla's implementation, readPixel checks if the backbuffer needs a clear (which is the case if preserveDrawingBuffer is false and the drawing buffer hasn't been cleared since it was last presented). If it does find that it needs a clear, then it clears it and requests it to be composited again.
How else should it behave?
A runnable testcase could be very useful here.