On 10/19/12 1:55 PM, Boris Zbarsky wrote:
Do we have a plan for adoptNode?  If we're allocating nodes out of the
JS heap, presumably we'll need to brain-transplant the JSObject and then
copy over the implementation into the new compartment... and make sure
we update any pointers to the implementation, right?

I'm not entirely clear on the semantics of adoptNode. Is it possible that the node could come from a different origin?

If the node can't come from a different origin, it's still tricky, but relatively straightforward: we brain transplant the JS object and essentially treat the node as deleted on the document it came from as far as layout is concerned. It's an invariant that layout can't directly store DOM node handles from layout pass to layout pass, so once layout is completed it should be OK to move the node over. We may have to wait for layout on the source document to complete before moving the node over to the destination document though; this means that adoptNode will probably cause a content task stall if layout is happening in the source document.

If the node can come from a different origin, then, well, we'll have to send it over IPC or something. It seems to me that Google Chrome would have the same problems here, since it runs different origins in different processes. Might be worth looking at its implementation in this scenario.

Patrick

_______________________________________________
dev-servo mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to