From 9e24ecd9bf2b8d7f69b3ff7846491d1fa4ed428d Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Thu, 26 Feb 2026 13:18:34 -0500 Subject: [PATCH 1/2] Add error dialog if WebGL2 is not enabled. --- src/C2022E3.vue | 65 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/src/C2022E3.vue b/src/C2022E3.vue index adefae2..a428699 100644 --- a/src/C2022E3.vue +++ b/src/C2022E3.vue @@ -312,6 +312,29 @@ + + + +
+

+ This app requires WebGL 2 +

+

+ Check your browser's settings and enable WebGL 2 ("graphics acceleration" on some browsers). +

+

+ You can check whether your browser supports WebGL 2 + and get assistance here. +

+
+
+
+ , layersLoaded: false, @@ -826,6 +851,19 @@ export default defineComponent({ mounted() { + if (!this.isWebGL2Enabled()) { + this.showWebGL2Warning = true; + this.layersLoaded = true; + this.positionSet = true; + this.showSplashScreen = false; + // eslint-disable-next-lint @typescript-eslint/ban-ts-comment + // @ts-expect-error `canvas` is defined + WWTControl.singleton.canvas.setAttribute("hidden", "true"); + // eslint-disable-next-line @typescript-eslint/no-empty-function + WWTControl.singleton.renderOneFrame = function() {}; + return; + } + this.waitForReady().then(async () => { // Unlike the other things we're hacking here, @@ -1868,6 +1906,15 @@ export default defineComponent({ this.ratingOptedOut = true; window.localStorage.setItem("cds-green-comet-rating-optout", "true"); }, + + isWebGL2Enabled(): boolean { + // It doesn't seem like there's a better way to do this than just to try and get a context + // https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/By_example/Detect_WebGL + // NB: The engine specifically wants a webgl2 context + const canvas = document.createElement("canvas"); + const gl = canvas.getContext("webgl2"); + return gl instanceof WebGL2RenderingContext; + }, }, watch: { @@ -2878,4 +2925,22 @@ input[type="range"]::-moz-range-track { border-style: none !important; } } + +.error-dialog { + width: auto; + height: auto; + max-width: 500px; + border-radius: 10px; + + .v-card { + border-radius: 10px !important; + } +} + +.error-message { + padding: 1rem; + border: 1px solid var(--comet-color); + text-align: center; + border-radius: 10px; +} From 87536de2c2b84f3e9e22387215797595c4873aac Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Thu, 26 Feb 2026 13:21:05 -0500 Subject: [PATCH 2/2] Enable WebGL2 on BrowserStack Firefox. --- tests/config.ts | 22 ++++++++++++++++++++++ tests/local.conf.ts | 11 ++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/tests/config.ts b/tests/config.ts index db2ce17..c90b8a5 100644 --- a/tests/config.ts +++ b/tests/config.ts @@ -21,6 +21,7 @@ export interface WebDriverSettings { export interface Capabilities { browserName: string, + "moz:firefoxOptions"?: Record; } export interface BrowserCapabilities extends Capabilities { @@ -82,6 +83,10 @@ export function addBrowsers(environments: { [env: string]: TestEnvironment | und ...browserCapabilities(browser, 'latest', osName, version) } }; + + if (browser.toLowerCase().includes("firefox")) { + enableWebGLFirefox(environments[key].desiredCapabilities); + } } } } @@ -97,3 +102,20 @@ export function addPhones(environments: { [env: string]: TestEnvironment | undef }; } } + +export function enableWebGLFirefox(firefoxCapabilities: Capabilities) { + const optionsKey = "moz:firefoxOptions"; + const currentOptions = firefoxCapabilities[optionsKey] ?? {}; + const options = { + ...currentOptions, + args: [], + prefs: { + "webgl.enable-prototype-webgl2": true, + "webgl.disabled": false, + "webgl.force-enabled": true, + "layers.acceleration.force-enabled": true, + }, + }; + + firefoxCapabilities[optionsKey] = options; +} diff --git a/tests/local.conf.ts b/tests/local.conf.ts index 660ffeb..68eb56f 100644 --- a/tests/local.conf.ts +++ b/tests/local.conf.ts @@ -67,6 +67,15 @@ const nightwatchConfig: Configuration = { firefox: { desiredCapabilities: { browserName: 'firefox', + "moz:firefoxOptions": { + args: [], + prefs: { + 'webgl.enable-prototype-webgl2': true, + 'webgl.disabled': false, + 'webgl.force-enabled': true, + 'layers.acceleration.force-enabled': true + }, + }, }, webdriver: { start_process: true, @@ -118,4 +127,4 @@ function loadServices(): Services { } catch (err) { /* empty */ } return s; } - \ No newline at end of file +