Closed Bug 1579536 Opened 5 years ago Closed 5 years ago

Allow JSWindowActor sendQuery to receive Transferables as well as sending them

Categories

(Core :: DOM: Content Processes, enhancement, P2)

enhancement

Tracking

()

RESOLVED WONTFIX
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?

Flags: needinfo?(jdai)
See Also: → 1544936

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.

(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 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?

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.

Flags: needinfo?(jdai)

(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.

Flags: needinfo?(jdai)

(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 in sendAsyncMessage and sendQuery?

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].

Flags: needinfo?(jdai)
Blocks: 1467212
Assignee: nobody → jdai
Blocks: 1576565
Status: NEW → ASSIGNED
Fission Milestone: --- → M4
Priority: -- → P2

File bug 1580907 to remove transferables attribute for SendAsyncMessage and SendQuery in JSWindowActor.

(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?

Flags: needinfo?(jdai)

(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. :)

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Flags: needinfo?(jdai)
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.