cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ismael Olusola Jimoh (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-5945) Navigator.notification.confirm crashes app
Date Thu, 30 Jan 2014 11:06:11 GMT
Ismael Olusola Jimoh created CB-5945:
----------------------------------------

             Summary: Navigator.notification.confirm crashes app
                 Key: CB-5945
                 URL: https://issues.apache.org/jira/browse/CB-5945
             Project: Apache Cordova
          Issue Type: Bug
          Components: 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.1.5#6160)

Mime
View raw message