Allow JSWindowActor sendQuery to receive Transferables as well as sending them
Categories
(Core :: DOM: Content Processes, enhancement, P2)
Tracking
()
Fission Milestone | M4 |
People
(Reporter: mconley, Assigned: jdai)
References
Details
sendQuery
is a really nice way for the front-end team to offload the management of ping-ponging call and response messages to the JSWindowActor native layer.
We're able to use the sendQuery
method to send Transferables from one actor to another - however, the receiver is not able to send a Transferable back. The data that the Promise resolves with seems to go through the normal structured clone stuff.
I'm not sure how to solve this - Promises are usually resolved with whatever data is passed as the first argument to the resolve
method. Perhaps we could have a convention where if an Object is passed to resolve
with a transferable
(sic) property set, then we expect those things to be transferred to the the originator of the sendQuery
. But I'm open to alternative suggestions.
What do you think, jdai?
Reporter | ||
Comment 1•5 years ago
|
||
Until we have something like this, I think I'm going to have to switch away from using sendQuery
in my fix for bug 1576565.
Assignee | ||
Comment 2•5 years ago
|
||
(In reply to Mike Conley (:mconley) (:⚙️) from comment #0)
sendQuery
is a really nice way for the front-end team to offload the management of ping-ponging call and response messages to the JSWindowActor native layer.We're able to use the
sendQuery
method to send Transferables from one actor to another - however, the receiver is not able to send a Transferable back. The data that the Promise resolves with seems to go through the normal structured clone stuff.I'm not sure how to solve this - Promises are usually resolved with whatever data is passed as the first argument to the
resolve
method. Perhaps we could have a convention where if an Object is passed toresolve
with atransferable
(sic) property set, then we expect those things to be transferred to the the originator of thesendQuery
. But I'm open to alternative suggestions.What do you think, jdai?
Do you have any specific use case need to send transferables
from one actor to another? According to mdn, transferable
can't use in cross process.
Reporter | ||
Comment 3•5 years ago
|
||
(In reply to John Dai[:jdai] from comment #2)
Do you have any specific use case need to send
transferables
from one actor to another? According to mdn,transferable
can't use in cross process.
Huh. If that's true, what are the transfer
's for in sendAsyncMessage
and sendQuery
?
What do they do? Have I greatly misunderstood their purpose? If so, we'll need to update the documentation.
Assignee | ||
Comment 4•5 years ago
|
||
(In reply to Mike Conley (:mconley) (:⚙️) from comment #3)
(In reply to John Dai[:jdai] from comment #2)
Do you have any specific use case need to send
transferable
from one actor to another? According to mdn,transferable
can't use in cross-process.Huh. If that's true, what are the
transfer
's for insendAsyncMessage
andsendQuery
?
The transferable
for sendAsyncMessage
was introduced by B2G, we don't use it in our codebase now. After discussed with Nika, we should remove the transfers
attribute in JSWindowActor.
What do they do? Have I greatly misunderstood their purpose? If so, we'll need to update the documentation.
For cross-process case, the transferable objects' contents are copied into the serialized data (rather than just writing a pointer) [1].
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 5•5 years ago
|
||
File bug 1580907 to remove transferables attribute for SendAsyncMessage and SendQuery in JSWindowActor.
Comment 6•5 years ago
•
|
||
(In reply to John Dai[:jdai] from comment #5)
File bug 1580907 to remove transferables attribute for SendAsyncMessage and SendQuery in JSWindowActor.
After removing trasferables, what else do we need to do here? What's the next step?
Assignee | ||
Comment 7•5 years ago
•
|
||
(In reply to Hsin-Yi Tsai [:hsinyi] from comment #6)
(In reply to John Dai[:jdai] from comment #5)
File bug 1580907 to remove transferables attribute for SendAsyncMessage and SendQuery in JSWindowActor.
After removing trasferables, what else do we need to do here? What's the next step?
According to comment #4, the transferable
attribute in sendAsyncMessage
and sendQuery
can't solve bug 1576565. I'm going to close it. Feel free to reopen it if you have different thought. :)
Description
•