Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-19977

evalJS() fails for large WebViews on Android M

    Details

      Description

      JS is being used within a webview to modify and/or return information about the contents. Above a certain yet-to-be determined size, it is now timing out (as of Android M). At first thought the issue might be Titanium 5.0; but reverting to the previous 3.5.1 (as I had skipped 4.x due to a host of other issues) didn't fix the problem.

      For instance, I'm loading jQuery on the pages with the webview, and calling it externally (i.e., from the Titanium JS via evalJS()). One use is to set the body font. On most HTML files, it works. On a larger one (again, above some threshold), it times out with the warning from getJSValue() in TiWebViewBinding.java: "Timeout waiting to evaluate JS". The same is the case for any evalJS() on the webviews holding larger HTML content.

      Now, I don't know if this is a Titanium problem or an Android problem, so at this point I'm trying to gather enough information about how exactly Titanium does its evalJS() call — and how exactly it times out — to triage what's going on. So, for instance, in getJSValue(), by the time that try {} block is hit and we're waiting for returnSemaphore.tryAcquire(3500, TimeUnit.MILLISECONDS)) to time out, presumably the JS call has already been executed (and, in this case, failed for whatever reason)?

      Where exactly does the JS call get dispatched to the webview? In AppBinding? I assume the (relative) complexity of this is due to the async nature of the webview vs. evalJS() waiting for a return value (hence the semaphore and timeout)?

      I'm faintly hopeful that increasing the timeout, or allowing the option to do so, might alleviate the problem — but not very. Because the effect of the failed JS call — such as the aforementioned jQuery call to change the body font — is never seen.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              kt KT
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-20675
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration