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


git-svn-id: svn://10.0.0.236/trunk@218361 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
myk%mozilla.org 2007-01-14 05:38:33 +00:00
parent 359f7c2edd
commit 61392019ab

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);
},