bug 272815: Make sure the parser is aware when we encounter a meta tag, so that other meta tags in the document don't override the first (correct) charset. r=bzbarsky sr=jst

This commit is contained in:
mrbkap%gmail.com 2005-02-23 05:42:37 +00:00
parent 8bf02cd23e
commit e8e89de647
3 changed files with 13 additions and 0 deletions

View File

@ -307,6 +307,9 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
}
} // if(NS_SUCCEEDED(res)
}
}
else {
res = NS_HTMLPARSER_VALID_META_CHARSET;
} // if EqualIgnoreCase
} // if !newCharset.IsEmpty()
} // if

View File

@ -86,5 +86,8 @@ public:
};
#define NS_HTMLPARSER_VALID_META_CHARSET NS_ERROR_GENERATE_SUCCESS( \
NS_ERROR_MODULE_HTMLPARSER,3000)
#endif /* nsIElementObserver_h__ */

View File

@ -1575,6 +1575,13 @@ nsObserverEntry::Notify(nsIParserNode* aNode,
if (NS_FAILED(result)) {
break;
}
if (result == NS_HTMLPARSER_VALID_META_CHARSET) {
// Inform the parser that this meta tag contained a valid
// charset. See bug 272815
aParser->SetDocumentCharset(charset, kCharsetFromMetaTag);
result = NS_OK;
}
}
}
}