[ 
https://issues.apache.org/jira/browse/CB-5664?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Godric Kwok updated CB-5664:
----------------------------

    Description: 
Expected Behavior:
1) AppCache is checked only *once* per App startup.

Observed Behavior:
1) AppCache is checked *multiple times* randomly per App startup.

Steps to repeat:
1) console.log() AppCache's "checking" event.
2) Start App, see "checking" once.
3) *navigator.app.exitApp()*, then re-launches App.
4) First relaunch leads to a single "checking" still.
5) Repeat the relaunch *a few times*.
6) Then you'll see sometimes it's a double, a triple, or a quadruple (but never 
5x).
7) Only a *"KILL"* from task switcher will reset these accumulations.

Unwanted Results:
1) Multiple "checking" triggers multiple subsequent events (download, 
updateready, etc...) that renders the App slow.
2) Multiple "updateready" triggers multiple swapCache()/reload() that renders 
the App appeared broken.

Code Snippet:

document.addEventListener('deviceready', function(){

function logEvent(event) {
        console.log('appcache: '+event.type);
}

window.applicationCache.addEventListener('checking', logEvent, false);
window.applicationCache.addEventListener('noupdate', logEvent, false);
window.applicationCache.addEventListener('downloading', logEvent, false);
window.applicationCache.addEventListener('progress', logEvent, false);
window.applicationCache.addEventListener('cached', logEvent, false);
window.applicationCache.addEventListener('updateready', logEvent, false);
window.applicationCache.addEventListener('obsolete', logEvent, false);
window.applicationCache.addEventListener('error', logEvent, false);

document.addEventListener('backbutton', function(){
        navigator.app.exitApp();
}, false);

}, false);

LogCat pattern:
*(1x)*
12-17 21:11:13.470: I/Web Console(2142): appcache: checking:23
12-17 21:11:13.478: I/Web Console(2142): appcache: noupdate:23
*(1x updateready)*
12-17 21:11:47.775: I/Web Console(2142): appcache: checking:23
12-17 21:11:50.072: I/Web Console(2142): appcache: downloading:23
12-17 21:11:50.072: I/Web Console(2142): appcache: progress:23
12-17 21:11:50.166: I/Web Console(2142): appcache: progress:23
12-17 21:11:50.197: I/Web Console(2142): appcache: progress:23
12-17 21:11:50.697: I/Web Console(2142): appcache: progress:23
12-17 21:11:50.697: I/Web Console(2142): appcache: progress:23
12-17 21:11:50.697: I/Web Console(2142): appcache: updateready:23
12-17 21:11:50.697: I/Web Console(2142): appcache: updateready:23
*(2x)*
12-17 21:12:27.283: I/Web Console(2142): appcache: checking:23
12-17 21:12:27.283: I/Web Console(2142): appcache: checking:23
12-17 21:12:29.759: I/Web Console(2142): appcache: noupdate:23
12-17 21:12:29.759: I/Web Console(2142): appcache: noupdate:23
*(2x)*
12-17 21:12:35.447: I/Web Console(2142): appcache: checking:23
12-17 21:12:35.447: I/Web Console(2142): appcache: checking:23
12-17 21:12:38.025: I/Web Console(2142): appcache: noupdate:23
12-17 21:12:38.025: I/Web Console(2142): appcache: noupdate:23
*(3x)*
12-17 21:12:45.322: I/Web Console(2142): appcache: checking:23
12-17 21:12:45.322: I/Web Console(2142): appcache: checking:23
12-17 21:12:45.322: I/Web Console(2142): appcache: checking:23
12-17 21:12:47.345: I/Web Console(2142): appcache: noupdate:23
12-17 21:12:47.345: I/Web Console(2142): appcache: noupdate:23
12-17 21:12:47.345: I/Web Console(2142): appcache: noupdate:23


  was:
Expected Behavior:
1) AppCache is checked only *once* per App startup.

Observed Behavior:
1) AppCache is checked *multiple times* randomly per App startup.

Steps to repeat:
1) console.log() AppCache's "checking" event.
2) Start App, see "checking" once.
3) navigator.app.exitApp(), then re-launches App.
4) First relaunch leads to a single "checking" still.
5) Repeat the relaunch a few times.
6) Then you'll see sometimes it's a double, a triple, or a quadruple (but never 
5x).
7) Only a "KILL" from task switcher will reset these accumulations.

Unwanted Results:
1) Multiple "checking" triggers multiple subsequent events (download, 
updateready, etc...) that renders the App slow.
2) Multiple "updateready" triggers multiple swapCache()/reload() that renders 
the App appeared broken.

Code Snippet:

document.addEventListener('deviceready', function(){

function logEvent(event) {
        console.log('appcache: '+event.type);
}

window.applicationCache.addEventListener('checking', logEvent, false);
window.applicationCache.addEventListener('noupdate', logEvent, false);
window.applicationCache.addEventListener('downloading', logEvent, false);
window.applicationCache.addEventListener('progress', logEvent, false);
window.applicationCache.addEventListener('cached', logEvent, false);
window.applicationCache.addEventListener('updateready', logEvent, false);
window.applicationCache.addEventListener('obsolete', logEvent, false);
window.applicationCache.addEventListener('error', logEvent, false);

document.addEventListener('backbutton', function(){
        navigator.app.exitApp();
}, false);

}, false);

LogCat pattern:
*(1x)*
12-17 21:11:13.470: I/Web Console(2142): appcache: checking:23
12-17 21:11:13.478: I/Web Console(2142): appcache: noupdate:23
*(1x updateready)*
12-17 21:11:47.775: I/Web Console(2142): appcache: checking:23
12-17 21:11:50.072: I/Web Console(2142): appcache: downloading:23
12-17 21:11:50.072: I/Web Console(2142): appcache: progress:23
12-17 21:11:50.166: I/Web Console(2142): appcache: progress:23
12-17 21:11:50.197: I/Web Console(2142): appcache: progress:23
12-17 21:11:50.697: I/Web Console(2142): appcache: progress:23
12-17 21:11:50.697: I/Web Console(2142): appcache: progress:23
12-17 21:11:50.697: I/Web Console(2142): appcache: updateready:23
12-17 21:11:50.697: I/Web Console(2142): appcache: updateready:23
*(2x)*
12-17 21:12:27.283: I/Web Console(2142): appcache: checking:23
12-17 21:12:27.283: I/Web Console(2142): appcache: checking:23
12-17 21:12:29.759: I/Web Console(2142): appcache: noupdate:23
12-17 21:12:29.759: I/Web Console(2142): appcache: noupdate:23
*(2x)*
12-17 21:12:35.447: I/Web Console(2142): appcache: checking:23
12-17 21:12:35.447: I/Web Console(2142): appcache: checking:23
12-17 21:12:38.025: I/Web Console(2142): appcache: noupdate:23
12-17 21:12:38.025: I/Web Console(2142): appcache: noupdate:23
*(3x)*
12-17 21:12:45.322: I/Web Console(2142): appcache: checking:23
12-17 21:12:45.322: I/Web Console(2142): appcache: checking:23
12-17 21:12:45.322: I/Web Console(2142): appcache: checking:23
12-17 21:12:47.345: I/Web Console(2142): appcache: noupdate:23
12-17 21:12:47.345: I/Web Console(2142): appcache: noupdate:23
12-17 21:12:47.345: I/Web Console(2142): appcache: noupdate:23



> AppCache's "checking" event fired more than once per App startup.
> -----------------------------------------------------------------
>
>                 Key: CB-5664
>                 URL: https://issues.apache.org/jira/browse/CB-5664
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 3.3.0
>         Environment: Android 4.1.2 (SDK 16)
>            Reporter: Godric Kwok
>
> Expected Behavior:
> 1) AppCache is checked only *once* per App startup.
> Observed Behavior:
> 1) AppCache is checked *multiple times* randomly per App startup.
> Steps to repeat:
> 1) console.log() AppCache's "checking" event.
> 2) Start App, see "checking" once.
> 3) *navigator.app.exitApp()*, then re-launches App.
> 4) First relaunch leads to a single "checking" still.
> 5) Repeat the relaunch *a few times*.
> 6) Then you'll see sometimes it's a double, a triple, or a quadruple (but 
> never 5x).
> 7) Only a *"KILL"* from task switcher will reset these accumulations.
> Unwanted Results:
> 1) Multiple "checking" triggers multiple subsequent events (download, 
> updateready, etc...) that renders the App slow.
> 2) Multiple "updateready" triggers multiple swapCache()/reload() that renders 
> the App appeared broken.
> Code Snippet:
> document.addEventListener('deviceready', function(){
> function logEvent(event) {
>       console.log('appcache: '+event.type);
> }
> window.applicationCache.addEventListener('checking', logEvent, false);
> window.applicationCache.addEventListener('noupdate', logEvent, false);
> window.applicationCache.addEventListener('downloading', logEvent, false);
> window.applicationCache.addEventListener('progress', logEvent, false);
> window.applicationCache.addEventListener('cached', logEvent, false);
> window.applicationCache.addEventListener('updateready', logEvent, false);
> window.applicationCache.addEventListener('obsolete', logEvent, false);
> window.applicationCache.addEventListener('error', logEvent, false);
> document.addEventListener('backbutton', function(){
>       navigator.app.exitApp();
> }, false);
> }, false);
> LogCat pattern:
> *(1x)*
> 12-17 21:11:13.470: I/Web Console(2142): appcache: checking:23
> 12-17 21:11:13.478: I/Web Console(2142): appcache: noupdate:23
> *(1x updateready)*
> 12-17 21:11:47.775: I/Web Console(2142): appcache: checking:23
> 12-17 21:11:50.072: I/Web Console(2142): appcache: downloading:23
> 12-17 21:11:50.072: I/Web Console(2142): appcache: progress:23
> 12-17 21:11:50.166: I/Web Console(2142): appcache: progress:23
> 12-17 21:11:50.197: I/Web Console(2142): appcache: progress:23
> 12-17 21:11:50.697: I/Web Console(2142): appcache: progress:23
> 12-17 21:11:50.697: I/Web Console(2142): appcache: progress:23
> 12-17 21:11:50.697: I/Web Console(2142): appcache: updateready:23
> 12-17 21:11:50.697: I/Web Console(2142): appcache: updateready:23
> *(2x)*
> 12-17 21:12:27.283: I/Web Console(2142): appcache: checking:23
> 12-17 21:12:27.283: I/Web Console(2142): appcache: checking:23
> 12-17 21:12:29.759: I/Web Console(2142): appcache: noupdate:23
> 12-17 21:12:29.759: I/Web Console(2142): appcache: noupdate:23
> *(2x)*
> 12-17 21:12:35.447: I/Web Console(2142): appcache: checking:23
> 12-17 21:12:35.447: I/Web Console(2142): appcache: checking:23
> 12-17 21:12:38.025: I/Web Console(2142): appcache: noupdate:23
> 12-17 21:12:38.025: I/Web Console(2142): appcache: noupdate:23
> *(3x)*
> 12-17 21:12:45.322: I/Web Console(2142): appcache: checking:23
> 12-17 21:12:45.322: I/Web Console(2142): appcache: checking:23
> 12-17 21:12:45.322: I/Web Console(2142): appcache: checking:23
> 12-17 21:12:47.345: I/Web Console(2142): appcache: noupdate:23
> 12-17 21:12:47.345: I/Web Console(2142): appcache: noupdate:23
> 12-17 21:12:47.345: I/Web Console(2142): appcache: noupdate:23



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to