<p>This tests for a crash when adding/removing content from a search field that is inside an editable region.</p>

<div contenteditable="true"><input id="search" type="search"></div>
<ul id="console"></ul>

<script>
function log(msg)
{
    li = document.createElement("li");
    li.appendChild(document.createTextNode(msg));
    document.getElementById("console").appendChild(li);
}

if (window.testRunner)
    window.testRunner.dumpAsText();
    
var search = document.getElementById("search");
search.setSelectionRange(0, 0);
document.execCommand("InsertText", false, "x");
if (search.value != "x")
    log("Failure: text wasn't added to the search field.");
document.execCommand("Delete");
if (search.value == "")
    log("Success! Test successfully removed text from the search field.");
</script>
