<!DOCTYPE html>
<title>Test changing focus inside plugin onblur event</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<input id="input1" type="text" onfocus="i1Focus()" onblur="i1Blur()"></input>
<input id="input2" type="text" onfocus="i2Focus()" onblur="i2Blur()"></input>
<input id="input3" type="text" onfocus="i3Focus()" onblur="i3Blur()"></input>
<embed id="plugin" type="application/x-webkit-test-webplugin" onfocus="pFocus()" onblur="pBlur()"></embed>
<script>
let events = [];
function i1Focus() { events.push('i1focus'); }
function i1Blur() { events.push('i1blur'); }
function i2Focus() { events.push('i2focus'); }
function i2Blur() { events.push('i2blur'); }
function i3Focus() { events.push('i3focus'); }
function i3Blur() { events.push('i3blur'); }
function pFocus() { events.push('pfocus'); }
function pBlur() {
events.push('pblur-change-2');
document.getElementById('input2').focus();
}
async_test(t => {
function finish() {
assert_array_equals(events, ["i1focus","i1blur","pfocus","pblur-change-2","i2focus"]);
t.done();
}
document.getElementById('input1').focus();
document.getElementById('plugin').focus();
document.getElementById('input3').focus();
t.step_timeout(finish, 0);
},"Test plugin focus behavior");
</script>