blob: aa7a64398f8b9a7236d3cd0fe9f753ef70deb9cd [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<form id=f action="interactive-validation-remove-node-in-handler.html">
<input type=hidden name=submitted value="true">
<input name=i0 required id="i0">
<input type=submit id="s">
</form>
<script>
description('Should not crash or have an assertion failure if a node was removed during an "invalid" event dispatching for the node.');
function gc() {
if (window.GCController)
return GCController.collect();
for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
var s = new String("");
}
}
function handler(event) {
var node = event.target;
node.parentNode.removeChild(node);
gc();
}
function startOrVerify() {
document.getElementById('i0').addEventListener('invalid', handler, false);
var query = window.location.search;
if (query.indexOf('submitted=true') != -1) {
testPassed('The form was submitted.');
debug('TEST COMPLETE');
if (window.layoutTestController)
layoutTestController.notifyDone();
} else {
// HTMLFormElement::submit() skips validation. Use the submit button.
document.getElementById('s').click();
// Should have no assertion failures.
testFailed('The form should be submitted.');
}
}
if (window.layoutTestController)
layoutTestController.waitUntilDone();
window.onload = startOrVerify;
</script>
</body>
</html>