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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 Bug 965872 - Storage inspector actor with cookies, local storage and session storage.
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <meta charset="utf-8">
michael@0 8 <title>Storage inspector blank html for tests</title>
michael@0 9 </head>
michael@0 10 <body>
michael@0 11 <script>
michael@0 12
michael@0 13 window.addCookie = function(name, value, path, domain, expires, secure) {
michael@0 14 var cookieString = name + "=" + value + ";";
michael@0 15 if (path) {
michael@0 16 cookieString += "path=" + path + ";";
michael@0 17 }
michael@0 18 if (domain) {
michael@0 19 cookieString += "domain=" + domain + ";";
michael@0 20 }
michael@0 21 if (expires) {
michael@0 22 cookieString += "expires=" + expires + ";";
michael@0 23 }
michael@0 24 if (secure) {
michael@0 25 cookieString += "secure=true;";
michael@0 26 }
michael@0 27 document.cookie = cookieString;
michael@0 28 };
michael@0 29
michael@0 30 window.removeCookie = function(name) {
michael@0 31 document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
michael@0 32 }
michael@0 33
michael@0 34 window.clear = function() {
michael@0 35 var cookies = document.cookie;
michael@0 36 for (var cookie of cookies.split(";")) {
michael@0 37 removeCookie(cookie.split("=")[0]);
michael@0 38 }
michael@0 39 localStorage.clear();
michael@0 40 sessionStorage.clear();
michael@0 41 }
michael@0 42 </script>
michael@0 43 </body>
michael@0 44 </html>

mercurial