You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sg...@apache.org on 2014/11/13 07:39:09 UTC
[1/6] cordova-plugin-inappbrowser git commit: CB-7695 Fix
InAppBrowser injectScriptFile for Windows 8.1 / Windows Phone 8.1
Repository: cordova-plugin-inappbrowser
Updated Branches:
refs/heads/master 70d74e527 -> e785533ab
CB-7695 Fix InAppBrowser injectScriptFile for Windows 8.1 / Windows Phone 8.1
Changed injects' paths to include parent folder
Used getFileFromApplicationUriAsync
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/71b43d39
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/71b43d39
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/71b43d39
Branch: refs/heads/master
Commit: 71b43d39a43cc25a9f5e08a8bbdbb447a10237e3
Parents: d2eaa08
Author: daserge <da...@yandex.ru>
Authored: Wed Oct 15 03:07:15 2014 +0400
Committer: sgrebnov <v-...@microsoft.com>
Committed: Wed Nov 12 22:35:09 2014 -0800
----------------------------------------------------------------------
src/windows/InAppBrowserProxy.js | 23 ++++++++++++++++-------
tests/tests.js | 7 +++++--
2 files changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/71b43d39/src/windows/InAppBrowserProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/InAppBrowserProxy.js b/src/windows/InAppBrowserProxy.js
index 68b5f59..1d17bc5 100644
--- a/src/windows/InAppBrowserProxy.js
+++ b/src/windows/InAppBrowserProxy.js
@@ -25,7 +25,8 @@
var cordova = require('cordova'),
- channel = require('cordova/channel');
+ channel = require('cordova/channel'),
+ urlutil = require('cordova/urlutil');
var browserWrap,
popup;
@@ -142,16 +143,24 @@ var IAB = {
op.start();
}
},
+
injectScriptFile: function (win, fail, args) {
- var file = args[0],
+ var filePath = args[0],
hasCallback = args[1];
+ if (!!filePath) {
+ filePath = urlutil.makeAbsolute(filePath);
+ }
+
if (isWebViewAvailable && browserWrap && popup) {
- Windows.Storage.FileIO.readTextAsync(file).done(function (code) {
- var op = popup.invokeScriptAsync("eval", code);
- op.oncomplete = function () { hasCallback && win([]); };
- op.onerror = function () { };
- op.start();
+ var uri = new Windows.Foundation.Uri(filePath);
+ 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.onerror = function () { };
+ op.start();
+ });
});
}
}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/71b43d39/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index a48ffa6..4a9e5ef 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -19,6 +19,9 @@
*
*/
+var cordova = require('cordova');
+var isWindows = cordova.platformId == 'windows';
+
window.alert = window.alert || navigator.notification.alert;
exports.defineManualTests = function (contentEl, createActionButton) {
@@ -306,8 +309,8 @@ exports.defineManualTests = function (contentEl, createActionButton) {
var localhtml = basePath + 'local.html',
localpdf = basePath + 'local.pdf',
injecthtml = basePath + 'inject.html',
- injectjs = 'inject.js',
- injectcss = 'inject.css',
+ injectjs = isWindows ? basePath + 'inject.js' : 'inject.js',
+ injectcss = isWindows ? basePath + 'inject.css' : 'inject.css',
videohtml = basePath + 'video.html';
//Local
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[3/6] cordova-plugin-inappbrowser git commit: CB-7692 InAppBrowser
local url opening bug in 8.1
Posted by sg...@apache.org.
CB-7692 InAppBrowser local url opening bug in 8.1
Using ms-appx-web instead of ms-appx
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/d2eaa089
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/d2eaa089
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/d2eaa089
Branch: refs/heads/master
Commit: d2eaa089f84480db44dc2809a92bf24794988afd
Parents: 1bf42c9
Author: daserge <da...@yandex.ru>
Authored: Wed Oct 15 02:52:28 2014 +0400
Committer: sgrebnov <v-...@microsoft.com>
Committed: Wed Nov 12 22:35:09 2014 -0800
----------------------------------------------------------------------
src/windows/InAppBrowserProxy.js | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/d2eaa089/src/windows/InAppBrowserProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/InAppBrowserProxy.js b/src/windows/InAppBrowserProxy.js
index dd4b0a0..68b5f59 100644
--- a/src/windows/InAppBrowserProxy.js
+++ b/src/windows/InAppBrowserProxy.js
@@ -88,7 +88,10 @@ var IAB = {
if (target === "_system") {
url = new Windows.Foundation.Uri(strUrl);
Windows.System.Launcher.launchUriAsync(url);
- } else if (target === "_blank") {
+ } else if (target === "_self" || !target) {
+ window.location = strUrl;
+ } else {
+ // "_blank" or anything else
if (!browserWrap) {
browserWrap = document.createElement("div");
browserWrap.style.position = "absolute";
@@ -115,15 +118,16 @@ var IAB = {
popup.style.borderWidth = "0px";
popup.style.width = "100%";
popup.style.height = "100%";
+
+ if (isWebViewAvailable) {
+ strUrl = strUrl.replace("ms-appx://", "ms-appx-web://");
+ }
popup.src = strUrl;
// start listening for navigation events
attachNavigationEvents(popup, win);
browserWrap.appendChild(popup);
-
- } else {
- window.location = strUrl;
}
},
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[4/6] cordova-plugin-inappbrowser git commit: CB-7690 InAppBrowser
loadstart/loadstop events issues
Posted by sg...@apache.org.
CB-7690 InAppBrowser loadstart/loadstop events issues
Subscribing to events before navigating
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/3f80b0b5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/3f80b0b5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/3f80b0b5
Branch: refs/heads/master
Commit: 3f80b0b59c4ec45141fd66b2d723e427e2ca53ad
Parents: 71b43d3
Author: daserge <da...@yandex.ru>
Authored: Wed Oct 15 03:23:26 2014 +0400
Committer: sgrebnov <v-...@microsoft.com>
Committed: Wed Nov 12 22:35:10 2014 -0800
----------------------------------------------------------------------
src/windows/InAppBrowserProxy.js | 6 +++---
tests/tests.js | 21 ++++++++++++---------
www/inappbrowser.js | 8 +++++++-
3 files changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/3f80b0b5/src/windows/InAppBrowserProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/InAppBrowserProxy.js b/src/windows/InAppBrowserProxy.js
index 1d17bc5..5842212 100644
--- a/src/windows/InAppBrowserProxy.js
+++ b/src/windows/InAppBrowserProxy.js
@@ -120,14 +120,14 @@ var IAB = {
popup.style.width = "100%";
popup.style.height = "100%";
+ // start listening for navigation events
+ attachNavigationEvents(popup, win);
+
if (isWebViewAvailable) {
strUrl = strUrl.replace("ms-appx://", "ms-appx-web://");
}
popup.src = strUrl;
- // start listening for navigation events
- attachNavigationEvents(popup, win);
-
browserWrap.appendChild(popup);
}
},
http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/3f80b0b5/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index 4a9e5ef..1587b99 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -29,11 +29,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
function doOpen(url, target, params, numExpectedRedirects) {
numExpectedRedirects = numExpectedRedirects || 0;
console.log("Opening " + url);
- var iab = window.open(url, target, params);
- if (!iab) {
- alert('window.open returned ' + iab);
- return;
- }
+
var counts;
var lastLoadStartURL;
var wasReset = false;
@@ -48,6 +44,17 @@ exports.defineManualTests = function (contentEl, createActionButton) {
}
reset();
+ var iab = window.open(url, target, params, {
+ loaderror: logEvent,
+ loadstart: logEvent,
+ loadstop: logEvent,
+ exit: logEvent
+ });
+ if (!iab) {
+ alert('window.open returned ' + iab);
+ return;
+ }
+
function logEvent(e) {
console.log('IAB event=' + JSON.stringify(e));
counts[e.type]++;
@@ -85,10 +92,6 @@ exports.defineManualTests = function (contentEl, createActionButton) {
}
}
}
- iab.addEventListener('loaderror', logEvent);
- iab.addEventListener('loadstart', logEvent);
- iab.addEventListener('loadstop', logEvent);
- iab.addEventListener('exit', logEvent);
return iab;
}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/3f80b0b5/www/inappbrowser.js
----------------------------------------------------------------------
diff --git a/www/inappbrowser.js b/www/inappbrowser.js
index 4211563..a85f27e 100644
--- a/www/inappbrowser.js
+++ b/www/inappbrowser.js
@@ -77,7 +77,7 @@ InAppBrowser.prototype = {
}
};
-module.exports = function(strUrl, strWindowName, strWindowFeatures) {
+module.exports = function(strUrl, strWindowName, strWindowFeatures, callbacks) {
// 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');
@@ -86,6 +86,12 @@ module.exports = function(strUrl, strWindowName, strWindowFeatures) {
strUrl = urlutil.makeAbsolute(strUrl);
var iab = new InAppBrowser();
+
+ callbacks = callbacks || {};
+ for (var callbackName in callbacks) {
+ iab.addEventListener(callbackName, callbacks[callbackName]);
+ }
+
var cb = function(eventname) {
iab._eventHandler(eventname);
};
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[5/6] cordova-plugin-inappbrowser git commit: CB-7697 Add locationBar
support to InAppBrowser windows platform version
Posted by sg...@apache.org.
CB-7697 Add locationBar support to InAppBrowser windows platform version
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/3056997c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/3056997c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/3056997c
Branch: refs/heads/master
Commit: 3056997c78db2ac870b39aaa808249c305150ad6
Parents: 3f80b0b
Author: daserge <da...@yandex.ru>
Authored: Wed Oct 15 03:48:23 2014 +0400
Committer: sgrebnov <v-...@microsoft.com>
Committed: Wed Nov 12 22:35:10 2014 -0800
----------------------------------------------------------------------
src/windows/InAppBrowserProxy.js | 97 +++++++++++++++++++++++++++++++++--
1 file changed, 93 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/3056997c/src/windows/InAppBrowserProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/InAppBrowserProxy.js b/src/windows/InAppBrowserProxy.js
index 5842212..febb974 100644
--- a/src/windows/InAppBrowserProxy.js
+++ b/src/windows/InAppBrowserProxy.js
@@ -29,7 +29,12 @@ var cordova = require('cordova'),
urlutil = require('cordova/urlutil');
var browserWrap,
- popup;
+ popup,
+ navigationButtonsDiv,
+ navigationButtonsDivInner,
+ backButton,
+ forwardButton,
+ closeButton;
// x-ms-webview is available starting from Windows 8.1 (platformId is 'windows')
// http://msdn.microsoft.com/en-us/library/windows/apps/dn301831.aspx
@@ -40,14 +45,23 @@ function attachNavigationEvents(element, callback) {
element.addEventListener("MSWebViewNavigationStarting", function (e) {
callback({ type: "loadstart", url: e.uri}, {keepCallback: true} );
});
+
element.addEventListener("MSWebViewNavigationCompleted", function (e) {
callback({ type: e.isSuccess ? "loadstop" : "loaderror", url: e.uri}, {keepCallback: true});
});
+
element.addEventListener("MSWebViewUnviewableContentIdentified", function (e) {
// WebView found the content to be not HTML.
// http://msdn.microsoft.com/en-us/library/windows/apps/dn609716.aspx
callback({ type: "loaderror", url: e.uri}, {keepCallback: true});
});
+
+ element.addEventListener("MSWebViewContentLoading", function (e) {
+ if (navigationButtonsDiv) {
+ backButton.disabled = !popup.canGoBack;
+ forwardButton.disabled = !popup.canGoForward;
+ }
+ });
} else {
var onError = function () {
callback({ type: "loaderror", url: this.contentWindow.location}, {keepCallback: true});
@@ -56,6 +70,7 @@ function attachNavigationEvents(element, callback) {
element.addEventListener("unload", function () {
callback({ type: "loadstart", url: this.contentWindow.location}, {keepCallback: true});
});
+
element.addEventListener("load", function () {
callback({ type: "loadstop", url: this.contentWindow.location}, {keepCallback: true});
});
@@ -118,7 +133,83 @@ var IAB = {
popup = document.createElement(isWebViewAvailable ? "x-ms-webview" : "iframe");
popup.style.borderWidth = "0px";
popup.style.width = "100%";
- popup.style.height = "100%";
+
+ browserWrap.appendChild(popup);
+
+ if (features.indexOf("location=yes") !== -1 || features.indexOf("location") === -1) {
+ popup.style.height = "calc(100% - 60px)";
+
+ navigationButtonsDiv = document.createElement("div");
+ navigationButtonsDiv.style.height = "60px";
+ navigationButtonsDiv.style.backgroundColor = "#404040";
+ navigationButtonsDiv.style.zIndex = "999";
+ navigationButtonsDiv.onclick = function (e) {
+ e.cancelBubble = true;
+ };
+
+ navigationButtonsDivInner = document.createElement("div");
+ navigationButtonsDivInner.style.paddingTop = "10px";
+ navigationButtonsDivInner.style.height = "50px";
+ navigationButtonsDivInner.style.width = "160px";
+ navigationButtonsDivInner.style.margin = "0 auto";
+ navigationButtonsDivInner.style.backgroundColor = "#404040";
+ navigationButtonsDivInner.style.zIndex = "999";
+ navigationButtonsDivInner.onclick = function (e) {
+ e.cancelBubble = true;
+ };
+
+
+ backButton = document.createElement("button");
+ backButton.style.width = "40px";
+ backButton.style.height = "40px";
+ backButton.style.borderRadius = "40px";
+
+ backButton.innerText = "<-";
+ backButton.addEventListener("click", function (e) {
+ if (popup.canGoBack)
+ popup.goBack();
+ });
+
+ forwardButton = document.createElement("button");
+ forwardButton.style.marginLeft = "20px";
+ forwardButton.style.width = "40px";
+ forwardButton.style.height = "40px";
+ forwardButton.style.borderRadius = "40px";
+
+ forwardButton.innerText = "->";
+ forwardButton.addEventListener("click", function (e) {
+ if (popup.canGoForward)
+ popup.goForward();
+ });
+
+ closeButton = document.createElement("button");
+ closeButton.style.marginLeft = "20px";
+ closeButton.style.width = "40px";
+ closeButton.style.height = "40px";
+ closeButton.style.borderRadius = "40px";
+
+ closeButton.innerText = "x";
+ closeButton.addEventListener("click", function (e) {
+ setTimeout(function () {
+ IAB.close();
+ }, 0);
+ });
+
+ if (!isWebViewAvailable) {
+ // iframe navigation is not yet supported
+ backButton.disabled = true;
+ forwardButton.disabled = true;
+ }
+
+ navigationButtonsDivInner.appendChild(backButton);
+ navigationButtonsDivInner.appendChild(forwardButton);
+ navigationButtonsDivInner.appendChild(closeButton);
+ navigationButtonsDiv.appendChild(navigationButtonsDivInner);
+
+ browserWrap.appendChild(navigationButtonsDiv);
+ } else {
+ popup.style.height = "100%";
+ }
// start listening for navigation events
attachNavigationEvents(popup, win);
@@ -127,8 +218,6 @@ var IAB = {
strUrl = strUrl.replace("ms-appx://", "ms-appx-web://");
}
popup.src = strUrl;
-
- browserWrap.appendChild(popup);
}
},
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[6/6] cordova-plugin-inappbrowser git commit: CB-7784 Exit event is
not fired after InAppBrowser closing
Posted by sg...@apache.org.
CB-7784 Exit event is not fired after InAppBrowser closing
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/e785533a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/e785533a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/e785533a
Branch: refs/heads/master
Commit: e785533ab4753ce0a98ea5ddccbaa5f965e959be
Parents: 3056997
Author: daserge <da...@yandex.ru>
Authored: Wed Oct 15 03:54:41 2014 +0400
Committer: sgrebnov <v-...@microsoft.com>
Committed: Wed Nov 12 22:35:10 2014 -0800
----------------------------------------------------------------------
src/windows/InAppBrowserProxy.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/e785533a/src/windows/InAppBrowserProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/InAppBrowserProxy.js b/src/windows/InAppBrowserProxy.js
index febb974..07fa79e 100644
--- a/src/windows/InAppBrowserProxy.js
+++ b/src/windows/InAppBrowserProxy.js
@@ -119,7 +119,7 @@ var IAB = {
browserWrap.onclick = function () {
setTimeout(function () {
- IAB.close();
+ IAB.close(win);
}, 0);
};
@@ -191,7 +191,7 @@ var IAB = {
closeButton.innerText = "x";
closeButton.addEventListener("click", function (e) {
setTimeout(function () {
- IAB.close();
+ IAB.close(win);
}, 0);
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[2/6] cordova-plugin-inappbrowser git commit: CB-7688 Alert is not
supported in InAppBrowser on Windows platform
Posted by sg...@apache.org.
CB-7688 Alert is not supported in InAppBrowser on Windows platform
Using cordova-plugin-dialogs to enable alerts.
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/1bf42c9e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/1bf42c9e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/1bf42c9e
Branch: refs/heads/master
Commit: 1bf42c9e3b2e9608e9bffc998c3a0f574b051cf6
Parents: 70d74e5
Author: daserge <da...@yandex.ru>
Authored: Tue Oct 14 23:18:29 2014 +0400
Committer: sgrebnov <v-...@microsoft.com>
Committed: Wed Nov 12 22:35:09 2014 -0800
----------------------------------------------------------------------
tests/tests.js | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/1bf42c9e/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index c52eda7..a48ffa6 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -19,6 +19,8 @@
*
*/
+window.alert = window.alert || navigator.notification.alert;
+
exports.defineManualTests = function (contentEl, createActionButton) {
function doOpen(url, target, params, numExpectedRedirects) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org