I'm a WebGL newbie, so I may be missing something important.
Under "How Lost Context Works" on this Wiki page, the code calls canvas.getContext from function main and remembers the returned value in global variable gl. The function init uses gl and does not return a value. All subsequent operations use that context stored in gl.
However, in the full-up examples such as https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/demos/webkit/Earth.html the call to canvas.getContext occurs within the function init and init returns the context. Function start, when invoked, one time only, saves that value in a local variable named ctx. The function f passes ctx to drawPicture.
The potential problem I see is that function handleContextRestored invokes init again and throws away the returned value.
Will that not make subsequent calls to f access the old, stale context rather than the context newly created and initialized by the most recent invocation of init?