OLD | NEW |
(Empty) | |
| 1 <script src="common.js"></script> |
| 2 <h1 id="status">Page C</h1> |
| 3 <div style="display:none" id="pageToScriptTunnel"></div> |
| 4 <div style="display:none" id="scriptToPageTunnel"></div> |
| 5 |
| 6 <script> |
| 7 var backgroundWindow; |
| 8 |
| 9 window.onload = function() { |
| 10 setupScriptTunnel(); |
| 11 // Note we are using a different window name than a.html so this should open |
| 12 // a different background page. |
| 13 backgroundWindow = window.open('bg.html', 'bg2', 'background'); |
| 14 if (backgroundWindow) { |
| 15 setStatus('background page opened'); |
| 16 } else { |
| 17 notifyBackgroundPagePermissionDenied(); |
| 18 setStatus('background page permission denied'); |
| 19 } |
| 20 } |
| 21 |
| 22 function onBackgroundPageLoaded() { |
| 23 if (!backgroundWindow.checkAndIncrementCounter(0)) { |
| 24 notifyCounterError(); |
| 25 return; |
| 26 } |
| 27 |
| 28 setStatus('background page loaded'); |
| 29 notifyBackgroundPageLoaded(); |
| 30 } |
| 31 </script> |
OLD | NEW |