emscripten_webgl_create_context returns EMSCRIPTEN_RESULT_SUCCESS (as value 0) when called with an id that doesn't match any canvas in the DOM. The documentation seems to imply that the correct return value should've been an error result, possibly EMSCRIPTEN_RESULT_UNKNOWN_TARGET.
This happens with fastcomp, not latest upstream.
The docs of EMSCRIPTEN_WEBGL_CONTEXT_HANDLE actually state "The value 0 denotes an invalid/no context", which is contradicted by the docs of emscripten_webgl_create_context, which (apparently incorrectly) state "On failure, a negative number that can be cast to an EMSCRIPTEN_RESULT field to get the reason why the context creation failed".
Most helpful comment
The docs of
EMSCRIPTEN_WEBGL_CONTEXT_HANDLEactually state "The value 0 denotes an invalid/no context", which is contradicted by the docs ofemscripten_webgl_create_context, which (apparently incorrectly) state "On failure, a negative number that can be cast to an EMSCRIPTEN_RESULT field to get the reason why the context creation failed".