Bug 1108382 - Part 5: Do not use non-standard flag argument of String.prototype.replace in docshell/test/unit/. r=gavin

This commit is contained in:
Tooru Fujisawa 2015-03-01 09:51:33 +09:00
parent e52cf55788
commit 1067bb7e38

View File

@ -621,14 +621,14 @@ function do_single_test_run() {
if (couldDoKeywordLookup) {
if (expectKeywordLookup) {
if (!affectedByWhitelist || (affectedByWhitelist && !inWhitelist)) {
let urlparamInput = encodeURIComponent(sanitize(testInput)).replace("%20", "+", "g");
let urlparamInput = encodeURIComponent(sanitize(testInput)).replace(/%20/g, "+");
// If the input starts with `?`, then info.preferredURI.spec will omit it
// In order to test this behaviour, remove `?` only if it is the first character
if (urlparamInput.startsWith("%3F")) {
urlparamInput = urlparamInput.replace("%3F", "");
}
let searchURL = kSearchEngineURL.replace("{searchTerms}", urlparamInput);
let spec = info.preferredURI.spec.replace("%27", "'", "g");
let spec = info.preferredURI.spec.replace(/%27/g, "'");
do_check_eq(spec, searchURL);
} else {
do_check_eq(info.preferredURI, null);