tor-browser

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

test_storageConstructor.html (904B)


      1 <html xmlns="http://www.w3.org/1999/xhtml">
      2 <head>
      3 <title>Storage interface</title>
      4 
      5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      7 
      8 <script type="text/javascript">
      9 
     10 function startTest()
     11 {
     12  var functionCalled = false;
     13  is(localStorage instanceof Storage, true, "localStorage is instance of Storage");
     14  Storage.prototype.exists = function(key) {
     15    functionCalled = true;
     16    return this.getItem(key) != null;
     17  }
     18  localStorage.setItem("test_prototype", "value");
     19  is(functionCalled, false, "Overridden function not called");
     20  is(localStorage.exists("test_prototype"), true, "Prototype overridden");
     21  is(functionCalled, true, "Overridden function called");
     22  localStorage.clear();
     23  
     24  SimpleTest.finish();
     25 }
     26 
     27 SimpleTest.waitForExplicitFinish();
     28 
     29 </script>
     30 
     31 </head>
     32 
     33 <body onload="startTest();">
     34 </body>
     35 </html>