[webkit-changes] cvs commit: WebCore/khtml/misc loader.cpp

Eric eseidel at opensource.apple.com
Tue Jan 3 14:02:29 PST 2006


eseidel     06/01/03 14:02:29

  Modified:    .        ChangeLog
               khtml/html html_formimpl.cpp
               khtml/misc loader.cpp
  Log:
  Bug #: 6345
  Submitted by: eseidel
  Reviewed by: darin
          REGRESSION: repro crash w/ invalid charset attribute on <script>
          http://bugzilla.opendarwin.org/show_bug.cgi?id=6345
          I also made some small spacing cleanup here.
          I did *not* fix the usage in formData, as the move from KCharSet to
          QTextCodec actually fixed a bug whereby if the first listed charset
          in accept-charsets was invalid, we would assume latin1 instead of
          checking for the next valid one before assuming system encoding.
  
          * khtml/html/html_formimpl.cpp:
          (DOM::HTMLFormElementImpl::formData): cleanup
          * khtml/misc/loader.cpp:
          (CachedCSSStyleSheet::CachedCSSStyleSheet): null check
          (CachedScript::CachedScript): cleanup
          (CachedXSLStyleSheet::CachedXSLStyleSheet): null check
          (CachedXBLDocument::CachedXBLDocument): cleanup
  
  Revision  Changes    Path
  1.79      +20 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.78
  retrieving revision 1.79
  diff -u -r1.78 -r1.79
  --- ChangeLog	3 Jan 2006 12:28:22 -0000	1.78
  +++ ChangeLog	3 Jan 2006 22:02:27 -0000	1.79
  @@ -1,3 +1,23 @@
  +2006-01-03  Eric Seidel  <eseidel at apple.com>
  +
  +        Reviewed by darin.
  +
  +        REGRESSION: repro crash w/ invalid charset attribute on <script>
  +        http://bugzilla.opendarwin.org/show_bug.cgi?id=6345
  +        I also made some small spacing cleanup here.
  +        I did *not* fix the usage in formData, as the move from KCharSet to
  +        QTextCodec actually fixed a bug whereby if the first listed charset
  +        in accept-charsets was invalid, we would assume latin1 instead of
  +        checking for the next valid one before assuming system encoding.
  +
  +        * khtml/html/html_formimpl.cpp:
  +        (DOM::HTMLFormElementImpl::formData): cleanup
  +        * khtml/misc/loader.cpp:
  +        (CachedCSSStyleSheet::CachedCSSStyleSheet): null check
  +        (CachedScript::CachedScript): cleanup
  +        (CachedXSLStyleSheet::CachedXSLStyleSheet): null check
  +        (CachedXBLDocument::CachedXBLDocument): cleanup
  +
   2006-01-03  Justin Garcia  <justin.garcia at apple.com>
   
           <http://bugzilla.opendarwin.org/show_bug.cgi?id=4904>
  
  
  
  1.220     +4 -6      WebCore/khtml/html/html_formimpl.cpp
  
  Index: html_formimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_formimpl.cpp,v
  retrieving revision 1.219
  retrieving revision 1.220
  diff -u -r1.219 -r1.220
  --- html_formimpl.cpp	3 Jan 2006 08:12:27 -0000	1.219
  +++ html_formimpl.cpp	3 Jan 2006 22:02:28 -0000	1.220
  @@ -307,21 +307,19 @@
       QStringList charsets = QStringList::split(' ', str);
       QTextCodec* codec = 0;
       KHTMLPart *part = getDocument()->part();
  -    for ( QStringList::Iterator it = charsets.begin(); it != charsets.end(); ++it )
  -    {
  +    for (QStringList::Iterator it = charsets.begin(); it != charsets.end(); ++it) {
           QString enc = (*it);
  -        if(enc.contains("UNKNOWN"))
  -        {
  +        if (enc.contains("UNKNOWN")) {
               // use standard document encoding
               enc = "ISO-8859-1";
               if (part)
                   enc = part->encoding();
           }
  -        if((codec = QTextCodec::codecForName(enc.latin1())))
  +        if ((codec = QTextCodec::codecForName(enc.latin1())))
               break;
       }
   
  -    if(!codec)
  +    if (!codec)
           codec = QTextCodec::codecForLocale();
   
   
  
  
  
  1.86      +10 -10    WebCore/khtml/misc/loader.cpp
  
  Index: loader.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/misc/loader.cpp,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -r1.85 -r1.86
  --- loader.cpp	28 Dec 2005 18:46:23 -0000	1.85
  +++ loader.cpp	3 Jan 2006 22:02:29 -0000	1.86
  @@ -160,16 +160,16 @@
   // -------------------------------------------------------------------------------------------
   
   CachedCSSStyleSheet::CachedCSSStyleSheet(DocLoader* dl, const DOMString &url, KIO::CacheControl _cachePolicy, time_t _expireDate, const QString& charset)
  -    : CachedObject(url, CSSStyleSheet, _cachePolicy, _expireDate)
  +    : CachedObject(url, CSSStyleSheet, _cachePolicy, _expireDate), m_codec(0)
   {
       // It's css we want.
  -    setAccept( QString::fromLatin1("text/css") );
  +    setAccept("text/css");
       // load the file
       Cache::loader()->load(dl, this, false);
       m_loading = true;
  -    if(!charset.isEmpty())
  +    if (!charset.isEmpty())
   	m_codec = QTextCodec::codecForName(charset.latin1());
  -    else
  +    if (!m_codec)
           m_codec = QTextCodec::codecForName("iso8859-1");
   }
   
  @@ -247,19 +247,19 @@
   // -------------------------------------------------------------------------------------------
   
   CachedScript::CachedScript(DocLoader* dl, const DOMString &url, KIO::CacheControl _cachePolicy, time_t _expireDate, const QString& charset)
  -    : CachedObject(url, Script, _cachePolicy, _expireDate)
  +    : CachedObject(url, Script, _cachePolicy, _expireDate), m_codec(0)
   {
       // It's javascript we want.
       // But some websites think their scripts are <some wrong mimetype here>
       // and refuse to serve them if we only accept application/x-javascript.
  -    setAccept( QString::fromLatin1("*/*") );
  +    setAccept("*/*");
       m_errorOccurred = false;
       // load the file
       Cache::loader()->load(dl, this, false);
       m_loading = true;
  -    if(!charset.isEmpty())
  +    if (!charset.isEmpty())
           m_codec = QTextCodec::codecForName(charset.latin1());
  -    else
  +    if (!m_codec)
   	m_codec = QTextCodec::codecForName("iso8859-1");
   }
   
  @@ -629,7 +629,7 @@
   {
       // It's XML we want.
       // FIXME: This should accept more general xml formats */*+xml, image/svg+xml for example.
  -    setAccept(QString::fromLatin1("text/xml, application/xml, application/xhtml+xml, text/xsl, application/rss+xml, application/atom+xml"));
  +    setAccept("text/xml, application/xml, application/xhtml+xml, text/xsl, application/rss+xml, application/atom+xml");
       
       // load the file
       Cache::loader()->load(dl, this, false);
  @@ -695,7 +695,7 @@
   : CachedObject(url, XBL, _cachePolicy, _expireDate), m_document(0)
   {
       // It's XML we want.
  -    setAccept( QString::fromLatin1("text/xml, application/xml, application/xhtml+xml, text/xsl, application/rss+xml, application/atom+xml") );
  +    setAccept("text/xml, application/xml, application/xhtml+xml, text/xsl, application/rss+xml, application/atom+xml");
       
       // Load the file
       Cache::loader()->load(dl, this, false);
  
  
  



More information about the webkit-changes mailing list