NodeList-static-length-getter-tampered-3.html (630B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <meta name=timeout content=long> 4 <title>NodeList (static collection) "length" getter tampered</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 8 <body> 9 10 <script src="support/NodeList-static-length-tampered.js"></script> 11 <script> 12 test(() => { 13 const nodeList = makeStaticNodeList(100); 14 15 for (var i = 0; i < 50; i++) { 16 if (i === 25) 17 Object.defineProperty(NodeList.prototype, "length", { get() { return 10; } }); 18 19 assert_equals(indexOfNodeList(nodeList), i >= 25 ? -1 : 50); 20 } 21 }); 22 </script>