Bug 582712 - Remove nsHTMLDocument::TryBookmarkCharset; r=bz a=bsmedberg

This commit is contained in:
Ms2ger 2010-11-05 11:57:10 +01:00
parent 994a73d975
commit f4cdfb893f
3 changed files with 10 additions and 61 deletions

View File

@ -467,48 +467,6 @@ nsHTMLDocument::TryCacheCharset(nsICachingChannel* aCachingChannel,
return PR_FALSE;
}
PRBool
nsHTMLDocument::TryBookmarkCharset(nsIDocShell* aDocShell,
nsIChannel* aChannel,
PRInt32& aCharsetSource,
nsACString& aCharset)
{
if (kCharsetFromBookmarks <= aCharsetSource) {
return PR_TRUE;
}
if (!aChannel) {
return PR_FALSE;
}
nsCOMPtr<nsICharsetResolver> bookmarksResolver =
do_GetService("@mozilla.org/embeddor.implemented/bookmark-charset-resolver;1");
if (!bookmarksResolver) {
return PR_FALSE;
}
PRBool wantCharset; // ignored for now
nsCAutoString charset;
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(aDocShell));
nsCOMPtr<nsISupports> closure;
nsresult rv = bookmarksResolver->RequestCharset(webNav,
aChannel,
&wantCharset,
getter_AddRefs(closure),
charset);
// FIXME: Bug 337970
NS_ASSERTION(!wantCharset, "resolved charset notification not implemented!");
if (NS_SUCCEEDED(rv) && !charset.IsEmpty()) {
aCharset = charset;
aCharsetSource = kCharsetFromBookmarks;
return PR_TRUE;
}
return PR_FALSE;
}
static PRBool
CheckSameOrigin(nsINode* aNode1, nsINode* aNode2)
{
@ -880,10 +838,6 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
// Use the channel's charset (e.g., charset from HTTP
// "Content-Type" header).
}
else if (!scheme.EqualsLiteral("about") && // don't try to access bookmarks for about:blank
TryBookmarkCharset(docShell, aChannel, charsetSource, charset)) {
// Use the bookmark's charset.
}
else if (cachingChan && !urlSpec.IsEmpty() &&
TryCacheCharset(cachingChan, charsetSource, charset)) {
// Use the cache's charset.

View File

@ -309,10 +309,6 @@ protected:
static PRBool TryCacheCharset(nsICachingChannel* aCachingChannel,
PRInt32& aCharsetSource,
nsACString& aCharset);
static PRBool TryBookmarkCharset(nsIDocShell* aDocShell,
nsIChannel* aChannel,
PRInt32& aCharsetSource,
nsACString& aCharset);
// aParentDocument could be null.
PRBool TryParentCharset(nsIDocumentCharsetInfo* aDocInfo,
nsIDocument* aParentDocument,

View File

@ -94,18 +94,17 @@ enum eParserDocType {
#define kCharsetFromDocTypeDefault 3
#define kCharsetFromCache 4
#define kCharsetFromParentFrame 5
#define kCharsetFromBookmarks 6
#define kCharsetFromAutoDetection 7
#define kCharsetFromHintPrevDoc 8
#define kCharsetFromMetaPrescan 9 // this one and smaller: HTML5 Tentative
#define kCharsetFromMetaTag 10 // this one and greater: HTML5 Confident
#define kCharsetFromByteOrderMark 11
#define kCharsetFromChannel 12
#define kCharsetFromOtherComponent 13
#define kCharsetFromAutoDetection 6
#define kCharsetFromHintPrevDoc 7
#define kCharsetFromMetaPrescan 8 // this one and smaller: HTML5 Tentative
#define kCharsetFromMetaTag 9 // this one and greater: HTML5 Confident
#define kCharsetFromByteOrderMark 10
#define kCharsetFromChannel 11
#define kCharsetFromOtherComponent 12
// Levels below here will be forced onto childframes too
#define kCharsetFromParentForced 14
#define kCharsetFromUserForced 15
#define kCharsetFromPreviousLoading 16
#define kCharsetFromParentForced 13
#define kCharsetFromUserForced 14
#define kCharsetFromPreviousLoading 15
enum eStreamState {eNone,eOnStart,eOnDataAvail,eOnStop};