Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

687 B
Raw Blame
<!doctype html>
<meta charset="utf-8">
<title>NodeList (static collection) "length" getter tampered (Array.prototype.indexOf)</title>
<script src="/wpt/resources/testharness.js"></script>
<script src="/wpt/resources/testharnessreport.js"></script>
<script src="/wpt/resources/moli-wpt-adapter.js"></script>

<body>

<script src="support/NodeList-static-length-tampered-moli.js"></script>
<script>
test(() => {
    const nodeList = makeStaticNodeList(100);

    for (var i = 0; i < 50; i++) {
        if (i === 25)
            Object.setPrototypeOf(nodeList, { get length() { return 10; } });

        assert_equals(arrayIndexOfNodeList(nodeList), i >= 25 ? -1 : 50);
    }
});
</script>