Closed
Bug 1253467
Opened 8 years ago
Closed 6 years ago
Java-side JavascriptBridge will not receive messages from js if js.syncCall returns (including assertions)
Categories
(Firefox for Android Graveyard :: Testing, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: mcomella, Unassigned)
Details
Attachments
(1 file)
8.05 KB,
patch
|
Details | Diff | Splinter Review |
So I can't: Java--- js.syncCall('getPromiseValue'); JS--- function getPromiseValue() { aPromise().then(function (ret) { java.asyncCall('gotPromiseValue', ret); }); } --- Either we should add to the documentation saying this is intended, or fix it. Jim, is this expected?
Flags: needinfo?(nchen)
Reporter | ||
Comment 1•8 years ago
|
||
MozReview-Commit-ID: I1y2By9kVZm
Reporter | ||
Updated•8 years ago
|
Assignee: nobody → michael.l.comella
Status: NEW → ASSIGNED
Reporter | ||
Updated•8 years ago
|
Assignee: michael.l.comella → nobody
Status: ASSIGNED → NEW
Reporter | ||
Comment 2•8 years ago
|
||
To be more explicit with comment 0: Java--- public void mainTest() { js.syncCall('getPromiseValue'); spinAndWaitForJSCallToFinish(); } public void gotPromiseValue(String ret) { // Never called. } public void spinAndWaitForJSCallToFinish() { // Do some Thread.sleep action in here until timeout } JS--- function getPromiseValue() { aPromise().then(function (ret) { java.asyncCall('gotPromiseValue', ret); }); } I also replaced `java.asyncCall...` with `do_check_false(true)` and the test completed successfully, rather than failing as expected. It appears that all js -> java messages are ignored once js.syncCall returns. We can't use js.asyncCall because the test will return.
Summary: JavascriptBridge will not receive javascript messages if js.syncCall returns → Java-side JavascriptBridge will not receive messages from js if js.syncCall returns (including assertions)
Comment 3•8 years ago
|
||
So your call will only go through if you wait for a call, which happens inside syncCall(). Otherwise, your test thread is busy doing other stuff (sleeping in this case), and the test thread doesn't get an opportunity to actually run the called method (because it's spending time inside Thread.sleep). If you put a dummy syncCall (e.g. js.syncCall("pollJs")) in the loop before you call Thread.sleep, your async call should go through as well.
Flags: needinfo?(nchen)
Comment 4•8 years ago
|
||
And if we want to "fix" this behavior, we should probably teach the JS side (i.e. JavaBridge) how to handle promises.
Comment 5•6 years ago
|
||
Mass closing Firefox for Android :: Testing bugs with no progress in 2017. If this bug is important to you, please re-open.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Updated•3 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•