Skip to content

Commit 51c7b30

Browse files
Release build 4.33.0 [ci release]
1 parent 8def15f commit 51c7b30

File tree

15 files changed

+666
-676
lines changed

15 files changed

+666
-676
lines changed

Sources/ContentScopeScripts/dist/contentScope.js

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -415,16 +415,14 @@
415415
const isTainted = hasTaintedMethod(scope);
416416
isExempt = !isTainted;
417417
}
418-
if (debug) {
419-
postDebugMessage(this.camelFeatureName, {
420-
isProxy: true,
421-
action: isExempt ? 'ignore' : 'restrict',
422-
kind: this.property,
423-
documentUrl: document.location.href,
424-
stack: getStack(),
425-
args: debugSerialize(args[2])
426-
});
427-
}
418+
postDebugMessage(this.camelFeatureName, {
419+
isProxy: true,
420+
action: isExempt ? 'ignore' : 'restrict',
421+
kind: this.property,
422+
documentUrl: document.location.href,
423+
stack: getStack(),
424+
args: debugSerialize(args[2])
425+
});
428426
// The normal return value
429427
if (isExempt) {
430428
return DDGReflect.apply(...args)
@@ -466,7 +464,25 @@
466464
}
467465
}
468466

469-
function postDebugMessage (feature, message) {
467+
const maxCounter = new Map();
468+
function numberOfTimesDebugged (feature) {
469+
if (!maxCounter.has(feature)) {
470+
maxCounter.set(feature, 1);
471+
} else {
472+
maxCounter.set(feature, maxCounter.get(feature) + 1);
473+
}
474+
return maxCounter.get(feature)
475+
}
476+
477+
const DEBUG_MAX_TIMES = 5000;
478+
479+
function postDebugMessage (feature, message, allowNonDebug = false) {
480+
if (!debug && !allowNonDebug) {
481+
return
482+
}
483+
if (numberOfTimesDebugged(feature) > DEBUG_MAX_TIMES) {
484+
return
485+
}
470486
if (message.stack) {
471487
const scriptOrigins = [...getStackTraceOrigins(message.stack)];
472488
message.scriptOrigins = scriptOrigins;
@@ -6895,6 +6911,8 @@
68956911
let appliedRules = new Set();
68966912
let shouldInjectStyleTag = false;
68976913
let mediaAndFormSelectors = 'video,canvas,embed,object,audio,map,form,input,textarea,select,option,button';
6914+
let hideTimeouts = [0, 100, 200, 300, 400, 500, 1000, 1500, 2000, 2500, 3000, 5000, 10000];
6915+
let unhideTimeouts = [750, 1500, 2250, 3000, 4500, 6000, 12000];
68986916

68996917
/** @type {ElementHiding} */
69006918
let featureInstance;
@@ -7142,6 +7160,8 @@
71427160
const globalRules = this.getFeatureSetting('rules');
71437161
adLabelStrings = this.getFeatureSetting('adLabelStrings');
71447162
shouldInjectStyleTag = this.getFeatureSetting('useStrictHideStyleTag');
7163+
hideTimeouts = this.getFeatureSetting('hideTimeouts') || hideTimeouts;
7164+
unhideTimeouts = this.getFeatureSetting('unhideTimeouts') || unhideTimeouts;
71457165
mediaAndFormSelectors = this.getFeatureSetting('mediaAndFormSelectors') || mediaAndFormSelectors;
71467166

71477167
// determine whether strict hide rules should be injected as a style tag
@@ -7197,8 +7217,6 @@
71977217
* @param {string} rules[].type
71987218
*/
71997219
applyRules (rules) {
7200-
const hideTimeouts = [0, 100, 200, 300, 400, 500, 1000, 1500, 2000, 2500, 3000];
7201-
const unhideTimeouts = [750, 1500, 2250, 3000];
72027220
const timeoutRules = extractTimeoutRules(rules);
72037221

72047222
// several passes are made to hide & unhide elements. this is necessary because we're not using
@@ -7240,7 +7258,7 @@
72407258
lineno: e.lineno,
72417259
colno: e.colno,
72427260
stack: e.error?.stack
7243-
});
7261+
}, true);
72447262
this.addDebugFlag();
72457263
};
72467264
globalThis.addEventListener('error', handleUncaughtException);

build/android/contentScope.js

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -415,16 +415,14 @@
415415
const isTainted = hasTaintedMethod(scope);
416416
isExempt = !isTainted;
417417
}
418-
if (debug) {
419-
postDebugMessage(this.camelFeatureName, {
420-
isProxy: true,
421-
action: isExempt ? 'ignore' : 'restrict',
422-
kind: this.property,
423-
documentUrl: document.location.href,
424-
stack: getStack(),
425-
args: debugSerialize(args[2])
426-
});
427-
}
418+
postDebugMessage(this.camelFeatureName, {
419+
isProxy: true,
420+
action: isExempt ? 'ignore' : 'restrict',
421+
kind: this.property,
422+
documentUrl: document.location.href,
423+
stack: getStack(),
424+
args: debugSerialize(args[2])
425+
});
428426
// The normal return value
429427
if (isExempt) {
430428
return DDGReflect.apply(...args)
@@ -466,7 +464,25 @@
466464
}
467465
}
468466

469-
function postDebugMessage (feature, message) {
467+
const maxCounter = new Map();
468+
function numberOfTimesDebugged (feature) {
469+
if (!maxCounter.has(feature)) {
470+
maxCounter.set(feature, 1);
471+
} else {
472+
maxCounter.set(feature, maxCounter.get(feature) + 1);
473+
}
474+
return maxCounter.get(feature)
475+
}
476+
477+
const DEBUG_MAX_TIMES = 5000;
478+
479+
function postDebugMessage (feature, message, allowNonDebug = false) {
480+
if (!debug && !allowNonDebug) {
481+
return
482+
}
483+
if (numberOfTimesDebugged(feature) > DEBUG_MAX_TIMES) {
484+
return
485+
}
470486
if (message.stack) {
471487
const scriptOrigins = [...getStackTraceOrigins(message.stack)];
472488
message.scriptOrigins = scriptOrigins;
@@ -6666,6 +6682,8 @@
66666682
let appliedRules = new Set();
66676683
let shouldInjectStyleTag = false;
66686684
let mediaAndFormSelectors = 'video,canvas,embed,object,audio,map,form,input,textarea,select,option,button';
6685+
let hideTimeouts = [0, 100, 200, 300, 400, 500, 1000, 1500, 2000, 2500, 3000, 5000, 10000];
6686+
let unhideTimeouts = [750, 1500, 2250, 3000, 4500, 6000, 12000];
66696687

66706688
/** @type {ElementHiding} */
66716689
let featureInstance;
@@ -6913,6 +6931,8 @@
69136931
const globalRules = this.getFeatureSetting('rules');
69146932
adLabelStrings = this.getFeatureSetting('adLabelStrings');
69156933
shouldInjectStyleTag = this.getFeatureSetting('useStrictHideStyleTag');
6934+
hideTimeouts = this.getFeatureSetting('hideTimeouts') || hideTimeouts;
6935+
unhideTimeouts = this.getFeatureSetting('unhideTimeouts') || unhideTimeouts;
69166936
mediaAndFormSelectors = this.getFeatureSetting('mediaAndFormSelectors') || mediaAndFormSelectors;
69176937

69186938
// determine whether strict hide rules should be injected as a style tag
@@ -6968,8 +6988,6 @@
69686988
* @param {string} rules[].type
69696989
*/
69706990
applyRules (rules) {
6971-
const hideTimeouts = [0, 100, 200, 300, 400, 500, 1000, 1500, 2000, 2500, 3000];
6972-
const unhideTimeouts = [750, 1500, 2250, 3000];
69736991
const timeoutRules = extractTimeoutRules(rules);
69746992

69756993
// several passes are made to hide & unhide elements. this is necessary because we're not using
@@ -7011,7 +7029,7 @@
70117029
lineno: e.lineno,
70127030
colno: e.colno,
70137031
stack: e.error?.stack
7014-
});
7032+
}, true);
70157033
this.addDebugFlag();
70167034
};
70177035
globalThis.addEventListener('error', handleUncaughtException);

build/chrome-mv3/inject.js

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -431,16 +431,14 @@
431431
const isTainted = hasTaintedMethod(scope);
432432
isExempt = !isTainted;
433433
}
434-
if (debug) {
435-
postDebugMessage(this.camelFeatureName, {
436-
isProxy: true,
437-
action: isExempt ? 'ignore' : 'restrict',
438-
kind: this.property,
439-
documentUrl: document.location.href,
440-
stack: getStack(),
441-
args: debugSerialize(args[2])
442-
});
443-
}
434+
postDebugMessage(this.camelFeatureName, {
435+
isProxy: true,
436+
action: isExempt ? 'ignore' : 'restrict',
437+
kind: this.property,
438+
documentUrl: document.location.href,
439+
stack: getStack(),
440+
args: debugSerialize(args[2])
441+
});
444442
// The normal return value
445443
if (isExempt) {
446444
return DDGReflect.apply(...args)
@@ -482,7 +480,25 @@
482480
}
483481
}
484482

485-
function postDebugMessage (feature, message) {
483+
const maxCounter = new Map();
484+
function numberOfTimesDebugged (feature) {
485+
if (!maxCounter.has(feature)) {
486+
maxCounter.set(feature, 1);
487+
} else {
488+
maxCounter.set(feature, maxCounter.get(feature) + 1);
489+
}
490+
return maxCounter.get(feature)
491+
}
492+
493+
const DEBUG_MAX_TIMES = 5000;
494+
495+
function postDebugMessage (feature, message, allowNonDebug = false) {
496+
if (!debug && !allowNonDebug) {
497+
return
498+
}
499+
if (numberOfTimesDebugged(feature) > DEBUG_MAX_TIMES) {
500+
return
501+
}
486502
if (message.stack) {
487503
const scriptOrigins = [...getStackTraceOrigins(message.stack)];
488504
message.scriptOrigins = scriptOrigins;
@@ -6942,6 +6958,8 @@
69426958
let appliedRules = new Set();
69436959
let shouldInjectStyleTag = false;
69446960
let mediaAndFormSelectors = 'video,canvas,embed,object,audio,map,form,input,textarea,select,option,button';
6961+
let hideTimeouts = [0, 100, 200, 300, 400, 500, 1000, 1500, 2000, 2500, 3000, 5000, 10000];
6962+
let unhideTimeouts = [750, 1500, 2250, 3000, 4500, 6000, 12000];
69456963

69466964
/** @type {ElementHiding} */
69476965
let featureInstance;
@@ -7189,6 +7207,8 @@
71897207
const globalRules = this.getFeatureSetting('rules');
71907208
adLabelStrings = this.getFeatureSetting('adLabelStrings');
71917209
shouldInjectStyleTag = this.getFeatureSetting('useStrictHideStyleTag');
7210+
hideTimeouts = this.getFeatureSetting('hideTimeouts') || hideTimeouts;
7211+
unhideTimeouts = this.getFeatureSetting('unhideTimeouts') || unhideTimeouts;
71927212
mediaAndFormSelectors = this.getFeatureSetting('mediaAndFormSelectors') || mediaAndFormSelectors;
71937213

71947214
// determine whether strict hide rules should be injected as a style tag
@@ -7244,8 +7264,6 @@
72447264
* @param {string} rules[].type
72457265
*/
72467266
applyRules (rules) {
7247-
const hideTimeouts = [0, 100, 200, 300, 400, 500, 1000, 1500, 2000, 2500, 3000];
7248-
const unhideTimeouts = [750, 1500, 2250, 3000];
72497267
const timeoutRules = extractTimeoutRules(rules);
72507268

72517269
// several passes are made to hide & unhide elements. this is necessary because we're not using
@@ -7287,7 +7305,7 @@
72877305
lineno: e.lineno,
72887306
colno: e.colno,
72897307
stack: e.error?.stack
7290-
});
7308+
}, true);
72917309
this.addDebugFlag();
72927310
};
72937311
globalThis.addEventListener('error', handleUncaughtException);

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/contentScope.js

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -431,16 +431,14 @@
431431
const isTainted = hasTaintedMethod(scope);
432432
isExempt = !isTainted;
433433
}
434-
if (debug) {
435-
postDebugMessage(this.camelFeatureName, {
436-
isProxy: true,
437-
action: isExempt ? 'ignore' : 'restrict',
438-
kind: this.property,
439-
documentUrl: document.location.href,
440-
stack: getStack(),
441-
args: debugSerialize(args[2])
442-
});
443-
}
434+
postDebugMessage(this.camelFeatureName, {
435+
isProxy: true,
436+
action: isExempt ? 'ignore' : 'restrict',
437+
kind: this.property,
438+
documentUrl: document.location.href,
439+
stack: getStack(),
440+
args: debugSerialize(args[2])
441+
});
444442
// The normal return value
445443
if (isExempt) {
446444
return DDGReflect.apply(...args)
@@ -482,7 +480,25 @@
482480
}
483481
}
484482

485-
function postDebugMessage (feature, message) {
483+
const maxCounter = new Map();
484+
function numberOfTimesDebugged (feature) {
485+
if (!maxCounter.has(feature)) {
486+
maxCounter.set(feature, 1);
487+
} else {
488+
maxCounter.set(feature, maxCounter.get(feature) + 1);
489+
}
490+
return maxCounter.get(feature)
491+
}
492+
493+
const DEBUG_MAX_TIMES = 5000;
494+
495+
function postDebugMessage (feature, message, allowNonDebug = false) {
496+
if (!debug && !allowNonDebug) {
497+
return
498+
}
499+
if (numberOfTimesDebugged(feature) > DEBUG_MAX_TIMES) {
500+
return
501+
}
486502
if (message.stack) {
487503
const scriptOrigins = [...getStackTraceOrigins(message.stack)];
488504
message.scriptOrigins = scriptOrigins;
@@ -6620,6 +6636,8 @@
66206636
let appliedRules = new Set();
66216637
let shouldInjectStyleTag = false;
66226638
let mediaAndFormSelectors = 'video,canvas,embed,object,audio,map,form,input,textarea,select,option,button';
6639+
let hideTimeouts = [0, 100, 200, 300, 400, 500, 1000, 1500, 2000, 2500, 3000, 5000, 10000];
6640+
let unhideTimeouts = [750, 1500, 2250, 3000, 4500, 6000, 12000];
66236641

66246642
/** @type {ElementHiding} */
66256643
let featureInstance;
@@ -6867,6 +6885,8 @@
68676885
const globalRules = this.getFeatureSetting('rules');
68686886
adLabelStrings = this.getFeatureSetting('adLabelStrings');
68696887
shouldInjectStyleTag = this.getFeatureSetting('useStrictHideStyleTag');
6888+
hideTimeouts = this.getFeatureSetting('hideTimeouts') || hideTimeouts;
6889+
unhideTimeouts = this.getFeatureSetting('unhideTimeouts') || unhideTimeouts;
68706890
mediaAndFormSelectors = this.getFeatureSetting('mediaAndFormSelectors') || mediaAndFormSelectors;
68716891

68726892
// determine whether strict hide rules should be injected as a style tag
@@ -6922,8 +6942,6 @@
69226942
* @param {string} rules[].type
69236943
*/
69246944
applyRules (rules) {
6925-
const hideTimeouts = [0, 100, 200, 300, 400, 500, 1000, 1500, 2000, 2500, 3000];
6926-
const unhideTimeouts = [750, 1500, 2250, 3000];
69276945
const timeoutRules = extractTimeoutRules(rules);
69286946

69296947
// several passes are made to hide & unhide elements. this is necessary because we're not using
@@ -6965,7 +6983,7 @@
69656983
lineno: e.lineno,
69666984
colno: e.colno,
69676985
stack: e.error?.stack
6968-
});
6986+
}, true);
69696987
this.addDebugFlag();
69706988
};
69716989
globalThis.addEventListener('error', handleUncaughtException);

0 commit comments

Comments
 (0)