bug 225695 : follow-up to bug 44272. tree-wide sweep to replace escape/unescape() with en|decodeURI(Component). part 2(mail/mailnews) of 3. r=neil, sr=bienvenu, a=asa

This commit is contained in:
jshin%mailaps.org 2003-12-03 21:52:10 +00:00
Родитель 88492d9c99
Коммит 5e7848db38
16 изменённых файлов: 50 добавлений и 40 удалений

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

@ -307,7 +307,7 @@ function onSearch()
for (var j=0;j<max_attrs;j++) { for (var j=0;j<max_attrs;j++) {
// append the term(s) to the searchUri // append the term(s) to the searchUri
searchUri += "(" + attrs[j] + "," + opStr + "," + escape(searchTerm.value.str) + ")"; searchUri += "(" + attrs[j] + "," + opStr + "," + encodeURIComponent(searchTerm.value.str) + ")";
} }
} }

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

@ -863,7 +863,7 @@ function saveAttachment(aAttachment)
{ {
messenger.saveAttachment(aAttachment.contentType, messenger.saveAttachment(aAttachment.contentType,
aAttachment.url, aAttachment.url,
escape(aAttachment.displayName), encodeURIComponent(aAttachment.displayName),
aAttachment.messageUri); aAttachment.messageUri);
} }
@ -871,7 +871,7 @@ function openAttachment(aAttachment)
{ {
messenger.openAttachment(aAttachment.contentType, messenger.openAttachment(aAttachment.contentType,
aAttachment.url, aAttachment.url,
escape(aAttachment.displayName), encodeURIComponent(aAttachment.displayName),
aAttachment.messageUri); aAttachment.messageUri);
} }
@ -880,7 +880,7 @@ function printAttachment(aAttachment)
/* we haven't implemented the ability to print attachments yet... /* we haven't implemented the ability to print attachments yet...
messenger.printAttachment(aAttachment.contentType, messenger.printAttachment(aAttachment.contentType,
aAttachment.url, aAttachment.url,
escape(aAttachment.displayName), encodeURIComponent(aAttachment.displayName),
aAttachment.messageUri); aAttachment.messageUri);
*/ */
} }
@ -1129,7 +1129,7 @@ function SaveAllAttachments()
var attachment = currentAttachments[index]; var attachment = currentAttachments[index];
attachmentContentTypeArray[index] = attachment.contentType; attachmentContentTypeArray[index] = attachment.contentType;
attachmentUrlArray[index] = attachment.url; attachmentUrlArray[index] = attachment.url;
attachmentDisplayNameArray[index] = escape(attachment.displayName); attachmentDisplayNameArray[index] = encodeURIComponent(attachment.displayName);
attachmentMessageUriArray[index] = attachment.uri; attachmentMessageUriArray[index] = attachment.uri;
} }

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

@ -206,7 +206,7 @@ function DisplayCardViewPane(card)
cvSetVisible(data.cvEmail1Box, false); cvSetVisible(data.cvEmail1Box, false);
cvSetVisible(data.cvScreennameBox, false); cvSetVisible(data.cvScreennameBox, false);
visible = HandleLink(data.cvListName, zListName, card.displayName, data.cvListNameBox, "mailto:" + escape(GenerateAddressFromCard(card))) || visible; visible = HandleLink(data.cvListName, zListName, card.displayName, data.cvListNameBox, "mailto:" + encodeURIComponent(GenerateAddressFromCard(card))) || visible;
} }
else { else {
// listname always hidden if not a mailing list // listname always hidden if not a mailing list
@ -496,12 +496,12 @@ function CreateMapItURL(address1, address2, city, state, zip, country)
if (!gMapItURLFormat) if (!gMapItURLFormat)
return null; return null;
var urlFormat = gMapItURLFormat.replace("@A1", escape(address1)); var urlFormat = gMapItURLFormat.replace("@A1", encodeURIComponent(address1));
urlFormat = urlFormat.replace("@A2", escape(address2)); urlFormat = urlFormat.replace("@A2", encodeURIComponent(address2));
urlFormat = urlFormat.replace("@CO", escape(country)); urlFormat = urlFormat.replace("@CO", encodeURIComponent(country));
urlFormat = urlFormat.replace("@CI", escape(city)); urlFormat = urlFormat.replace("@CI", encodeURIComponent(city));
urlFormat = urlFormat.replace("@ST", escape(state)); urlFormat = urlFormat.replace("@ST", encodeURIComponent(state));
urlFormat = urlFormat.replace("@ZI", escape(zip)); urlFormat = urlFormat.replace("@ZI", encodeURIComponent(zip));
return urlFormat; return urlFormat;
} }

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

@ -623,7 +623,7 @@ function onEnterInSearchBar()
if (gSearchInput.value != "") { if (gSearchInput.value != "") {
// replace all instances of @V with the escaped version // replace all instances of @V with the escaped version
// of what the user typed in the quick search text input // of what the user typed in the quick search text input
searchURI += gQueryURIFormat.replace(/@V/g, escape(gSearchInput.value)); searchURI += gQueryURIFormat.replace(/@V/g, encodeURIComponent(gSearchInput.value));
} }
SetAbView(searchURI, sortColumn, sortDirection); SetAbView(searchURI, sortColumn, sortDirection);
@ -812,4 +812,4 @@ function loadThrobberUrl(urlPref)
messenger = messenger.QueryInterface(Components.interfaces.nsIMessenger); messenger = messenger.QueryInterface(Components.interfaces.nsIMessenger);
messenger.launchExternalURL(url); messenger.launchExternalURL(url);
} catch (ex) {} } catch (ex) {}
} }

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

@ -1089,7 +1089,7 @@ function GetArgs(originalData)
args[argname] = argvalue.substring(1, argvalue.length - 1); args[argname] = argvalue.substring(1, argvalue.length - 1);
else else
try { try {
args[argname] = unescape(argvalue); args[argname] = decodeURIComponent(argvalue);
} catch (e) {args[argname] = argvalue;} } catch (e) {args[argname] = argvalue;}
dump("[" + argname + "=" + args[argname] + "]\n"); dump("[" + argname + "=" + args[argname] + "]\n");
} }
@ -1278,9 +1278,10 @@ function ComposeStartup(recycled, aParams)
{ {
var cleanBody; var cleanBody;
try { try {
cleanBody = unescape(body); cleanBody = decodeURI(body);
} catch(e) { cleanBody = body;} } catch(e) { cleanBody = body;}
// XXX : need html-escaping here
msgCompFields.body = "<BR><A HREF=\"" + body + "\">" + cleanBody + "</A><BR>"; msgCompFields.body = "<BR><A HREF=\"" + body + "\">" + cleanBody + "</A><BR>";
} }
else else
@ -1777,9 +1778,15 @@ function Save()
function SaveAsFile(saveAs) function SaveAsFile(saveAs)
{ {
<<<<<<< MsgComposeCommands.js
dump("SaveAsFile from XUL\n");
var subject = document.getElementById('msgSubject').value;
GetCurrentEditor().setDocumentTitle(subject);
=======
dump("SaveAsFile from XUL\n"); dump("SaveAsFile from XUL\n");
var subject = document.getElementById('msgSubject').value; var subject = document.getElementById('msgSubject').value;
GetCurrentEditor().setDocumentTitle(subject); GetCurrentEditor().setDocumentTitle(subject);
>>>>>>> 1.26
if (gMsgCompose.bodyConvertible() == nsIMsgCompConvertible.Plain) if (gMsgCompose.bodyConvertible() == nsIMsgCompConvertible.Plain)
SaveDocument(saveAs, false, "text/plain"); SaveDocument(saveAs, false, "text/plain");
@ -2233,7 +2240,7 @@ function AddAttachment(attachment)
item.setAttribute("label", attachment.name); //use for display only item.setAttribute("label", attachment.name); //use for display only
item.attachment = attachment; //full attachment object stored here item.attachment = attachment; //full attachment object stored here
try { try {
item.setAttribute("tooltiptext", unescape(attachment.url)); item.setAttribute("tooltiptext", decodeURI(attachment.url));
} catch(e) { } catch(e) {
item.setAttribute("tooltiptext", attachment.url); item.setAttribute("tooltiptext", attachment.url);
} }
@ -2985,4 +2992,4 @@ function toggleAddressPicker()
function AddRecipient(recipientType, address) function AddRecipient(recipientType, address)
{ {
awAddRecipient(recipientType, address); awAddRecipient(recipientType, address);
} }

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

@ -993,7 +993,7 @@ function onEnterInSearchBar()
var sortDirection = selectedNode.getAttribute("sortDirection"); var sortDirection = selectedNode.getAttribute("sortDirection");
if (gSearchInput.value != "") { if (gSearchInput.value != "") {
searchURI += gQueryURIFormat.replace(/@V/g, escape(gSearchInput.value)); searchURI += gQueryURIFormat.replace(/@V/g, encodeURIComponent(gSearchInput.value));
} }
SetAbView(searchURI, sortColumn, sortDirection); SetAbView(searchURI, sortColumn, sortDirection);

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

@ -166,7 +166,8 @@ function installExtension()
if (ret == nsIFilePicker.returnOK) if (ret == nsIFilePicker.returnOK)
{ {
var file = ''; var file = '';
file = 'file:///' + escape(fp.file.path.replace(/\\/g,'/')); // XXX To fix : see bugzilla 225695 comment #43
file = encodeURI('file:///' + fp.file.path.replace(/\\/g,'/'));
doXPIInstall(file, getName(file)); doXPIInstall(file, getName(file));
} }
} }

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

@ -256,7 +256,8 @@ function installSkin()
function installTheme(filePath) function installTheme(filePath)
{ {
var file = ''; var file = '';
file = 'file:///' + escape(filePath.replace(/\\/g,'/')); // XXX To fix : see bugzilla 225695 comment #43
file = encodeURI('file:///' + filePath.replace(/\\/g,'/'));
InstallTrigger.installChrome(InstallTrigger.SKIN, file, getName(file)); InstallTrigger.installChrome(InstallTrigger.SKIN, file, getName(file));
} }

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

@ -207,7 +207,7 @@ function DisplayCardViewPane(card)
cvSetVisible(data.cvEmail1Box, false); cvSetVisible(data.cvEmail1Box, false);
cvSetVisible(data.cvScreennameBox, false); cvSetVisible(data.cvScreennameBox, false);
visible = HandleLink(data.cvListName, zListName, card.displayName, data.cvListNameBox, "mailto:" + escape(GenerateAddressFromCard(card))) || visible; visible = HandleLink(data.cvListName, zListName, card.displayName, data.cvListNameBox, "mailto:" + encodeURIComponent(GenerateAddressFromCard(card))) || visible;
} }
else { else {
// listname always hidden if not a mailing list // listname always hidden if not a mailing list
@ -493,12 +493,12 @@ function CreateMapItURL(address1, address2, city, state, zip, country)
if (!gMapItURLFormat) if (!gMapItURLFormat)
return null; return null;
var urlFormat = gMapItURLFormat.replace("@A1", escape(address1)); var urlFormat = gMapItURLFormat.replace("@A1", encodeURIComponent(address1));
urlFormat = urlFormat.replace("@A2", escape(address2)); urlFormat = urlFormat.replace("@A2", encodeURIComponent(address2));
urlFormat = urlFormat.replace("@CO", escape(country)); urlFormat = urlFormat.replace("@CO", encodeURIComponent(country));
urlFormat = urlFormat.replace("@CI", escape(city)); urlFormat = urlFormat.replace("@CI", encodeURIComponent(city));
urlFormat = urlFormat.replace("@ST", escape(state)); urlFormat = urlFormat.replace("@ST", encodeURIComponent(state));
urlFormat = urlFormat.replace("@ZI", escape(zip)); urlFormat = urlFormat.replace("@ZI", encodeURIComponent(zip));
return urlFormat; return urlFormat;
} }

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

@ -426,7 +426,7 @@ function onEnterInSearchBar()
var searchURI = selectedNode.getAttribute("id"); var searchURI = selectedNode.getAttribute("id");
if (gSearchInput.value != "") { if (gSearchInput.value != "") {
searchURI += gQueryURIFormat.replace(/@V/g, escape(gSearchInput.value)); searchURI += gQueryURIFormat.replace(/@V/g, encodeURIComponent(gSearchInput.value));
} }
SetAbView(searchURI, sortColumn, sortDirection); SetAbView(searchURI, sortColumn, sortDirection);

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

@ -612,7 +612,7 @@ function onEnterInSearchBar()
if (gSearchInput.value != "") { if (gSearchInput.value != "") {
// replace all instances of @V with the escaped version // replace all instances of @V with the escaped version
// of what the user typed in the quick search text input // of what the user typed in the quick search text input
searchURI += gQueryURIFormat.replace(/@V/g, escape(gSearchInput.value)); searchURI += gQueryURIFormat.replace(/@V/g, encodeURIComponent(gSearchInput.value));
} }
SetAbView(searchURI, sortColumn, sortDirection); SetAbView(searchURI, sortColumn, sortDirection);

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

@ -852,7 +852,7 @@ createNewAttachmentInfo.prototype.saveAttachment = function saveAttachment()
{ {
messenger.saveAttachment(this.contentType, messenger.saveAttachment(this.contentType,
this.url, this.url,
escape(this.displayName), encodeURIComponent(this.displayName),
this.uri); this.uri);
} }
@ -860,7 +860,7 @@ createNewAttachmentInfo.prototype.openAttachment = function openAttachment()
{ {
messenger.openAttachment(this.contentType, messenger.openAttachment(this.contentType,
this.url, this.url,
escape(this.displayName), encodeURIComponent(this.displayName),
this.uri); this.uri);
} }
@ -869,7 +869,7 @@ createNewAttachmentInfo.prototype.printAttachment = function printAttachment()
/* we haven't implemented the ability to print attachments yet... /* we haven't implemented the ability to print attachments yet...
messenger.printAttachment(this.contentType, messenger.printAttachment(this.contentType,
this.url, this.url,
escape(this.displayName), encodeURIComponent(this.displayName),
this.uri); this.uri);
*/ */
} }
@ -1089,7 +1089,7 @@ function SaveAllAttachments()
var attachment = currentAttachments[index]; var attachment = currentAttachments[index];
attachmentContentTypeArray[index] = attachment.contentType; attachmentContentTypeArray[index] = attachment.contentType;
attachmentUrlArray[index] = attachment.url; attachmentUrlArray[index] = attachment.url;
attachmentDisplayNameArray[index] = escape(attachment.displayName); attachmentDisplayNameArray[index] = encodeURI(attachment.displayName);
attachmentMessageUriArray[index] = attachment.uri; attachmentMessageUriArray[index] = attachment.uri;
} }

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

@ -309,7 +309,7 @@ function onSearch()
for (var j=0;j<max_attrs;j++) { for (var j=0;j<max_attrs;j++) {
// append the term(s) to the searchUri // append the term(s) to the searchUri
searchUri += "(" + attrs[j] + "," + opStr + "," + escape(searchTerm.value.str) + ")"; searchUri += "(" + attrs[j] + "," + opStr + "," + encodeURIComponent(searchTerm.value.str) + ")";
} }
} }

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

@ -653,7 +653,7 @@ function SearchNewFolderOkCallback(name,uri)
if (!imapFolder) if (!imapFolder)
{ {
var curFolder = uri+"/"+escape(name); var curFolder = uri+"/"+encodeURIComponent(name);
SetFolderPicker(curFolder, gActionTargetElement.id); SetFolderPicker(curFolder, gActionTargetElement.id);
} }
} }

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

@ -1086,7 +1086,7 @@ function GetArgs(originalData)
args[argname] = argvalue.substring(1, argvalue.length - 1); args[argname] = argvalue.substring(1, argvalue.length - 1);
else else
try { try {
args[argname] = unescape(argvalue); args[argname] = decodeURIComponent(argvalue);
} catch (e) {args[argname] = argvalue;} } catch (e) {args[argname] = argvalue;}
dump("[" + argname + "=" + args[argname] + "]\n"); dump("[" + argname + "=" + args[argname] + "]\n");
} }
@ -1261,9 +1261,10 @@ function ComposeStartup(recycled, aParams)
{ {
var cleanBody; var cleanBody;
try { try {
cleanBody = unescape(body); cleanBody = decodeURI(body);
} catch(e) { cleanBody = body;} } catch(e) { cleanBody = body;}
// XXX : need to do html-escaping here !
msgCompFields.body = "<BR><A HREF=\"" + body + "\">" + cleanBody + "</A><BR>"; msgCompFields.body = "<BR><A HREF=\"" + body + "\">" + cleanBody + "</A><BR>";
} }
else else
@ -2188,7 +2189,7 @@ function AddAttachment(attachment)
item.setAttribute("label", attachment.name); //use for display only item.setAttribute("label", attachment.name); //use for display only
item.attachment = attachment; //full attachment object stored here item.attachment = attachment; //full attachment object stored here
try { try {
item.setAttribute("tooltiptext", unescape(attachment.url)); item.setAttribute("tooltiptext", decodeURI(attachment.url));
} catch(e) { } catch(e) {
item.setAttribute("tooltiptext", attachment.url); item.setAttribute("tooltiptext", attachment.url);
} }

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

@ -68,7 +68,7 @@
.getService(Components.interfaces.nsIExternalProtocolService); .getService(Components.interfaces.nsIExternalProtocolService);
var ioService = Components.classes["@mozilla.org/network/io-service;1"] var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService); .getService(Components.interfaces.nsIIOService);
var mailto = url ? "mailto:?body="+escape(url)+"&subject="+escape(title) : "mailto:"; var mailto = url ? "mailto:?body="+encodeURIComponent(url)+"&subject="+encodeURIComponent(title) : "mailto:";
var uri = ioService.newURI(mailto, null, null); var uri = ioService.newURI(mailto, null, null);
extProtocolSvc.loadUrl(uri); extProtocolSvc.loadUrl(uri);