Merge branch 'master' into 4.0.x (delete onDestroy)

Conflicts:
	framework/assets/www/cordova.js
	framework/src/org/apache/cordova/CordovaWebView.java
This commit is contained in:
Andrew Grieve 2015-01-12 10:58:00 -05:00
commit a816a48416
2 changed files with 9 additions and 10 deletions

View File

@ -1,5 +1,5 @@
// Platform: android // Platform: android
// 3b066a6856fd4d01806a332f2ab57eb7d340fe35 // 24ab6855470f2dc0662624b597c98585e56a1666
/* /*
Licensed to the Apache Software Foundation (ASF) under one Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file or more contributor license agreements. See the NOTICE file
@ -284,10 +284,16 @@ var cordova = {
if (callback) { if (callback) {
if (isSuccess && status == cordova.callbackStatus.OK) { if (isSuccess && status == cordova.callbackStatus.OK) {
callback.success && callback.success.apply(null, args); callback.success && callback.success.apply(null, args);
} else { } else if (!isSuccess) {
callback.fail && callback.fail.apply(null, args); callback.fail && callback.fail.apply(null, args);
} }
/*
else
Note, this case is intentionally not caught.
this can happen if isSuccess is true, but callbackStatus is NO_RESULT
which is used to remove a callback from the list without calling the callbacks
typically keepCallback is false in this case
*/
// Clear callback if not expecting any more results // Clear callback if not expecting any more results
if (!keepCallback) { if (!keepCallback) {
delete cordova.callbacks[callbackId]; delete cordova.callbacks[callbackId];
@ -631,7 +637,6 @@ var utils = require('cordova/utils'),
* onDeviceReady* User event fired to indicate that Cordova is ready * onDeviceReady* User event fired to indicate that Cordova is ready
* onResume User event fired to indicate a start/resume lifecycle event * onResume User event fired to indicate a start/resume lifecycle event
* onPause User event fired to indicate a pause lifecycle event * onPause User event fired to indicate a pause lifecycle event
* onDestroy* Internal event fired when app is being destroyed (User should use window.onunload event, not this one).
* *
* The events marked with an * are sticky. Once they have fired, they will stay in the fired state. * The events marked with an * are sticky. Once they have fired, they will stay in the fired state.
* All listeners that subscribe after the event is fired will be executed right away. * All listeners that subscribe after the event is fired will be executed right away.
@ -843,9 +848,6 @@ channel.create('onResume');
// Event to indicate a pause lifecycle event // Event to indicate a pause lifecycle event
channel.create('onPause'); channel.create('onPause');
// Event to indicate a destroy lifecycle event
channel.createSticky('onDestroy');
// Channels that must fire before "deviceready" is fired. // Channels that must fire before "deviceready" is fired.
channel.waitForInitialization('onCordovaReady'); channel.waitForInitialization('onCordovaReady');
channel.waitForInitialization('onDOMContentLoaded'); channel.waitForInitialization('onDOMContentLoaded');

View File

@ -630,9 +630,6 @@ public class AndroidWebView extends WebView implements CordovaWebView {
// Cancel pending timeout timer. // Cancel pending timeout timer.
loadUrlTimeout++; loadUrlTimeout++;
// Send destroy event to JavaScript
this.loadUrl("javascript:try{cordova.require('cordova/channel').onDestroy.fire();}catch(e){console.log('exception firing destroy event from native');};");
// Load blank page so that JavaScript onunload is called // Load blank page so that JavaScript onunload is called
this.loadUrl("about:blank"); this.loadUrl("about:blank");