incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Bowser <bows...@gmail.com>
Subject Re: [Android] loadUrl, input methods and making the web a thread-safe place
Date Thu, 26 Jul 2012 23:14:14 GMT
It's totally "Do as I say, not as I do". That being said, there is a
real problem when you start using loadUrl without checking where your
WebKit cursor is.

On Thu, Jul 26, 2012 at 4:06 PM, Anis KADRI <anis.kadri@gmail.com> wrote:
> Just one thought:
>
> If google thinks it's a bad idea to use loadUrl to execute javascript they
> should probably start by removing that exact thing from their docs [1].
>
> [1]
> http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object,
> java.lang.String)
>
> On Thu, Jul 26, 2012 at 3:44 PM, Joe Bowser <bowserj@gmail.com> wrote:
>
>> Hey
>>
>> So, on ICS and greater, it turns out that the routing table is
>> fragile, so fragile in fact that you can't connect to localhost if you
>> don't have an internet connection of some sort.  This is a problem for
>> us on Android because we need to connect to localhost to use the
>> bridge and communicate with the Callback Server so that we can get the
>> callbacks.  In my opinion, this is the straw that broke the camel's
>> back, and this bug is far worse than the reason we moved to the
>> CallbackServer to begin with.
>>
>> First, some history:
>>
>> Back in OSCON 2010, we talked to Justin at Google about how they could
>> help PhoneGap, and he mentioned that we shouldn't be using loadUrl for
>> sending Javascript over because it is linked to the Handler and can
>> interrupt the UI thread.  He suggested a callback server, which Bryce
>> implemented.  The callback server and sending commands over the prompt
>> happened at roughly the same six months, when Gingerbread was being
>> rolled out.
>>
>> Now, in 2012, we are starting to have issues with the Callback Server
>> approach, and we should examine why we did this in the first place.
>> The test case for it is simple:
>>
>> 1. Put an input field on the accelerometer page on Mobile-Spec
>> 2. Turn on Accelerometer
>> 3. Try to type something
>>
>> What it will do is it will update the accelerometer values as you type
>> text. This is awesome, but I'm wondering if anyone is actually going
>> to use this use case, and if it's OK to break this functionality in
>> exchange for performance and stability.  We currently have the ability
>> to use loadUrl("javascript:foo()") again by checking whether we have
>> focus on a text field, which we can use with HitTestResult, which
>> inspect's webkit's cursor.  This would fix the bug that I call
>> "Airplane, Airplane Crash" where you can crash our bridge by switching
>> your phone in and out of airplane mode over and over again.  I have a
>> test repository here, and it passes most of Mobile Spec.  It would be
>> nice to be able to have this as a configurable option to start.
>>
>> https://github.com/infil00p/callback-android/tree/testbridge
>>
>> Any thoughts?
>>
>> Joe
>>

Mime
View raw message