Bug 1422931 - Part 1: Fix crash with slot element. r=smaug

This commit is contained in:
Jessica Jong 2017-12-09 11:24:58 +08:00
Родитель 022fdd6e61
Коммит b519c97d26
4 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@ -66,7 +66,8 @@ ExplicitChildIterator::ExplicitChildIterator(const nsIContent* aParent,
mIsFirst(aStartAtBeginning), mIsFirst(aStartAtBeginning),
mIndexInInserted(0) mIndexInInserted(0)
{ {
mParentAsSlot = HTMLSlotElement::FromContent(mParent); mParentAsSlot = nsContentUtils::IsWebComponentsEnabled() ?
HTMLSlotElement::FromContent(mParent) : nullptr;
} }
nsIContent* nsIContent*

Просмотреть файл

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<!-- Testing slot element with "dom.webcomponents.enabled" set to false -->
<slot><div></div></slot>
</html>

Просмотреть файл

@ -236,4 +236,5 @@ load 1406109-1.html
pref(dom.webcomponents.enabled,true) load 1324463.html pref(dom.webcomponents.enabled,true) load 1324463.html
pref(dom.webcomponents.customelements.enabled,true) load 1413815.html pref(dom.webcomponents.customelements.enabled,true) load 1413815.html
load 1411473.html load 1411473.html
pref(dom.webcomponents.enabled,false) load 1422931.html
pref(dom.webcomponents.enabled,true) load 1419799.html pref(dom.webcomponents.enabled,true) load 1419799.html

Просмотреть файл

@ -7534,7 +7534,7 @@ nsContentUtils::IsContentInsertionPoint(nsIContent* aContent)
bool bool
nsContentUtils::HasDistributedChildren(nsIContent* aContent) nsContentUtils::HasDistributedChildren(nsIContent* aContent)
{ {
if (!aContent) { if (!IsWebComponentsEnabled() || !aContent) {
return false; return false;
} }