You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by da...@apache.org on 2016/12/12 12:17:29 UTC
cordova-windows git commit: CB-12193 cordova.js crashes windows app
if there is no CoreWindow Also made confighelper to load after WinJS as it
depends on it
Repository: cordova-windows
Updated Branches:
refs/heads/master 623ff181d -> 707bf9628
CB-12193 cordova.js crashes windows app if there is no CoreWindow
Also made confighelper to load after WinJS as it depends on it
Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/707bf962
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/707bf962
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/707bf962
Branch: refs/heads/master
Commit: 707bf962823b9585a22dfaa3ffa6f0185562df5a
Parents: 623ff18
Author: daserge <v-...@microsoft.com>
Authored: Thu Dec 8 17:53:11 2016 +0300
Committer: daserge <v-...@microsoft.com>
Committed: Fri Dec 9 18:39:36 2016 +0300
----------------------------------------------------------------------
cordova-js-src/platform.js | 23 ++++++++++++++++-------
template/www/cordova.js | 23 ++++++++++++++++-------
2 files changed, 32 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/707bf962/cordova-js-src/platform.js
----------------------------------------------------------------------
diff --git a/cordova-js-src/platform.js b/cordova-js-src/platform.js
index c1431eb..4bc4025 100644
--- a/cordova-js-src/platform.js
+++ b/cordova-js-src/platform.js
@@ -27,7 +27,6 @@ module.exports = {
channel = cordova.require('cordova/channel'),
platform = require('cordova/platform'),
modulemapper = require('cordova/modulemapper'),
- configHelper = require('cordova/confighelper'),
utils = require('cordova/utils');
modulemapper.clobbers('cordova/exec/proxy', 'cordova.commandProxy');
@@ -41,7 +40,8 @@ module.exports = {
var onWinJSReady = function () {
var app = WinJS.Application,
- splashscreen = require('cordova/splashscreen');
+ splashscreen = require('cordova/splashscreen'),
+ configHelper = require('cordova/confighelper');
modulemapper.clobbers('cordova/splashscreen', 'navigator.splashscreen');
@@ -94,13 +94,22 @@ module.exports = {
}));
};
- app.addEventListener("checkpoint", checkpointHandler);
- app.addEventListener("activated", activationHandler, false);
- Windows.UI.WebUI.WebUIApplication.addEventListener("resuming", resumingHandler, false);
+ // CB-12193 CoreWindow and some WinRT APIs are not available in webview
+ var isCoreWindowAvailable = false;
+ try {
+ Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
+ isCoreWindowAvailable = true;
+ } catch (e) { }
+
+ if (isCoreWindowAvailable) {
+ app.addEventListener("checkpoint", checkpointHandler);
+ app.addEventListener("activated", activationHandler, false);
+ Windows.UI.WebUI.WebUIApplication.addEventListener("resuming", resumingHandler, false);
- injectBackButtonHandler();
+ injectBackButtonHandler();
- app.start();
+ app.start();
+ }
};
function appendScript(scriptElem, loadedCb) {
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/707bf962/template/www/cordova.js
----------------------------------------------------------------------
diff --git a/template/www/cordova.js b/template/www/cordova.js
index 0f97f09..201a384 100644
--- a/template/www/cordova.js
+++ b/template/www/cordova.js
@@ -1558,7 +1558,6 @@ module.exports = {
channel = cordova.require('cordova/channel'),
platform = require('cordova/platform'),
modulemapper = require('cordova/modulemapper'),
- configHelper = require('cordova/confighelper'),
utils = require('cordova/utils');
modulemapper.clobbers('cordova/exec/proxy', 'cordova.commandProxy');
@@ -1572,7 +1571,8 @@ module.exports = {
var onWinJSReady = function () {
var app = WinJS.Application,
- splashscreen = require('cordova/splashscreen');
+ splashscreen = require('cordova/splashscreen'),
+ configHelper = require('cordova/confighelper');
modulemapper.clobbers('cordova/splashscreen', 'navigator.splashscreen');
@@ -1625,13 +1625,22 @@ module.exports = {
}));
};
- app.addEventListener("checkpoint", checkpointHandler);
- app.addEventListener("activated", activationHandler, false);
- Windows.UI.WebUI.WebUIApplication.addEventListener("resuming", resumingHandler, false);
+ // CB-12193 CoreWindow and some WinRT APIs are not available in webview
+ var isCoreWindowAvailable = false;
+ try {
+ Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
+ isCoreWindowAvailable = true;
+ } catch (e) { }
+
+ if (isCoreWindowAvailable) {
+ app.addEventListener("checkpoint", checkpointHandler);
+ app.addEventListener("activated", activationHandler, false);
+ Windows.UI.WebUI.WebUIApplication.addEventListener("resuming", resumingHandler, false);
- injectBackButtonHandler();
+ injectBackButtonHandler();
- app.start();
+ app.start();
+ }
};
function appendScript(scriptElem, loadedCb) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org