CB-5021 Make it safe to call close() multiple times

This commit is contained in:
Andrew Grieve 2013-10-09 21:25:24 -04:00
parent 3d8b04f982
commit ef5eddac9a

View File

@ -30,6 +30,7 @@ function InAppBrowser() {
'loaderror' : channel.create('loaderror'), 'loaderror' : channel.create('loaderror'),
'exit' : channel.create('exit') 'exit' : channel.create('exit')
}; };
this._alive = true;
} }
InAppBrowser.prototype = { InAppBrowser.prototype = {
@ -39,7 +40,10 @@ InAppBrowser.prototype = {
} }
}, },
close: function (eventname) { close: function (eventname) {
if (this._alive) {
this._alive = false;
exec(null, null, "InAppBrowser", "close", []); exec(null, null, "InAppBrowser", "close", []);
}
}, },
show: function (eventname) { show: function (eventname) {
exec(null, null, "InAppBrowser", "show", []); exec(null, null, "InAppBrowser", "show", []);