-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand tracker blocking test to include redirected tracker and reques…
…t from two frames deep. (#105)
- Loading branch information
Showing
4 changed files
with
94 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
}) | ||
.catch(e => { | ||
window.parent.postMessage('frame fetch failed', '*'); | ||
}) | ||
}); | ||
} | ||
}; | ||
|
||
|
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
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,30 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Middleframe Test</title> | ||
</head> | ||
<body> | ||
<script> | ||
const iframe = document.createElement('iframe'); | ||
iframe.src = `./frame.html?${Math.random()}`; | ||
|
||
const onMessage = msg => { | ||
if (msg.data.action && msg.data.action === 'fetch') { | ||
iframe.addEventListener('load', () => { | ||
// pass message from upper frame to lower frame | ||
iframe.contentWindow.postMessage({ action: 'fetch', url: msg.data.url }); | ||
}); | ||
document.body.appendChild(iframe); | ||
} else if (msg.data && (msg.data.includes('frame fetch loaded') || msg.data.includes('frame fetch failed'))) { | ||
// pass message from lower frame to upper frame | ||
window.parent.postMessage(msg.data, '*'); | ||
window.removeEventListener('message', onMessage); | ||
} | ||
}; | ||
|
||
window.addEventListener('message', onMessage); | ||
</script> | ||
</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