Bug 1427419 - Part 22: Move inIDOMUtils.getUsedFontFaces to InspectorUtils. r?bz draft
authorCameron McCormack <cam@mcc.id.au>
Sat, 06 Jan 2018 15:08:15 +0800
changeset 716767 d7be1f779edd9a764e89b1323b9128a40c0b54d7
parent 716766 6fa77e224bdfef2295110e92aa07cc952f9d3c89
child 716768 161a63cbd431af40cbe2f815da23bf896b9a740e
push id94496
push userbmo:cam@mcc.id.au
push dateSat, 06 Jan 2018 07:08:40 +0000
reviewersbz
bugs1427419
milestone59.0a1
Bug 1427419 - Part 22: Move inIDOMUtils.getUsedFontFaces to InspectorUtils. r?bz This also changes the function to return a sequence (JS Array) instead of an nsFontFaceList object, and converts nsFontFace/nsIDOMFontFace into a Web IDL implemented object too. MozReview-Commit-ID: 1iAW3DYe5kO
devtools/server/actors/object.js
devtools/server/actors/styles.js
dom/base/nsRange.cpp
dom/base/nsRange.h
dom/bindings/Bindings.conf
dom/interfaces/base/domstubs.idl
dom/webidl/InspectorUtils.webidl
gfx/tests/mochitest/test_font_whitelist.html
gfx/thebes/gfxUserFontSet.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/inspector/InspectorFontFace.cpp
layout/inspector/InspectorFontFace.h
layout/inspector/InspectorUtils.h
layout/inspector/inDOMUtils.cpp
layout/inspector/inIDOMUtils.idl
layout/inspector/moz.build
layout/inspector/nsFontFace.cpp
layout/inspector/nsFontFace.h
layout/inspector/nsFontFaceList.cpp
layout/inspector/nsFontFaceList.h
layout/inspector/nsIDOMFontFace.idl
layout/inspector/nsIDOMFontFaceList.idl
layout/inspector/tests/chrome/test_bug467669.xul
layout/inspector/tests/chrome/test_bug695639.xul
--- a/devtools/server/actors/object.js
+++ b/devtools/server/actors/object.js
@@ -1765,17 +1765,16 @@ DebuggerServer.ObjectActorPreviewers.Obj
   function ArrayLike({obj, hooks}, grip, rawObj) {
     if (isWorker || !rawObj ||
         obj.class != "DOMStringList" &&
         obj.class != "DOMTokenList" &&
         !(rawObj instanceof Ci.nsIDOMMozNamedAttrMap ||
           rawObj instanceof Ci.nsIDOMCSSRuleList ||
           rawObj instanceof Ci.nsIDOMCSSValueList ||
           rawObj instanceof Ci.nsIDOMFileList ||
-          rawObj instanceof Ci.nsIDOMFontFaceList ||
           rawObj instanceof Ci.nsIDOMMediaList ||
           rawObj instanceof Ci.nsIDOMNodeList ||
           rawObj instanceof Ci.nsIDOMStyleSheetList)) {
       return false;
     }
 
     if (typeof rawObj.length != "number") {
       return false;
--- a/devtools/server/actors/styles.js
+++ b/devtools/server/actors/styles.js
@@ -267,21 +267,21 @@ var PageStyleActor = protocol.ActorClass
    */
   getUsedFontFaces: function (node, options) {
     // node.rawNode is defined for NodeActor objects
     let actualNode = node.rawNode || node;
     let contentDocument = actualNode.ownerDocument;
     // We don't get fonts for a node, but for a range
     let rng = contentDocument.createRange();
     rng.selectNodeContents(actualNode);
-    let fonts = DOMUtils.getUsedFontFaces(rng);
+    let fonts = InspectorUtils.getUsedFontFaces(rng);
     let fontsArray = [];
 
     for (let i = 0; i < fonts.length; i++) {
-      let font = fonts.item(i);
+      let font = fonts[i];
       let fontFace = {
         name: font.name,
         CSSFamilyName: font.CSSFamilyName,
         srcIndex: font.srcIndex,
         URI: font.URI,
         format: font.format,
         localName: font.localName,
         metadata: font.metadata
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -20,30 +20,30 @@
 #include "nsIDOMText.h"
 #include "nsError.h"
 #include "nsIContentIterator.h"
 #include "nsIDOMNodeList.h"
 #include "nsGkAtoms.h"
 #include "nsContentUtils.h"
 #include "nsGenericDOMDataNode.h"
 #include "nsTextFrame.h"
-#include "nsFontFaceList.h"
 #include "mozilla/dom/DocumentFragment.h"
 #include "mozilla/dom/DocumentType.h"
 #include "mozilla/dom/RangeBinding.h"
 #include "mozilla/dom/DOMRect.h"
 #include "mozilla/dom/DOMStringList.h"
 #include "mozilla/dom/ShadowRoot.h"
 #include "mozilla/dom/Selection.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/Likely.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsStyleStruct.h"
 #include "nsStyleStructInlines.h"
 #include "nsComputedDOMStyle.h"
+#include "mozilla/dom/InspectorFontFace.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 JSObject*
 nsRange::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return RangeBinding::Wrap(aCx, this, aGivenProto);
@@ -3462,35 +3462,37 @@ nsRange::GetClientRectsAndTexts(
   aResult.mRectList = new DOMRectList(static_cast<nsIDOMRange*>(this));
 
   nsLayoutUtils::RectListBuilder builder(aResult.mRectList);
 
   CollectClientRectsAndText(&builder, &aResult.mTextList, this,
     mStart.Container(), mStart.Offset(), mEnd.Container(), mEnd.Offset(), true, true);
 }
 
-NS_IMETHODIMP
-nsRange::GetUsedFontFaces(nsIDOMFontFaceList** aResult)
+nsresult
+nsRange::GetUsedFontFaces(nsTArray<nsAutoPtr<InspectorFontFace>>& aResult)
 {
-  *aResult = nullptr;
-
   NS_ENSURE_TRUE(mStart.Container(), NS_ERROR_UNEXPECTED);
 
   nsCOMPtr<nsINode> startContainer = do_QueryInterface(mStart.Container());
   nsCOMPtr<nsINode> endContainer = do_QueryInterface(mEnd.Container());
 
   // Flush out layout so our frames are up to date.
   nsIDocument* doc = mStart.Container()->OwnerDoc();
   NS_ENSURE_TRUE(doc, NS_ERROR_UNEXPECTED);
   doc->FlushPendingNotifications(FlushType::Frames);
 
   // Recheck whether we're still in the document
   NS_ENSURE_TRUE(mStart.Container()->IsInUncomposedDoc(), NS_ERROR_UNEXPECTED);
 
-  RefPtr<nsFontFaceList> fontFaceList = new nsFontFaceList();
+  // A table to map gfxFontEntry objects to InspectorFontFace objects.
+  // (We hold on to the InspectorFontFaces strongly due to the nsAutoPtrs
+  // in the nsClassHashtable, until we move them out into aResult at the end
+  // of the function.)
+  nsLayoutUtils::UsedFontFaceTable fontFaces;
 
   RangeSubtreeIterator iter;
   nsresult rv = iter.Init(this);
   NS_ENSURE_SUCCESS(rv, rv);
 
   while (!iter.IsDone()) {
     // only collect anything if the range is not collapsed
     nsCOMPtr<nsINode> node = iter.GetCurrentNode();
@@ -3505,30 +3507,35 @@ nsRange::GetUsedFontFaces(nsIDOMFontFace
       continue;
     }
 
     if (content->IsNodeOfType(nsINode::eTEXT)) {
        if (node == startContainer) {
          int32_t offset = startContainer == endContainer ?
            mEnd.Offset() : content->GetText()->GetLength();
          nsLayoutUtils::GetFontFacesForText(frame, mStart.Offset(), offset,
-                                            true, fontFaceList);
+                                            true, fontFaces);
          continue;
        }
        if (node == endContainer) {
          nsLayoutUtils::GetFontFacesForText(frame, 0, mEnd.Offset(),
-                                            true, fontFaceList);
+                                            true, fontFaces);
          continue;
        }
     }
 
-    nsLayoutUtils::GetFontFacesForFrames(frame, fontFaceList);
+    nsLayoutUtils::GetFontFacesForFrames(frame, fontFaces);
   }
 
-  fontFaceList.forget(aResult);
+  // Take ownership of the InspectorFontFaces in the table and move them into
+  // the aResult outparam.
+  for (auto iter = fontFaces.Iter(); !iter.Done(); iter.Next()) {
+    aResult.AppendElement(Move(iter.Data()));
+  }
+
   return NS_OK;
 }
 
 nsINode*
 nsRange::GetRegisteredCommonAncestor()
 {
   MOZ_ASSERT(IsInSelection(),
              "GetRegisteredCommonAncestor only valid for range in selection");
--- a/dom/base/nsRange.h
+++ b/dom/base/nsRange.h
@@ -28,16 +28,17 @@
 namespace mozilla {
 class ErrorResult;
 namespace dom {
 struct ClientRectsAndTexts;
 class DocGroup;
 class DocumentFragment;
 class DOMRect;
 class DOMRectList;
+class InspectorFontFace;
 class Selection;
 } // namespace dom
 } // namespace mozilla
 
 class nsRange final : public nsIDOMRange,
                       public nsStubMutationObserver,
                       public nsWrapperCache,
                       // For linking together selection-associated ranges.
@@ -275,17 +276,18 @@ public:
     int32_t indexInParent = parentNode->IndexOf(aNode);
     if (NS_WARN_IF(indexInParent < 0)) {
       return nullptr;
     }
     *aOffset = static_cast<uint32_t>(indexInParent);
     return parentNode;
   }
 
-  NS_IMETHOD GetUsedFontFaces(nsIDOMFontFaceList** aResult);
+  nsresult GetUsedFontFaces(
+      nsTArray<nsAutoPtr<mozilla::dom::InspectorFontFace>>& aResult);
 
   // nsIMutationObserver methods
   NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
   NS_DECL_NSIMUTATIONOBSERVER_PARENTCHAINCHANGED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
 
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -512,16 +512,20 @@ DOMInterfaces = {
     'wrapperCache': False,
 },
 
 'InputStream': {
     'nativeType': 'nsIInputStream',
     'notflattened': True
 },
 
+'InspectorFontFace': {
+    'wrapperCache': False,
+},
+
 'IntersectionObserver': {
     'nativeType': 'mozilla::dom::DOMIntersectionObserver',
 },
 
 'IntersectionObserverEntry': {
     'nativeType': 'mozilla::dom::DOMIntersectionObserverEntry',
     'headerFile': 'DOMIntersectionObserver.h',
 },
--- a/dom/interfaces/base/domstubs.idl
+++ b/dom/interfaces/base/domstubs.idl
@@ -75,12 +75,8 @@ interface nsIDOMRect;
 interface nsIDOMCSSStyleRule;
 interface nsIDOMCSSStyleRuleCollection;
 
 // Range
 interface nsIDOMRange;
 
 // Crypto
 interface nsIDOMCrypto;
-
-// Used font face (for inspector)
-interface nsIDOMFontFace;
-interface nsIDOMFontFaceList;
--- a/dom/webidl/InspectorUtils.webidl
+++ b/dom/webidl/InspectorUtils.webidl
@@ -58,16 +58,17 @@ namespace InspectorUtils {
                                           boolean showingAnonymousContent);
   sequence<DOMString> getBindingURLs(Element element);
   [Throws] void setContentState(Element element, unsigned long long state);
   [Throws] void removeContentState(
       Element element,
       unsigned long long state,
       optional boolean clearActiveDocument = false);
   unsigned long long getContentState(Element element);
+  [NewObject, Throws] sequence<InspectorFontFace> getUsedFontFaces(Range range);
 };
 
 dictionary PropertyNamesOptions {
   boolean includeAliases = false;
 };
 
 dictionary InspectorRGBATuple {
   /*
@@ -76,8 +77,31 @@ dictionary InspectorRGBATuple {
    *
    * a is in the range 0 - 1.
    */
   double r = 0;
   double g = 0;
   double b = 0;
   double a = 1;
 };
+
+[ChromeOnly]
+interface InspectorFontFace {
+  // An indication of how we found this font during font-matching.
+  // Note that the same physical font may have been found in multiple ways within a range.
+  readonly attribute boolean fromFontGroup;
+  readonly attribute boolean fromLanguagePrefs;
+  readonly attribute boolean fromSystemFallback;
+
+  // available for all fonts
+  readonly attribute DOMString name; // full font name as obtained from the font resource
+  readonly attribute DOMString CSSFamilyName; // a family name that could be used in CSS font-family
+                                              // (not necessarily the actual name that was used,
+                                              // due to aliases, generics, localized names, etc)
+
+  // meaningful only when the font is a user font defined using @font-face
+  readonly attribute CSSFontFaceRule? rule; // null if no associated @font-face rule
+  readonly attribute long srcIndex; // index in the rule's src list, -1 if no @font-face rule
+  readonly attribute DOMString URI; // empty string if not a downloaded font, i.e. local
+  readonly attribute DOMString localName; // empty string  if not a src:local(...) rule
+  readonly attribute DOMString format; // as per http://www.w3.org/TR/css3-webfonts/#referencing
+  readonly attribute DOMString metadata; // XML metadata from WOFF file (if any)
+};
--- a/gfx/tests/mochitest/test_font_whitelist.html
+++ b/gfx/tests/mochitest/test_font_whitelist.html
@@ -16,25 +16,24 @@ https://bugzilla.mozilla.org/show_bug.cg
 <span id="serif" style="font-family: serif; font-size: 64px;">M</span>
 <div id="content" style="display: none">
 
 </div>
 <script class="testbody" type="application/javascript">
 
 /** Test for Bug 1121643 **/
 
-const DOMUtils =  SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"]
-                               .getService(SpecialPowers.Ci.inIDOMUtils);
+const InspectorUtils = SpecialPowers.InspectorUtils;
 
 // Given an element id, returns the first font face name encountered.
 let fontUsed = id => {
   let element = document.getElementById(id),
       range = document.createRange();
   range.selectNode(element);
-  return DOMUtils.getUsedFontFaces(range).item(0).CSSFamilyName;
+  return InspectorUtils.getUsedFontFaces(range)[0].CSSFamilyName;
 }
 
 // A map of the default mono, sans and serif fonts, obtained when
 // whitelisting is disabled.
 const fonts = { mono : fontUsed("mono"),
                 sans : fontUsed("sans"),
                 serif : fontUsed("serif") };
 
--- a/gfx/thebes/gfxUserFontSet.cpp
+++ b/gfx/thebes/gfxUserFontSet.cpp
@@ -714,17 +714,17 @@ gfxUserFontEntry::LoadPlatformFont(const
         gfxFontUtils::DetermineFontDataType(aFontData, aLength);
     Telemetry::Accumulate(Telemetry::WEBFONT_FONTTYPE, uint32_t(fontType));
 
     // Unwrap/decompress/sanitize or otherwise munge the downloaded data
     // to make a usable sfnt structure.
 
     // Because platform font activation code may replace the name table
     // in the font with a synthetic one, we save the original name so that
-    // it can be reported via the nsIDOMFontFace API.
+    // it can be reported via the InspectorUtils API.
     nsAutoString originalFullName;
 
     // Call the OTS sanitizer; this will also decode WOFF to sfnt
     // if necessary. The original data in aFontData is left unchanged.
     uint32_t saneLen;
     uint32_t fontCompressionRatio = 0;
     size_t computedSize = 0;
     const uint8_t* saneData =
@@ -780,17 +780,17 @@ gfxUserFontEntry::LoadPlatformFont(const
         if (!fe) {
             mFontSet->LogMessage(this, "not usable by platform");
         }
     }
 
     if (fe) {
         fe->mComputedSizeOfUserFont = computedSize;
 
-        // Save a copy of the metadata block (if present) for nsIDOMFontFace
+        // Save a copy of the metadata block (if present) for InspectorUtils
         // to use if required. Ownership of the metadata block will be passed
         // to the gfxUserFontData record below.
         FallibleTArray<uint8_t> metadata;
         uint32_t metaOrigLen = 0;
         uint8_t compression = gfxUserFontData::kUnknownCompression;
         if (fontType == GFX_USERFONT_WOFF) {
             CopyWOFFMetadata<WOFFHeader>(aFontData, aLength,
                                          &metadata, &metaOrigLen);
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -83,17 +83,16 @@
 #include "mozilla/dom/Element.h"
 #include "nsCanvasFrame.h"
 #include "gfxDrawable.h"
 #include "gfxEnv.h"
 #include "gfxUtils.h"
 #include "nsDataHashtable.h"
 #include "nsTableWrapperFrame.h"
 #include "nsTextFrame.h"
-#include "nsFontFaceList.h"
 #include "nsFontInflationData.h"
 #include "nsSVGIntegrationUtils.h"
 #include "nsSVGUtils.h"
 #include "SVGImageContext.h"
 #include "SVGTextFrame.h"
 #include "nsStyleStructInlines.h"
 #include "nsStyleTransformMatrix.h"
 #include "nsIFrameInlines.h"
@@ -128,16 +127,17 @@
 #include "mozilla/layers/WebRenderLayerManager.h"
 #include "prenv.h"
 #include "RetainedDisplayListBuilder.h"
 #include "DisplayListChecker.h"
 #include "TextDrawTarget.h"
 #include "nsDeckFrame.h"
 #include "nsIEffectiveTLDService.h" // for IsInStyloBlocklist
 #include "mozilla/StylePrefs.h"
+#include "mozilla/dom/InspectorFontFace.h"
 
 #ifdef MOZ_XUL
 #include "nsXULPopupManager.h"
 #endif
 
 #include "GeckoProfiler.h"
 #include "nsAnimationManager.h"
 #include "nsTransitionManager.h"
@@ -7985,61 +7985,86 @@ nsLayoutUtils::AssertTreeOnlyEmptyNextIn
     for (; !childFrames.AtEnd(); childFrames.Next()) {
       nsLayoutUtils::AssertTreeOnlyEmptyNextInFlows(childFrames.get());
     }
   }
 }
 #endif
 
 static void
-GetFontFacesForFramesInner(nsIFrame* aFrame, nsFontFaceList* aFontFaceList)
+GetFontFacesForFramesInner(nsIFrame* aFrame,
+                           nsLayoutUtils::UsedFontFaceTable& aFontFaces)
 {
   NS_PRECONDITION(aFrame, "NULL frame pointer");
 
   if (aFrame->IsTextFrame()) {
     if (!aFrame->GetPrevContinuation()) {
       nsLayoutUtils::GetFontFacesForText(aFrame, 0, INT32_MAX, true,
-                                         aFontFaceList);
+                                         aFontFaces);
     }
     return;
   }
 
   nsIFrame::ChildListID childLists[] = { nsIFrame::kPrincipalList,
                                          nsIFrame::kPopupList };
   for (size_t i = 0; i < ArrayLength(childLists); ++i) {
     nsFrameList children(aFrame->GetChildList(childLists[i]));
     for (nsFrameList::Enumerator e(children); !e.AtEnd(); e.Next()) {
       nsIFrame* child = e.get();
       child = nsPlaceholderFrame::GetRealFrameFor(child);
-      GetFontFacesForFramesInner(child, aFontFaceList);
-    }
-  }
-}
-
-/* static */
-nsresult
+      GetFontFacesForFramesInner(child, aFontFaces);
+    }
+  }
+}
+
+/* static */ nsresult
 nsLayoutUtils::GetFontFacesForFrames(nsIFrame* aFrame,
-                                     nsFontFaceList* aFontFaceList)
+                                     UsedFontFaceTable& aFontFaces)
 {
   NS_PRECONDITION(aFrame, "NULL frame pointer");
 
   while (aFrame) {
-    GetFontFacesForFramesInner(aFrame, aFontFaceList);
+    GetFontFacesForFramesInner(aFrame, aFontFaces);
     aFrame = GetNextContinuationOrIBSplitSibling(aFrame);
   }
 
   return NS_OK;
 }
 
-/* static */
-nsresult
+static void
+AddFontsFromTextRun(gfxTextRun* aTextRun,
+                    uint32_t aOffset,
+                    uint32_t aLength,
+                    nsLayoutUtils::UsedFontFaceTable& aFontFaces)
+{
+  gfxTextRun::Range range(aOffset, aOffset + aLength);
+  gfxTextRun::GlyphRunIterator iter(aTextRun, range);
+  while (iter.NextRun()) {
+    gfxFontEntry *fe = iter.GetGlyphRun()->mFont->GetFontEntry();
+    // if we have already listed this face, just make sure the match type is
+    // recorded
+    InspectorFontFace* existingFace = aFontFaces.Get(fe);
+    if (existingFace) {
+      existingFace->AddMatchType(iter.GetGlyphRun()->mMatchType);
+    } else {
+      // A new font entry we haven't seen before
+      InspectorFontFace* ff =
+        new InspectorFontFace(fe, aTextRun->GetFontGroup(),
+                              iter.GetGlyphRun()->mMatchType);
+      aFontFaces.Put(fe, ff);
+    }
+  }
+}
+
+/* static */ nsresult
 nsLayoutUtils::GetFontFacesForText(nsIFrame* aFrame,
-                                   int32_t aStartOffset, int32_t aEndOffset,
+                                   int32_t aStartOffset,
+                                   int32_t aEndOffset,
                                    bool aFollowContinuations,
-                                   nsFontFaceList* aFontFaceList)
+                                   UsedFontFaceTable& aFontFaces)
 {
   NS_PRECONDITION(aFrame, "NULL frame pointer");
 
   if (!aFrame->IsTextFrame()) {
     return NS_OK;
   }
 
   nsTextFrame* curr = static_cast<nsTextFrame*>(aFrame);
@@ -8064,17 +8089,17 @@ nsLayoutUtils::GetFontFacesForText(nsIFr
         fend = std::min(next->GetContentEnd(), aEndOffset);
         next = fend < aEndOffset ?
           static_cast<nsTextFrame*>(next->GetNextContinuation()) : nullptr;
       }
     }
 
     uint32_t skipStart = iter.ConvertOriginalToSkipped(fstart);
     uint32_t skipEnd = iter.ConvertOriginalToSkipped(fend);
-    aFontFaceList->AddFontsFromTextRun(textRun, skipStart, skipEnd - skipStart);
+    AddFontsFromTextRun(textRun, skipStart, skipEnd - skipStart, aFontFaces);
     curr = next;
   } while (aFollowContinuations && curr);
 
   return NS_OK;
 }
 
 /* static */
 size_t
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -31,16 +31,17 @@
 #include "mozilla/ReflowOutput.h"
 #include "ImageContainer.h"
 #include "gfx2DGlue.h"
 #include "nsStyleConsts.h"
 #include "SVGImageContext.h"
 #include <limits>
 #include <algorithm>
 #include "gfxPoint.h"
+#include "nsClassHashtable.h"
 
 class gfxContext;
 class nsPresContext;
 class nsIContent;
 class nsAtom;
 class nsIScrollableFrame;
 class nsIDOMEvent;
 class nsRegion;
@@ -76,16 +77,17 @@ class EffectSet;
 struct ActiveScrolledRoot;
 namespace dom {
 class CanvasRenderingContext2D;
 class DOMRectList;
 class Element;
 class HTMLImageElement;
 class HTMLCanvasElement;
 class HTMLVideoElement;
+class InspectorFontFace;
 class OffscreenCanvas;
 class Selection;
 } // namespace dom
 namespace gfx {
 struct RectCornerRadii;
 enum class ShapedTextFlags : uint16_t;
 } // namespace gfx
 namespace layers {
@@ -2262,34 +2264,37 @@ public:
                                       nscolor aBackstop);
 
   /**
    * Returns true if the passed in prescontext needs the dark grey background
    * that goes behind the page of a print preview presentation.
    */
   static bool NeedsPrintPreviewBackground(nsPresContext* aPresContext);
 
+  typedef nsClassHashtable<nsPtrHashKey<gfxFontEntry>,
+                           mozilla::dom::InspectorFontFace> UsedFontFaceTable;
+
   /**
    * Adds all font faces used in the frame tree starting from aFrame
    * to the list aFontFaceList.
    */
   static nsresult GetFontFacesForFrames(nsIFrame* aFrame,
-                                        nsFontFaceList* aFontFaceList);
+                                        UsedFontFaceTable& aResult);
 
   /**
    * Adds all font faces used within the specified range of text in aFrame,
    * and optionally its continuations, to the list in aFontFaceList.
    * Pass 0 and INT32_MAX for aStartOffset and aEndOffset to specify the
    * entire text is to be considered.
    */
   static nsresult GetFontFacesForText(nsIFrame* aFrame,
                                       int32_t aStartOffset,
                                       int32_t aEndOffset,
                                       bool aFollowContinuations,
-                                      nsFontFaceList* aFontFaceList);
+                                      UsedFontFaceTable& aResult);
 
   /**
    * Walks the frame tree starting at aFrame looking for textRuns.
    * If |clear| is true, just clears the TEXT_RUN_MEMORY_ACCOUNTED flag
    * on each textRun found (and |aMallocSizeOf| is not used).
    * If |clear| is false, adds the storage used for each textRun to the
    * total, and sets the TEXT_RUN_MEMORY_ACCOUNTED flag to avoid double-
    * accounting. (Runs with this flag already set will be skipped.)
rename from layout/inspector/nsFontFace.cpp
rename to layout/inspector/InspectorFontFace.cpp
--- a/layout/inspector/nsFontFace.cpp
+++ b/layout/inspector/InspectorFontFace.cpp
@@ -1,164 +1,129 @@
 /* -*- 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/. */
 
-#include "nsFontFace.h"
-#include "nsIDOMCSSFontFaceRule.h"
+#include "InspectorFontFace.h"
+
 #include "nsCSSRules.h"
 #include "gfxTextRun.h"
 #include "gfxUserFontSet.h"
 #include "nsFontFaceLoader.h"
 #include "mozilla/gfx/2D.h"
 #include "brotli/decode.h"
 #include "zlib.h"
 #include "mozilla/dom/FontFaceSet.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
+namespace mozilla {
+namespace dom {
 
-nsFontFace::nsFontFace(gfxFontEntry*      aFontEntry,
-                       gfxFontGroup*      aFontGroup,
-                       uint8_t            aMatchType)
-  : mFontEntry(aFontEntry),
-    mFontGroup(aFontGroup),
-    mMatchType(aMatchType)
+bool
+InspectorFontFace::FromFontGroup()
 {
-}
-
-nsFontFace::~nsFontFace()
-{
+  return mMatchType & gfxTextRange::kFontGroup;
 }
 
-////////////////////////////////////////////////////////////////////////
-// nsISupports
-
-NS_IMPL_ISUPPORTS(nsFontFace, nsIDOMFontFace)
-
-////////////////////////////////////////////////////////////////////////
-// nsIDOMFontFace
-
-NS_IMETHODIMP
-nsFontFace::GetFromFontGroup(bool * aFromFontGroup)
+bool
+InspectorFontFace::FromLanguagePrefs()
 {
-  *aFromFontGroup =
-    (mMatchType & gfxTextRange::kFontGroup) != 0;
-  return NS_OK;
+  return mMatchType & gfxTextRange::kPrefsFallback;
 }
 
-NS_IMETHODIMP
-nsFontFace::GetFromLanguagePrefs(bool * aFromLanguagePrefs)
+bool
+InspectorFontFace::FromSystemFallback()
 {
-  *aFromLanguagePrefs =
-    (mMatchType & gfxTextRange::kPrefsFallback) != 0;
-  return NS_OK;
+  return mMatchType & gfxTextRange::kSystemFallback;
 }
 
-NS_IMETHODIMP
-nsFontFace::GetFromSystemFallback(bool * aFromSystemFallback)
-{
-  *aFromSystemFallback =
-    (mMatchType & gfxTextRange::kSystemFallback) != 0;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsFontFace::GetName(nsAString & aName)
+void
+InspectorFontFace::GetName(nsAString& aName)
 {
   if (mFontEntry->IsUserFont() && !mFontEntry->IsLocalUserFont()) {
     NS_ASSERTION(mFontEntry->mUserFontData, "missing userFontData");
     aName = mFontEntry->mUserFontData->mRealName;
   } else {
     aName = mFontEntry->RealFaceName();
   }
-  return NS_OK;
 }
 
-NS_IMETHODIMP
-nsFontFace::GetCSSFamilyName(nsAString & aCSSFamilyName)
+void
+InspectorFontFace::GetCSSFamilyName(nsAString& aCSSFamilyName)
 {
   aCSSFamilyName = mFontEntry->FamilyName();
-  return NS_OK;
 }
 
-NS_IMETHODIMP
-nsFontFace::GetRule(nsIDOMCSSFontFaceRule **aRule)
+nsCSSFontFaceRule*
+InspectorFontFace::GetRule()
 {
   // check whether this font entry is associated with an @font-face rule
   // in the relevant font group's user font set
   nsCSSFontFaceRule* rule = nullptr;
   if (mFontEntry->IsUserFont()) {
     FontFaceSet::UserFontSet* fontSet =
       static_cast<FontFaceSet::UserFontSet*>(mFontGroup->GetUserFontSet());
     if (fontSet) {
       FontFaceSet* fontFaceSet = fontSet->GetFontFaceSet();
       if (fontFaceSet) {
         rule = fontFaceSet->FindRuleForEntry(mFontEntry);
       }
     }
   }
-
-  NS_IF_ADDREF(*aRule = rule);
-  return NS_OK;
+  return rule;
 }
 
-NS_IMETHODIMP
-nsFontFace::GetSrcIndex(int32_t * aSrcIndex)
+int32_t
+InspectorFontFace::SrcIndex()
 {
   if (mFontEntry->IsUserFont()) {
     NS_ASSERTION(mFontEntry->mUserFontData, "missing userFontData");
-    *aSrcIndex = mFontEntry->mUserFontData->mSrcIndex;
-  } else {
-    *aSrcIndex = -1;
+    return mFontEntry->mUserFontData->mSrcIndex;
   }
-  return NS_OK;
+
+  return -1;
 }
 
-NS_IMETHODIMP
-nsFontFace::GetURI(nsAString & aURI)
+void
+InspectorFontFace::GetURI(nsAString& aURI)
 {
   aURI.Truncate();
   if (mFontEntry->IsUserFont() && !mFontEntry->IsLocalUserFont()) {
     NS_ASSERTION(mFontEntry->mUserFontData, "missing userFontData");
     if (mFontEntry->mUserFontData->mURI) {
       nsAutoCString spec;
-      nsresult rv = mFontEntry->mUserFontData->mURI->GetSpec(spec);
-      NS_ENSURE_SUCCESS(rv, rv);
+      mFontEntry->mUserFontData->mURI->GetSpec(spec);
       AppendUTF8toUTF16(spec, aURI);
     }
   }
-  return NS_OK;
 }
 
-NS_IMETHODIMP
-nsFontFace::GetLocalName(nsAString & aLocalName)
+void
+InspectorFontFace::GetLocalName(nsAString& aLocalName)
 {
   if (mFontEntry->IsLocalUserFont()) {
     NS_ASSERTION(mFontEntry->mUserFontData, "missing userFontData");
     aLocalName = mFontEntry->mUserFontData->mLocalName;
   } else {
     aLocalName.Truncate();
   }
-  return NS_OK;
 }
 
 static void
-AppendToFormat(nsAString & aResult, const char* aFormat)
+AppendToFormat(nsAString& aResult, const char* aFormat)
 {
   if (!aResult.IsEmpty()) {
     aResult.Append(',');
   }
   aResult.AppendASCII(aFormat);
 }
 
-NS_IMETHODIMP
-nsFontFace::GetFormat(nsAString & aFormat)
+void
+InspectorFontFace::GetFormat(nsAString& aFormat)
 {
   aFormat.Truncate();
   if (mFontEntry->IsUserFont() && !mFontEntry->IsLocalUserFont()) {
     NS_ASSERTION(mFontEntry->mUserFontData, "missing userFontData");
     uint32_t formatFlags = mFontEntry->mUserFontData->mFormat;
     if (formatFlags & gfxUserFontSet::FLAG_FORMAT_OPENTYPE) {
       AppendToFormat(aFormat, "opentype");
     }
@@ -176,21 +141,20 @@ nsFontFace::GetFormat(nsAString & aForma
     }
     if (formatFlags & gfxUserFontSet::FLAG_FORMAT_WOFF) {
       AppendToFormat(aFormat, "woff");
     }
     if (formatFlags & gfxUserFontSet::FLAG_FORMAT_WOFF2) {
       AppendToFormat(aFormat, "woff2");
     }
   }
-  return NS_OK;
 }
 
-NS_IMETHODIMP
-nsFontFace::GetMetadata(nsAString & aMetadata)
+void
+InspectorFontFace::GetMetadata(nsAString& aMetadata)
 {
   aMetadata.Truncate();
   if (mFontEntry->IsUserFont() && !mFontEntry->IsLocalUserFont()) {
     NS_ASSERTION(mFontEntry->mUserFontData, "missing userFontData");
     const gfxUserFontData* userFontData = mFontEntry->mUserFontData.get();
     if (userFontData->mMetadata.Length() && userFontData->mMetaOrigLen) {
       nsAutoCString str;
       str.SetLength(userFontData->mMetaOrigLen);
@@ -218,10 +182,12 @@ nsFontFace::GetMetadata(nsAString & aMet
               AppendUTF8toUTF16(str, aMetadata);
             }
           }
           break;
         }
       }
     }
   }
-  return NS_OK;
 }
+
+} // namespace dom
+} // namespace mozilla
rename from layout/inspector/nsFontFace.h
rename to layout/inspector/InspectorFontFace.h
--- a/layout/inspector/nsFontFace.h
+++ b/layout/inspector/InspectorFontFace.h
@@ -1,39 +1,74 @@
 /* -*- 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 __nsFontFace_h__
-#define __nsFontFace_h__
+#ifndef mozilla_InspectorFontFace_h
+#define mozilla_InspectorFontFace_h
 
-#include "nsIDOMFontFace.h"
+#include "mozilla/dom/InspectorUtilsBinding.h"
+#include "mozilla/dom/NonRefcountedDOMObject.h"
 
 class gfxFontEntry;
 class gfxFontGroup;
+class nsCSSFontFaceRule;
 
-class nsFontFace : public nsIDOMFontFace
+namespace mozilla {
+namespace dom {
+
+/**
+ * Information on font face usage by a given DOM Range, as returned by
+ * InspectorUtils.getUsedFontFaces.
+ */
+class InspectorFontFace final : public NonRefcountedDOMObject
 {
 public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIDOMFONTFACE
+  InspectorFontFace(gfxFontEntry* aFontEntry,
+                    gfxFontGroup* aFontGroup,
+                    uint8_t aMatchType)
+    : mFontEntry(aFontEntry)
+    , mFontGroup(aFontGroup)
+    , mMatchType(aMatchType)
+  {
+    MOZ_COUNT_CTOR(InspectorFontFace);
+  }
+
+  ~InspectorFontFace()
+  {
+    MOZ_COUNT_DTOR(InspectorFontFace);
+  }
+
+  gfxFontEntry* GetFontEntry() const { return mFontEntry; }
+  void AddMatchType(uint8_t aMatchType) { mMatchType |= aMatchType; }
 
-  nsFontFace(gfxFontEntry*      aFontEntry,
-             gfxFontGroup*      aFontGroup,
-             uint8_t            aMatchInfo);
+  // Web IDL
+  bool FromFontGroup();
+  bool FromLanguagePrefs();
+  bool FromSystemFallback();
+  void GetName(nsAString& aName);
+  void GetCSSFamilyName(nsAString& aCSSFamilyName);
+  nsCSSFontFaceRule* GetRule();
+  int32_t SrcIndex();
+  void GetURI(nsAString& aURI);
+  void GetLocalName(nsAString& aLocalName);
+  void GetFormat(nsAString& aFormat);
+  void GetMetadata(nsAString& aMetadata);
 
-  gfxFontEntry* GetFontEntry() const { return mFontEntry.get(); }
-
-  void AddMatchType(uint8_t aMatchType) {
-    mMatchType |= aMatchType;
+  bool WrapObject(JSContext* aCx,
+                  JS::Handle<JSObject*> aGivenProto,
+                  JS::MutableHandle<JSObject*> aReflector)
+  {
+    return InspectorFontFaceBinding::Wrap(aCx, this, aGivenProto, aReflector);
   }
 
 protected:
-  virtual ~nsFontFace();
-
   RefPtr<gfxFontEntry> mFontEntry;
   RefPtr<gfxFontGroup> mFontGroup;
   uint8_t mMatchType;
 };
 
-#endif // __nsFontFace_h__
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_InspectorFontFace_h
--- a/layout/inspector/InspectorUtils.h
+++ b/layout/inspector/InspectorUtils.h
@@ -17,16 +17,17 @@ class nsStyleContext;
 
 namespace mozilla {
 class StyleSheet;
 namespace css {
 class Rule;
 } // namespace css
 namespace dom {
 class Element;
+class InspectorFontFace;
 } // namespace dom
 } // namespace mozilla
 
 namespace mozilla {
 namespace dom {
 
 /**
  * A collection of utility methods for use by devtools.
@@ -212,16 +213,21 @@ public:
                               ErrorResult& aRv);
   static bool RemoveContentState(GlobalObject& aGlobal,
                                  Element& aElement,
                                  uint64_t aState,
                                  bool aClearActiveDocument,
                                  ErrorResult& aRv);
   static uint64_t GetContentState(GlobalObject& aGlobal, Element& aElement);
 
+  static void GetUsedFontFaces(GlobalObject& aGlobal,
+                               nsRange& aRange,
+                               nsTArray<nsAutoPtr<InspectorFontFace>>& aResult,
+                               ErrorResult& aRv);
+
 private:
   static already_AddRefed<nsStyleContext>
     GetCleanStyleContextForElement(Element* aElement, nsAtom* aPseudo);
 };
 
 } // namespace dom
 } // namespace mozilla
 
--- a/layout/inspector/inDOMUtils.cpp
+++ b/layout/inspector/inDOMUtils.cpp
@@ -51,16 +51,17 @@
 #include "mozilla/StyleSetHandleInlines.h"
 #include "nsStyleUtil.h"
 #include "nsQueryObject.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/ServoStyleRule.h"
 #include "mozilla/ServoStyleRuleMap.h"
 #include "mozilla/ServoCSSParser.h"
 #include "mozilla/dom/InspectorUtils.h"
+#include "mozilla/dom/InspectorFontFace.h"
 
 using namespace mozilla;
 using namespace mozilla::css;
 using namespace mozilla::dom;
 
 extern const char* const kCSSRawProperties[];
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -968,26 +969,31 @@ InspectorUtils::GetCleanStyleContextForE
 
   presContext->EnsureSafeToHandOutCSSRules();
 
   RefPtr<nsStyleContext> styleContext =
     nsComputedDOMStyle::GetStyleContext(aElement, aPseudo, presShell);
   return styleContext.forget();
 }
 
+/* static */ void
+InspectorUtils::GetUsedFontFaces(GlobalObject& aGlobalObject,
+                                 nsRange& aRange,
+                                 nsTArray<nsAutoPtr<InspectorFontFace>>& aResult,
+                                 ErrorResult& aRv)
+{
+  nsresult rv = aRange.GetUsedFontFaces(aResult);
+  if (NS_FAILED(rv)) {
+    aRv.Throw(rv);
+  }
+}
+
 } // namespace dom
 } // namespace mozilla
 
-NS_IMETHODIMP
-inDOMUtils::GetUsedFontFaces(nsIDOMRange* aRange,
-                             nsIDOMFontFaceList** aFontFaceList)
-{
-  return static_cast<nsRange*>(aRange)->GetUsedFontFaces(aFontFaceList);
-}
-
 static EventStates
 GetStatesForPseudoClass(const nsAString& aStatePseudo)
 {
   // An array of the states that are relevant for various pseudoclasses.
   // XXXbz this duplicates code in nsCSSRuleProcessor
   static const EventStates sPseudoClassStates[] = {
 #define CSS_PSEUDO_CLASS(_name, _value, _flags, _pref) \
     EventStates(),
--- a/layout/inspector/inIDOMUtils.idl
+++ b/layout/inspector/inIDOMUtils.idl
@@ -15,18 +15,16 @@ interface nsIDOMNode;
 interface nsIDOMNodeList;
 interface nsIDOMFontFaceList;
 interface nsIDOMRange;
 interface nsIDOMCSSStyleSheet;
 
 [scriptable, uuid(362e98c3-82c2-4ad8-8dcb-00e8e4eab497)]
 interface inIDOMUtils : nsISupports
 {
-  nsIDOMFontFaceList getUsedFontFaces(in nsIDOMRange aRange);
-
   /**
    * Get the names of all the supported pseudo-elements.
    * Pseudo-elements which are only accepted in UA style sheets are
    * not included.
    *
    * @param {unsigned long} aCount the number of items returned
    * @param {wstring[]} aNames the names
    */
--- a/layout/inspector/moz.build
+++ b/layout/inspector/moz.build
@@ -10,42 +10,35 @@ if CONFIG['ENABLE_TESTS']:
 
 XPIDL_SOURCES += [
     'inICSSValueSearch.idl',
     'inIDeepTreeWalker.idl',
     'inIDOMUtils.idl',
     'inIDOMView.idl',
     'inISearchObserver.idl',
     'inISearchProcess.idl',
-    'nsIDOMFontFace.idl',
-    'nsIDOMFontFaceList.idl',
 ]
 
 XPIDL_MODULE = 'inspector'
 
-EXPORTS += [
-    'nsFontFace.h',
-    'nsFontFaceList.h',
-]
-
 EXPORTS.mozilla += [
     'ServoStyleRuleMap.h',
 ]
 
 EXPORTS.mozilla.dom += [
+    'InspectorFontFace.h',
     'InspectorUtils.h',
 ]
 
 UNIFIED_SOURCES += [
     'inCSSValueSearch.cpp',
     'inDeepTreeWalker.cpp',
     'inDOMUtils.cpp',
     'inLayoutUtils.cpp',
-    'nsFontFace.cpp',
-    'nsFontFaceList.cpp',
+    'InspectorFontFace.cpp',
     'ServoStyleRuleMap.cpp',
 ]
 
 if CONFIG['MOZ_XUL']:
     UNIFIED_SOURCES += [
         'inDOMView.cpp',
     ]
 
deleted file mode 100644
--- a/layout/inspector/nsFontFaceList.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- 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/. */
-
-#include "nsFontFaceList.h"
-#include "nsFontFace.h"
-#include "nsFontFaceLoader.h"
-#include "nsIFrame.h"
-#include "gfxTextRun.h"
-#include "mozilla/gfx/2D.h"
-
-nsFontFaceList::nsFontFaceList()
-{
-}
-
-nsFontFaceList::~nsFontFaceList()
-{
-}
-
-////////////////////////////////////////////////////////////////////////
-// nsISupports
-
-NS_IMPL_ISUPPORTS(nsFontFaceList, nsIDOMFontFaceList)
-
-////////////////////////////////////////////////////////////////////////
-// nsIDOMFontFaceList
-
-NS_IMETHODIMP
-nsFontFaceList::Item(uint32_t index, nsIDOMFontFace **_retval)
-{
-  NS_ENSURE_TRUE(index < mFontFaces.Count(), NS_ERROR_INVALID_ARG);
-
-  uint32_t current = 0;
-  nsIDOMFontFace* result = nullptr;
-  for (auto iter = mFontFaces.Iter(); !iter.Done(); iter.Next()) {
-    if (current == index) {
-      result = iter.UserData();
-      break;
-    }
-    current++;
-  }
-  NS_ASSERTION(result != nullptr, "null entry in nsFontFaceList?");
-  NS_IF_ADDREF(*_retval = result);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsFontFaceList::GetLength(uint32_t *aLength)
-{
-  *aLength = mFontFaces.Count();
-  return NS_OK;
-}
-
-////////////////////////////////////////////////////////////////////////
-// nsFontFaceList
-
-nsresult
-nsFontFaceList::AddFontsFromTextRun(gfxTextRun* aTextRun,
-                                    uint32_t aOffset, uint32_t aLength)
-{
-  gfxTextRun::Range range(aOffset, aOffset + aLength);
-  gfxTextRun::GlyphRunIterator iter(aTextRun, range);
-  while (iter.NextRun()) {
-    gfxFontEntry *fe = iter.GetGlyphRun()->mFont->GetFontEntry();
-    // if we have already listed this face, just make sure the match type is
-    // recorded
-    nsFontFace* existingFace =
-      static_cast<nsFontFace*>(mFontFaces.GetWeak(fe));
-    if (existingFace) {
-      existingFace->AddMatchType(iter.GetGlyphRun()->mMatchType);
-    } else {
-      // A new font entry we haven't seen before
-      RefPtr<nsFontFace> ff =
-        new nsFontFace(fe, aTextRun->GetFontGroup(),
-                       iter.GetGlyphRun()->mMatchType);
-      mFontFaces.Put(fe, ff);
-    }
-  }
-
-  return NS_OK;
-}
deleted file mode 100644
--- a/layout/inspector/nsFontFaceList.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- 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 __nsFontFaceList_h__
-#define __nsFontFaceList_h__
-
-#include "nsIDOMFontFaceList.h"
-#include "nsIDOMFontFace.h"
-#include "nsCOMPtr.h"
-#include "nsInterfaceHashtable.h"
-#include "nsHashKeys.h"
-
-class gfxFontEntry;
-class gfxTextRun;
-
-class nsFontFaceList : public nsIDOMFontFaceList
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIDOMFONTFACELIST
-
-  nsFontFaceList();
-
-  nsresult AddFontsFromTextRun(gfxTextRun* aTextRun,
-                               uint32_t aOffset, uint32_t aLength);
-
-protected:
-  virtual ~nsFontFaceList();
-
-  nsInterfaceHashtable<nsPtrHashKey<gfxFontEntry>,nsIDOMFontFace> mFontFaces;
-};
-
-#endif // __nsFontFaceList_h__
deleted file mode 100644
--- a/layout/inspector/nsIDOMFontFace.idl
+++ /dev/null
@@ -1,32 +0,0 @@
-/* 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/. */
-
-#include "nsISupports.idl"
-
-interface nsIDOMCSSFontFaceRule;
-interface nsIDOMCSSStyleDeclaration;
-
-[scriptable, uuid(9a3b1272-6585-4f41-b08f-fdc5da444cd0)]
-interface nsIDOMFontFace : nsISupports
-{
-  // An indication of how we found this font during font-matching.
-  // Note that the same physical font may have been found in multiple ways within a range.
-  readonly attribute boolean fromFontGroup;
-  readonly attribute boolean fromLanguagePrefs;
-  readonly attribute boolean fromSystemFallback;
-
-  // available for all fonts
-  readonly attribute DOMString name; // full font name as obtained from the font resource
-  readonly attribute DOMString CSSFamilyName; // a family name that could be used in CSS font-family
-                                              // (not necessarily the actual name that was used,
-                                              // due to aliases, generics, localized names, etc)
-
-  // meaningful only when the font is a user font defined using @font-face
-  readonly attribute nsIDOMCSSFontFaceRule rule; // null if no associated @font-face rule
-  readonly attribute long srcIndex; // index in the rule's src list, -1 if no @font-face rule
-  readonly attribute DOMString URI; // null if not a downloaded font, i.e. local
-  readonly attribute DOMString localName; // null if not a src:local(...) rule
-  readonly attribute DOMString format; // as per http://www.w3.org/TR/css3-webfonts/#referencing
-  readonly attribute DOMString metadata; // XML metadata from WOFF file (if any)
-};
deleted file mode 100644
--- a/layout/inspector/nsIDOMFontFaceList.idl
+++ /dev/null
@@ -1,14 +0,0 @@
-/* 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/. */
-
-#include "nsISupports.idl"
-
-interface nsIDOMFontFace;
-
-[scriptable, uuid(2538579c-9472-4fd9-8dc1-d44ce4c1b7ba)]
-interface nsIDOMFontFaceList : nsISupports
-{
-  nsIDOMFontFace                    item(in unsigned long index);
-  readonly attribute unsigned long  length;
-};
--- a/layout/inspector/tests/chrome/test_bug467669.xul
+++ b/layout/inspector/tests/chrome/test_bug467669.xul
@@ -20,83 +20,80 @@ SimpleTest.waitForExplicitFinish();
 function RunTest() {
   const CI = Components.interfaces;
   const CC = Components.classes;
 
   const kIsLinux = navigator.platform.indexOf("Linux") == 0;
   const kIsMac = navigator.platform.indexOf("Mac") == 0;
   const kIsWin = navigator.platform.indexOf("Win") == 0;
 
-  var domUtils =
-    CC["@mozilla.org/inspector/dom-utils;1"].getService(CI.inIDOMUtils);
-
   var rng = document.createRange();
   var elem, fonts, f;
 
   elem = document.getElementById("test1");
   rng.selectNode(elem);
-  fonts = domUtils.getUsedFontFaces(rng);
+  fonts = InspectorUtils.getUsedFontFaces(rng);
   is(fonts.length, 1, "number of fonts for simple Latin text");
-  f = fonts.item(0);
+  f = fonts[0];
   is(f.rule, null, "rule");
   is(f.srcIndex, -1, "srcIndex");
   is(f.localName, "", "local name");
   is(f.URI, "", "URI");
   is(f.format, "", "format string");
   is(f.metadata, "", "metadata");
 //  report(elem.id, fonts);
 
   elem = document.getElementById("test2");
   rng.selectNode(elem);
-  fonts = domUtils.getUsedFontFaces(rng);
+  fonts = InspectorUtils.getUsedFontFaces(rng);
   is(fonts.length, 3, "number of fonts for mixed serif, sans and monospaced text");
 //  report(elem.id, fonts);
 
   elem = document.getElementById("test3");
   rng.selectNode(elem);
-  fonts = domUtils.getUsedFontFaces(rng);
+  fonts = InspectorUtils.getUsedFontFaces(rng);
   is(fonts.length, 2, "number of fonts for mixed Latin & Chinese");
 //  report(elem.id, fonts);
 
   // get properties of a @font-face font
   elem = document.getElementById("test4");
   rng.selectNode(elem);
-  fonts = domUtils.getUsedFontFaces(rng);
+  fonts = InspectorUtils.getUsedFontFaces(rng);
   is(fonts.length, 1, "number of fonts in @font-face test");
-  f = fonts.item(0);
+  f = fonts[0];
   isnot(f.rule, null, "missing rule");
   is(f.srcIndex, 1, "srcIndex");
   is(f.localName, "", "local name");
   is(f.URI, "chrome://mochitests/content/chrome/layout/inspector/tests/chrome/GentiumPlus-R.woff", "bad URI");
   is(f.format, "woff", "format");
   is(/bukva:raz/.test(f.metadata), true, "metadata");
 //  report(elem.id, fonts);
 
   elem = document.getElementById("test5").childNodes[0];
   // check that string length is as expected, including soft hyphens
   is(elem.length, 42, "string length with soft hyphens");
 
   // initial latin substring...
   rng.setStart(elem, 0);
   rng.setEnd(elem, 20); // "supercalifragilistic"
-  fonts = domUtils.getUsedFontFaces(rng);
+  fonts = InspectorUtils.getUsedFontFaces(rng);
   is(fonts.length, 1, "number of fonts (Latin-only)");
-  f = fonts.item(0);
+  f = fonts[0];
   is(f.name, "Gentium Plus", "font name");
   is(f.CSSFamilyName, "font-face-test-family", "family name");
   is(f.fromFontGroup, true, "font matched in font group");
 
   // extend to include a chinese character
   rng.setEnd(elem, 21);
-  fonts = domUtils.getUsedFontFaces(rng);
+  fonts = InspectorUtils.getUsedFontFaces(rng);
   is(fonts.length, 2, "number of fonts (incl Chinese)");
   if (kIsMac || kIsWin) { // these are only implemented by the Mac & Win font backends
     var i;
     for (i = 0; i < fonts.length; ++i) {
-      f = fonts.item(i);
+      f = fonts[i];
       if (f.rule) {
         is(f.fromFontGroup, true, "@font-face font matched in group");
         is(f.fromLanguagePrefs, false, "not from language prefs");
         is(f.fromSystemFallback, false, "not from system fallback");
       } else {
         is(f.fromFontGroup, false, "not matched in group");
         is(f.fromLanguagePrefs, true, "from language prefs");
         is(f.fromSystemFallback, false, "not from system fallback");
@@ -104,43 +101,43 @@ function RunTest() {
     }
   }
 
   // second half of the string includes &shy; chars to check original/skipped mapping;
   // select just the final character
   rng.setStart(elem, elem.length - 1);
   rng.setEnd(elem, elem.length);
   is(rng.toString(), "!", "content of range");
-  fonts = domUtils.getUsedFontFaces(rng);
+  fonts = InspectorUtils.getUsedFontFaces(rng);
   is(fonts.length, 1, "number of fonts for last char");
-  f = fonts.item(0);
+  f = fonts[0];
   is(f.name, "Gentium Plus", "font name");
 
   // include the preceding character as well
   rng.setStart(elem, elem.length - 2);
-  fonts = domUtils.getUsedFontFaces(rng);
+  fonts = InspectorUtils.getUsedFontFaces(rng);
   is(fonts.length, 2, "number of fonts for last two chars");
 
   // then trim the final one
   rng.setEnd(elem, elem.length - 1);
-  fonts = domUtils.getUsedFontFaces(rng);
+  fonts = InspectorUtils.getUsedFontFaces(rng);
   is(fonts.length, 1, "number of fonts for Chinese char");
-  f = fonts.item(0);
+  f = fonts[0];
   isnot(f.name, "Gentium Plus", "font name for Chinese char");
 
   rng.selectNode(elem);
-  fonts = domUtils.getUsedFontFaces(rng);
+  fonts = InspectorUtils.getUsedFontFaces(rng);
 //  report("test5", fonts);
 
   elem = document.getElementById("test6");
   rng.selectNode(elem);
-  fonts = domUtils.getUsedFontFaces(rng);
+  fonts = InspectorUtils.getUsedFontFaces(rng);
   is(fonts.length, 2, "number of font faces for regular & italic");
-  is(fonts.item(0).CSSFamilyName, fonts.item(1).CSSFamilyName, "same family for regular & italic");
-  isnot(fonts.item(0).name, fonts.item(1).name, "different faces for regular & italic");
+  is(fonts[0].CSSFamilyName, fonts[1].CSSFamilyName, "same family for regular & italic");
+  isnot(fonts[0].name, fonts[1].name, "different faces for regular & italic");
 //  report(elem.id, fonts);
 
   SimpleTest.finish();
 }
 
 // just for test-debugging purposes
 function report(e, f) {
   var fontNames = "";
--- a/layout/inspector/tests/chrome/test_bug695639.xul
+++ b/layout/inspector/tests/chrome/test_bug695639.xul
@@ -14,58 +14,55 @@ https://bugzilla.mozilla.org/show_bug.cg
   /** Test for Bug 695639 - check that GetFontFacesForText handles wrapped lines properly **/
 
 SimpleTest.waitForExplicitFinish();
 
 function RunTest() {
   const CI = Components.interfaces;
   const CC = Components.classes;
 
-  var domUtils =
-    CC["@mozilla.org/inspector/dom-utils;1"].getService(CI.inIDOMUtils);
-
   var rng = document.createRange();
   var elem, fonts, f;
 
   elem = document.getElementById("test").childNodes[0];
   rng.setStart(elem, 0);
   rng.setEnd(elem, 14);
-  fonts = domUtils.getUsedFontFaces(rng);
+  fonts = InspectorUtils.getUsedFontFaces(rng);
   is(fonts.length, 2, "number of fonts used for entire text");
 
   // initial latin substring...
   rng.setStart(elem, 0);
   rng.setEnd(elem, 5); // "Hello"
-  fonts = domUtils.getUsedFontFaces(rng);
+  fonts = InspectorUtils.getUsedFontFaces(rng);
   is(fonts.length, 1, "number of fonts (1)");
-  f = fonts.item(0);
+  f = fonts[0];
   is(f.name, "Gentium Plus", "font name (1)");
 
   // the space (where the line wraps) should also be Gentium
   rng.setStart(elem, 5);
   rng.setEnd(elem, 6); // space
-  fonts = domUtils.getUsedFontFaces(rng);
+  fonts = InspectorUtils.getUsedFontFaces(rng);
   is(fonts.length, 1, "number of fonts (2)");
-  f = fonts.item(0);
+  f = fonts[0];
   is(f.name, "Gentium Plus", "font name (2)");
 
   // the Chinese text "ni hao" should NOT be in Gentium
   rng.setStart(elem, 6);
   rng.setEnd(elem, 8); // two Chinese characters on second line
-  fonts = domUtils.getUsedFontFaces(rng);
+  fonts = InspectorUtils.getUsedFontFaces(rng);
   is(fonts.length, 1, "number of fonts (3)");
-  f = fonts.item(0);
+  f = fonts[0];
   isnot(f.name, "Gentium Plus", "font name (3)");
 
   // space and "world" should be Gentium again
   rng.setStart(elem, 8);
   rng.setEnd(elem, 14);
-  fonts = domUtils.getUsedFontFaces(rng);
+  fonts = InspectorUtils.getUsedFontFaces(rng);
   is(fonts.length, 1, "number of fonts (4)");
-  f = fonts.item(0);
+  f = fonts[0];
   is(f.name, "Gentium Plus", "font name (4)");
 
   SimpleTest.finish();
 }
   ]]>
   </script>
 
   <style type="text/css">