зеркало из https://github.com/mozilla/pjs.git
Support Windows line endings in manifest files again (regression introduced in revision 5229353383b0). With test!
This commit is contained in:
Родитель
43ba1cfb5c
Коммит
c8c55836ed
|
@ -0,0 +1,3 @@
|
|||
# Note: the following lines begins/end with a CR
|
||||
|
||||
content test_crlf .
|
|
@ -0,0 +1,15 @@
|
|||
registerManifests([do_get_file("data/test_crlf.manifest")]);
|
||||
|
||||
function run_test()
|
||||
{
|
||||
let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].
|
||||
getService(Ci.nsIChromeRegistry);
|
||||
|
||||
let ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
let sourceURI = ios.newURI("chrome://test_crlf/content/", null, null);
|
||||
// this throws for packages that are not registered
|
||||
let file = cr.convertChromeURL(sourceURI).QueryInterface(Ci.nsIFileURL).file;
|
||||
|
||||
do_check_true(file.equals(do_get_file("data/test_crlf.xul", true)));
|
||||
}
|
|
@ -116,7 +116,11 @@ static const ManifestDirective kParsingTable[] = {
|
|||
};
|
||||
|
||||
static const char kWhitespace[] = "\t ";
|
||||
static const char kNewlines[] = "\r\n";
|
||||
|
||||
static bool IsNewline(char c)
|
||||
{
|
||||
return c == '\n' || c == '\r';
|
||||
}
|
||||
|
||||
namespace {
|
||||
struct AutoPR_smprintf_free
|
||||
|
@ -477,7 +481,7 @@ ParseManifest(NSLocationType aType, nsILocalFile* aFile, char* buf,
|
|||
|
||||
// outer loop tokenizes by newline
|
||||
while (*newline) {
|
||||
while (*newline && '\n' == *newline) {
|
||||
while (*newline && IsNewline(*newline)) {
|
||||
++newline;
|
||||
++line;
|
||||
}
|
||||
|
@ -485,7 +489,7 @@ ParseManifest(NSLocationType aType, nsILocalFile* aFile, char* buf,
|
|||
break;
|
||||
|
||||
token = newline;
|
||||
while (*newline && '\n' != *newline)
|
||||
while (*newline && !IsNewline(*newline))
|
||||
++newline;
|
||||
|
||||
if (*newline) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче