-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add POC example nested frames tracker counter test.
- Loading branch information
1 parent
76e1226
commit 33b94c8
Showing
1 changed file
with
58 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,58 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Nested Frames Tracker Blocking Test</title> | ||
</head> | ||
|
||
<body> | ||
<p><a href="/">[Home]</a></p> | ||
|
||
<h1>Nested Frames Tracker Blocking Test</h1> | ||
|
||
<p> | ||
Example page that loads trackers in nested frames to check if tracker counts in the new tab page are updated | ||
when child frame requests are blocked. | ||
</p> | ||
|
||
<button onclick="loadTracker('parent')">Load Tracker in Parent Frame</button> | ||
<button onclick="loadTracker('child')">Load Tracker in Child Frame</button> | ||
|
||
<script src="http://bad.third-party.site/privacy-protections/request-blocking/block-me/script.js"></script> | ||
<script> | ||
const [parentFrame, childFrame] = createFrames(); | ||
|
||
function createFrames() { | ||
const parent = document.createElement('iframe'); | ||
const child = document.createElement('iframe'); | ||
parent.name = "parent-frame"; | ||
parent.id = "parent-frame"; | ||
child.name = "child-frame"; | ||
child.id = "child-frame"; | ||
|
||
document.body.appendChild(parent); | ||
parent.contentDocument.body.appendChild(child); | ||
|
||
return [parent, child]; | ||
} | ||
|
||
function loadTracker(frameType) { | ||
const trackerSrc = frameType === 'parent' | ||
? "http://broken.third-party.site/privacy-protections/request-blocking/block-me/script.js" | ||
: "http://privacy-test-pages.site/privacy-protections/request-blocking/block-me/script.js"; | ||
|
||
const scriptElm = document.createElement('script'); | ||
scriptElm.src = trackerSrc; | ||
|
||
if (frameType === 'parent') { | ||
parentFrame.contentDocument.body.appendChild(scriptElm); | ||
} else { | ||
childFrame.contentDocument.body.appendChild(scriptElm); | ||
} | ||
} | ||
</script> | ||
</body> | ||
|
||
</html> |