Bug 397443 - properly unencode URL-encoded email addresses in context menus, use implicit wrappers instead of deprecated workarounds, r=mscott

This commit is contained in:
philringnalda%gmail.com 2007-09-28 03:04:21 +00:00
Родитель e05009d3e4
Коммит 480409394e
2 изменённых файлов: 3 добавлений и 6 удалений

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

@ -835,13 +835,11 @@ function getEmail (url)
else
addresses = url.substr( mailtolength );
// Let's try to unescape it using a character set
// in case the address is not ASCII.
try {
var characterSet = Components.lookupMethod(this.target.ownerDocument, "characterSet")
.call(this.target.ownerDocument);
var characterSet = gContextMenu.target.ownerDocument.characterSet;
const textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
.getService(Components.interfaces.nsITextToSubURI);
addresses = textToSubURI.unEscapeNonAsciiURI(characterSet, addresses);
addresses = textToSubURI.unEscapeURIForUI(characterSet, addresses);
}
catch(ex) {
// Do nothing.

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

@ -584,8 +584,7 @@ nsContextMenu.prototype = {
// Let's try to unescape it using a character set
try {
var ownerDocument = new XPCNativeWrapper(this.target, "ownerDocument").ownerDocument;
var characterSet = new XPCNativeWrapper(ownerDocument, "characterSet").characterSet;
var characterSet = this.target.ownerDocument.characterSet;
const textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
.getService(Components.interfaces.nsITextToSubURI);
addresses = textToSubURI.unEscapeURIForUI(characterSet, addresses);