bug 345016: correctly generate microsummary for page with non-UTF-8 charset specified via meta tags or other mechanisms not detectable by XMLHttpRequest

r=bzbarsky
sr=mconnor
This commit is contained in:
myk@mozilla.org
2007-01-14 05:38:33 +00:00
parent 81f0595d18
commit 7be1304ff8

View File

@@ -2142,6 +2142,21 @@ MicrosummaryResource.prototype = {
// XMLHttpRequest will handle the notifications we don't handle.
request.channel.notificationCallbacks = this;
// If this is a bookmarked resource, and the bookmarks service recorded
// its charset in the bookmarks datastore the last time the user visited it,
// then specify the charset in the channel so XMLHttpRequest loads
// the resource correctly.
try {
var resolver = Cc["@mozilla.org/embeddor.implemented/bookmark-charset-resolver;1"].
getService(Ci.nsICharsetResolver);
if (resolver) {
var charset = resolver.requestCharset(null, request.channel, {}, {});
if (charset != "");
request.channel.contentCharset = charset;
}
}
catch(ex) {}
request.send(null);
},