navigator-indexed.html (1070B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>Test for lack of indexed getter on Navigator</title> 4 <link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com"> 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-navigator-object"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <div id="log"></div> 9 <script> 10 test(function() { 11 assert_false("0" in window.navigator); 12 assert_equals(window.navigator[0], undefined); 13 }, "window.navigator[0] should not exist"); 14 test(function() { 15 window.navigator[0] = "pass"; 16 assert_true("0" in window.navigator); 17 assert_equals(window.navigator[0], "pass"); 18 }, "window.navigator[0] should be settable"); 19 test(function() { 20 assert_false("-1" in window.navigator); 21 assert_equals(window.navigator[-1], undefined); 22 }, "window.navigator[-1] should not exist"); 23 test(function() { 24 window.navigator[-1] = "pass"; 25 assert_true("-1" in window.navigator); 26 assert_equals(window.navigator[-1], "pass"); 27 }, "window.navigator[-1] should be settable"); 28 </script>