toolkit/devtools/server/tests/browser/storage-updates.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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>
    13 window.addCookie = function(name, value, path, domain, expires, secure) {
    14   var 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 };
    30 window.removeCookie = function(name) {
    31   document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
    32 }
    34 window.clear = function() {
    35   var cookies = document.cookie;
    36   for (var cookie of cookies.split(";")) {
    37     removeCookie(cookie.split("=")[0]);
    38   }
    39   localStorage.clear();
    40   sessionStorage.clear();
    41 }
    42 </script>
    43 </body>
    44 </html>

mercurial