mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
66190 External style sheet with unrecognized charset is ignored / 63502 Content-Style-Type don't ignore parameters. r=attinasi/glazman
This commit is contained in:
parent
06edf9b3e7
commit
8585a14bb1
@ -598,13 +598,13 @@ SheetLoadData::OnStreamComplete(nsIStreamLoader* aLoader,
|
||||
|
||||
if (string && stringLen>0) {
|
||||
|
||||
// First determine the charset (if one is indicated) and set the data member
|
||||
// First determine the charset (if one is indicated) and set the data member.
|
||||
// XXX use the HTTP header data too
|
||||
nsString strStyleDataUndecoded;
|
||||
nsString strHTTPHeaderData;
|
||||
strStyleDataUndecoded.AssignWithConversion(string,stringLen);
|
||||
result = mLoader->SetCharset(strHTTPHeaderData, strStyleDataUndecoded);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
(void)mLoader->SetCharset(strHTTPHeaderData, strStyleDataUndecoded); // bug 66190: ignore errors
|
||||
{
|
||||
// now get the decoder
|
||||
NS_WITH_SERVICE(nsICharsetConverterManager,ccm,kCharsetConverterManagerCID,&result);
|
||||
if (NS_SUCCEEDED(result) && ccm) {
|
||||
@ -1618,18 +1618,18 @@ nsresult CSSLoaderImpl::SetCharset(/*in*/ const nsString &aHTTPHeader,
|
||||
|
||||
if (aHTTPHeader.Length() > 0) {
|
||||
// check if it has the charset= parameter
|
||||
if (aHTTPHeader.Find("charset=",PR_TRUE) > 0) {
|
||||
// XXX use it
|
||||
|
||||
NS_ASSERTION(PR_FALSE,"Needs to be implemented!!!");
|
||||
|
||||
PRInt32 charsetOffset;
|
||||
static const char* charsetStr = "charset=";
|
||||
if ((charsetOffset = aHTTPHeader.Find(charsetStr,PR_TRUE)) > 0) {
|
||||
aHTTPHeader.Mid(str, charsetOffset + sizeof(charsetStr), -1);
|
||||
setCharset = PR_TRUE;
|
||||
}
|
||||
} else if (aStyleSheetData.Length() > 0) {
|
||||
if (aStyleSheetData.Find("@charset") > -1) {
|
||||
static const char* atCharsetStr = "@charset";
|
||||
if (aStyleSheetData.Find(atCharsetStr) > -1) {
|
||||
nsString strValue;
|
||||
// skip past the ident
|
||||
aStyleSheetData.Mid(str,8,-1);
|
||||
aStyleSheetData.Mid(str,sizeof(atCharsetStr),-1);
|
||||
// strip any whitespace
|
||||
str.StripWhitespace();
|
||||
// truncate everything past the delimiter (semicolon)
|
||||
|
@ -598,13 +598,13 @@ SheetLoadData::OnStreamComplete(nsIStreamLoader* aLoader,
|
||||
|
||||
if (string && stringLen>0) {
|
||||
|
||||
// First determine the charset (if one is indicated) and set the data member
|
||||
// First determine the charset (if one is indicated) and set the data member.
|
||||
// XXX use the HTTP header data too
|
||||
nsString strStyleDataUndecoded;
|
||||
nsString strHTTPHeaderData;
|
||||
strStyleDataUndecoded.AssignWithConversion(string,stringLen);
|
||||
result = mLoader->SetCharset(strHTTPHeaderData, strStyleDataUndecoded);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
(void)mLoader->SetCharset(strHTTPHeaderData, strStyleDataUndecoded); // bug 66190: ignore errors
|
||||
{
|
||||
// now get the decoder
|
||||
NS_WITH_SERVICE(nsICharsetConverterManager,ccm,kCharsetConverterManagerCID,&result);
|
||||
if (NS_SUCCEEDED(result) && ccm) {
|
||||
@ -1618,18 +1618,18 @@ nsresult CSSLoaderImpl::SetCharset(/*in*/ const nsString &aHTTPHeader,
|
||||
|
||||
if (aHTTPHeader.Length() > 0) {
|
||||
// check if it has the charset= parameter
|
||||
if (aHTTPHeader.Find("charset=",PR_TRUE) > 0) {
|
||||
// XXX use it
|
||||
|
||||
NS_ASSERTION(PR_FALSE,"Needs to be implemented!!!");
|
||||
|
||||
PRInt32 charsetOffset;
|
||||
static const char* charsetStr = "charset=";
|
||||
if ((charsetOffset = aHTTPHeader.Find(charsetStr,PR_TRUE)) > 0) {
|
||||
aHTTPHeader.Mid(str, charsetOffset + sizeof(charsetStr), -1);
|
||||
setCharset = PR_TRUE;
|
||||
}
|
||||
} else if (aStyleSheetData.Length() > 0) {
|
||||
if (aStyleSheetData.Find("@charset") > -1) {
|
||||
static const char* atCharsetStr = "@charset";
|
||||
if (aStyleSheetData.Find(atCharsetStr) > -1) {
|
||||
nsString strValue;
|
||||
// skip past the ident
|
||||
aStyleSheetData.Mid(str,8,-1);
|
||||
aStyleSheetData.Mid(str,sizeof(atCharsetStr),-1);
|
||||
// strip any whitespace
|
||||
str.StripWhitespace();
|
||||
// truncate everything past the delimiter (semicolon)
|
||||
|
Loading…
Reference in New Issue
Block a user