Skip to content

Commit

Permalink
Add fixture for test_cookie_tracker_detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostwords committed Jul 30, 2020
1 parent c657b6f commit 3edf06a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
12 changes: 12 additions & 0 deletions html/cookie_frame.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<script src="cookie_frame.js"></script>
</head>
<body>
<p>
Welcome to the third party iframe.
I'm going to set a cookie. This won't hurt a bit!
</p>
</body>
</html>
25 changes: 25 additions & 0 deletions html/cookie_frame.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
function setExpire() {
var now = new Date();
var time = now.getTime();
var expireTime = time + 864000;
now.setTime(expireTime);
return ";expires=" + now.toGMTString();
}

function setPath() {
return ";path=/";
}

function setSameSite() {
return ";SameSite=None;Secure";
}

function updateCookie() {
var oldcookie = document.cookie;
var val = "1234567890";
console.log("read cookie:" + oldcookie);
document.cookie = "thirdpartytest=" + encodeURIComponent(val) + setExpire() + setPath() + setSameSite();
console.log("updated cookie to:" + document.cookie);
}

updateCookie();

0 comments on commit 3edf06a

Please sign in to comment.