blob: 789191fc4f945018439be8817026bc8d3c8bc6a5 [file] [log] [blame]
<html>
<script>
function tabsocketTest() {
// Unfortunately, the order in which
// HeadlessRenderFrameControllerImpl::DidCreateScriptContext and
// HeadlessRenderFrameControllerImpl::InstallMainWorldTabSocket are called
// is non-deterministic. This means the TabSocket might not have been
// installed yet. If that happens just try again a bit later.
if (window.hasOwnProperty('TabSocket')) {
window.TabSocket.send('Hello world!');
window.TabSocket.onmessage = function(message) {
window.TabSocket.send('Embedder sent us: ' + message);
};
} else {
setTimeout(tabsocketTest, 1);
}
}
tabsocketTest();
</script>
</html>