Bug 1452441 - Fix infinite recursion in testBinASTReader for Windows;r=self
MozReview-Commit-ID: Fwv0VgPpv4v
--- a/js/src/jsapi-tests/moz.build
+++ b/js/src/jsapi-tests/moz.build
@@ -139,17 +139,17 @@ if CONFIG['ENABLE_STREAMS']:
if CONFIG['NIGHTLY_BUILD']:
# The Error interceptor only exists on Nightly.
UNIFIED_SOURCES += [
'testErrorInterceptor.cpp',
]
-if CONFIG['JS_BUILD_BINAST'] and CONFIG['JS_STANDALONE'] and CONFIG['OS_TARGET'] != 'WINNT':
+if CONFIG['JS_BUILD_BINAST'] and CONFIG['JS_STANDALONE']:
# Standalone builds leave the source directory untouched,
# which lets us run tests with the data files intact.
# Otherwise, in the current state of the build system,
# we can't have data files in js/src tests.
UNIFIED_SOURCES += [
'testBinASTReader.cpp',
'testBinTokenReaderTester.cpp'
]
--- a/js/src/jsapi-tests/testBinASTReader.cpp
+++ b/js/src/jsapi-tests/testBinASTReader.cpp
@@ -76,21 +76,27 @@ runTestFromPath(JSContext* cx, const cha
while (auto entry = readdir(dir)) {
const char* d_name = entry->d_name;
const bool isDirectory = entry->d_type == DT_DIR;
#elif defined(XP_WIN)
MOZ_ASSERT(path[pathlen - 1] == '\\');
- const char PATTERN[] = "*";
+ Vector<char> pattern(cx);
+ if (!pattern.append(path, pathlen))
+ MOZ_CRASH();
+ if (!pattern.append('*'))
+ MOZ_CRASH();
+ if (!pattern.append('\0'))
+ MOZ_CRASH();
WIN32_FIND_DATA FindFileData;
enterJsDirectory();
- HANDLE hFind = FindFirstFile(PATTERN, &FindFileData);
+ HANDLE hFind = FindFirstFile(pattern.begin(), &FindFileData);
exitJsDirectory();
for (bool found = (hFind != INVALID_HANDLE_VALUE);
found;
found = FindNextFile(hFind, &FindFileData))
{
const char* d_name = FindFileData.cFileName;
const bool isDirectory = FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;