|
4313 | 4313 | }
|
4314 | 4314 | }
|
4315 | 4315 |
|
4316 |
| - /* eslint-disable quote-props */ |
4317 |
| - /* eslint-disable quotes */ |
4318 |
| - /* eslint-disable indent */ |
4319 |
| - /* eslint-disable eol-last */ |
4320 |
| - /* eslint-disable no-trailing-spaces */ |
4321 |
| - /* eslint-disable no-multiple-empty-lines */ |
4322 |
| - const exceptions = [ |
4323 |
| - { |
4324 |
| - "domain": "nespresso.com", |
4325 |
| - "reason": "Clicking 'Continue' after filling out details for account creation yields an error." |
4326 |
| - } |
4327 |
| - ]; |
4328 |
| - const excludedCookieDomains = [ |
4329 |
| - { |
4330 |
| - "domain": "accounts.google.com", |
4331 |
| - "reason": "On some Google sign-in flows, there is an error after entering username and proceeding: 'Your browser has cookies disabled. Make sure that your cookies are enabled and try again.'" |
4332 |
| - }, |
4333 |
| - { |
4334 |
| - "domain": "pay.google.com", |
4335 |
| - "reason": "After sign-in for Google Pay flows, there is repeated flickering and a loading spinner, preventing the flow from proceeding." |
4336 |
| - }, |
4337 |
| - { |
4338 |
| - "domain": "payments.google.com", |
4339 |
| - "reason": "After sign-in for Google Pay flows (after flickering is resolved), blocking this causes the loading spinner to spin indefinitely, and the payment flow cannot proceed." |
4340 |
| - }, |
4341 |
| - { |
4342 |
| - "domain": "shutterfly.com", |
4343 |
| - "reason": "https://github.com/duckduckgo/privacy-configuration/issues/544" |
4344 |
| - } |
4345 |
| - ]; |
4346 |
| - |
4347 |
| - let protectionExempted = true; |
4348 |
| - const tabHostname = getTabHostname(); |
4349 |
| - let tabExempted = true; |
4350 |
| - |
4351 |
| - if (tabHostname != null) { |
4352 |
| - tabExempted = exceptions.some((exception) => { |
4353 |
| - return matchHostname(tabHostname, exception.domain) |
4354 |
| - }); |
4355 |
| - } |
4356 |
| - const frameExempted = excludedCookieDomains.some((exception) => { |
4357 |
| - return matchHostname(globalThis.location.hostname, exception.domain) |
4358 |
| - }); |
4359 |
| - protectionExempted = frameExempted || tabExempted; |
4360 |
| - |
4361 | 4316 | // Initial cookie policy pre init
|
4362 | 4317 | let cookiePolicy = {
|
4363 | 4318 | debug: false,
|
4364 | 4319 | isFrame: isBeingFramed(),
|
4365 | 4320 | isTracker: false,
|
4366 |
| - shouldBlock: !protectionExempted, |
| 4321 | + shouldBlock: true, |
4367 | 4322 | shouldBlockTrackerCookie: true,
|
4368 |
| - shouldBlockNonTrackerCookie: true, |
| 4323 | + shouldBlockNonTrackerCookie: false, |
4369 | 4324 | isThirdParty: isThirdParty(),
|
4370 | 4325 | policy: {
|
4371 | 4326 | threshold: 604800, // 7 days
|
|
4414 | 4369 | if (args.platform.name !== 'extension') {
|
4415 | 4370 | return
|
4416 | 4371 | }
|
| 4372 | + if (args.documentOriginIsTracker) { |
| 4373 | + cookiePolicy.isTracker = true; |
| 4374 | + } |
| 4375 | + if (args.bundledConfig) { |
| 4376 | + // use the bundled config to get a best-effort at the policy, before the background sends the real one |
| 4377 | + const { exceptions, settings } = args.bundledConfig.features.cookie; |
| 4378 | + const tabHostname = getTabHostname(); |
| 4379 | + let tabExempted = true; |
| 4380 | + |
| 4381 | + if (tabHostname != null) { |
| 4382 | + tabExempted = exceptions.some((exception) => { |
| 4383 | + return matchHostname(tabHostname, exception.domain) |
| 4384 | + }); |
| 4385 | + } |
| 4386 | + const frameExempted = settings.excludedCookieDomains.some((exception) => { |
| 4387 | + return matchHostname(globalThis.location.hostname, exception.domain) |
| 4388 | + }); |
| 4389 | + cookiePolicy.shouldBlock = !frameExempted && !tabExempted; |
| 4390 | + cookiePolicy.policy = settings.firstPartyCookiePolicy; |
| 4391 | + } |
4417 | 4392 | trackerHosts.clear();
|
4418 | 4393 |
|
4419 | 4394 | // The cookie policy is injected into every frame immediately so that no cookie will
|
|
0 commit comments