Re: [whatwg/dom] shadowRoot.innerHTML parsing elements from another realm/iframe (#977)

Thanks for your detailed and linked analysis, @rniwa. Indeed I made a mistake in mine and yours seems correct, at least for the `<x-baz>` case: it should be from the main window's registry.

I think the `<p>` case is still not clear though, since step 7.1 of [create an element](https://dom.spec.whatwg.org/#concept-create-element) is not specific about which window to look up the element interface in. (I guess the HTMLElement and HTMLUnknownElement in step 6 has a similar problem, for the intermediate period between the insertion and the upgrade...). I'd say there are at least two plausible choices:

- Use the element interface from the global associated to the document passed to "create an element"
- Use the element interface from the current global object (i.e. the global object of the innerHTML setter)

In this case they are equivalent and equal to the other window (so `<p>` should not be from the main window, I think, so Chrome's behavior is correct?). But they could be different if you did something like `Object.getOwnPropertyDescriptor(ShadowRoot, "innerHTML").set.call(elmFromAnotherDoc.shadowRoot, ...)`.

I'd appreciate a double-check on my logic as to whether `<p>` should be from the main window or not though, as this is a tricky area and I've already gotten things wrong once...

(All this just makes me wish globals weren't allowed to synchronously touch each other, ugh.)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/977#issuecomment-832028946

Received on Tuesday, 4 May 2021 15:25:31 UTC