cbitstech / Purple-Robot

Sensing and automation platform for Android.
Other
38 stars 19 forks source link

PR 1.5.3: running the same 2 showNativeDialog(..., tag, prio) calls twice in test.html page succeeds on first exec, errors on second exec #225

Closed estory1 closed 10 years ago

estory1 commented 10 years ago

Repro:

1) In your browser, at http://{device IP}:12345/test.html paste this code:

{
    "command": "execute_script",
    "script": "PurpleRobot.showNativeDialog('A', 'B', 'C', 'D', '', '', 'MA', 5); PurpleRobot.showNativeDialog('E', 'F', 'G', 'H', '', '', 'MA', 50);"
}

2) In your browser, run that script. Response:

{
  "command": "execute_script",
  "status": "ok"
}

3) On your device, hit the "G" button on the first prompt, then the "C" button on the second. 4) In your browser, hit the Back button (used Chrome in my testing). 5) In your browser, run the script again. Response:

{
  "message": "org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException",
  "command": "execute_script",
  "status": "error"
}

Expected behavior is that the response in step 2 would appear both times...

estory1 commented 10 years ago

I suspect it's a content caching issue with the web server (Back button handling), because if you refresh the test.html page between steps 4 and 5, then the response from step 2 is displayed again.

audaciouscode commented 10 years ago

It was an unrelated race condition between the scripting engine and the dialog UI. Fixed.