Skip to content

Commit bc9c3d4

Browse files
Scope alwaysInitFeatures to extensions only (#194)
* scope alwaysInitFeatures to extensions only * Update build Co-authored-by: Jonathan Kingston <jkingston@duckduckgo.com>
1 parent 0274b67 commit bc9c3d4

File tree

8 files changed

+36
-8
lines changed

8 files changed

+36
-8
lines changed

Sources/ContentScopeScripts/dist/contentScope.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1902,7 +1902,7 @@
19021902
initStringExemptionLists(args);
19031903
const resolvedFeatures = await Promise.all(features);
19041904
resolvedFeatures.forEach(({ init, featureName }) => {
1905-
if (!isFeatureBroken(args, featureName) || alwaysInitFeatures.has(featureName)) {
1905+
if (!isFeatureBroken(args, featureName) || alwaysInitExtensionFeatures(args, featureName)) {
19061906
init(args);
19071907
}
19081908
});
@@ -1924,6 +1924,10 @@
19241924
updateFeaturesInner(args);
19251925
}
19261926

1927+
function alwaysInitExtensionFeatures (args, featureName) {
1928+
return args.platform.name === 'extension' && alwaysInitFeatures.has(featureName)
1929+
}
1930+
19271931
async function updateFeaturesInner (args) {
19281932
const resolvedFeatures = await Promise.all(features);
19291933
resolvedFeatures.forEach(({ update, featureName }) => {

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/chrome-mv3/inject.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/chrome/inject.js

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

build/firefox/inject.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/integration/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: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/content-scope-features.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export async function init (args) {
5959
initStringExemptionLists(args)
6060
const resolvedFeatures = await Promise.all(features)
6161
resolvedFeatures.forEach(({ init, featureName }) => {
62-
if (!isFeatureBroken(args, featureName) || alwaysInitFeatures.has(featureName)) {
62+
if (!isFeatureBroken(args, featureName) || alwaysInitExtensionFeatures(args, featureName)) {
6363
init(args)
6464
}
6565
})
@@ -81,6 +81,10 @@ export async function update (args) {
8181
updateFeaturesInner(args)
8282
}
8383

84+
function alwaysInitExtensionFeatures (args, featureName) {
85+
return args.platform.name === 'extension' && alwaysInitFeatures.has(featureName)
86+
}
87+
8488
async function updateFeaturesInner (args) {
8589
const resolvedFeatures = await Promise.all(features)
8690
resolvedFeatures.forEach(({ update, featureName }) => {

0 commit comments

Comments
 (0)