From 15ee3d3e8f8b4be3189ac18a5cdff0b66347b9ed Mon Sep 17 00:00:00 2001 From: Jorg K Date: Tue, 12 Feb 2019 18:43:30 +0100 Subject: [PATCH] Bug 1527236 - Allow % in URLs for Thunderbird. r=valentin --- netwerk/base/nsStandardURL.cpp | 5 +++++ netwerk/test/unit/test_standardurl.js | 9 ++++++--- netwerk/test/unit/xpcshell.ini | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/netwerk/base/nsStandardURL.cpp b/netwerk/base/nsStandardURL.cpp index c641f24092b3..b847887d8aaa 100644 --- a/netwerk/base/nsStandardURL.cpp +++ b/netwerk/base/nsStandardURL.cpp @@ -69,7 +69,12 @@ constexpr bool TestForInvalidHostCharacters(char c) { return (c > 0 && c < 32) || // The control characters are [1, 31] c == ' ' || c == '#' || c == '/' || c == ':' || c == '?' || c == '@' || c == '[' || c == '\\' || c == ']' || c == '*' || c == '<' || +#if defined(MOZ_THUNDERBIRD) || defined(MOZ_SUITE) + // Mailnews %-escapes file paths into URLs. + c == '>' || c == '|' || c == '"'; +#else c == '>' || c == '|' || c == '"' || c == '%'; +#endif } constexpr ASCIIMaskArray sInvalidHostChars = CreateASCIIMask(TestForInvalidHostCharacters); diff --git a/netwerk/test/unit/test_standardurl.js b/netwerk/test/unit/test_standardurl.js index c22a90d9d87b..f7fb40f3f144 100644 --- a/netwerk/test/unit/test_standardurl.js +++ b/netwerk/test/unit/test_standardurl.js @@ -1,6 +1,7 @@ "use strict"; -ChromeUtils.import('resource://gre/modules/Services.jsm'); +var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); +var {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); const gPrefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); function symmetricEquality(expect, a, b) @@ -308,7 +309,8 @@ add_test(function test_accentEncoding() run_next_test(); }); -add_test(function test_percentDecoding() +add_test({ skip_if: () => AppConstants.MOZ_APP_NAME == "thunderbird" }, + function test_percentDecoding() { var url = stringToURL("http://%70%61%73%74%65%62%69%6E.com"); Assert.equal(url.spec, "http://pastebin.com/"); @@ -698,7 +700,8 @@ add_test(function test_idna_host() { run_next_test(); }); -add_test(function test_bug1517025() { +add_test({ skip_if: () => AppConstants.MOZ_APP_NAME == "thunderbird" }, + function test_bug1517025() { Assert.throws(() => { let other = stringToURL("https://b%9a/"); }, /NS_ERROR_UNEXPECTED/, "bad URI"); diff --git a/netwerk/test/unit/xpcshell.ini b/netwerk/test/unit/xpcshell.ini index ad04f3ecd2a8..d0761321eb59 100644 --- a/netwerk/test/unit/xpcshell.ini +++ b/netwerk/test/unit/xpcshell.ini @@ -382,7 +382,9 @@ skip-if = os == "android" [test_cookie_blacklist.js] [test_getHost.js] [test_bug412457.js] +skip-if = appname == "thunderbird" [test_bug464591.js] +skip-if = appname == "thunderbird" [test_alt-data_simple.js] [test_alt-data_stream.js] [test_alt-data_too_big.js]