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

git-svn-id: svn://10.0.0.236/trunk@169635 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mrbkap%gmail.com 2005-02-23 05:42:37 +00:00
parent 2836199f0b
commit b0eca57bf6
3 changed files with 13 additions and 0 deletions

View File

@ -307,6 +307,9 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
} }
} // if(NS_SUCCEEDED(res) } // if(NS_SUCCEEDED(res)
} }
}
else {
res = NS_HTMLPARSER_VALID_META_CHARSET;
} // if EqualIgnoreCase } // if EqualIgnoreCase
} // if !newCharset.IsEmpty() } // if !newCharset.IsEmpty()
} // if } // 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__ */ #endif /* nsIElementObserver_h__ */

View File

@ -1575,6 +1575,13 @@ nsObserverEntry::Notify(nsIParserNode* aNode,
if (NS_FAILED(result)) { if (NS_FAILED(result)) {
break; 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;
}
} }
} }
} }