diff --git a/README.md b/README.md index e2c79de..88e7e53 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,14 @@ Please note that we are not taking external contributions for new test pages, bu - Please remember to link new test page from [index.html](./index.html). - Once you have a PR with a new page please assign it to one of the AoR DRIs (@brindy, @kdzwinel). +### Test domains + +We have couple of test domains, that all resolve to `privacy-test-pages.glitch.me`, which help us simulate various scenarios: + +- `good.third-party.site` - non-tracking third party, it's not on our blocklist and will not be blocked by our clients +- `broken.third-party.site` - tracking third party that we can't block (e.g. due to brekage), it's on our blocklist, but it will not be blocked by our clients +- `bad.third-party.site` - tracking third party that's on our blocklist and our clients will block + ### How to test it locally If you are working on a simple page you can start any local server (e.g. `python -m SimpleHTTPServer 8000`) in the main folder of the project. diff --git a/privacy-protections/storage-blocking/3rdparty.js b/privacy-protections/storage-blocking/3rdparty.js index 347f60d..abffe6e 100644 --- a/privacy-protections/storage-blocking/3rdparty.js +++ b/privacy-protections/storage-blocking/3rdparty.js @@ -4,12 +4,17 @@ * As we load this script via a 3rd party origin in the test, when running `store` the 3rd party * origin will be visible in the call stack to document.cookie. */ -commonTests.push({ - id: 'JS cookie (3rd party script)', - store: (data) => { - document.cookie = `tpdata=${data}; expires= Wed, 21 Aug 2030 20:00:00 UTC;`; - }, - retrive: () => { - return document.cookie.match(/tpdata=([0-9]+)/)[1]; - } -}); +(function () { + const src = document.currentScript.src; + const trackingDomain = src.indexOf('https://broken.third-party.site/') === 0; + + commonTests.push({ + id: `JS cookie (3rd party ${trackingDomain ? 'tracking' : 'safe'} script)`, + store: (data) => { + document.cookie = `tp${trackingDomain ? 't' : 's'}data=${data}; expires= Wed, 21 Aug 2030 20:00:00 UTC;`; + }, + retrive: () => { + return trackingDomain ? document.cookie.match(/tptdata=([0-9]+)/)[1] : document.cookie.match(/tpsdata=([0-9]+)/)[1]; + } + }); +})(); diff --git a/privacy-protections/storage-blocking/index.html b/privacy-protections/storage-blocking/index.html index f7e5b5a..d72e41e 100644 --- a/privacy-protections/storage-blocking/index.html +++ b/privacy-protections/storage-blocking/index.html @@ -7,6 +7,7 @@ + @@ -27,4 +28,4 @@