[Bug 22485] [Custom]: registration context is defined oddly since Window of a document may change

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

--- Comment #6 from Dominic Cooney <dominicc@chromium.org> ---
(In reply to comment #5)
> (In reply to comment #4)
> 
> > This has the benefit that x.implementation.createHTMLDocument gives
> > consistent results, irregardless of which window is running the script that
> > acts on x.
> 
> Can you help me understand this? If I have main document A that contains an
> iframe B, and A reaches into B and attempts to createHTMLDocument on its
> document, we need to make sure that the document has the registration
> context from B, right?

Right. The spec today has this:

"Whenever created, each document must retain a weak reference to the Window
object of the browsing context's active document. This referenced Window object
is called the registration context."

I assume? this means that if A reaches into B and does 

doc = B.contentDocument.implementation.createHTMLDocument();

'doc' should be associated with the registration context of A, because the
window that's running the script, etc. is A's.

If you think it is B, I am prepared to believe you, but then what does

doc2 = doc.implementation.createHTMLDocument();

associate doc2 with? In terms of browsing contexts, B has fled the scene.

So I'm proposing that documents are associated with a registration context, and
when creating documents in specific situations, that association is transmitted
to the new document in a process like quantum entanglement.

After having a crack at implementing something in Blink, I think you could do
anything right up to letting the author imperatively state which documents they
want entangled.

The idea of changing the entanglement of a document after custom element
processing has started sounds scary, but it is really not--remember we have to
solve the adoptNode problem. Changing the entanglement would look, from the
point of view of the old context, like all of the elements got put up for
adoption at once.

I have no idea whether this is a good idea, except to say it is a nice
conservative security default to entangle very little, maybe just template and
imports. And then the author can decide to entangle other kinds of documents if
he/she wants.

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

Received on Friday, 12 July 2013 23:48:45 UTC