+diff --git a/dom/base/nsTextFragment.cpp b/dom/base/nsTextFragment.cpp
+--- a/dom/base/nsTextFragment.cpp
++++ b/dom/base/nsTextFragment.cpp
+@@ -157,11 +157,11 @@
+
+ return -1;
+ }
+
+ #if defined(MOZILLA_MAY_SUPPORT_SSE2)
+-# include "nsTextFragmentGeneric.h"
++# include "nsTextFragmentGenericFwd.h"
+ #endif
+
+ #ifdef __powerpc__
+ namespace mozilla {
+ namespace VMX {
+diff --git a/dom/base/nsTextFragmentGeneric.h b/dom/base/nsTextFragmentGeneric.h
+--- a/dom/base/nsTextFragmentGeneric.h
++++ b/dom/base/nsTextFragmentGeneric.h
+@@ -2,14 +2,18 @@
+ /* vim: set ts=8 sts=2 et sw=2 tw=80: */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
++#ifndef nsTextFragmentGeneric_h__
++#define nsTextFragmentGeneric_h__
++
++#include "nsTextFragmentGenericFwd.h"
++
+ #include "nscore.h"
+ #include "nsTextFragmentImpl.h"
+ #include <algorithm>
+-#include <xsimd/xsimd.hpp>
+
+ namespace mozilla {
+
+ template <class Arch>
+ int32_t FirstNon8Bit(const char16_t* str, const char16_t* end) {
+@@ -55,5 +59,7 @@
+
+ return -1;
+ }
+
+ } // namespace mozilla
++
++#endif
+diff --git a/dom/base/nsTextFragmentGenericFwd.h b/dom/base/nsTextFragmentGenericFwd.h
+new file mode 100644
+--- /dev/null
++++ b/dom/base/nsTextFragmentGenericFwd.h
+@@ -0,0 +1,21 @@
++/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* vim: set ts=8 sts=2 et sw=2 tw=80: */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#ifndef nsTextFragmentGenericFwd_h__
++#define nsTextFragmentGenericFwd_h__
++
++#include <cstdint>
++#include <cuchar>
++#include <xsimd/xsimd.hpp>
++
++namespace mozilla {
++
++template <class Arch>
++int32_t FirstNon8Bit(const char16_t* str, const char16_t* end);
++
++} // namespace mozilla
++
++#endif
+