<!DOCTYPE html>
<html>
<head>
<style>
input:default {
    color: red;
}
</style>
</head>
<body>
<table>
<form><input type="submit"></form>
</table>
<p>This test passes if we avoid crashing, and if the green text "PASS" appears. This test requires DumpRenderTree or WebKitTestRunner.</p>
</body>
<script>
if (window.testRunner) {
    testRunner.waitUntilDone();
    testRunner.dumpAsText();
}

document.addEventListener("DOMContentLoaded", () => {
    let currentIteration = 1;
    const href = location.href;
    const index = href.lastIndexOf("#");
    if (index !== -1)
        currentIteration = parseInt(href.substring(index + 1));

    if (currentIteration === 5) {
        document.writeln("<pre style='color: green'>PASS</pre>");
        if (window.testRunner)
            testRunner.notifyDone();
        return;
    }

    if (window.GCController)
        GCController.collect();

    location.href = `${href.substring(0, index)}#${currentIteration + 1}`;
    location.reload();
}, false);
</script>
</html>
