storage-updates.html (1095B)
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) { 31 document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"; 32 }; 33 34 window.clearLocalAndSessionStores = function() { 35 localStorage.clear(); 36 sessionStorage.clear(); 37 }; 38 39 window.clearCookies = function() { 40 const cookies = document.cookie; 41 for (const cookie of cookies.split(";")) { 42 window.removeCookie(cookie.split("=")[0]); 43 } 44 }; 45 </script> 46 </body> 47 </html>