Updated Branches: refs/heads/2.9.x af4bcf4b4 -> f911603c6
Pull in InAppBrowser.js changes from cordova-plugin-inappbrowser@aa81c3267a5b1c337b09933ff5ceb06a93f9dbb7 Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/da697377 Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/da697377 Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/da697377 Branch: refs/heads/2.9.x Commit: da697377ab73ec62c75c0ea240d5878c9474c872 Parents: af4bcf4 Author: Andrew Grieve <[email protected]> Authored: Tue Oct 22 16:39:24 2013 -0400 Committer: Andrew Grieve <[email protected]> Committed: Tue Oct 22 16:39:24 2013 -0400 ---------------------------------------------------------------------- lib/common/plugin/InAppBrowser.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-js/blob/da697377/lib/common/plugin/InAppBrowser.js ---------------------------------------------------------------------- diff --git a/lib/common/plugin/InAppBrowser.js b/lib/common/plugin/InAppBrowser.js index 5da53fd..3fe9261 100644 --- a/lib/common/plugin/InAppBrowser.js +++ b/lib/common/plugin/InAppBrowser.js @@ -22,6 +22,7 @@ var exec = require('cordova/exec'); var channel = require('cordova/channel'); var modulemapper = require('cordova/modulemapper'); +var urlutil = require('cordova/urlutil'); function InAppBrowser() { this.channels = { @@ -30,6 +31,7 @@ function InAppBrowser() { 'loaderror' : channel.create('loaderror'), 'exit' : channel.create('exit') }; + this._alive = true; } InAppBrowser.prototype = { @@ -39,7 +41,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", []); @@ -77,17 +82,18 @@ InAppBrowser.prototype = { }; module.exports = function(strUrl, strWindowName, strWindowFeatures) { - var iab = new InAppBrowser(); - var cb = function(eventname) { - iab._eventHandler(eventname); - }; - // Don't catch calls that write to existing frames (e.g. named iframes). if (window.frames && window.frames[strWindowName]) { var origOpenFunc = modulemapper.getOriginalSymbol(window, 'open'); return origOpenFunc.apply(window, arguments); } + strUrl = urlutil.makeAbsolute(strUrl); + var iab = new InAppBrowser(); + var cb = function(eventname) { + iab._eventHandler(eventname); + }; + exec(cb, cb, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]); return iab; };
