<script src="common.js"></script>
<h1 id="status">Page A</h1>
<div style="display:none" id="pageToScriptTunnel"></div>
<div style="display:none" id="scriptToPageTunnel"></div>
<script>
var backgroundWindow;
window.onload = function() {
setupScriptTunnel();
backgroundWindow = window.open('bg.html', 'bg', 'background');
if (backgroundWindow) {
setStatus('background page opened');
} else {
notifyBackgroundPagePermissionDenied();
setStatus('background page permission denied');
}
}
function onBackgroundPageLoaded() {
if (!backgroundWindow.checkAndIncrementCounter(0)) {
notifyCounterError();
return;
}
setStatus('background page loaded');
notifyBackgroundPageLoaded();
}
</script>