You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Jesse MacFadyen (JIRA)" <ji...@apache.org> on 2014/05/17 07:33:15 UTC

[jira] [Resolved] (CB-5945) Navigator.notification.confirm crashes app

     [ https://issues.apache.org/jira/browse/CB-5945?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse MacFadyen resolved CB-5945.
---------------------------------

    Resolution: Fixed

> Navigator.notification.confirm crashes app
> ------------------------------------------
>
>                 Key: CB-5945
>                 URL: https://issues.apache.org/jira/browse/CB-5945
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Dialogs, Windows 8
>    Affects Versions: 3.3.0
>            Reporter: Ismael Olusola Jimoh
>            Assignee: Jesse MacFadyen
>
> Good Day All,
> I recently tested a code whereby I called navigator.notification.confirm on 2 pages.
> On the first page, I create an instance that triggers a navigator.notification.confirm query, accepting should launch the next page which also has a navigator.notification.confirm triggered from onDeviceReady.
> Once the second instance is triggered, app crashes and returns no error(or at least visible one).
> I am testing this on Windows 8 pro, PhoneGap 3.3 and I have all plugins needed installed.
> When I test this and have a button launch the same function on the second page, error doesn't occur.
> Find below sample code for said issue:
> Page 1:
> <!DOCTYPE html>
> <html>
>   <head>
>     <title>Notification Example</title>
>     <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
>     <script type="text/javascript" charset="utf-8">
>     // Wait for device API libraries to load
>     //
>     document.addEventListener("deviceready", onDeviceReady, false);
>     // device APIs are available
>     //
>     function onDeviceReady() {
>         // Empty
>     }
>     // process the confirmation dialog result
>     function onConfirm(buttonIndex) {
>         //alert('You selected button ' + buttonIndex);
> 		if(buttonIndex === 1){
> 			window.open("page2.html","_self");
> 		}
>     }
>     // Show a custom confirmation dialog
>     //
>     function showConfirm() {
>         navigator.notification.confirm(
>             'You are the winner!', // message
>              onConfirm,            // callback to invoke with index of button pressed
>             'Game Over',           // title
>             ['Restart','Exit']         // buttonLabels
>         );
>     }
>     </script>
>   </head>
>   <body>
>     <p><a href="#" onclick="showConfirm(); return false;">Show Confirm</a></p>
>   </body>
> </html>
> Page 2:
> <!DOCTYPE html>
> <html>
>   <head>
>     <title>Notification Example</title>
>     <!--<script type="text/javascript" charset="utf-8" src="cordova.js"></script>-->
>     <script type="text/javascript" charset="utf-8">
>     // Wait for device API libraries to load
>     //
>     document.addEventListener("deviceready", onDeviceReady, false);
>     // device APIs are available
>     //
>     function onDeviceReady() {
>         // Empty
>         showConfirm();
>     }
>     // process the confirmation dialog result
>     function onConfirm(buttonIndex) {
>         //alert('You selected button ' + buttonIndex);
> 		if(buttonIndex === 1){
> 			window.open("page2.html","_self");
> 		}
>     }
>     // Show a custom confirmation dialog
>     //
>     function showConfirm() {
>         navigator.notification.confirm(
>             'You are the winner!', // message
>              onConfirm,            // callback to invoke with index of button pressed
>             'Game Over',           // title
>             ['Restart','Exit']         // buttonLabels
>         );
>     }
>     </script>
>   </head>
>   <body>
>     <p><a href="#" onclick="showConfirm(); return false;">Show Confirm</a></p>
>   </body>
> </html>
> Thanks.
> Ismael



--
This message was sent by Atlassian JIRA
(v6.2#6252)