forked from EFForg/privacybadger-test-fixtures
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fixture for test_cookie_tracker_detection
- Loading branch information
1 parent
c657b6f
commit 3edf06a
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |