allada / LineaDevice

Linea Pro Device plugin for phonegap (ios / iphone / ipad)
http://webinterface.allada.com/
Apache License 2.0
6 stars 10 forks source link

cordova bridge cannot open if document references image which times out #4

Open binki opened 9 years ago

binki commented 9 years ago

See my repro. If you enter the “failmode” version, it tries to load a resource from a server which will always timeout the connection (I’m using 8.8.8.8). Scanning does not work. Well, it works if you background the app, wait a couple seconds, and then foreground it—this seems to appear to interrupt the image’s load and permit the cordova bridge connection to finish being made. If you just load the “succeedmode” version of the repro, the cordova bridge is set up successfully and scans work.

When I’ve played around with accessing gap://ready directly and intercepting the cordova.require() call, it seems like cordova.require('cordova/exec') runs but it ignores the return value. It looks to me like cordova is supposedly trying to evaluate something like cordova.require('cordova/exec').nativeEvalAndFetch(function () {/* Do things here. */}). So the fact that nativeEvalAndFetch() never gets called even though cordova.require('cordova/exec') runs confuses me. What I imagine happening is Mobile Safari suspending execution of the iframe’s JavaScript while it is trying to download the image and the image somehow never “completing” (even though the TCP connection itself should time out within a minute or so), thus blocking the iframe’s execution indefinitely (or until the page is suspended by, say, the app being backgrounded or the lockscreen brought up).

Wondering if the latest cordova would still have this issue. I’m using Web Interface-2.1 on iOS-8.4.1 and iOS-9 Beta 3.