Skip to content

Commit 11f8fb9

Browse files
Disable all features globally if we have the config before load (#156)
1 parent e66180d commit 11f8fb9

File tree

7 files changed

+29
-7
lines changed

7 files changed

+29
-7
lines changed

Sources/ContentScopeScripts/dist/contentScope.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,10 @@
749749
return preferences
750750
}
751751

752+
function isGloballyDisabled (args) {
753+
return args.site.allowlisted || args.site.isBroken
754+
}
755+
752756
var contentScopeFeatures = (function (exports) {
753757
'use strict';
754758

@@ -4458,7 +4462,7 @@
44584462

44594463
function init () {
44604464
const processedConfig = processConfig($CONTENT_SCOPE$, $USER_UNPROTECTED_DOMAINS$, $USER_PREFERENCES$);
4461-
if (processedConfig.site.allowlisted) {
4465+
if (isGloballyDisabled(processedConfig)) {
44624466
return
44634467
}
44644468

build/android/contentScope.js

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/windows/contentScope.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inject/android.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* global contentScopeFeatures */
22

3-
import { processConfig } from './../src/utils'
3+
import { processConfig, isGloballyDisabled } from './../src/utils'
44

55
function init () {
66
const processedConfig = processConfig($CONTENT_SCOPE$, $USER_UNPROTECTED_DOMAINS$, $USER_PREFERENCES$)
7-
if (processedConfig.site.allowlisted) {
7+
if (isGloballyDisabled(processedConfig)) {
88
return
99
}
1010

inject/apple.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* global contentScopeFeatures */
22

3-
import { processConfig } from './../src/utils'
3+
import { processConfig, isGloballyDisabled } from './../src/utils'
44

55
function init () {
66
const processedConfig = processConfig($CONTENT_SCOPE$, $USER_UNPROTECTED_DOMAINS$, $USER_PREFERENCES$)
7-
if (processedConfig.site.allowlisted) {
7+
if (isGloballyDisabled(processedConfig)) {
88
return
99
}
1010

inject/windows.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/* global contentScopeFeatures */
22

3-
import { processConfig, windowsSpecificFeatures } from './../src/utils'
3+
import { processConfig, isGloballyDisabled, windowsSpecificFeatures } from './../src/utils'
44

55
function init () {
66
const processedConfig = processConfig($CONTENT_SCOPE$, $USER_UNPROTECTED_DOMAINS$, $USER_PREFERENCES$, windowsSpecificFeatures)
7+
if (isGloballyDisabled(processedConfig)) {
8+
return
9+
}
710

811
contentScopeFeatures.load()
912

src/utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,10 @@ export function processConfig (data, userList, preferences, platformSpecificFeat
478478
return preferences
479479
}
480480

481+
export function isGloballyDisabled (args) {
482+
return args.site.allowlisted || args.site.isBroken
483+
}
484+
481485
export const windowsSpecificFeatures = ['windowsPermissionUsage']
482486

483487
export function isWindowsSpecificFeature (featureName) {

0 commit comments

Comments
 (0)