teach new chrome registration to handle urls and jar files

This commit is contained in:
danm%netscape.com 2000-05-17 02:01:08 +00:00
Родитель 0e5c82a198
Коммит 85b5c58dec
2 изменённых файлов: 38 добавлений и 8 удалений

Просмотреть файл

@ -1935,6 +1935,9 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength) {
nsCAutoString locale("locale"); nsCAutoString locale("locale");
nsCAutoString skin("skin"); nsCAutoString skin("skin");
nsCAutoString profile("profile"); nsCAutoString profile("profile");
nsCAutoString path("path");
nsCAutoString fileURL;
nsCAutoString chromeURL;
static const char *delim = ",\r\n"; static const char *delim = ",\r\n";
@ -1946,7 +1949,7 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength) {
chromeProfile = strtok(0, delim); chromeProfile = strtok(0, delim);
if (!chromeProfile || chromeProfile > bufferEnd) if (!chromeProfile || chromeProfile > bufferEnd)
break; break;
chromeLocType = strtok(0, delim); // unused for now. assume "path" chromeLocType = strtok(0, delim);
if (!chromeLocType || chromeProfile > bufferEnd) if (!chromeLocType || chromeProfile > bufferEnd)
break; break;
chromeLocation = strtok(0, delim); chromeLocation = strtok(0, delim);
@ -1954,9 +1957,21 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength) {
break; break;
isProfile = profile.Equals(chromeProfile); isProfile = profile.Equals(chromeProfile);
nsFileSpec chromeFile(chromeLocation);
nsFileURL fileURL(chromeFile); if (path.Equals(chromeLocType)) {
const char* chromeURL = fileURL.GetURLString(); // location is a (full) path. convert it to an URL.
nsFileSpec chromeFile(chromeLocation);
nsFileURL file(chromeFile);
chromeURL = file.GetURLString();
if (chromeFile.IsFile()) {
// path points to a file. must be a jar file. convert to a jar url.
fileURL = "jar:";
fileURL += chromeURL;
fileURL += "!/";
chromeURL = fileURL;
}
} else // not "path". assume "url".
chromeURL = chromeLocation;
// process the line // process the line
if (skin.Equals(chromeType)) if (skin.Equals(chromeType))

Просмотреть файл

@ -1935,6 +1935,9 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength) {
nsCAutoString locale("locale"); nsCAutoString locale("locale");
nsCAutoString skin("skin"); nsCAutoString skin("skin");
nsCAutoString profile("profile"); nsCAutoString profile("profile");
nsCAutoString path("path");
nsCAutoString fileURL;
nsCAutoString chromeURL;
static const char *delim = ",\r\n"; static const char *delim = ",\r\n";
@ -1946,7 +1949,7 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength) {
chromeProfile = strtok(0, delim); chromeProfile = strtok(0, delim);
if (!chromeProfile || chromeProfile > bufferEnd) if (!chromeProfile || chromeProfile > bufferEnd)
break; break;
chromeLocType = strtok(0, delim); // unused for now. assume "path" chromeLocType = strtok(0, delim);
if (!chromeLocType || chromeProfile > bufferEnd) if (!chromeLocType || chromeProfile > bufferEnd)
break; break;
chromeLocation = strtok(0, delim); chromeLocation = strtok(0, delim);
@ -1954,9 +1957,21 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength) {
break; break;
isProfile = profile.Equals(chromeProfile); isProfile = profile.Equals(chromeProfile);
nsFileSpec chromeFile(chromeLocation);
nsFileURL fileURL(chromeFile); if (path.Equals(chromeLocType)) {
const char* chromeURL = fileURL.GetURLString(); // location is a (full) path. convert it to an URL.
nsFileSpec chromeFile(chromeLocation);
nsFileURL file(chromeFile);
chromeURL = file.GetURLString();
if (chromeFile.IsFile()) {
// path points to a file. must be a jar file. convert to a jar url.
fileURL = "jar:";
fileURL += chromeURL;
fileURL += "!/";
chromeURL = fileURL;
}
} else // not "path". assume "url".
chromeURL = chromeLocation;
// process the line // process the line
if (skin.Equals(chromeType)) if (skin.Equals(chromeType))