Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: chrome/test/data/extensions/api_test/app_background_page/common/c.html

Issue 8116015: Now closes existing background contents if app opens a new one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed presubmit error (added license header to js file) Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698