[Bug 21976] [imports]: Preventing DOM hierarchy cycles

https://www.w3.org/Bugs/Public/show_bug.cgi?id=21976

--- Comment #14 from Morrita Hajime <morrita@google.com> ---
On second thought, I think we can just let create the cycle.
As Raf pointed, detecting cycle isn't trivial and will be expensive.

Instead, we can make the <link>-to-import reference weak.
We can do this because the import can be retained by someone else,
probably by the master document.
The <link> doesn't need to be an owner of the import.

Conceptually, <link rel=import> could be taken as a directive to load the
import.
It doesn't need to imply any ownership. 

Implementation wise, we could maintain import dependency tree in a separate
data structure. (Blink is doing this.) So loaded imports are alive as long as
the dependency structure is retained by, say, the master document.

So, what should happen when the master document is gone while the <link> is
alive somewhere else? This can happen if the <link> is moved to another frame
and original frame is removed.

In this case, I think it is OK to disconnect <link> from the imported document,
and allow |link.import| to return null.
This is useless edge case where we just have to prevent terrible things
(leak, crash) from happening.

Does this make sense?

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 1 October 2013 09:44:36 UTC