Bug 1431255 - Part V, Set the reflectors of the UA Widget DOM to UA Widget Scope r=bholley

The DOM elements within the UA Widget Shadow DOM should have its reflectors in
the UA Widget Scope. This is done by calling nsINode::IsInUAWidget() which
would check its containing shadow and its UA Widget bit.

To prevent JS access of the DOM element before it is in the
UA Widget Shadom DOM tree, various DOM methods are set to inaccessible to
UA Widget script. It would need to use the two special methods in ShadowRoot
instead to insert the DOM directly into the shadow tree.

MozReview-Commit-ID: Jz9iCaVIoij
This commit is contained in:
Timothy Guan-tin Chien
2018-06-29 13:39:46 -07:00
parent bf709bb904
commit b367b1030b
24 changed files with 420 additions and 58 deletions

View File

@@ -4942,11 +4942,14 @@ void
HTMLMediaElement::AttachAndSetUAShadowRoot()
{
if (GetShadowRoot()) {
MOZ_ASSERT(GetShadowRoot()->IsUAWidget());
return;
}
// Add a closed shadow root to host video controls
AttachShadowWithoutNameChecks(ShadowRootMode::Closed);
RefPtr<ShadowRoot> shadowRoot =
AttachShadowWithoutNameChecks(ShadowRootMode::Closed);
shadowRoot->SetIsUAWidget(true);
}
nsresult