# Global Metrics

path: .metrics.nom.functions
old: 0.0
new: 70.0
path: .metrics.nom.total
old: 0.0
new: 70.0
path: .metrics.nexits.average
old: null
new: 1.0142857142857142
path: .metrics.nexits.sum
old: 0.0
new: 71.0
path: .metrics.loc.lloc
old: 0.0
new: 87.0
path: .metrics.loc.sloc
old: 103.0
new: 410.0
path: .metrics.loc.cloc
old: 35.0
new: 20.0
path: .metrics.loc.blank
old: 16.0
new: 83.0
path: .metrics.loc.ploc
old: 52.0
new: 307.0
path: .metrics.mi.mi_sei
old: 47.861437974794654
new: -37.130999420239206
path: .metrics.mi.mi_original
old: 58.00936116368213
new: 9.742481966450498
path: .metrics.mi.mi_visual_studio
old: 33.923603019697154
new: 5.69735787511725
path: .metrics.cognitive.sum
old: 0.0
new: 3.0
path: .metrics.cognitive.average
old: null
new: 0.04285714285714286
path: .metrics.nargs.sum
old: 0.0
new: 88.0
path: .metrics.nargs.average
old: null
new: 1.2571428571428571
path: .metrics.halstead.level
old: 0.13380281690140844
new: 0.038345864661654135
path: .metrics.halstead.effort
old: 8400.18563193158
new: 192526.2579207362
path: .metrics.halstead.n2
old: 57.0
new: 153.0
path: .metrics.halstead.N2
old: 71.0
new: 399.0
path: .metrics.halstead.bugs
old: 0.13774356984922123
new: 1.1114042632791823
path: .metrics.halstead.purity_ratio
old: 2.040729787043718
new: 1.205255691671423
path: .metrics.halstead.N1
old: 113.0
new: 594.0
path: .metrics.halstead.difficulty
old: 7.473684210526316
new: 26.07843137254902
path: .metrics.halstead.volume
old: 1123.9685000471832
new: 7382.585830043267
path: .metrics.halstead.estimated_program_length
old: 375.4942808160441
new: 1196.818901829723
path: .metrics.halstead.n1
old: 12.0
new: 20.0
path: .metrics.halstead.length
old: 184.0
new: 993.0
path: .metrics.halstead.vocabulary
old: 69.0
new: 173.0
path: .metrics.halstead.time
old: 466.6769795517544
new: 10695.903217818675
path: .metrics.cyclomatic.sum
old: 6.0
new: 76.0
path: .metrics.cyclomatic.average
old: 1.0
new: 1.0410958904109588

# Spaces Data

## Minimal test - lines (18, 410)

path: .spaces[0].metrics.halstead.level
old: 0.1328125
new: 0.036923076923076927
path: .spaces[0].metrics.halstead.time
old: 442.5531174732487
new: 10893.264495726218
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.8774759460406787
new: 1.137101384253496
path: .spaces[0].metrics.halstead.N2
old: 64.0
new: 390.0
path: .spaces[0].metrics.halstead.n2
old: 51.0
new: 144.0
path: .spaces[0].metrics.halstead.difficulty
old: 7.529411764705882
new: 27.083333333333332
path: .spaces[0].metrics.halstead.length
old: 177.0
new: 984.0
path: .spaces[0].metrics.halstead.N1
old: 113.0
new: 594.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 332.3132424492001
new: 1118.90776210544
path: .spaces[0].metrics.halstead.vocabulary
old: 63.0
new: 164.0
path: .spaces[0].metrics.halstead.effort
old: 7965.956114518476
new: 196078.7609230719
path: .spaces[0].metrics.halstead.bugs
old: 0.13295479914659014
new: 1.1250343460095045
path: .spaces[0].metrics.halstead.n1
old: 12.0
new: 20.0
path: .spaces[0].metrics.halstead.volume
old: 1057.9785464594852
new: 7239.831172544195
path: .spaces[0].metrics.loc.blank
old: 14.0
new: 81.0
path: .spaces[0].metrics.loc.cloc
old: 23.0
new: 14.0
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 87.0
path: .spaces[0].metrics.loc.ploc
old: 43.0
new: 298.0
path: .spaces[0].metrics.loc.sloc
old: 80.0
new: 393.0
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 88.0
path: .spaces[0].metrics.nargs.average
old: null
new: 1.2571428571428571
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 71.0
path: .spaces[0].metrics.nexits.average
old: null
new: 1.0142857142857142
path: .spaces[0].metrics.nom.functions
old: 0.0
new: 70.0
path: .spaces[0].metrics.nom.total
old: 0.0
new: 70.0
path: .spaces[0].metrics.mi.mi_sei
old: 52.10878452526414
new: -38.12846476390461
path: .spaces[0].metrics.mi.mi_visual_studio
old: 36.63612209211084
new: 6.2924256271612355
path: .spaces[0].metrics.mi.mi_original
old: 62.64776877750954
new: 10.760047822445712
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 3.0
path: .spaces[0].metrics.cognitive.average
old: null
new: 0.04285714285714286
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 1.0416666666666667
path: .spaces[0].metrics.cyclomatic.sum
old: 5.0
new: 75.0

### Code

    namespace mozilla {
    namespace net {

    NS_IMPL_ISUPPORTS(FileDescriptorFile, nsIFile)

    LazyLogModule gFDFileLog("FDFile");
    #undef DBG
    #define DBG(...) MOZ_LOG(gFDFileLog, LogLevel::Debug, (__VA_ARGS__))

    FileDescriptorFile::FileDescriptorFile(const FileDescriptor& aFD,
                                           nsIFile* aFile) {
      MOZ_ASSERT(aFD.IsValid());
      auto platformHandle = aFD.ClonePlatformHandle();
      mFD = FileDescriptor(platformHandle.get());
      mFile = aFile;
    }

    FileDescriptorFile::FileDescriptorFile(const FileDescriptorFile& aOther) {
      auto platformHandle = aOther.mFD.ClonePlatformHandle();
      mFD = FileDescriptor(platformHandle.get());
      aOther.mFile->Clone(getter_AddRefs(mFile));
    }

    //-----------------------------------------------------------------------------
    // FileDescriptorFile::nsIFile functions that we override logic for
    //-----------------------------------------------------------------------------

    NS_IMETHODIMP
    FileDescriptorFile::Clone(nsIFile** aFileOut) {
      RefPtr fdFile = new FileDescriptorFile(*this);
      fdFile.forget(aFileOut);
      return NS_OK;
    }

    NS_IMETHODIMP
    FileDescriptorFile::OpenNSPRFileDesc(int32_t aFlags, int32_t aMode,
                                         PRFileDesc** aRetval) {
      // Remove optional OS_READAHEAD flag so we test against PR_RDONLY
      aFlags &= ~nsIFile::OS_READAHEAD;

      // Remove optional/deprecated DELETE_ON_CLOSE flag
      aFlags &= ~nsIFile::DELETE_ON_CLOSE;

      // All other flags require write access to the file and
      // this implementation only provides read access.
      if (aFlags != PR_RDONLY) {
        DBG("OpenNSPRFileDesc flags error (%" PRIu32 ")\n", aFlags);
        return NS_ERROR_NOT_AVAILABLE;
      }

      if (!mFD.IsValid()) {
        DBG("OpenNSPRFileDesc error: no file descriptor\n");
        return NS_ERROR_NOT_AVAILABLE;
      }

      auto platformHandle = mFD.ClonePlatformHandle();
      *aRetval = PR_ImportFile(PROsfd(platformHandle.release()));

      if (!*aRetval) {
        DBG("OpenNSPRFileDesc Clone failure\n");
        return NS_ERROR_NOT_AVAILABLE;
      }

      return NS_OK;
    }

    //-----------------------------------------------------------------------------
    // FileDescriptorFile::nsIFile functions that we delegate to underlying nsIFile
    //-----------------------------------------------------------------------------

    nsresult FileDescriptorFile::GetLeafName(nsAString& aLeafName) {
      return mFile->GetLeafName(aLeafName);
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetNativeLeafName(nsACString& aLeafName) {
      return mFile->GetNativeLeafName(aLeafName);
    }

    nsresult FileDescriptorFile::GetTarget(nsAString& aRetVal) {
      return mFile->GetTarget(aRetVal);
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetNativeTarget(nsACString& aRetVal) {
      return mFile->GetNativeTarget(aRetVal);
    }

    nsresult FileDescriptorFile::GetPath(nsAString& aRetVal) {
      return mFile->GetPath(aRetVal);
    }

    PathString FileDescriptorFile::NativePath() { return mFile->NativePath(); }

    NS_IMETHODIMP
    FileDescriptorFile::Equals(nsIFile* aOther, bool* aRetVal) {
      return mFile->Equals(aOther, aRetVal);
    }

    NS_IMETHODIMP
    FileDescriptorFile::Contains(nsIFile* aOther, bool* aRetVal) {
      return mFile->Contains(aOther, aRetVal);
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetParent(nsIFile** aParent) {
      return mFile->GetParent(aParent);
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetPersistentDescriptor(nsACString& aPersistentDescriptor) {
      return mFile->GetPersistentDescriptor(aPersistentDescriptor);
    }

    //-----------------------------------------------------------------------------
    // FileDescriptorFile::nsIFile functions that are not currently supported
    //-----------------------------------------------------------------------------

    nsresult FileDescriptorFile::Append(const nsAString& aNode) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::AppendNative(const nsACString& aFragment) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::Normalize() { return NS_ERROR_NOT_IMPLEMENTED; }

    NS_IMETHODIMP
    FileDescriptorFile::Create(uint32_t aType, uint32_t aPermissions) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    nsresult FileDescriptorFile::SetLeafName(const nsAString& aLeafName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetNativeLeafName(const nsACString& aLeafName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    nsresult FileDescriptorFile::InitWithPath(const nsAString& aPath) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::InitWithNativePath(const nsACString& aPath) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::InitWithFile(nsIFile* aFile) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    nsresult FileDescriptorFile::AppendRelativePath(const nsAString& aNode) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::AppendRelativeNativePath(const nsACString& aFragment) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetPersistentDescriptor(
        const nsACString& aPersistentDescriptor) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetRelativeDescriptor(nsIFile* aFromFile,
                                              nsACString& aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetRelativeDescriptor(nsIFile* aFromFile,
                                              const nsACString& aRelativeDesc) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetRelativePath(nsIFile* aFromFile, nsACString& aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetRelativePath(nsIFile* aFromFile,
                                        const nsACString& aRelativePath) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    nsresult FileDescriptorFile::CopyTo(nsIFile* aNewParentDir,
                                        const nsAString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::CopyToNative(nsIFile* aNewParent,
                                     const nsACString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    nsresult FileDescriptorFile::CopyToFollowingLinks(nsIFile* aNewParentDir,
                                                      const nsAString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::CopyToFollowingLinksNative(nsIFile* aNewParent,
                                                   const nsACString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    nsresult FileDescriptorFile::MoveTo(nsIFile* aNewParentDir,
                                        const nsAString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::MoveToNative(nsIFile* aNewParent,
                                     const nsACString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::MoveToFollowingLinks(nsIFile* aNewParent,
                                             const nsAString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::MoveToFollowingLinksNative(nsIFile* aNewParent,
                                                   const nsACString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::RenameTo(nsIFile* aNewParentDir,
                                 const nsAString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::RenameToNative(nsIFile* aNewParentDir,
                                       const nsACString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::Remove(bool aRecursive) { return NS_ERROR_NOT_IMPLEMENTED; }

    NS_IMETHODIMP
    FileDescriptorFile::GetPermissions(uint32_t* aPermissions) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetPermissions(uint32_t aPermissions) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetPermissionsOfLink(uint32_t* aPermissionsOfLink) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetPermissionsOfLink(uint32_t aPermissions) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetLastModifiedTime(PRTime* aLastModTime) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetLastModifiedTime(PRTime aLastModTime) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetLastModifiedTimeOfLink(PRTime* aLastModTimeOfLink) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetLastModifiedTimeOfLink(PRTime aLastModTimeOfLink) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetCreationTime(PRTime* aCreationTime) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetCreationTimeOfLink(PRTime* aCreationTime) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetFileSize(int64_t* aFileSize) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetFileSize(int64_t aFileSize) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetFileSizeOfLink(int64_t* aFileSize) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::Exists(bool* aRetVal) { return NS_ERROR_NOT_IMPLEMENTED; }

    NS_IMETHODIMP
    FileDescriptorFile::IsWritable(bool* aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::IsReadable(bool* aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::IsExecutable(bool* aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::IsHidden(bool* aRetVal) { return NS_ERROR_NOT_IMPLEMENTED; }

    NS_IMETHODIMP
    FileDescriptorFile::IsDirectory(bool* aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::IsFile(bool* aRetVal) { return NS_ERROR_NOT_IMPLEMENTED; }

    NS_IMETHODIMP
    FileDescriptorFile::IsSymlink(bool* aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::IsSpecial(bool* aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::CreateUnique(uint32_t aType, uint32_t aAttributes) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetDirectoryEntriesImpl(nsIDirectoryEnumerator** aEntries) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::OpenANSIFileDesc(const char* aMode, FILE** aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::Load(PRLibrary** aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetDiskSpaceAvailable(int64_t* aDiskSpaceAvailable) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::Reveal() { return NS_ERROR_NOT_IMPLEMENTED; }

    NS_IMETHODIMP
    FileDescriptorFile::Launch() { return NS_ERROR_NOT_IMPLEMENTED; }

    }  // namespace net
    }  // namespace mozilla

## Minimal test - lines (19, 409)

path: .spaces[0].spaces[0].metrics.nexits.average
old: null
new: 1.0142857142857142
path: .spaces[0].spaces[0].metrics.nexits.sum
old: 0.0
new: 71.0
path: .spaces[0].spaces[0].metrics.nom.total
old: 0.0
new: 70.0
path: .spaces[0].spaces[0].metrics.nom.functions
old: 0.0
new: 70.0
path: .spaces[0].spaces[0].metrics.cognitive.sum
old: 0.0
new: 3.0
path: .spaces[0].spaces[0].metrics.cognitive.average
old: null
new: 0.04285714285714286
path: .spaces[0].spaces[0].metrics.nargs.average
old: null
new: 1.2571428571428571
path: .spaces[0].spaces[0].metrics.nargs.sum
old: 0.0
new: 88.0
path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 74.0
path: .spaces[0].spaces[0].metrics.cyclomatic.average
old: 1.0
new: 1.0422535211267605
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 15.0
new: 391.0
path: .spaces[0].spaces[0].metrics.loc.blank
old: 0.0
new: 82.0
path: .spaces[0].spaces[0].metrics.loc.cloc
old: 5.0
new: 13.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 10.0
new: 296.0
path: .spaces[0].spaces[0].metrics.loc.lloc
old: 0.0
new: 87.0
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 100.98670696040588
new: 11.089520983137248
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 109.08652171412312
new: -38.23043687086709
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 59.056553778015136
new: 6.4850999901387425
path: .spaces[0].spaces[0].metrics.halstead.length
old: 35.0
new: 982.0
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 18.0
new: 163.0
path: .spaces[0].spaces[0].metrics.halstead.time
old: 30.958534101617165
new: 10905.980798212757
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 23.0
new: 593.0
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 7.0
new: 20.0
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.02257255263245504
new: 1.1259097184370523
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.6487209216975285
new: 1.1306518972067787
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.2619047619047619
new: 0.036760925449871466
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 12.0
new: 389.0
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 557.253613829109
new: 196307.6543678296
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 3.8181818181818183
new: 27.202797202797203
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 145.94737505048093
new: 7216.451047454918
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 11.0
new: 143.0
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 57.70523225941349
new: 1110.3001630570568

### Code

    namespace net {

    NS_IMPL_ISUPPORTS(FileDescriptorFile, nsIFile)

    LazyLogModule gFDFileLog("FDFile");
    #undef DBG
    #define DBG(...) MOZ_LOG(gFDFileLog, LogLevel::Debug, (__VA_ARGS__))

    FileDescriptorFile::FileDescriptorFile(const FileDescriptor& aFD,
                                           nsIFile* aFile) {
      MOZ_ASSERT(aFD.IsValid());
      auto platformHandle = aFD.ClonePlatformHandle();
      mFD = FileDescriptor(platformHandle.get());
      mFile = aFile;
    }

    FileDescriptorFile::FileDescriptorFile(const FileDescriptorFile& aOther) {
      auto platformHandle = aOther.mFD.ClonePlatformHandle();
      mFD = FileDescriptor(platformHandle.get());
      aOther.mFile->Clone(getter_AddRefs(mFile));
    }

    //-----------------------------------------------------------------------------
    // FileDescriptorFile::nsIFile functions that we override logic for
    //-----------------------------------------------------------------------------

    NS_IMETHODIMP
    FileDescriptorFile::Clone(nsIFile** aFileOut) {
      RefPtr fdFile = new FileDescriptorFile(*this);
      fdFile.forget(aFileOut);
      return NS_OK;
    }

    NS_IMETHODIMP
    FileDescriptorFile::OpenNSPRFileDesc(int32_t aFlags, int32_t aMode,
                                         PRFileDesc** aRetval) {
      // Remove optional OS_READAHEAD flag so we test against PR_RDONLY
      aFlags &= ~nsIFile::OS_READAHEAD;

      // Remove optional/deprecated DELETE_ON_CLOSE flag
      aFlags &= ~nsIFile::DELETE_ON_CLOSE;

      // All other flags require write access to the file and
      // this implementation only provides read access.
      if (aFlags != PR_RDONLY) {
        DBG("OpenNSPRFileDesc flags error (%" PRIu32 ")\n", aFlags);
        return NS_ERROR_NOT_AVAILABLE;
      }

      if (!mFD.IsValid()) {
        DBG("OpenNSPRFileDesc error: no file descriptor\n");
        return NS_ERROR_NOT_AVAILABLE;
      }

      auto platformHandle = mFD.ClonePlatformHandle();
      *aRetval = PR_ImportFile(PROsfd(platformHandle.release()));

      if (!*aRetval) {
        DBG("OpenNSPRFileDesc Clone failure\n");
        return NS_ERROR_NOT_AVAILABLE;
      }

      return NS_OK;
    }

    //-----------------------------------------------------------------------------
    // FileDescriptorFile::nsIFile functions that we delegate to underlying nsIFile
    //-----------------------------------------------------------------------------

    nsresult FileDescriptorFile::GetLeafName(nsAString& aLeafName) {
      return mFile->GetLeafName(aLeafName);
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetNativeLeafName(nsACString& aLeafName) {
      return mFile->GetNativeLeafName(aLeafName);
    }

    nsresult FileDescriptorFile::GetTarget(nsAString& aRetVal) {
      return mFile->GetTarget(aRetVal);
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetNativeTarget(nsACString& aRetVal) {
      return mFile->GetNativeTarget(aRetVal);
    }

    nsresult FileDescriptorFile::GetPath(nsAString& aRetVal) {
      return mFile->GetPath(aRetVal);
    }

    PathString FileDescriptorFile::NativePath() { return mFile->NativePath(); }

    NS_IMETHODIMP
    FileDescriptorFile::Equals(nsIFile* aOther, bool* aRetVal) {
      return mFile->Equals(aOther, aRetVal);
    }

    NS_IMETHODIMP
    FileDescriptorFile::Contains(nsIFile* aOther, bool* aRetVal) {
      return mFile->Contains(aOther, aRetVal);
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetParent(nsIFile** aParent) {
      return mFile->GetParent(aParent);
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetPersistentDescriptor(nsACString& aPersistentDescriptor) {
      return mFile->GetPersistentDescriptor(aPersistentDescriptor);
    }

    //-----------------------------------------------------------------------------
    // FileDescriptorFile::nsIFile functions that are not currently supported
    //-----------------------------------------------------------------------------

    nsresult FileDescriptorFile::Append(const nsAString& aNode) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::AppendNative(const nsACString& aFragment) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::Normalize() { return NS_ERROR_NOT_IMPLEMENTED; }

    NS_IMETHODIMP
    FileDescriptorFile::Create(uint32_t aType, uint32_t aPermissions) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    nsresult FileDescriptorFile::SetLeafName(const nsAString& aLeafName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetNativeLeafName(const nsACString& aLeafName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    nsresult FileDescriptorFile::InitWithPath(const nsAString& aPath) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::InitWithNativePath(const nsACString& aPath) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::InitWithFile(nsIFile* aFile) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    nsresult FileDescriptorFile::AppendRelativePath(const nsAString& aNode) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::AppendRelativeNativePath(const nsACString& aFragment) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetPersistentDescriptor(
        const nsACString& aPersistentDescriptor) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetRelativeDescriptor(nsIFile* aFromFile,
                                              nsACString& aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetRelativeDescriptor(nsIFile* aFromFile,
                                              const nsACString& aRelativeDesc) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetRelativePath(nsIFile* aFromFile, nsACString& aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetRelativePath(nsIFile* aFromFile,
                                        const nsACString& aRelativePath) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    nsresult FileDescriptorFile::CopyTo(nsIFile* aNewParentDir,
                                        const nsAString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::CopyToNative(nsIFile* aNewParent,
                                     const nsACString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    nsresult FileDescriptorFile::CopyToFollowingLinks(nsIFile* aNewParentDir,
                                                      const nsAString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::CopyToFollowingLinksNative(nsIFile* aNewParent,
                                                   const nsACString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    nsresult FileDescriptorFile::MoveTo(nsIFile* aNewParentDir,
                                        const nsAString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::MoveToNative(nsIFile* aNewParent,
                                     const nsACString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::MoveToFollowingLinks(nsIFile* aNewParent,
                                             const nsAString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::MoveToFollowingLinksNative(nsIFile* aNewParent,
                                                   const nsACString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::RenameTo(nsIFile* aNewParentDir,
                                 const nsAString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::RenameToNative(nsIFile* aNewParentDir,
                                       const nsACString& aNewName) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::Remove(bool aRecursive) { return NS_ERROR_NOT_IMPLEMENTED; }

    NS_IMETHODIMP
    FileDescriptorFile::GetPermissions(uint32_t* aPermissions) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetPermissions(uint32_t aPermissions) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetPermissionsOfLink(uint32_t* aPermissionsOfLink) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetPermissionsOfLink(uint32_t aPermissions) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetLastModifiedTime(PRTime* aLastModTime) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetLastModifiedTime(PRTime aLastModTime) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetLastModifiedTimeOfLink(PRTime* aLastModTimeOfLink) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetLastModifiedTimeOfLink(PRTime aLastModTimeOfLink) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetCreationTime(PRTime* aCreationTime) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetCreationTimeOfLink(PRTime* aCreationTime) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetFileSize(int64_t* aFileSize) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::SetFileSize(int64_t aFileSize) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetFileSizeOfLink(int64_t* aFileSize) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::Exists(bool* aRetVal) { return NS_ERROR_NOT_IMPLEMENTED; }

    NS_IMETHODIMP
    FileDescriptorFile::IsWritable(bool* aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::IsReadable(bool* aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::IsExecutable(bool* aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::IsHidden(bool* aRetVal) { return NS_ERROR_NOT_IMPLEMENTED; }

    NS_IMETHODIMP
    FileDescriptorFile::IsDirectory(bool* aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::IsFile(bool* aRetVal) { return NS_ERROR_NOT_IMPLEMENTED; }

    NS_IMETHODIMP
    FileDescriptorFile::IsSymlink(bool* aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::IsSpecial(bool* aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::CreateUnique(uint32_t aType, uint32_t aAttributes) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetDirectoryEntriesImpl(nsIDirectoryEnumerator** aEntries) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::OpenANSIFileDesc(const char* aMode, FILE** aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::Load(PRLibrary** aRetVal) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::GetDiskSpaceAvailable(int64_t* aDiskSpaceAvailable) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    FileDescriptorFile::Reveal() { return NS_ERROR_NOT_IMPLEMENTED; }

    NS_IMETHODIMP
    FileDescriptorFile::Launch() { return NS_ERROR_NOT_IMPLEMENTED; }

    }  // namespace net