Bug 1533344 - Stop reading Universal CRT forwarder DLLs ahead on Windows 10. r=froydnj
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Thu, 07 Mar 2019 22:14:35 +0000
changeset 520944 c8d9a73cf366
parent 520943 289a463d4ded
child 520945 7f1c8a3ebd95
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)
reviewersfroydnj
bugs1533344
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 1533344 - Stop reading Universal CRT forwarder DLLs ahead on Windows 10. r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D22487
xpcom/glue/standalone/nsXPCOMGlue.cpp
--- a/xpcom/glue/standalone/nsXPCOMGlue.cpp
+++ b/xpcom/glue/standalone/nsXPCOMGlue.cpp
@@ -28,16 +28,17 @@ using namespace mozilla;
 #  define READ_TEXTMODE "r"
 #endif
 
 typedef void (*NSFuncPtr)();
 
 #if defined(XP_WIN)
 #  include <windows.h>
 #  include <mbstring.h>
+#  include "mozilla/WindowsVersion.h"
 
 typedef HINSTANCE LibHandleType;
 
 static LibHandleType GetLibHandle(pathstr_t aDependentLib) {
   LibHandleType libHandle =
       LoadLibraryExW(aDependentLib, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH);
 
 #  ifdef DEBUG
@@ -272,16 +273,23 @@ static nsresult XPCOMGlueLoad(const char
 
   while (fgets(buffer, sizeof(buffer), flist)) {
     int l = strlen(buffer);
 
     // ignore empty lines and comments
     if (l == 0 || *buffer == '#') {
       continue;
     }
+#  ifdef XP_WIN
+    // There is no point in reading Universal CRT forwarder DLLs ahead on
+    // Windows 10 because they will not be touched later.
+    if (IsWin10OrLater() && !strncmp(buffer, "api-", 4)) {
+      continue;
+    }
+#  endif
 
     // cut the trailing newline, if present
     if (buffer[l - 1] == '\n') {
       buffer[l - 1] = '\0';
     }
 
     if (l + size_t(cursor - xpcomDir) > MAXPATHLEN) {
       return NS_ERROR_FAILURE;