diff --git a/browser/resources/settings/brave_overrides/security_page.ts b/browser/resources/settings/brave_overrides/security_page.ts index 46eab7411cb5..807d7f0bf620 100644 --- a/browser/resources/settings/brave_overrides/security_page.ts +++ b/browser/resources/settings/brave_overrides/security_page.ts @@ -56,14 +56,25 @@ RegisterPolymerTemplateModifications({ } else { httpsOnlyModeToggle.setAttribute('hidden', 'true') } - const secureDnsSettings = enableHttpsFirstModeNewSettings.content. + } + + const positiveEnableHttpsFirstModeNewSettings = templateContent. + querySelector( + 'template[is=dom-if][if="[[enableHttpsFirstModeNewSettings_]]"]' + ) + if (!positiveEnableHttpsFirstModeNewSettings) { + console.error( + '[Brave Settings Overrides] Could not find template with ' + + 'if=[[enableHttpsFirstModeNewSettings]] on security page.') + } else { + const showSecureDnsSettings = positiveEnableHttpsFirstModeNewSettings.content. querySelector( 'template[is=dom-if][if="[[showSecureDnsSetting_]]"]') - if (!secureDnsSettings) { - console.error('[Brave Settings Overrides] Could not find' + - 'secureDnsSettings on security page.') + if (!showSecureDnsSettings) { + console.error('[Brave Settings Overrides] Could not find template with ' + + 'if=[[showSecureDnsSetting_]] on security page.') } else { - const secureDnsToggle = secureDnsSettings.content.querySelector('settings-secure-dns') + const secureDnsToggle = showSecureDnsSettings.content.querySelector('settings-secure-dns') if (!secureDnsToggle) { console.error('[Brave Settings Overrides] Could not find' + 'secureDnsToggle on security page.')