Skip to content

Commit

Permalink
Add local frames test page.
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHeaps committed Oct 30, 2024
1 parent 4f7184e commit 1a59f5e
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions local-frames/brave-logo-sans-text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions local-frames/test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<body>

<div>

</div>

<script>

const onload = () => {
const localFrame = document.createElement('iframe');
localFrame.src = 'about:blank';
localFrame.width = 400;
localFrame.height = 400;
document.body.appendChild(localFrame);

const localFrame1PImgElm = document.createElement('img');
localFrame.contentDocument.body.appendChild(localFrame1PImgElm);
localFrame1PImgElm.src = './brave-logo-sans-text.svg';

const localFrame3PImgElm = document.createElement('img');
localFrame.contentDocument.body.appendChild(localFrame3PImgElm);
localFrame3PImgElm.src = 'https://brave.com/static-assets/images/brave-logo-sans-text.svg';

const localFrameScript = document.createElement('script');
localFrameScript.src = 'test.js';
localFrame.contentDocument.body.appendChild(localFrameScript);

const mainFrame1PImageElm = document.createElement('img');
document.body.appendChild(mainFrame1PImageElm);
mainFrame1PImageElm.src = './brave-logo-sans-text.svg';

const mainFrame3PImageElm = document.createElement('img');
document.body.appendChild(mainFrame3PImageElm);
mainFrame3PImageElm.src = 'https://brave.com/static-assets/images/brave-logo-sans-text.svg';
}

window.onload = onload;

</script>

</body>
</html>
17 changes: 17 additions & 0 deletions local-frames/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
console.log('First Party Local Frame');

const text = document.createElement('h1');
text.textContent = 'First Party Local Script';
document.body.appendChild(text);

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
// Typical action to be performed when the document is ready:
const hp = document.createElement('p');
hp.textContent = xhttp.responseText;
document.body.appendChild(hp);
}
};
xhttp.open("GET", "https://blockrequests.localframetesting.xyz/ads/index.txt", true);
xhttp.send();

0 comments on commit 1a59f5e

Please sign in to comment.