From ef5eddac9add2200e91a846cdea9e54d66b66074 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Wed, 9 Oct 2013 21:25:24 -0400 Subject: [PATCH] CB-5021 Make it safe to call close() multiple times --- www/InAppBrowser.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/www/InAppBrowser.js b/www/InAppBrowser.js index 5da53fd..83f5a22 100644 --- a/www/InAppBrowser.js +++ b/www/InAppBrowser.js @@ -30,6 +30,7 @@ function InAppBrowser() { 'loaderror' : channel.create('loaderror'), 'exit' : channel.create('exit') }; + this._alive = true; } InAppBrowser.prototype = { @@ -39,7 +40,10 @@ InAppBrowser.prototype = { } }, close: function (eventname) { - exec(null, null, "InAppBrowser", "close", []); + if (this._alive) { + this._alive = false; + exec(null, null, "InAppBrowser", "close", []); + } }, show: function (eventname) { exec(null, null, "InAppBrowser", "show", []);