summaryrefslogtreecommitdiffstats
path: root/toolkit/xre/nsWindowsWMain.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:33 +0000
commit086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch)
treea4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /toolkit/xre/nsWindowsWMain.cpp
parentAdding debian version 124.0.1-1. (diff)
downloadfirefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz
firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/xre/nsWindowsWMain.cpp')
-rw-r--r--toolkit/xre/nsWindowsWMain.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/toolkit/xre/nsWindowsWMain.cpp b/toolkit/xre/nsWindowsWMain.cpp
index 7eb9e11046..2a91deec5c 100644
--- a/toolkit/xre/nsWindowsWMain.cpp
+++ b/toolkit/xre/nsWindowsWMain.cpp
@@ -111,9 +111,32 @@ static void FreeAllocStrings(int argc, char** argv) {
delete[] argv;
}
+// Remove "/prefetch:##" argument from the command line, if present. (See
+// GeckoChildProcessHost.cpp for details.)
+//
+// Colons are not permitted in path-elements on Windows, so a string of this
+// form is extremely unlikely to appear with the intent of being a legitimate
+// path-argument.
+void RemovePrefetchArguments(int& argc, WCHAR** argv) {
+ size_t prefetchArgsCount [[maybe_unused]] = 0;
+ for (int i = 0; i < argc; ++i) {
+ constexpr const wchar_t prefix[] = L"/prefetch:";
+ auto const cmp = wcsncmp(argv[i], prefix, ARRAYSIZE(prefix) - 1);
+ if (cmp == 0) {
+ std::copy(argv + i + 1, argv + argc, argv + i);
+ --argc;
+ --i;
+ prefetchArgsCount++;
+ }
+ }
+ MOZ_ASSERT(prefetchArgsCount <= 1,
+ "at most one /prefetch:## argument should be present");
+}
+
int wmain(int argc, WCHAR** argv) {
SanitizeEnvironmentVariables();
SetDllDirectoryW(L"");
+ RemovePrefetchArguments(argc, argv);
// Only run this code if LauncherProcessWin.h was included beforehand, thus
// signalling that the hosting process should support launcher mode.