Skip to content

Commit 1bc77e5

Browse files
committed
Fixes #921, avoid max arg list to push.apply
1 parent 27594a4 commit 1bc77e5

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

build/jslib/node/file.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ define(['fs', 'path', 'prim'], function (fs, path, prim) {
128128
} else if (stat.isDirectory() &&
129129
(!file.exclusionRegExp || !file.exclusionRegExp.test(fileName))) {
130130
dirFiles = this.getFilteredFileList(filePath, regExpFilters, makeUnixPaths);
131-
files.push.apply(files, dirFiles);
131+
//Do not use push.apply for dir listings, can hit limit of max number
132+
//of arguments to a function call, #921.
133+
dirFiles.forEach(function (dirFile) {
134+
files.push(dirFile);
135+
});
132136
}
133137
}
134138
}

build/jslib/rhino/file.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ define(['prim'], function (prim) {
9393
} else if (fileObj.isDirectory() &&
9494
(!file.exclusionRegExp || !file.exclusionRegExp.test(fileObj.getName()))) {
9595
dirFiles = this.getFilteredFileList(fileObj, regExpFilters, makeUnixPaths, true);
96-
files.push.apply(files, dirFiles);
96+
//Do not use push.apply for dir listings, can hit limit of max number
97+
//of arguments to a function call, #921.
98+
dirFiles.forEach(function (dirFile) {
99+
files.push(dirFile);
100+
});
97101
}
98102
}
99103
}

build/jslib/xpconnect/file.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ define(['prim'], function (prim) {
105105
} else if (fileObj.isDirectory() &&
106106
(!file.exclusionRegExp || !file.exclusionRegExp.test(fileObj.leafName))) {
107107
dirFiles = this.getFilteredFileList(fileObj, regExpFilters, makeUnixPaths, true);
108-
files.push.apply(files, dirFiles);
108+
//Do not use push.apply for dir listings, can hit limit of max number
109+
//of arguments to a function call, #921.
110+
dirFiles.forEach(function (dirFile) {
111+
files.push(dirFile);
112+
});
109113
}
110114
}
111115
}

0 commit comments

Comments
 (0)