diff --git a/dom/base/ChildIterator.cpp b/dom/base/ChildIterator.cpp
index 00664d9573fa..6ef0c4e96d59 100644
--- a/dom/base/ChildIterator.cpp
+++ b/dom/base/ChildIterator.cpp
@@ -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*
diff --git a/dom/base/crashtests/1422931.html b/dom/base/crashtests/1422931.html
new file mode 100644
index 000000000000..9f09f41efdbd
--- /dev/null
+++ b/dom/base/crashtests/1422931.html
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/dom/base/crashtests/crashtests.list b/dom/base/crashtests/crashtests.list
index 37b502fd8507..02b02a9c7eb0 100644
--- a/dom/base/crashtests/crashtests.list
+++ b/dom/base/crashtests/crashtests.list
@@ -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
diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp
index 8db11279e86f..37cd08839330 100644
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -7534,7 +7534,7 @@ nsContentUtils::IsContentInsertionPoint(nsIContent* aContent)
bool
nsContentUtils::HasDistributedChildren(nsIContent* aContent)
{
- if (!aContent) {
+ if (!IsWebComponentsEnabled() || !aContent) {
return false;
}