cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an-s...@apache.org
Subject cordova-plugin-inappbrowser git commit: CB-8661 Return executed script result on Windows
Date Thu, 02 Apr 2015 10:31:07 GMT
Repository: cordova-plugin-inappbrowser
Updated Branches:
  refs/heads/master c85cab15b -> 16353c346


CB-8661 Return executed script result on Windows


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/commit/16353c34
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/16353c34
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/16353c34

Branch: refs/heads/master
Commit: 16353c346670980ca993633624dd4f75ba17ca94
Parents: c85cab1
Author: Vladimir Kotikov <v-vlkoti@microsoft.com>
Authored: Tue Mar 24 18:11:28 2015 +0300
Committer: Vladimir Kotikov <v-vlkoti@microsoft.com>
Committed: Thu Apr 2 13:29:00 2015 +0300

----------------------------------------------------------------------
 README.md                        |  4 ++++
 src/windows/InAppBrowserProxy.js | 10 ++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/16353c34/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 47bbac0..274dc94 100644
--- a/README.md
+++ b/README.md
@@ -349,6 +349,10 @@ The function is passed an `InAppBrowserEvent` object.
 
 - only __code__ key is supported.
 
+### Windows Quirks
+
+Due to [MSDN docs](https://msdn.microsoft.com/en-us/library/windows.ui.xaml.controls.webview.invokescriptasync.aspx)
the invoked script can return only string values, otherwise the parameter, passed to __callback__
will be `[null]`.
+
 ## insertCSS
 
 > Injects CSS into the `InAppBrowser` window.

http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/16353c34/src/windows/InAppBrowserProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/InAppBrowserProxy.js b/src/windows/InAppBrowserProxy.js
index da5eb82..d31be2d 100644
--- a/src/windows/InAppBrowserProxy.js
+++ b/src/windows/InAppBrowserProxy.js
@@ -242,7 +242,10 @@ var IAB = {
 
         if (isWebViewAvailable && browserWrap && popup) {
             var op = popup.invokeScriptAsync("eval", code);
-            op.oncomplete = function () { hasCallback && win([]); };
+            op.oncomplete = function (e) {
+                var result = [e.target.result];
+                hasCallback && win(result);
+            };
             op.onerror = function () { };
             op.start();
         }
@@ -261,7 +264,10 @@ var IAB = {
             Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).done(function
(file) {
                 Windows.Storage.FileIO.readTextAsync(file).done(function (code) {
                     var op = popup.invokeScriptAsync("eval", code);
-                    op.oncomplete = function () { hasCallback && win([]); };
+                    op.oncomplete = function(e) {
+                        var result = [e.target.result];
+                        hasCallback && win(result);
+                    };
                     op.onerror = function () { };
                     op.start();
                 });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message