tor-browser

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

storage-updates.html (1975B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 Bug 965872 - Storage inspector actor with cookies, local storage and session storage.
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Storage inspector blank html for tests</title>
      9 </head>
     10 <body>
     11 <script type="application/javascript">
     12 "use strict";
     13 window.addCookie = function(name, value, path, domain, expires, secure) {
     14  let cookieString = name + "=" + value + ";";
     15  if (path) {
     16    cookieString += "path=" + path + ";";
     17  }
     18  if (domain) {
     19    cookieString += "domain=" + domain + ";";
     20  }
     21  if (expires) {
     22    cookieString += "expires=" + expires + ";";
     23  }
     24  if (secure) {
     25    cookieString += "secure=true;";
     26  }
     27  document.cookie = cookieString;
     28 };
     29 
     30 window.removeCookie = function(name, path) {
     31  document.cookie =
     32    name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=" + path;
     33 };
     34 
     35 /**
     36 * We keep this method here even though these items are automatically cleared
     37 * after the test is complete. this is so that the store-objects-cleared event
     38 * can be tested.
     39 */
     40 window.clear = function() {
     41  localStorage.clear();
     42  dump("removed localStorage from " + document.location + "\n");
     43 
     44  sessionStorage.clear();
     45  dump("removed sessionStorage from " + document.location + "\n");
     46 };
     47 
     48 window.onload = function() {
     49  window.addCookie("c1", "1.2.3.4.5.6.7", "/browser");
     50  window.addCookie("c2", "foobar", "/browser");
     51 
     52  // Some keys have to be set to strings that JSON.parse can parse successfully
     53  // instead of throwings (to verify the issue fixed by Bug 1578447 doesn't regress).
     54  localStorage.setItem("1", "testing");
     55  localStorage.setItem("2", "testing");
     56  localStorage.setItem("3", "testing");
     57  localStorage.setItem("4", "testing");
     58  localStorage.setItem("5", "testing");
     59  localStorage.setItem("null", "testing");
     60  localStorage.setItem("non-json-parsable", "testing");
     61 
     62  sessionStorage.setItem("ss1", "foobar");
     63  sessionStorage.setItem("ss2", "foobar");
     64  sessionStorage.setItem("ss3", "foobar");
     65 };
     66 </script>
     67 </body>
     68 </html>