@duckduckgo/autoconsent 14.91.0 → 14.93.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/addon-firefox/background.bundle.js +5 -1
- package/dist/addon-firefox/compact-rules.json +1 -1
- package/dist/addon-firefox/content.bundle.js +33 -2
- package/dist/addon-firefox/manifest.json +1 -1
- package/dist/addon-firefox/popup.bundle.js +5 -1
- package/dist/addon-firefox/rules.json +1 -1
- package/dist/addon-mv3/background.bundle.js +5 -1
- package/dist/addon-mv3/compact-rules.json +1 -1
- package/dist/addon-mv3/content.bundle.js +33 -2
- package/dist/addon-mv3/manifest.json +1 -1
- package/dist/addon-mv3/popup.bundle.js +5 -1
- package/dist/addon-mv3/rules.json +1 -1
- package/dist/autoconsent.cjs.js +33 -2
- package/dist/autoconsent.esm.js +33 -2
- package/dist/autoconsent.extra.cjs.js +33 -2
- package/dist/autoconsent.extra.esm.js +33 -2
- package/dist/autoconsent.playwright.js +33 -2
- package/dist/types/messages.d.ts +4 -1
- package/dist/types/types.d.ts +2 -0
- package/dist/types/web.d.ts +8 -0
- package/lib/cmps/base.ts +4 -0
- package/lib/messages.ts +11 -1
- package/lib/types.ts +2 -0
- package/lib/utils.ts +1 -0
- package/lib/web.ts +31 -2
- package/package.json +1 -1
- package/rules/autoconsent/vivenu.json +31 -0
- package/rules/compact-rules.json +1 -1
- package/rules/rules.json +1 -1
- package/tests/vivenu.spec.ts +5 -0
|
@@ -707,7 +707,8 @@
|
|
|
707
707
|
errors: true,
|
|
708
708
|
messages: false,
|
|
709
709
|
waits: false
|
|
710
|
-
}
|
|
710
|
+
},
|
|
711
|
+
performanceLoggingEnabled: false
|
|
711
712
|
};
|
|
712
713
|
const updatedConfig = copyObject(defaultConfig);
|
|
713
714
|
for (const key of Object.keys(defaultConfig)) {
|
|
@@ -1988,7 +1989,10 @@
|
|
|
1988
1989
|
return false;
|
|
1989
1990
|
}
|
|
1990
1991
|
detectCmp() {
|
|
1992
|
+
this.autoconsent.config.performanceLoggingEnabled && performance.mark("heuristicDetectorStart");
|
|
1991
1993
|
this.popups = getActionablePopups();
|
|
1994
|
+
this.autoconsent.config.performanceLoggingEnabled && performance.mark("heuristicDetectorEnd");
|
|
1995
|
+
this.autoconsent.config.performanceLoggingEnabled && performance.measure("heuristicDetector", "heuristicDetectorStart", "heuristicDetectorEnd");
|
|
1992
1996
|
if (this.popups.length > 0) {
|
|
1993
1997
|
return Promise.resolve(true);
|
|
1994
1998
|
}
|
|
@@ -3379,6 +3383,8 @@
|
|
|
3379
3383
|
});
|
|
3380
3384
|
}
|
|
3381
3385
|
parseDeclarativeRules(declarativeRules) {
|
|
3386
|
+
const perfEnabled = this.#config?.performanceLoggingEnabled;
|
|
3387
|
+
perfEnabled && performance.mark("parseDeclarativeRulesStart");
|
|
3382
3388
|
if (declarativeRules.consentomatic) {
|
|
3383
3389
|
for (const [name, rule] of Object.entries(declarativeRules.consentomatic)) {
|
|
3384
3390
|
this.addConsentomaticCMP(name, rule);
|
|
@@ -3394,9 +3400,11 @@
|
|
|
3394
3400
|
const rules = decodeRules(declarativeRules.compact);
|
|
3395
3401
|
rules.forEach(this.addDeclarativeCMP.bind(this));
|
|
3396
3402
|
} catch (e) {
|
|
3397
|
-
this
|
|
3403
|
+
this.#config?.logs.errors && console.error(e);
|
|
3398
3404
|
}
|
|
3399
3405
|
}
|
|
3406
|
+
perfEnabled && performance.mark("parseDeclarativeRulesEnd");
|
|
3407
|
+
perfEnabled && performance.measure("parseDeclarativeRules", "parseDeclarativeRulesStart", "parseDeclarativeRulesEnd");
|
|
3400
3408
|
}
|
|
3401
3409
|
addDeclarativeCMP(ruleset) {
|
|
3402
3410
|
if ((ruleset.minimumRuleStepVersion || 1) <= SUPPORTED_RULE_STEP_VERSION) {
|
|
@@ -3416,6 +3424,9 @@
|
|
|
3416
3424
|
this.updateState({ lifecycle: "started" });
|
|
3417
3425
|
const foundCmps = await this.findCmp(this.config.detectRetries);
|
|
3418
3426
|
this.updateState({ detectedCmps: foundCmps.map((c) => c.name) });
|
|
3427
|
+
if (this.config.performanceLoggingEnabled) {
|
|
3428
|
+
this.updateState({ performance: this.measurePerformance() });
|
|
3429
|
+
}
|
|
3419
3430
|
if (foundCmps.length === 0) {
|
|
3420
3431
|
logsConfig.lifecycle && console.log("no CMP found", location.href);
|
|
3421
3432
|
if (this.shouldPrehide) {
|
|
@@ -3509,7 +3520,10 @@
|
|
|
3509
3520
|
`Trying ${stageName} rules`,
|
|
3510
3521
|
ruleGroup.map((r) => r.name)
|
|
3511
3522
|
);
|
|
3523
|
+
this.config.performanceLoggingEnabled && performance.mark(`findCmpStage_${stageName}`);
|
|
3512
3524
|
await Promise.all(ruleGroup.map(runDetectCmp));
|
|
3525
|
+
this.config.performanceLoggingEnabled && performance.mark(`findCmpStageEnd_${stageName}`);
|
|
3526
|
+
this.config.performanceLoggingEnabled && performance.measure(`findCmp_${stageName}`, `findCmpStage_${stageName}`, `findCmpStageEnd_${stageName}`);
|
|
3513
3527
|
if (foundCMPs.length > 0) {
|
|
3514
3528
|
break;
|
|
3515
3529
|
}
|
|
@@ -3527,11 +3541,14 @@
|
|
|
3527
3541
|
}
|
|
3528
3542
|
detectHeuristics() {
|
|
3529
3543
|
if (this.config.enableHeuristicDetection) {
|
|
3544
|
+
this.config.performanceLoggingEnabled && performance.mark("detectHeuristicsStart");
|
|
3530
3545
|
const { patterns, snippets: snippets2 } = checkHeuristicPatterns(document.documentElement?.innerText || "");
|
|
3531
3546
|
if (patterns.length > 0 && (patterns.length !== this.state.heuristicPatterns.length || this.state.heuristicPatterns.some((p, i) => p !== patterns[i]))) {
|
|
3532
3547
|
this.config.logs.lifecycle && console.log("Heuristic patterns found", patterns, snippets2);
|
|
3533
3548
|
this.updateState({ heuristicPatterns: patterns, heuristicSnippets: snippets2 });
|
|
3534
3549
|
}
|
|
3550
|
+
this.config.performanceLoggingEnabled && performance.mark("detectHeuristicsEnd");
|
|
3551
|
+
this.config.performanceLoggingEnabled && performance.measure("detectHeuristics", "detectHeuristicsStart", "detectHeuristicsEnd");
|
|
3535
3552
|
}
|
|
3536
3553
|
}
|
|
3537
3554
|
/**
|
|
@@ -3793,8 +3810,22 @@
|
|
|
3793
3810
|
case "evalResp":
|
|
3794
3811
|
resolveEval(message.id, message.result);
|
|
3795
3812
|
break;
|
|
3813
|
+
case "measurePerformance":
|
|
3814
|
+
this.updateState({ performance: this.measurePerformance() });
|
|
3815
|
+
break;
|
|
3796
3816
|
}
|
|
3797
3817
|
}
|
|
3818
|
+
measurePerformance() {
|
|
3819
|
+
const getRoundedPerformanceEntries = (name) => performance.getEntriesByName(name).map((m) => Number(m.duration.toFixed(3)));
|
|
3820
|
+
return {
|
|
3821
|
+
detectHeuristics: getRoundedPerformanceEntries("detectHeuristics"),
|
|
3822
|
+
heuristicDetector: getRoundedPerformanceEntries("heuristicDetector"),
|
|
3823
|
+
findCmpSiteSpecific: getRoundedPerformanceEntries("findCmp_site-specific"),
|
|
3824
|
+
findCmpGeneric: getRoundedPerformanceEntries("findCmp_generic"),
|
|
3825
|
+
findCmpHeuristic: getRoundedPerformanceEntries("findCmp_heuristic"),
|
|
3826
|
+
parseDeclarativeRules: getRoundedPerformanceEntries("parseDeclarativeRules")
|
|
3827
|
+
};
|
|
3828
|
+
}
|
|
3798
3829
|
};
|
|
3799
3830
|
|
|
3800
3831
|
// addon/content.ts
|
|
@@ -538,7 +538,8 @@
|
|
|
538
538
|
errors: true,
|
|
539
539
|
messages: false,
|
|
540
540
|
waits: false
|
|
541
|
-
}
|
|
541
|
+
},
|
|
542
|
+
performanceLoggingEnabled: false
|
|
542
543
|
};
|
|
543
544
|
const updatedConfig = copyObject(defaultConfig);
|
|
544
545
|
for (const key of Object.keys(defaultConfig)) {
|
|
@@ -571,6 +572,9 @@
|
|
|
571
572
|
waits: true
|
|
572
573
|
};
|
|
573
574
|
}
|
|
575
|
+
if (storedConfig.performanceLoggingEnabled === void 0) {
|
|
576
|
+
storedConfig.performanceLoggingEnabled = true;
|
|
577
|
+
}
|
|
574
578
|
return normalizeConfig(storedConfig);
|
|
575
579
|
}
|
|
576
580
|
async function showOptOutStatus(tabId, status, cmp = "") {
|