diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 06:34:38 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 06:34:38 -0400 |
commit | 5f12940329ba496da5730863cae94cd8c0b145da (patch) | |
tree | 7dede8dd472329aac367a5bd1c02494fca44482f /dom/base/Element.cpp | |
parent | a72b827325c25c5951b57146e482e49e92e60f32 (diff) | |
download | uxp-5f12940329ba496da5730863cae94cd8c0b145da.tar.gz |
Bug 1396584 - Remove support for multiple ShadowRoots
Tag #1375
Diffstat (limited to 'dom/base/Element.cpp')
-rw-r--r-- | dom/base/Element.cpp | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index a2b78092ad..5bbfbee9b4 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -1095,6 +1095,11 @@ Element::RemoveFromIdTable() already_AddRefed<ShadowRoot> Element::CreateShadowRoot(ErrorResult& aError) { + if (GetShadowRoot()) { + aError.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); + return nullptr; + } + nsAutoScriptBlocker scriptBlocker; RefPtr<mozilla::dom::NodeInfo> nodeInfo; @@ -1131,24 +1136,7 @@ Element::CreateShadowRoot(ErrorResult& aError) shadowRoot->SetIsComposedDocParticipant(IsInComposedDoc()); - // Replace the old ShadowRoot with the new one and let the old - // ShadowRoot know about the younger ShadowRoot because the old - // ShadowRoot is projected into the younger ShadowRoot's shadow - // insertion point (if it exists). - ShadowRoot* olderShadow = GetShadowRoot(); SetShadowRoot(shadowRoot); - if (olderShadow) { - olderShadow->SetYoungerShadow(shadowRoot); - - // Unbind children of older shadow root because they - // are no longer in the composed tree. - for (nsIContent* child = olderShadow->GetFirstChild(); child; - child = child->GetNextSibling()) { - child->UnbindFromTree(true, false); - } - - olderShadow->SetIsComposedDocParticipant(false); - } // xblBinding takes ownership of docInfo. RefPtr<nsXBLBinding> xblBinding = new nsXBLBinding(shadowRoot, protoBinding); |