@duckduckgo/autoconsent 14.68.0 → 14.70.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/AGENTS.md +36 -11
- package/CHANGELOG.md +30 -0
- package/dist/addon-firefox/compact-rules.json +1 -1
- package/dist/addon-firefox/content.bundle.js +17 -3
- package/dist/addon-firefox/manifest.json +1 -1
- package/dist/addon-firefox/rules.json +1 -1
- package/dist/addon-mv3/compact-rules.json +1 -1
- package/dist/addon-mv3/content.bundle.js +17 -3
- package/dist/addon-mv3/manifest.json +1 -1
- package/dist/addon-mv3/rules.json +1 -1
- package/dist/autoconsent.cjs.js +17 -3
- package/dist/autoconsent.esm.js +17 -3
- package/dist/autoconsent.extra.cjs.js +17 -3
- package/dist/autoconsent.extra.esm.js +17 -3
- package/dist/autoconsent.playwright.js +17 -3
- package/dist/types/heuristics.d.ts +1 -0
- package/docs/rule-syntax.md +32 -1
- package/lib/heuristics.ts +18 -3
- package/package.json +1 -1
- package/rules/autoconsent/gallup.json +9 -0
- package/rules/compact-rules.json +1 -1
- package/rules/generated/auto_GB_www2.hm.com_0.json +15 -6
- package/rules/rules.json +1 -1
- package/tests/gallup.spec.ts +6 -0
- package/tests/generated/auto_GB_www2.hm.com_0.spec.ts +16 -0
- package/tests-wtr/heuristics/get-actionable-popups.html +24 -0
- package/tests-wtr/heuristics/get-actionable-popups.ts +36 -0
- package/tests-wtr/heuristics/heuristics-utils.test.ts +43 -0
- package/rules/generated/auto_DE_www2.hm.com_beo.json +0 -40
- package/tests/generated/auto_DE_www2.hm.com_beo.spec.ts +0 -6
|
@@ -4,3 +4,19 @@ generateCMPTests('auto_GB_www2.hm.com_0', ['https://www2.hm.com/en_gb/index.html
|
|
|
4
4
|
testSelfTest: false,
|
|
5
5
|
onlyRegions: ['GB'],
|
|
6
6
|
});
|
|
7
|
+
generateCMPTests('auto_GB_www2.hm.com_0', ['https://www2.hm.com/de_de/index.html'], {
|
|
8
|
+
testOptIn: false,
|
|
9
|
+
testSelfTest: false,
|
|
10
|
+
onlyRegions: ['DE'],
|
|
11
|
+
});
|
|
12
|
+
generateCMPTests('auto_GB_www2.hm.com_0', ['https://www2.hm.com/en_us/index.html'], {
|
|
13
|
+
testOptIn: false,
|
|
14
|
+
testSelfTest: false,
|
|
15
|
+
onlyRegions: ['US'],
|
|
16
|
+
});
|
|
17
|
+
generateCMPTests('auto_GB_www2.hm.com_0', ['https://www2.hm.com/en_us/index.html'], {
|
|
18
|
+
testOptIn: false,
|
|
19
|
+
testSelfTest: false,
|
|
20
|
+
onlyRegions: ['US'],
|
|
21
|
+
mobile: true,
|
|
22
|
+
});
|
|
@@ -20,6 +20,12 @@
|
|
|
20
20
|
position: sticky;
|
|
21
21
|
top: 0;
|
|
22
22
|
}
|
|
23
|
+
.popup.dialog-pos {
|
|
24
|
+
position: absolute;
|
|
25
|
+
}
|
|
26
|
+
dialog.popup {
|
|
27
|
+
position: absolute;
|
|
28
|
+
}
|
|
23
29
|
</style>
|
|
24
30
|
</head>
|
|
25
31
|
<body>
|
|
@@ -68,5 +74,23 @@
|
|
|
68
74
|
<button>Settings</button>
|
|
69
75
|
<button>Learn More</button>
|
|
70
76
|
</div>
|
|
77
|
+
|
|
78
|
+
<div id="popup-role-dialog" class="popup dialog-pos" role="dialog">
|
|
79
|
+
<p>We use cookies to improve your experience.</p>
|
|
80
|
+
<button>Accept All</button>
|
|
81
|
+
<button>Reject All</button>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<div id="popup-aria-modal" class="popup dialog-pos" aria-modal="true">
|
|
85
|
+
<p>We use cookies to improve your experience.</p>
|
|
86
|
+
<button>Accept All</button>
|
|
87
|
+
<button>Reject All</button>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<dialog id="popup-dialog-element" class="popup">
|
|
91
|
+
<p>We use cookies to improve your experience.</p>
|
|
92
|
+
<button>Accept All</button>
|
|
93
|
+
<button>Reject All</button>
|
|
94
|
+
</dialog>
|
|
71
95
|
</body>
|
|
72
96
|
</html>
|
|
@@ -67,6 +67,42 @@ describe('getActionablePopups', () => {
|
|
|
67
67
|
|
|
68
68
|
expect(popups.length).to.equal(0);
|
|
69
69
|
});
|
|
70
|
+
|
|
71
|
+
it('finds popup with role="dialog"', () => {
|
|
72
|
+
showPopup('popup-role-dialog');
|
|
73
|
+
|
|
74
|
+
const popups = getActionablePopups();
|
|
75
|
+
|
|
76
|
+
expect(popups.length).to.equal(1);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('finds popup with aria-modal="true"', () => {
|
|
80
|
+
showPopup('popup-aria-modal');
|
|
81
|
+
|
|
82
|
+
const popups = getActionablePopups();
|
|
83
|
+
|
|
84
|
+
expect(popups.length).to.equal(1);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('finds open <dialog> element', () => {
|
|
88
|
+
const dialog = document.getElementById('popup-dialog-element') as HTMLDialogElement;
|
|
89
|
+
dialog.show();
|
|
90
|
+
dialog.classList.add('visible');
|
|
91
|
+
|
|
92
|
+
const popups = getActionablePopups();
|
|
93
|
+
|
|
94
|
+
expect(popups.length).to.equal(1);
|
|
95
|
+
dialog.close();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('ignores closed <dialog> element', () => {
|
|
99
|
+
const dialog = document.getElementById('popup-dialog-element') as HTMLDialogElement;
|
|
100
|
+
dialog.classList.add('visible');
|
|
101
|
+
|
|
102
|
+
const popups = getActionablePopups();
|
|
103
|
+
|
|
104
|
+
expect(popups.length).to.equal(0);
|
|
105
|
+
});
|
|
70
106
|
});
|
|
71
107
|
|
|
72
108
|
describe('button classification', () => {
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
isDisabled,
|
|
8
8
|
excludeContainers,
|
|
9
9
|
getButtonData,
|
|
10
|
+
isDialogLikeElement,
|
|
10
11
|
} from '../../lib/heuristics';
|
|
11
12
|
|
|
12
13
|
describe('checkHeuristicPatterns', () => {
|
|
@@ -151,6 +152,48 @@ describe('isDisabled', () => {
|
|
|
151
152
|
});
|
|
152
153
|
});
|
|
153
154
|
|
|
155
|
+
describe('isDialogLikeElement', () => {
|
|
156
|
+
it('returns true for open dialog element', () => {
|
|
157
|
+
const dialog = document.createElement('dialog');
|
|
158
|
+
dialog.setAttribute('open', '');
|
|
159
|
+
expect(isDialogLikeElement(dialog)).to.be.true;
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('returns false for closed dialog element', () => {
|
|
163
|
+
const dialog = document.createElement('dialog');
|
|
164
|
+
expect(isDialogLikeElement(dialog)).to.be.false;
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('returns true for element with role="dialog"', () => {
|
|
168
|
+
const div = document.createElement('div');
|
|
169
|
+
div.setAttribute('role', 'dialog');
|
|
170
|
+
expect(isDialogLikeElement(div)).to.be.true;
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('returns true for element with aria-modal="true"', () => {
|
|
174
|
+
const div = document.createElement('div');
|
|
175
|
+
div.setAttribute('aria-modal', 'true');
|
|
176
|
+
expect(isDialogLikeElement(div)).to.be.true;
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it('returns false for aria-modal="false"', () => {
|
|
180
|
+
const div = document.createElement('div');
|
|
181
|
+
div.setAttribute('aria-modal', 'false');
|
|
182
|
+
expect(isDialogLikeElement(div)).to.be.false;
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it('returns false for plain div', () => {
|
|
186
|
+
const div = document.createElement('div');
|
|
187
|
+
expect(isDialogLikeElement(div)).to.be.false;
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
it('returns false for element with unrelated role', () => {
|
|
191
|
+
const div = document.createElement('div');
|
|
192
|
+
div.setAttribute('role', 'button');
|
|
193
|
+
expect(isDialogLikeElement(div)).to.be.false;
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
|
|
154
197
|
describe('excludeContainers', () => {
|
|
155
198
|
it('returns empty array for empty input', () => {
|
|
156
199
|
expect(excludeContainers([])).to.have.length(0);
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "auto_DE_www2.hm.com_beo",
|
|
3
|
-
"cosmetic": false,
|
|
4
|
-
"_metadata": {
|
|
5
|
-
"vendorUrl": "http://www2.hm.com/"
|
|
6
|
-
},
|
|
7
|
-
"runContext": {
|
|
8
|
-
"main": true,
|
|
9
|
-
"frame": false,
|
|
10
|
-
"urlPattern": "^https?://(www\\.)?www2\\.hm\\.com/"
|
|
11
|
-
},
|
|
12
|
-
"prehideSelectors": [],
|
|
13
|
-
"detectCmp": [
|
|
14
|
-
{
|
|
15
|
-
"exists": "body > div:not([id]) > dialog:nth-child(1):not([id]) > div:nth-child(2):not([id]) > div:not([id]) > div:nth-child(1):not([id]) > button:nth-child(2)#banner-reject-btn"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"detectPopup": [
|
|
19
|
-
{
|
|
20
|
-
"visible": "body > div:not([id]) > dialog:nth-child(1):not([id]) > div:nth-child(2):not([id]) > div:not([id]) > div:nth-child(1):not([id]) > button:nth-child(2)#banner-reject-btn"
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
"optIn": [],
|
|
24
|
-
"optOut": [
|
|
25
|
-
{
|
|
26
|
-
"wait": 500
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"waitForThenClick": "body > div:not([id]) > dialog:nth-child(1):not([id]) > div:nth-child(2):not([id]) > div:not([id]) > div:nth-child(1):not([id]) > button:nth-child(2)#banner-reject-btn",
|
|
30
|
-
"comment": "NUR ERFORDERLICHE COOKIES"
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
"test": [
|
|
34
|
-
{
|
|
35
|
-
"waitForVisible": "body > div:not([id]) > dialog:nth-child(1):not([id]) > div:nth-child(2):not([id]) > div:not([id]) > div:nth-child(1):not([id]) > button:nth-child(2)#banner-reject-btn",
|
|
36
|
-
"timeout": 1000,
|
|
37
|
-
"check": "none"
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
}
|