dom/tests/mochitest/localstorage/test_storageConstructor.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <html xmlns="http://www.w3.org/1999/xhtml">
     2 <head>
     3 <title>Storage interface</title>
     5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     8 <script type="text/javascript">
    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();
    24   SimpleTest.finish();
    25 }
    27 SimpleTest.waitForExplicitFinish();
    29 </script>
    31 </head>
    33 <body onload="startTest();">
    34 </body>
    35 </html>

mercurial