Bug 857715: In testing/xpcshell/head.js, use 'uneval' to quote values passed to the child process. r=ted

This commit is contained in:
Jim Blandy 2013-04-14 17:49:40 -07:00
parent a8833344c1
commit b615271c9e

View File

@ -978,27 +978,20 @@ function do_load_child_test_harness()
return; return;
do_load_child_test_harness.alreadyRun = 1; do_load_child_test_harness.alreadyRun = 1;
function addQuotes (str) {
return '"' + str + '"';
}
var quoted_head_files = _HEAD_FILES.map(addQuotes);
var quoted_tail_files = _TAIL_FILES.map(addQuotes);
_XPCSHELL_PROCESS = "parent"; _XPCSHELL_PROCESS = "parent";
let command = let command =
"const _HEAD_JS_PATH='" + _HEAD_JS_PATH + "'; " "const _HEAD_JS_PATH=" + uneval(_HEAD_JS_PATH) + "; "
+ "const _HTTPD_JS_PATH='" + _HTTPD_JS_PATH + "'; " + "const _HTTPD_JS_PATH=" + uneval(_HTTPD_JS_PATH) + "; "
+ "const _HEAD_FILES=[" + quoted_head_files.join() + "];" + "const _HEAD_FILES=" + uneval(_HEAD_FILES) + "; "
+ "const _TAIL_FILES=[" + quoted_tail_files.join() + "];" + "const _TAIL_FILES=" + uneval(_TAIL_FILES) + "; "
+ "const _XPCSHELL_PROCESS='child';"; + "const _XPCSHELL_PROCESS='child';";
if (this._TESTING_MODULES_DIR) { if (this._TESTING_MODULES_DIR) {
normalized = this._TESTING_MODULES_DIR.replace('\\', '\\\\', 'g'); command += " const _TESTING_MODULES_DIR=" + uneval(_TESTING_MODULES_DIR) + ";";
command += "const _TESTING_MODULES_DIR='" + normalized + "'; ";
} }
command += "load(_HEAD_JS_PATH);"; command += " load(_HEAD_JS_PATH);";
sendCommand(command); sendCommand(command);
} }