mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:17:36 +00:00
LibWeb: Convert the cookie test page to a text test
This commit is contained in:
parent
0989a81a48
commit
00510e40d9
4 changed files with 173 additions and 56 deletions
|
@ -1,55 +0,0 @@
|
|||
<body>
|
||||
<h3>Valid cookies:</h3>
|
||||
<br /><input type=button onclick="setCookie(this.value)" value="cookie1=value1; max-age=5; path=/res/html" />
|
||||
<br /><input type=button onclick="setCookie(this.value)" value="cookie2=value2; expires=Sat, 23 Jan 2060 08:10:36 GMT" />
|
||||
<br /><input type=button onclick="setCookie(this.value)" value="cookie3=value3" />
|
||||
<br /><input type=button onclick="setCookie(this.value)" value="cookie4=value4;SameSite=Lax" />
|
||||
<br /><input type=button onclick="setCookie(this.value)" value="cookie5=value5;SameSite=Strict" />
|
||||
<br /><input type=button onclick="setCookie(this.value)" value="cookie6=value6;SameSite=None" />
|
||||
<br /><input type=button onclick="setPrettyLargeCookie()" value="cookie7=xxxxx..[2048 x's]" />
|
||||
<br />
|
||||
|
||||
<h3>Invalid cookies (the browser should reject these):</h3>
|
||||
<br /><input id=invalid1 type=button onclick="setCookie(this.value)" value="cookie4=value4; domain=serenityos.org" />
|
||||
<label for=invalid1>The Domain attribute does not domain-match this page</label>
|
||||
<br /><input id=invalid2 type=button onclick="setCookie(this.value)" value="cookie5=value5; httponly" />
|
||||
<label for=invalid2>The cookie is HttpOnly thus cannot be set via JavaScript</label>
|
||||
<br /><input id=invalid3 type=button onclick="setCookie(this.value)" value="cookie6=value6; max-age=-1" />
|
||||
<label for=invalid3>The cookie expired in the past</label>
|
||||
<br /><input id=invalid4 type=button onclick="setCookie(this.value)" value="cookie7=value7; expires=Mon, 23 Jan 1989 08:10:36 GMT" />
|
||||
<label for=invalid4>The cookie expired in the past</label>
|
||||
<br /><input id=invalid5 type=button onclick="setTooLargeCookie()" value="cookie10=[more than 4096 chars]" />
|
||||
<label for=invalid5>The cookie is too large</label>
|
||||
<br /><input id=invalid6 type=button onclick="setCookie(this.value)" value="cookie11=value11; domain=uk.gov" />
|
||||
<label for=invalid6>The cookie's domain is on the Public Suffix List</label>
|
||||
<br /><input id=invalid7 type=button onclick="setCookie(this.value)" value="cookie12=value12; expires=Sat, 31 Feb 2060 08:10:36 GMT" />
|
||||
<label for=invalid4>The cookie has a date that does not exist</label>
|
||||
<br />
|
||||
|
||||
<h3>Unretrievable cookies (the browser should accept these but not display them):</h3>
|
||||
<br /><input id=locked1 type=button onclick="setCookie(this.value)" value="cookie8=value8; path=/not/this/path" />
|
||||
<label for=locked1>The Path attribute does not path-match this page</label>
|
||||
<br /><input id=locked2 type=button onclick="setCookie(this.value)" value="cookie9=value9; secure" />
|
||||
<label for=locked2>The cookie is Secure thus cannot be viewed by a file:// page</label>
|
||||
<br />
|
||||
|
||||
<pre>document.cookie = <span id=cookies></span></pre>
|
||||
|
||||
<script>
|
||||
function setCookie(cookie) {
|
||||
document.cookie = cookie;
|
||||
document.getElementById('cookies').innerHTML = document.cookie;
|
||||
}
|
||||
|
||||
function setPrettyLargeCookie() {
|
||||
setCookie('cookie7=' + 'x'.repeat(2048));
|
||||
}
|
||||
|
||||
function setTooLargeCookie() {
|
||||
const cookie = 'name=' + 'x'.repeat(4 << 10);
|
||||
setCookie(cookie);
|
||||
}
|
||||
|
||||
document.getElementById('cookies').innerHTML = document.cookie;
|
||||
</script>
|
||||
</body>
|
|
@ -173,7 +173,6 @@
|
|||
<li><a href="mouse-events.html">mouse events</a></li>
|
||||
<li><a href="message-channel.html">MessageChannel</a></li>
|
||||
<li><a href="websocket.html">WebSocket API Test</a></li>
|
||||
<li><a href="cookie.html">document.cookie</a></li>
|
||||
<li><a href="event-bubbling-and-multiple-listeners.html">event bubbling and multiple listeners</a></li>
|
||||
<li><a href="raf.html">requestAnimationFrame</a></li>
|
||||
<li><a href="events.html">simple DOM events</a></li>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue