cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject js commit: [CB-2641] InAppBrowser launched incorrectly when window.open called on iframes
Date Thu, 28 Mar 2013 22:55:40 GMT
Updated Branches:
  refs/heads/master ecd08f25c -> 5a6b48aeb


[CB-2641] InAppBrowser launched incorrectly when window.open called on iframes


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/5a6b48ae
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/5a6b48ae
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/5a6b48ae

Branch: refs/heads/master
Commit: 5a6b48aeb03cd11191ba688b9e7ad45c25227875
Parents: ecd08f2
Author: Shazron Abdullah <shazron@apache.org>
Authored: Thu Mar 28 15:55:38 2013 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Thu Mar 28 15:55:38 2013 -0700

----------------------------------------------------------------------
 lib/common/plugin/InAppBrowser.js |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5a6b48ae/lib/common/plugin/InAppBrowser.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/InAppBrowser.js b/lib/common/plugin/InAppBrowser.js
index 618befd..e2eaf0f 100644
--- a/lib/common/plugin/InAppBrowser.js
+++ b/lib/common/plugin/InAppBrowser.js
@@ -29,6 +29,7 @@ function InAppBrowser() {
         'loaderror' : channel.create('loaderror'),
         'exit' : channel.create('exit')
    };
+   this.originalWindowOpen = window.open;
 }
 
 InAppBrowser.prototype = {
@@ -85,7 +86,12 @@ module.exports = function(strUrl, strWindowName, strWindowFeatures) {
     var cb = function(eventname) {
        iab._eventHandler(eventname);
     };
-    exec(cb, cb, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]);
-    return iab;
+
+    if (window.frames && window.frames[strWindowName]) {
+        return this.originalWindowOpen(strUrl, strWindowName, strWindowFeatures);
+    } else {
+        exec(cb, cb, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]);
+        return iab;
+    }
 };
 


Mime
View raw message