blob: c4823619cf62529ac37efd0914cb3256a0fca3d9 [file] [log] [blame]
<html>
<body>
<div contenteditable></div>
<script>
// Notify opener.
window.onpageshow = function() { opener.postMessage('first-page', '*'); }
// Our opener will tell us to perform various loads.
window.addEventListener('message', function(event) {
// Navigate to other page.
if (event.data === 'navigate-other-page') {
window.location = 'other-page.html';
return;
}
if (event.data === 'add-unconfirmed-text') {
textInputController.setMarkedText("test", 0, 4);
return;
}
if (event.data === 'has-marked-text') {
var result;
// DumpRenderTree does not restore textInputController after navigating back.
// FIXME: Fix textInputController to work in restored pages.
try {
// Workaround for a DRT vs. WTR difference - one returns a number, and another a boolean.
// FIXME: Fix the tools instead of working around the difference.
result = textInputController.hasMarkedText() ? "1" : "0";
} catch (ex) {
result = ex;
}
opener.postMessage('has-marked-text: ' + result, '*');
return;
}
}, false);
var input = document.getElementsByTagName("div")[0];
input.focus();
</script>
</body>
</html>