Commit 9d783fab authored by darin's avatar darin

LayoutTests:

        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=9176
          REGRESSION: repro crash in WebCore::StringImpl::hash() const + 28 (StringImpl.h:67)

        * fast/loader/link-no-URL.html: Added.
        * fast/loader/link-no-URL-expected.txt: Added.

WebCore:

        Reviewed by Maciej.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9176
          REGRESSION: repro crash in WebCore::StringImpl::hash() const + 28 (StringImpl.h:67)

        Test: fast/loader/link-no-URL.html

        * loader/Cache.h:
        * loader/Cache.cpp:
        (WebCore::Cache::updateCacheStatus): Removed the URL parameter. Instead get the URL
        from the cached object itself. Callers were passing in the wrong URL. When it was a
        null string, it caused the crash mentioned above. But in other cases it may have
        caused some other minor problems as well. Added an assert to catch cases where the
        URL is null (should never happen).
        (WebCore::Cache::requestImage): Changed call site to not pass URL.
        (WebCore::Cache::requestStyleSheet): Ditto.
        (WebCore::Cache::requestScript): Ditto.
        (WebCore::Cache::requestXSLStyleSheet): Ditto.
        (WebCore::Cache::requestXBLDocument): Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@14732 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7a104b48
2006-06-04 Darin Adler <darin@apple.com>
- test for http://bugzilla.opendarwin.org/show_bug.cgi?id=9176
REGRESSION: repro crash in WebCore::StringImpl::hash() const + 28 (StringImpl.h:67)
* fast/loader/link-no-URL.html: Added.
* fast/loader/link-no-URL-expected.txt: Added.
2006-06-04 Sam Weinig <sam.weinig@gmail.com>
Reviewed by hyatt.
If it didn't crash, the browser passed the test. The bug was a problem with link elements with no URL.
<html>
<head>
<link type="text/css">
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
</script>
</head>
<body>
If it didn't crash, the browser passed the test.
The <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=9176">bug</a> was a problem with link elements with no URL.
</body>
</html>
2006-06-04 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9176
REGRESSION: repro crash in WebCore::StringImpl::hash() const + 28 (StringImpl.h:67)
Test: fast/loader/link-no-URL.html
* loader/Cache.h:
* loader/Cache.cpp:
(WebCore::Cache::updateCacheStatus): Removed the URL parameter. Instead get the URL
from the cached object itself. Callers were passing in the wrong URL. When it was a
null string, it caused the crash mentioned above. But in other cases it may have
caused some other minor problems as well. Added an assert to catch cases where the
URL is null (should never happen).
(WebCore::Cache::requestImage): Changed call site to not pass URL.
(WebCore::Cache::requestStyleSheet): Ditto.
(WebCore::Cache::requestScript): Ditto.
(WebCore::Cache::requestXSLStyleSheet): Ditto.
(WebCore::Cache::requestXBLDocument): Ditto.
2006-06-04 Darin Adler <darin@apple.com>
Reviewed by Adele.
......
......@@ -109,18 +109,19 @@ void Cache::clear()
delete docloaders; docloaders = 0;
}
void Cache::updateCacheStatus(DocLoader* dl, const String& url, CachedObject* o)
void Cache::updateCacheStatus(DocLoader* dl, CachedObject* o)
{
moveToHeadOfLRUList(o);
if (dl) {
ASSERT(!o->url().isNull());
if (cacheDisabled)
dl->m_docObjects.remove(url);
dl->m_docObjects.remove(o->url());
else
dl->m_docObjects.set(url, o);
dl->m_docObjects.set(o->url(), o);
}
}
CachedImage *Cache::requestImage(DocLoader* dl, const String& url, bool reload, time_t expireDate)
CachedImage* Cache::requestImage(DocLoader* dl, const String& url, bool reload, time_t expireDate)
{
// this brings the _url to a standard form...
KURL kurl;
......@@ -131,7 +132,7 @@ CachedImage *Cache::requestImage(DocLoader* dl, const String& url, bool reload,
return requestImage(dl, kurl, reload, expireDate);
}
CachedImage *Cache::requestImage(DocLoader* dl, const KURL& url, bool reload, time_t expireDate)
CachedImage* Cache::requestImage(DocLoader* dl, const KURL& url, bool reload, time_t expireDate)
{
KIO::CacheControl cachePolicy;
if (dl)
......@@ -173,11 +174,11 @@ CachedImage *Cache::requestImage(DocLoader* dl, const KURL& url, bool reload, ti
kdDebug(6060) << "Cache: using cached: " << kurl.url() << ", status " << o->status() << endl;
#endif
updateCacheStatus(dl, o->url(), o);
updateCacheStatus(dl, o);
return static_cast<CachedImage *>(o);
}
CachedCSSStyleSheet *Cache::requestStyleSheet(DocLoader* dl, const String& url, bool reload, time_t expireDate, const DeprecatedString& charset)
CachedCSSStyleSheet* Cache::requestStyleSheet(DocLoader* dl, const String& url, bool reload, time_t expireDate, const DeprecatedString& charset)
{
// this brings the _url to a standard form...
KURL kurl;
......@@ -223,11 +224,11 @@ CachedCSSStyleSheet *Cache::requestStyleSheet(DocLoader* dl, const String& url,
kdDebug(6060) << "Cache: using cached: " << kurl.url() << endl;
#endif
updateCacheStatus(dl, url, o);
updateCacheStatus(dl, o);
return static_cast<CachedCSSStyleSheet *>(o);
}
CachedScript *Cache::requestScript(DocLoader* dl, const String& url, bool reload, time_t expireDate, const DeprecatedString& charset)
CachedScript* Cache::requestScript(DocLoader* dl, const String& url, bool reload, time_t expireDate, const DeprecatedString& charset)
{
// this brings the _url to a standard form...
KURL kurl;
......@@ -274,7 +275,7 @@ CachedScript *Cache::requestScript(DocLoader* dl, const String& url, bool reload
kdDebug(6060) << "Cache: using cached: " << kurl.url() << endl;
#endif
updateCacheStatus(dl, url, o);
updateCacheStatus(dl, o);
return static_cast<CachedScript *>(o);
}
......@@ -325,7 +326,7 @@ CachedXSLStyleSheet* Cache::requestXSLStyleSheet(DocLoader* dl, const String& ur
kdDebug(6060) << "Cache: using cached: " << kurl.url() << endl;
#endif
updateCacheStatus(dl, url, o);
updateCacheStatus(dl, o);
return static_cast<CachedXSLStyleSheet*>(o);
}
#endif
......@@ -377,7 +378,7 @@ CachedXBLDocument* Cache::requestXBLDocument(DocLoader* dl, const String& url, b
kdDebug(6060) << "Cache: using cached: " << kurl.url() << endl;
#endif
updateCacheStatus(dl, url, o);
updateCacheStatus(dl, o);
return static_cast<CachedXBLDocument*>(o);
}
#endif
......
......@@ -153,7 +153,7 @@ namespace WebCore {
static Loader* m_loader;
static void moveToHeadOfLRUList(CachedObject*);
static void updateCacheStatus(DocLoader*, const String& url, CachedObject*);
static void updateCacheStatus(DocLoader*, CachedObject*);
static LRUList* m_LRULists;
static int m_totalSizeOfLRULists;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment