Its main purpose is to decide whether the change of perfer-color-scheme will trigger checkSysTheme(). In idling state, its value stays as false, which means checkSysTheme() will be triggered by colour scheme change. detect_scheme_change_block will be set as true only in the small time-window between browser.management.setEnabled() // commen.js#354 and browser.theme.update() //common.js#372. That’s because browser.management.setEnabled() applies a theme whose color_scheme property may not be system, which might trigger checkSysTheme() again and potentially cause a theme changing loop.
More on the variable
detect_scheme_change_block
:Its main purpose is to decide whether the change of
perfer-color-scheme
will triggercheckSysTheme()
. In idling state, its value stays asfalse
, which meanscheckSysTheme()
will be triggered by colour scheme change.detect_scheme_change_block
will be set astrue
only in the small time-window betweenbrowser.management.setEnabled() // commen.js#354
andbrowser.theme.update() //common.js#372
. That’s becausebrowser.management.setEnabled()
applies a theme whosecolor_scheme
property may not besystem
, which might triggercheckSysTheme()
again and potentially cause a theme changing loop.