function getTestContext()

in seriously.js [505:540]


	function getTestContext() {
		var canvas;

		if (testContext && testContext.getError() === testContext.CONTEXT_LOST_WEBGL) {
			/*
			Test context was lost already, and the webglcontextlost event maybe hasn't fired yet
			so try making a new context
			*/
			testContext = undefined;
		}

		if (testContext || !window.WebGLRenderingContext || incompatibility) {
			return testContext;
		}

		canvas = document.createElement('canvas');
		testContext = getWebGlContext(canvas);

		if (testContext) {
			canvas.addEventListener('webglcontextlost', function contextLost(event) {
				/*
				If/When context is lost, just clear testContext and create
				a new one the next time it's needed
				*/
				event.preventDefault();
				if (testContext && testContext.canvas === this) {
					testContext = undefined;
					canvas.removeEventListener('webglcontextlost', contextLost, false);
				}
			}, false);
		} else {
			Seriously.logger.warn('Unable to access WebGL.');
		}

		return testContext;
	}