Bug 1533775 - PoisonIOInterposerWin should report the filename when opening non-existant files, r=aklotz.
authorFlorian Quèze <florian@queze.net>
Fri, 08 Mar 2019 17:15:21 +0000
changeset 521055 63625c423683a941a2d6afeb3c67b0d578847bb7
parent 521054 13115d00f301e54ba7fb2a38a92a81d5b22f6da3
child 521056 b49300f6cc1fc2411be9031f765f240099ec715f
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaklotz
bugs1533775
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1533775 - PoisonIOInterposerWin should report the filename when opening non-existant files, r=aklotz. Differential Revision: https://phabricator.services.mozilla.com/D22722
xpcom/build/PoisonIOInterposerWin.cpp
--- a/xpcom/build/PoisonIOInterposerWin.cpp
+++ b/xpcom/build/PoisonIOInterposerWin.cpp
@@ -128,18 +128,21 @@ class WinIOAutoObservation : public IOIn
   WinIOAutoObservation(IOInterposeObserver::Operation aOp, nsAString& aFilename)
       : IOInterposeObserver::Observation(aOp, sReference),
         mFileHandle(nullptr),
         mHasQueriedFilename(false) {
     if (mShouldReport) {
       nsAutoString dosPath;
       if (NtPathToDosPath(aFilename, dosPath)) {
         mFilename = dosPath;
-        mHasQueriedFilename = true;
+      } else {
+        // If we can't get a dosPath, what we have is better than nothing.
+        mFilename = aFilename;
       }
+      mHasQueriedFilename = true;
       mOffset.QuadPart = 0;
     }
   }
 
   // Custom implementation of IOInterposeObserver::Observation::Filename
   void Filename(nsAString& aFilename) override;
 
   ~WinIOAutoObservation() { Report(); }
@@ -155,20 +158,21 @@ class WinIOAutoObservation : public IOIn
 const char* WinIOAutoObservation::sReference = "PoisonIOInterposer";
 
 // Get filename for this observation
 void WinIOAutoObservation::Filename(nsAString& aFilename) {
   // If mHasQueriedFilename is true, then filename is already stored in
   // mFilename
   if (mHasQueriedFilename) {
     aFilename = mFilename;
+    return;
   }
 
   nsAutoString filename;
-  if (HandleToFilename(mFileHandle, mOffset, filename)) {
+  if (mFileHandle && HandleToFilename(mFileHandle, mOffset, filename)) {
     mFilename = filename;
   }
   mHasQueriedFilename = true;
 
   aFilename = mFilename;
 }
 
 /*************************** IO Interposing Methods ***************************/