Skip to content

Commit

Permalink
Bug 1422931 - Part 1: Fix crash with slot element. r=smaug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessica Jong committed Dec 8, 2017
1 parent ba42dac commit 491af03
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dom/base/ChildIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ ExplicitChildIterator::ExplicitChildIterator(const nsIContent* aParent,
mIsFirst(aStartAtBeginning),
mIndexInInserted(0)
{
mParentAsSlot = HTMLSlotElement::FromContent(mParent);
mParentAsSlot = nsContentUtils::IsWebComponentsEnabled() ?
HTMLSlotElement::FromContent(mParent) : nullptr;
}

nsIContent*
Expand Down
6 changes: 6 additions & 0 deletions dom/base/crashtests/1422931.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<!-- Testing slot element with "dom.webcomponents.enabled" set to false -->
<slot><div></div></slot>
</html>
1 change: 1 addition & 0 deletions dom/base/crashtests/crashtests.list
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,5 @@ load 1406109-1.html
pref(dom.webcomponents.enabled,true) load 1324463.html
pref(dom.webcomponents.customelements.enabled,true) load 1413815.html
load 1411473.html
pref(dom.webcomponents.enabled,false) load 1422931.html
pref(dom.webcomponents.enabled,true) load 1419799.html
2 changes: 1 addition & 1 deletion dom/base/nsContentUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7534,7 +7534,7 @@ nsContentUtils::IsContentInsertionPoint(nsIContent* aContent)
bool
nsContentUtils::HasDistributedChildren(nsIContent* aContent)
{
if (!aContent) {
if (!IsWebComponentsEnabled() || !aContent) {
return false;
}

Expand Down

0 comments on commit 491af03

Please sign in to comment.