tor-browser

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

test_writable-replaceable.html (1541B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4  <meta charset="UTF-8">
      5  <title>Test for Bug 823283</title>
      6  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      8 </head>
      9 <body>
     10 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=823283">Mozilla Bug 823283</a>
     11 <p id="display"></p>
     12 <div id="content" style="display: none"></div>
     13 <pre id="test">
     14 <script type="application/javascript">
     15 /** Test for Bug 823283 */
     16 
     17 function createTest(prop, typeStr, valCode, replaceable)
     18 {
     19  var newType = replaceable ? typeof(valCode) : typeStr;
     20  var code =
     21    'is(typeof ' + prop + ', "' + typeStr + '", "' + prop + ': bad unqualified before-state");\n' +
     22    'is(typeof window.' + prop + ', "' + typeStr + '", "' + prop + ': bad qualified before-state");\n' +
     23    '\n' +
     24    prop + ' = ' + valCode + ';\n' +
     25    '\n' +
     26    'is(typeof ' + prop + ', "' + newType + '", "' + prop + ': bad unqualified after-state");\n' +
     27    'is(typeof window.' + prop + ', "' + newType + '", "' + prop + ': bad qualified after-state");';
     28 
     29  return Function(code);
     30 }
     31 
     32 [
     33  ["innerHeight", "number", '"123"', true],
     34  ["innerWidth", "number", '"456"', true],
     35  ["outerHeight", "number", '"654"', true],
     36  ["outerWidth", "number", '"321"', true],
     37  ["screenX", "number", '"17"', true],
     38  ["screenY", "number", '"42"', true],
     39  ["status", "string", '{}', false],
     40  ["name", "string", '{}', false],
     41 ].forEach(function(args)
     42 {
     43  createTest.apply(null, args)();
     44 });
     45 
     46 </script>
     47 </pre>
     48 </body>
     49 </html>