Skip to content

Commit

Permalink
Windows Browser: Script Injection test pages (#185)
Browse files Browse the repository at this point in the history
* First pass at getting script injection test pages into Privacy Test Pages

* Refactored tests for better naming

* Update windows-browser/script-injection/secureWorld_index.html

Co-authored-by: Maxim Tsoy <[email protected]>

---------

Co-authored-by: Maxim Tsoy <[email protected]>
  • Loading branch information
RendijsSmukulis and muodov authored Feb 8, 2024
1 parent d0b96a8 commit 581c6a2
Show file tree
Hide file tree
Showing 5 changed files with 376 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ <h2>Other</h2>
<li><a href="./tracker-site-blocking/index.html">Site specific tracker blocking test</a>
<li><a href='./features/clear-data/'>🗑️ Clear domain data</a></li>
<li><a href='./viewport/'>Viewport test cases</a></li>
<li><a href='./windows-browser/script-injection/index.html'>Windows Browser: MainWorld Script injection tests</a></li>
<li><a href='./windows-browser/script-injection/secureWorld_index.html'>Windows Browser: SecureWorld Script injection tests</a></li>
</ul>

</body>
Expand Down
108 changes: 108 additions & 0 deletions windows-browser/script-injection/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Windows Browser: Main World Content Scope script tests</title>

<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}

h1 {
margin-bottom: 20px;
}

table {
border-collapse: separate;
border-spacing: 0;
border-radius: 10px;
overflow: hidden;
width: 50%;
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}

th {
background-color: #4CAF50;
color: white;
}

tr:nth-child(even) {
background-color: #f2f2f2;
}

tr:hover {
background-color: #ddd;
}
</style>

</head>
<body>
<p><a href="../../index.html">[Home]</a></p>
<h2>Windows Browser: Main World Content Scope script tests</h2>

<p>Validates the Windows Browser can successfully inject MainWorld scripts and provides message dispatching.</P>


<table>
<tr>
<td>Content scripts executed:</td>
<td id="mainWorld-testResult-1">False</td>
</tr>
<tr>
<td>Message to handlers:</td>
<td id="mainWorld-testResult-3">False</td>
</tr>
<tr>
<td>Round trip message from JS back to JS:</td>
<td id="mainWorld-testResult-4">False</td>
</tr>
<tr>
<td>ExecutableScript updated:</td>
<td id="mainWorld-testResult-5">False</td>
</tr>
<tr>
<td>Value set by script not visible to page:</td>
<td id="mainWorld-testResult-6">True</td>
</tr>
</table>
<h2>Iframe (same origin):</h2>
<iframe src="mainWorld_iframe.html" height="400"></iframe>

<h2>Iframe (different origin):</h2>
<iframe src="https://good.third-party.site/windows-browser/script-injection/mainWorld_iframe.html" height="400"></iframe>
<script>
if (typeof window.helloFromDDG !== 'undefined') {
document.getElementById("mainWorld-testResult-6").innerHTML = "False";
}
</script>
<a href="./index.html">Main World Content Scope script tests</a>
<a href="./secureWorld_index.html">Secure World Content Scope script tests</a>

<form action="./index.html" method="POST" target="_blank">
<!-- Add any form elements here if needed -->
<button type="submit">Main World Content Scope script tests with POST to _blank</button>
</form>


<form action="./secureWorld_index.html" method="POST" target="_blank">
<!-- Add any form elements here if needed -->
<button type="submit">Secure World Content Scope script tests with POST to _blank</button>
</form>
</body>
</html>
80 changes: 80 additions & 0 deletions windows-browser/script-injection/mainWorld_iframe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}

h1 {
margin-bottom: 20px;
}

table {
border-collapse: separate;
border-spacing: 0;
border-radius: 10px;
overflow: hidden;
width: 50%;
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}

th {
background-color: #4CAF50;
color: white;
}

tr:nth-child(even) {
background-color: #f2f2f2;
}

tr:hover {
background-color: #ddd;
}
</style>
</head>
<body>
<h2>Main world tests</h2>
<table>
<tr>
<td>Content scripts executed:</td>
<td id="mainWorld-testResult-1">False</td>
</tr>
<tr>
<td>Message to handlers:</td>
<td id="mainWorld-testResult-3">False</td>
</tr>
<tr>
<td>Round trip message from JS back to JS:</td>
<td id="mainWorld-testResult-4">False</td>
</tr>
<tr>
<td>ExecutableScript updated:</td>
<td id="mainWorld-testResult-5">False</td>
</tr>
<tr>
<td>Value set by script not visible to page:</td>
<td id="mainWorld-testResult-6">True</td>
</tr>
</table>
<script>
if (typeof window.helloFromDDG !== 'undefined') {
document.getElementById("mainWorld-testResult-6").innerHTML = "False";
}
</script>
</body>
</html>
80 changes: 80 additions & 0 deletions windows-browser/script-injection/secureWorld_iframe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}

h1 {
margin-bottom: 20px;
}

table {
border-collapse: separate;
border-spacing: 0;
border-radius: 10px;
overflow: hidden;
width: 50%;
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}

th {
background-color: #4CAF50;
color: white;
}

tr:nth-child(even) {
background-color: #f2f2f2;
}

tr:hover {
background-color: #ddd;
}
</style>
</head>
<body>
<h2>Main world tests</h2>
<table>
<tr>
<td>Content scripts executed:</td>
<td id="secureWorld-testResult-1">False</td>
</tr>
<tr>
<td>Message to handlers:</td>
<td id="secureWorld-testResult-3">False</td>
</tr>
<tr>
<td>Round trip message from JS back to JS:</td>
<td id="secureWorld-testResult-4">False</td>
</tr>
<tr>
<td>ExecutableScript updated:</td>
<td id="secureWorld-testResult-5">False</td>
</tr>
<tr>
<td>Value set by script not visible to page:</td>
<td id="secureWorld-testResult-6">True</td>
</tr>
</table>
<script>
if (typeof window.helloFromSecureDDG !== 'undefined') {
document.getElementById("secureWorld-testResult-6").innerHTML = "False";
}
</script>
</body>
</html>
106 changes: 106 additions & 0 deletions windows-browser/script-injection/secureWorld_index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Windows Browser: Secure World Content Scope script tests</title>

<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}

h1 {
margin-bottom: 20px;
}

table {
border-collapse: separate;
border-spacing: 0;
border-radius: 10px;
overflow: hidden;
width: 50%;
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}

th {
background-color: #4CAF50;
color: white;
}

tr:nth-child(even) {
background-color: #f2f2f2;
}

tr:hover {
background-color: #ddd;
}
</style>

</head>
<body>
<p><a href="../../index.html">[Home]</a></p>
<h2>Windows Browser: Secure World Content Scope script tests</h2>

<p>Validates the Windows Browser can successfully inject SecureWorld scripts and provides message dispatching.</P>
<table>
<tr>
<td>Content scripts executed:</td>
<td id="secureWorld-testResult-1">False</td>
</tr>
<tr>
<td>Message to handlers:</td>
<td id="secureWorld-testResult-3">False</td>
</tr>
<tr>
<td>Round trip message from JS back to JS:</td>
<td id="secureWorld-testResult-4">False</td>
</tr>
<tr>
<td>ExecutableScript updated:</td>
<td id="secureWorld-testResult-5">False</td>
</tr>
<tr>
<td>Value set by script not visible to page:</td>
<td id="secureWorld-testResult-6">True</td>
</tr>
</table>
<h2>Iframe (same origin):</h2>
<iframe src="secureWorld_iframe.html" height="400"></iframe>

<h2>Iframe (different origin):</h2>
<iframe src="https://good.third-party.site/windows-browser/script-injection/secureWorld_iframe.html" height="400"></iframe>
<script>
if (typeof window.helloFromSecureDDG !== 'undefined') {
document.getElementById("secureWorld-testResult-6").innerHTML = "False";
}
</script>
<a href="./index.html">Main World Content Scope script tests</a>
<a href="./secureWorld_index.html">Secure World Content Scope script tests</a>

<form action="./index.html" method="POST" target="_blank">
<!-- Add any form elements here if needed -->
<button type="submit">Main World Content Scope script tests with POST to _blank</button>
</form>


<form action="./secureWorld_index.html" method="POST" target="_blank">
<!-- Add any form elements here if needed -->
<button type="submit">Secure World Content Scope script tests with POST to _blank</button>
</form>
</body>
</html>

0 comments on commit 581c6a2

Please sign in to comment.