expires.html (2038B)
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset=utf-8> 5 <title>Test expires attribute parsing</title> 6 <meta name=help href="https://tools.ietf.org/html/rfc6265#section-5.1.1"> 7 <meta name="timeout" content="long"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/resources/testdriver.js"></script> 11 <script src="/resources/testdriver-vendor.js"></script> 12 <script src="/cookies/resources/cookie-test.js"></script> 13 </head> 14 <body> 15 <div id=log></div> 16 <script> 17 const expiresTests = [ 18 { 19 cookie: "test=1; Expires=Fri, 01 Jan 2038 00:00:00 GMT", 20 expected: "test=1", 21 name: "Set cookie with expires value containing a comma", 22 }, 23 { 24 cookie: "test=2; Expires=Fri 01 Jan 2038 00:00:00 GMT, baz=qux", 25 expected: "test=2", 26 name: "Set cookie with expires value followed by comma", 27 }, 28 { 29 cookie: "test=3; Expires=Fri, 01 Jan 2038 00:00:00 GMT", 30 expected: "test=3", 31 name: "Set cookie with future expiration", 32 }, 33 { 34 cookie: ["test=expired; Expires=Fri, 07 Aug 2007 08:04:19 GMT", "test=4; Expires=Fri, 07 Aug 2027 08:04:19 GMT"], 35 expected: "test=4", 36 name: "Set expired cookie along with valid cookie", 37 }, 38 { 39 cookie: "test=5; expires=Thu, 10 Apr 1980 16:33:12 GMT", 40 expected: "", 41 name: "Don't set cookie with expires set to the past", 42 }, 43 ]; 44 45 // These tests evaluate setting cookies with expiration via HTTP headers. 46 for (const test of expiresTests) { 47 httpCookieTest(test.cookie, test.expected, test.name + " via HTTP headers"); 48 } 49 50 // These tests evaluate setting cookies with expiration via document.cookie. 51 for (const test of expiresTests) { 52 domCookieTest(test.cookie, test.expected, test.name + " via document.cookie"); 53 } 54 </script> 55 </body> 56 </html>