Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!DOCTYPE html>
<form action="blank.html">
<select>
<option value=a>a</option>
<option value=b>b</option>
</select>
</form>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<link rel=author href="mailto:[email protected]">
<link rel=help href="https://issues.chromium.org/issues/41360677">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>

<iframe src="resources/select-restore-invalid-option-iframe.html"></iframe>

<script>
const iframe = document.querySelector('iframe');
promise_test(async () => {
await new Promise(resolve => iframe.onload = resolve);
await test_driver.bless();

iframe.contentDocument.querySelector('select').innerHTML = `
<option value=A>a</option>
<option value=B>b</option>
`;
iframe.contentDocument.querySelector('form').submit();
await new Promise(resolve => iframe.onload = resolve);
assert_equals(iframe.contentDocument.querySelector('select'), null,
'There should not be a select element on the blank page.');

await test_driver.bless();
iframe.contentWindow.history.back();
await new Promise(resolve => iframe.onload = resolve);
await new Promise(requestAnimationFrame);
await new Promise(requestAnimationFrame);

assert_equals(iframe.contentDocument.querySelector('select').value, 'a',
'The selects value should be reset after navigating back.');
}, 'The select element should reset to its initial state when restoring a mismatched value.');
</script>