tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ordering-child.sub.html (2861B)


      1 <!doctype html>
      2 <html>
      3  <head>
      4    <meta charset=utf-8>
      5    <title>Test cookie ordering</title>
      6    <meta name=help href="https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-07#section-5.5">
      7    <meta name="timeout" content="long">
      8    <script src="/resources/testharness.js"></script>
      9    <script src="/resources/testdriver.js"></script>
     10    <script src="/resources/testdriver-vendor.js"></script>
     11    <script src="/cookies/resources/cookie-test.js"></script>
     12  </head>
     13  <body>
     14    <div id=log></div>
     15    <script>
     16      const host = "{{host}}";
     17      const wwwHost = "{{domains[www]}}";
     18 
     19      const orderingTests = [
     20      {
     21          cookie: [
     22            "testA=1",
     23            "testB=1; path=/cookies",
     24            "testC=1; path=/",
     25            "testD=1; path=/cooking",
     26            `testE=1; domain=.${host}; path=/`,
     27            `testF=1; domain=.${host}; path=/cookies/attributes`,
     28          ],
     29          expected: "testF=1; testB=1; testC=1; testE=1",
     30          name: "Cookies with longer path attribute values are ordered before shorter ones",
     31          location: "/cookies/attributes/resources/path/one.html",
     32        },
     33        {
     34          cookie: [
     35            "testA=2",
     36            "testB=2; path=/cookies/attributes/resources",
     37            "testC=2; path=/",
     38            "testD=2; path=/cooking",
     39            `testE=2; domain=.${host}`,
     40            `testF=2; domain=.${host}; path=/cookies/attributes`,
     41            `testG=2; domain=.${host}; path=/cookies/attributes/resources/path`,
     42            "testH=2; path=/cookies",
     43          ],
     44          expected: "testG=2; testB=2; testF=2; testH=2; testC=2",
     45          name: "Cookies with longer path attribute values are ordered before shorter ones (2)",
     46          location: "/cookies/attributes/resources/path/one.html",
     47        },
     48        {
     49          cookie: [
     50            "testA=3; path=/cookies/attributes/resources/path",
     51            "testB=3; path=/cookies/attributes/resources/path/one.html",
     52            "testC=3; path=/cookies/attributes",
     53          ],
     54          expected: "testB=3; testA=3; testC=3",
     55          name: "Cookies with longer paths are listed before cookies with shorter paths",
     56          location: "/cookies/attributes/resources/path/one.html",
     57        },
     58        {
     59          cookie: [
     60            "testZ=4; path=/cookies",
     61            "testB=4; path=/cookies/attributes/resources/path",
     62            "testA=4; path=/cookies",
     63          ],
     64          expected: "testB=4; testZ=4; testA=4",
     65          name: "For equal length paths, list the cookie with an earlier creation time first",
     66          location: "/cookies/attributes/resources/path/one.html",
     67        },
     68      ];
     69 
     70      for (const test of orderingTests) {
     71        httpRedirectCookieTest(test.cookie, test.expected, test.name,
     72                               test.location);
     73      }
     74    </script>
     75  </body>
     76 </html>