Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-17570

CordovaSim: Phonegap API doesn't work after refresh with javaFx web engine when running against JDK 8

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.2.0.Beta3
    • 4.2.0.Beta2
    • browsersim
    • None
    • Hide

      1. Create new HMT project
      2. Add Device motion plugin (org.apache.cordova.core.device-motion)
      2. Change index.html

      <!DOCTYPE html>
      <html>
          <head>
              <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
              <meta name = "format-detection" content = "telephone=no"/>
              <link rel="stylesheet" type="text/css" href="css/index.css" />
              <title>Hello Cordova</title>
          </head>	 
           <script>
              document.addEventListener("deviceready", onDeviceReady, false);
      
              // PhoneGap is ready
              //
              function onDeviceReady() {
                  navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
              }
      
              // onSuccess: Get a snapshot of the current acceleration
              //
              function onSuccess(acceleration) {
                  alert('Acceleration X: ' + acceleration.x + '\n' +
                        'Acceleration Y: ' + acceleration.y + '\n' +
                        'Acceleration Z: ' + acceleration.z + '\n' +
                        'Timestamp: '      + acceleration.timestamp + '\n');
              }
      
              // onError: Failed to get the acceleration
              //
              function onError() {
              }
              </script>   
          <body>
              <div class="app">
                  <div id="deviceready">
                      <p class="status pending blink">Connecting to Device</p>
                      <p class="status complete blink hide">Device is Ready</p>
                  </div>
              </div>
              <script type="text/javascript" src="cordova.js"></script>
              <script type="text/javascript" src="js/index.js"></script>
              <script type="text/javascript">
                  app.initialize();
              </script>
          </body>
      </html>
      

      3. Run As -> Run with CordovaSim
      4. Alert will be shown
      5. Push refresh button
      6. Error: No alert

      Show
      1. Create new HMT project 2. Add Device motion plugin (org.apache.cordova.core.device-motion) 2. Change index.html <!DOCTYPE html> <html> <head> <meta http-equiv= "Content-Type" content= "text/html; charset=UTF-8" /> <meta name = "format-detection" content = "telephone=no" /> <link rel= "stylesheet" type= "text/css" href= "css/index.css" /> <title>Hello Cordova</title> </head> <script> document.addEventListener( "deviceready" , onDeviceReady, false ); // PhoneGap is ready // function onDeviceReady() { navigator.accelerometer.getCurrentAcceleration(onSuccess, onError); } // onSuccess: Get a snapshot of the current acceleration // function onSuccess(acceleration) { alert( 'Acceleration X: ' + acceleration.x + '\n' + 'Acceleration Y: ' + acceleration.y + '\n' + 'Acceleration Z: ' + acceleration.z + '\n' + 'Timestamp: ' + acceleration.timestamp + '\n' ); } // onError: Failed to get the acceleration // function onError() { } </script> <body> <div class= "app" > <div id= "deviceready" > <p class= "status pending blink" >Connecting to Device</p> <p class= "status complete blink hide" >Device is Ready</p> </div> </div> <script type= "text/javascript" src= "cordova.js" ></script> <script type= "text/javascript" src= "js/index.js" ></script> <script type= "text/javascript" > app.initialize(); </script> </body> </html> 3. Run As -> Run with CordovaSim 4. Alert will be shown 5. Push refresh button 6. Error: No alert

      Doesn't work only with JDK 8 + javaFx web engine combo. Due to this issue livereload doesn't work properly

        1. alert.png
          21 kB
          Ilya Buziuk

            ibuziuk@redhat.com Ilya Buziuk
            ibuziuk@redhat.com Ilya Buziuk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: