cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "venkata guddanti (JIRA)" <>
Subject [jira] [Commented] (CB-12193) cordova.js crashes windows app if there is no CoreWindow
Date Tue, 29 Nov 2016 15:21:58 GMT


venkata guddanti commented on CB-12193:

Please note that cordova runs fine without WinJS. For e.g it has the following code:

if (!window.WinJS) {
            if (navigator.appVersion.indexOf('MSAppHost/3.0') !== -1) {
                // Windows 10 UWP
                scriptElem.src = '/www/WinJS/js/base.js';
else {

The location of WinJS was changed from /WinJS/js/base to /www/WinJS/js/base.js after Cordova
4.0.0. So if Cordova fails to load WinJS it still functions without a glitch.  

Another thing to consider is if a framework already includes WinJS before cordova.js, there
is no need to call onWinJSReady. Such a framework would have done its own app lifecycle management
(activation, checkpoint etc). So you can eliminate onWinJSReady

> cordova.js crashes windows app if there is no CoreWindow
> --------------------------------------------------------
>                 Key: CB-12193
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Windows
>         Environment: Windows 10
>            Reporter: venkata guddanti
>            Priority: Critical
> The back button support in cordova.js crashes windows app. In particular the following
line crashes:
> var navigationManager = Windows.UI.Core.SystemNavigationManager.getForCurrentView();
> Putting try catch around it does not help. It crashes deep in the bowels of native code.
So I believe there should a fix similar to the following code in WinJS base.js:
>     // If getForCurrentView fails, it is an indication that we are running in a WebView
>     // a CoreWindow where some WinRT APIs are not available. In this case, we just treat
it as
>     // if no WinRT APIs are available.
>     var isCoreWindowAvailable = false;
>     try{
>       _Global.Windows.UI.ViewManagement.InputPane.getForCurrentView();
>       isCoreWindowAvailable = true;
>     }
>     catch (e){
>     }
> You can then skip setting up the back button handler if there is no CoreWindow:
> if (isCoreWindowAvailable)
>       {
>         var navigationManager = Windows.UI.Core.SystemNavigationManager.getForCurrentView();
>         ...
> }
> I am aware that Cordova Windows 10 is not supported in a WebView (i.e. there is no CoreWindow).
But WinJS and majority of Windows APIs work. Cordova 4.0.0 used to work as well, since there
was no back button support in it. Plugins that need CoreWindow (i.e. plugins that show native
UI) like Camera etc have issues without it. We have a framework where we proxy these plugins
through the main application Window (similar to iOS and Android).
> Please do consider this and incorporate a fix in cordova for Windows 10

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message