Skip to content

Commit 3481740

Browse files
Rename protections to contentScopeFeatues
1 parent 24ec96a commit 3481740

File tree

15 files changed

+154
-154
lines changed

15 files changed

+154
-154
lines changed

build/apple/contentScope.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var protections = (function (exports) {
1+
var contentScopeFeatures = (function (exports) {
22
'use strict';
33

44
const sjcl = (() => {
@@ -880,7 +880,7 @@ var protections = (function (exports) {
880880
const updates = [];
881881
const features = [];
882882

883-
async function loadProtections () {
883+
async function load$1 () {
884884
if (!shouldRun()) {
885885
return
886886
}
@@ -910,39 +910,39 @@ var protections = (function (exports) {
910910
}
911911
}
912912

913-
async function initProtections (args) {
913+
async function init$b (args) {
914914
initArgs = args;
915915
if (!shouldRun()) {
916916
return
917917
}
918918
initStringExemptionLists(args);
919-
const resolvedProtections = await Promise.all(features);
920-
resolvedProtections.forEach(({ init, featureName }) => {
919+
const resolvedFeatures = await Promise.all(features);
920+
resolvedFeatures.forEach(({ init, featureName }) => {
921921
if (!isFeatureBroken(args, featureName)) {
922922
init(args);
923923
}
924924
});
925925
// Fire off updates that came in faster than the init
926926
while (updates.length) {
927927
const update = updates.pop();
928-
await updateProtectionsInner(update);
928+
await updateFeaturesInner(update);
929929
}
930930
}
931931

932-
async function updateProtections (args) {
932+
async function update$1 (args) {
933933
if (!shouldRun()) {
934934
return
935935
}
936936
if (initArgs === null) {
937937
updates.push(args);
938938
return
939939
}
940-
updateProtectionsInner(args);
940+
updateFeaturesInner(args);
941941
}
942942

943-
async function updateProtectionsInner (args) {
944-
const resolvedProtections = await Promise.all(features);
945-
resolvedProtections.forEach(({ update, featureName }) => {
943+
async function updateFeaturesInner (args) {
944+
const resolvedFeatures = await Promise.all(features);
945+
resolvedFeatures.forEach(({ update, featureName }) => {
946946
if (!isFeatureBroken(initArgs, featureName) && update) {
947947
update(args);
948948
}
@@ -2766,9 +2766,9 @@ var protections = (function (exports) {
27662766
init: init
27672767
});
27682768

2769-
exports.initProtections = initProtections;
2770-
exports.loadProtections = loadProtections;
2771-
exports.updateProtections = updateProtections;
2769+
exports.init = init$b;
2770+
exports.load = load$1;
2771+
exports.update = update$1;
27722772

27732773
Object.defineProperty(exports, '__esModule', { value: true });
27742774

@@ -2832,12 +2832,12 @@ function init () {
28322832
return
28332833
}
28342834

2835-
protections.loadProtections()
2835+
contentScopeFeatures.load()
28362836

2837-
protections.initProtections(processedConfig)
2837+
contentScopeFeatures.init(processedConfig)
28382838

28392839
// Not supported:
2840-
// protections.updateProtections(message)
2840+
// contentScopeFeatures.update(message)
28412841
}
28422842

28432843
init()

build/chrome/inject.js

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

build/firefox/inject.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var protections = (function (exports) {
1+
var contentScopeFeatures = (function (exports) {
22
'use strict';
33

44
const sjcl = (() => {
@@ -894,7 +894,7 @@ var protections = (function (exports) {
894894
const updates = [];
895895
const features = [];
896896

897-
async function loadProtections () {
897+
async function load$1 () {
898898
if (!shouldRun()) {
899899
return
900900
}
@@ -924,39 +924,39 @@ var protections = (function (exports) {
924924
}
925925
}
926926

927-
async function initProtections (args) {
927+
async function init$b (args) {
928928
initArgs = args;
929929
if (!shouldRun()) {
930930
return
931931
}
932932
initStringExemptionLists(args);
933-
const resolvedProtections = await Promise.all(features);
934-
resolvedProtections.forEach(({ init, featureName }) => {
933+
const resolvedFeatures = await Promise.all(features);
934+
resolvedFeatures.forEach(({ init, featureName }) => {
935935
if (!isFeatureBroken(args, featureName)) {
936936
init(args);
937937
}
938938
});
939939
// Fire off updates that came in faster than the init
940940
while (updates.length) {
941941
const update = updates.pop();
942-
await updateProtectionsInner(update);
942+
await updateFeaturesInner(update);
943943
}
944944
}
945945

946-
async function updateProtections (args) {
946+
async function update$1 (args) {
947947
if (!shouldRun()) {
948948
return
949949
}
950950
if (initArgs === null) {
951951
updates.push(args);
952952
return
953953
}
954-
updateProtectionsInner(args);
954+
updateFeaturesInner(args);
955955
}
956956

957-
async function updateProtectionsInner (args) {
958-
const resolvedProtections = await Promise.all(features);
959-
resolvedProtections.forEach(({ update, featureName }) => {
957+
async function updateFeaturesInner (args) {
958+
const resolvedFeatures = await Promise.all(features);
959+
resolvedFeatures.forEach(({ update, featureName }) => {
960960
if (!isFeatureBroken(initArgs, featureName) && update) {
961961
update(args);
962962
}
@@ -2780,9 +2780,9 @@ var protections = (function (exports) {
27802780
init: init
27812781
});
27822782

2783-
exports.initProtections = initProtections;
2784-
exports.loadProtections = loadProtections;
2785-
exports.updateProtections = updateProtections;
2783+
exports.init = init$b;
2784+
exports.load = load$1;
2785+
exports.update = update$1;
27862786

27872787
Object.defineProperty(exports, '__esModule', { value: true });
27882788

@@ -2792,7 +2792,7 @@ var protections = (function (exports) {
27922792

27932793

27942794
function init () {
2795-
protections.loadProtections()
2795+
contentScopeFeatures.load()
27962796

27972797
chrome.runtime.sendMessage({
27982798
messageType: 'registeredContentScript',
@@ -2801,7 +2801,7 @@ function init () {
28012801
}
28022802
},
28032803
(message) => {
2804-
// Background has disabled protections
2804+
// Background has disabled features
28052805
if (!message) {
28062806
return
28072807
}
@@ -2814,14 +2814,14 @@ function init () {
28142814
}
28152815
})
28162816
}
2817-
protections.initProtections(message)
2817+
contentScopeFeatures.init(message)
28182818
}
28192819
)
28202820

28212821
chrome.runtime.onMessage.addListener((message) => {
28222822
// forward update messages to the embedded script
28232823
if (message && message.type === 'update') {
2824-
protections.updateProtections(message)
2824+
contentScopeFeatures.update(message)
28252825
}
28262826
})
28272827
}

build/integration/contentScope.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var protections = (function (exports) {
1+
var contentScopeFeatures = (function (exports) {
22
'use strict';
33

44
const sjcl = (() => {
@@ -880,7 +880,7 @@ var protections = (function (exports) {
880880
const updates = [];
881881
const features = [];
882882

883-
async function loadProtections () {
883+
async function load$1 () {
884884
if (!shouldRun()) {
885885
return
886886
}
@@ -910,39 +910,39 @@ var protections = (function (exports) {
910910
}
911911
}
912912

913-
async function initProtections (args) {
913+
async function init$b (args) {
914914
initArgs = args;
915915
if (!shouldRun()) {
916916
return
917917
}
918918
initStringExemptionLists(args);
919-
const resolvedProtections = await Promise.all(features);
920-
resolvedProtections.forEach(({ init, featureName }) => {
919+
const resolvedFeatures = await Promise.all(features);
920+
resolvedFeatures.forEach(({ init, featureName }) => {
921921
if (!isFeatureBroken(args, featureName)) {
922922
init(args);
923923
}
924924
});
925925
// Fire off updates that came in faster than the init
926926
while (updates.length) {
927927
const update = updates.pop();
928-
await updateProtectionsInner(update);
928+
await updateFeaturesInner(update);
929929
}
930930
}
931931

932-
async function updateProtections (args) {
932+
async function update$1 (args) {
933933
if (!shouldRun()) {
934934
return
935935
}
936936
if (initArgs === null) {
937937
updates.push(args);
938938
return
939939
}
940-
updateProtectionsInner(args);
940+
updateFeaturesInner(args);
941941
}
942942

943-
async function updateProtectionsInner (args) {
944-
const resolvedProtections = await Promise.all(features);
945-
resolvedProtections.forEach(({ update, featureName }) => {
943+
async function updateFeaturesInner (args) {
944+
const resolvedFeatures = await Promise.all(features);
945+
resolvedFeatures.forEach(({ update, featureName }) => {
946946
if (!isFeatureBroken(initArgs, featureName) && update) {
947947
update(args);
948948
}
@@ -2766,9 +2766,9 @@ var protections = (function (exports) {
27662766
init: init
27672767
});
27682768

2769-
exports.initProtections = initProtections;
2770-
exports.loadProtections = loadProtections;
2771-
exports.updateProtections = updateProtections;
2769+
exports.init = init$b;
2770+
exports.load = load$1;
2771+
exports.update = update$1;
27722772

27732773
Object.defineProperty(exports, '__esModule', { value: true });
27742774

@@ -2811,12 +2811,12 @@ function generateConfig (data, userList) {
28112811
function init () {
28122812
const processedConfig = generateConfig()
28132813

2814-
protections.loadProtections()
2814+
contentScopeFeatures.load()
28152815

2816-
protections.initProtections(processedConfig)
2816+
contentScopeFeatures.init(processedConfig)
28172817

28182818
// Not supported:
2819-
// protections.updateProtections(message)
2819+
// contentScopeFeatures.update(message)
28202820
}
28212821

28222822
init()

inject/apple.js

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

33
function getTopLevelURL () {
44
try {
@@ -55,12 +55,12 @@ function init () {
5555
return
5656
}
5757

58-
protections.loadProtections()
58+
contentScopeFeatures.load()
5959

60-
protections.initProtections(processedConfig)
60+
contentScopeFeatures.init(processedConfig)
6161

6262
// Not supported:
63-
// protections.updateProtections(message)
63+
// contentScopeFeatures.update(message)
6464
}
6565

6666
init()

inject/chrome.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ function init () {
2626
const reusableMethodName = '_rm' + randomString()
2727
const reusableSecret = '_r' + randomString()
2828
const initialScript = `
29-
/* global protections */
30-
protections.loadProtections()
29+
/* global contentScopeFeatures */
30+
contentScopeFeatures.load()
3131
// Define a random function we call later.
3232
// Use define property so isn't enumerable
3333
Object.defineProperty(window, '${randomMethodName}', {
@@ -39,10 +39,10 @@ function init () {
3939
value: new Proxy(function () {}, {
4040
apply(target, thisArg, args) {
4141
if ('${randomPassword}' === args[0]) {
42-
protections.initProtections(args[1])
42+
contentScopeFeatures.init(args[1])
4343
} else {
44-
// TODO force enable all protections if password is wrong
45-
console.error("Password for hidden function wasn't correct! The page is likely attempting to attack the protections by DuckDuckGo");
44+
// TODO force enable all features if password is wrong
45+
console.error("Password for hidden function wasn't correct! The page is likely attempting to attack the feature by DuckDuckGo");
4646
}
4747
// This method is single use, clean up
4848
delete window.${randomMethodName};
@@ -61,7 +61,7 @@ function init () {
6161
value: new Proxy(function () {}, {
6262
apply(target, thisArg, args) {
6363
if ('${reusableSecret}' === args[0]) {
64-
protections.updateProtections(args[1])
64+
contentScopeFeatures.update(args[1])
6565
}
6666
}
6767
})
@@ -77,7 +77,7 @@ function init () {
7777
},
7878
(message) => {
7979
if (!message) {
80-
// Remove injected function only as background has disabled protections
80+
// Remove injected function only as background has disabled feature
8181
inject(`delete window.${randomMethodName}`)
8282
return
8383
}

inject/integration.js

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

33
function getTopLevelURL () {
44
try {
@@ -34,12 +34,12 @@ function generateConfig (data, userList) {
3434
function init () {
3535
const processedConfig = generateConfig()
3636

37-
protections.loadProtections()
37+
contentScopeFeatures.load()
3838

39-
protections.initProtections(processedConfig)
39+
contentScopeFeatures.init(processedConfig)
4040

4141
// Not supported:
42-
// protections.updateProtections(message)
42+
// contentScopeFeatures.update(message)
4343
}
4444

4545
init()

0 commit comments

Comments
 (0)