<html>
<head>
    <title>Submit</title>
    <style type="text/css">
    h2 {
        display: none;
        
    }
    #pass {
        background: #0f0;
    }
    #fail {
        background: Red;
    }
    </style>
</head>
<body onload="test()">
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=20184">bug 20184</a>:
SELECT with no name generates invalid query string.</p>
<form action="">
<select><option disabled>invalid</option></select>
<select><option disabled></option></select>

<input type='hidden' id="done" name="done" value="true"/>
<input type="hidden" id="id" name="id" value="123"/>
</form>
<h2 id="pass">PASS</h2>
<h2 id="fail">FAIL</h2>
<script type="text/javascript">
if (window.testRunner) {
    testRunner.waitUntilDone();
    testRunner.dumpAsText();
}

function test() {
    var id = document.getElementById('id');
    
    // Options with "disabled" or "invalid" value
    // are are failures here.
    if(location.search && /invalid|disabled/.test(location.search)) {
      document.getElementById("fail").style.display = "inline-block";
    } else {
        if(location.search) {
            var m = location.search.match(/id=(\d+)/);
            if(m && m[1]) {
                id.value = m[1];
            } else {
                id.disabled = true;
            }
        } else id.disabled = true;
        
        if(!/done=true/.test(location.search)) {
            document.forms[0].submit();
            return;
        } 
        document.getElementById("pass").style.display = "inline-block";
    }
    if (window.testRunner)
        testRunner.notifyDone();
};
</script>
<p>
<a href="javascript:history.back();">reload</a>
</p>
</body>
</html>
