New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-25859] Android: Delay WebView Ti.App.fireEvent() to be fired after page load #9931
Conversation
- Updated EvalJS() documentation to indicate it can't be called reliably until after "load" event.
} | ||
|
||
// Queue event and fire it, if ready. | ||
synchronized (this) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the synchronized
is necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method can be called by the WebView's JavaScript thread (via @JavaScriptInterface
APIs) or the main UI thread (via resumeFiringEvents()
calls). So, the synchronized is needed. And we shouldn't invoke a listener within a synchronized block to avoid potential deadlock.
} catch (JSONException e) { | ||
Log.e(TAG, "Error parsing event JSON", e); | ||
} | ||
} | ||
|
||
public void fireQueuedEvents() | ||
{ | ||
while (true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just use the Iterator
like this:
if (!isEventFiringSuspended) {
for (final Event event : this.eventQueue) {
module.fireEvent(event.name, event.properties);
this.eventQueue.remove();
}
}
@jquick-axway , I am seeing an issue where if I have soasta enabled then I do see the Full log: https://gist.github.com/lokeshchdhry/b0e1755bcccdf77e2dc8f2d8422557a0 |
@lokeshchdhry, we still have a timeout for |
Waiting for resolving conflicts |
This PR may be obsolete due to our new async I'll re-test this with our new async API. If it works with that, then I'll close out this PR. |
I've confirmed that the async version of Closing this PR. |
JIRA: https://jira.appcelerator.org/browse/TIMOB-25859
Summary:
evalJS()
will fail if page hasn't finished loading.evalJS()
documentation to state that it'll only work after the "load" event.Test:
Timeout waiting to evaluate JS
warning messages appear.