Speed-Test icon indicating copy to clipboard operation
Speed-Test copied to clipboard

Firefox Issue with Darkmode, prevents page load

Open kaiden11 opened this issue 1 year ago • 7 comments

Versions:

  • Firefox: 126.0
  • Chrome: 119.0

Description: Upon attempting to detect dark mode during page load, Firefox attempts to operate on the non-existent id=darkmode element in the <head>.

Steps to reproduce:

  1. Run docker run:

    docker run --name openspeedtest -p 3000:3000 -p 3001:3001 openspeedtest/latest
    
  2. Open http://localhost:3000/

  3. Observe a blank window (failed page load), with the following in the browser console:

OpenSpeedTest.com V2.5.4 Loaded! localhost:3000:131:15

Now Press the Start Button or HIT Enter. localhost:3000:132:15

The secret to living happy is giving happiness. Have a wonderful day. localhost:3000:133:15

Uncaught TypeError: c is null
    addEvt http://localhost:3000/assets/js/app-2.5.4.min.js line 8 > srcScript:30
    jb http://localhost:3000/assets/js/app-2.5.4.min.js line 8 > srcScript:44
    Start http://localhost:3000/assets/js/app-2.5.4.min.js line 8 > srcScript:51
    onload http://localhost:3000/assets/js/app-2.5.4.min.js line 8 > srcScript:9
    EventHandlerNonNull* http://localhost:3000/assets/js/app-2.5.4.min.js line 8 > srcScript:9

app-2.5.4.min.js line 8 > srcScript:30:282
Uncaught TypeError: nightMode is null
    changeSkin http://localhost:3000/assets/js/darkmode.js:2
    EventListener.handleEvent* http://localhost:3000/assets/js/darkmode.js:1
darkmode.js:2:247

Attempting the same page load with Chrome does not exhibit this issue.

There does not appear to be a 'mode' cookie that would indicate a previous detection of dark mode. The 'matchMedia' handling in the <head> script does not appear to fail, but later reference to the darkmode element prevents further page load (and results in no interface presented in Firefox).

kaiden11 avatar Jun 09 '24 19:06 kaiden11

Unable to reproduce this on my M1 Mac with Firefox 126.0.1 (64-bit). What are your Firefox version and OS?

openspeedtest avatar Jun 10 '24 02:06 openspeedtest

Versions:

  • Firefox: 126.0+build2-0ubuntu0.22.04.1~mt1 (and 64-bit, according to apt list)
  • OS: Ubuntu 22.04.4 LTS (according to lsb_release -a).

kaiden11 avatar Jun 10 '24 03:06 kaiden11

For what it's worth, I'm finding that when I check out the main branch for openspeedtest, and volume mount those files into an HTTP serving container, I am able to get the proper openspeedtest UI.

Example docker-compose.yml:

version: '3'

services:

  app:
    image: halverneus/static-file-server:latest
    environment:
     - "FOLDER=/web"
     - "DEBUG=1"
     - "PORT=8080"
    ports:
     - 8080:8080
    volumes:
    # , the current directory being the openspeedtest repo, latest commit on main
     - ".:/web:ro"

It seems that the issue is only present so far with the openspeedtest/latest:latest image from Dockerhub.

kaiden11 avatar Jun 10 '24 04:06 kaiden11

I have the same issue running with Firefox/126.0 on Fedora 40 Screenshot from 2024-06-12 17-02-13

BTW, the issue happens even on the public https://openspeedtest.com/ website but without the nightMode is null error.

jorsol avatar Jun 12 '24 15:06 jorsol

Checking more closely, the issue only happens with the NoScript Firefox extension even having the site as TRUSTED, I need to completely disable the extension to make the site work.

jorsol avatar Jun 12 '24 15:06 jorsol

I have the same or similar issue on Firefox.. I am not using NoScript though.

I think the issue might be related to Firefox privacy settings. I basically have them on CUSTOM that result in STRICT.

obrazek When with anonymous window without extensions: obrazek

MilosHavranek avatar Nov 18 '24 13:11 MilosHavranek

@SpiReCZ SVG not loaded? Maybe try this https://github.com/openspeedtest/Speed-Test/pull/137

openspeedtest avatar Nov 18 '24 13:11 openspeedtest