Skip to content
Permalink
Browse files
2010-03-24 Jeremy Moskovich <jeremy@chromium.org>
        Reviewed by Jeremy Orlow.

        Add some diagnostics to try to track down cause of crash in ArchiveFactory::isArchiveMimeType().

        https://bugs.webkit.org/show_bug.cgi?id=36426

        No new tests as there is no new functionality.

        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::finishedLoadingDocument): Make copy of mimeType string to isolate crash.
2010-03-24  Jeremy Moskovich  <jeremy@chromium.org>

        Reviewed by Jeremy Orlow.

        Add some diagnostics to try to track down cause of crash in ArchiveFactory::isArchiveMimeType().

        https://bugs.webkit.org/show_bug.cgi?id=36426

        * src/ResourceHandle.cpp: Track state across ResourceHandle invocations.
        (WebCore::ResourceHandleInternal::ResourceHandleInternal):
        (WebCore::ResourceHandleInternal::):
        (WebCore::ResourceHandleInternal::start):
        (WebCore::ResourceHandleInternal::cancel):
        (WebCore::ResourceHandleInternal::didReceiveResponse):
        (WebCore::ResourceHandleInternal::didReceiveData):
        (WebCore::ResourceHandleInternal::didFinishLoading):
        (WebCore::ResourceHandleInternal::didFail):

Canonical link: https://commits.webkit.org/47747@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@56453 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eseidel committed Mar 24, 2010
1 parent 208b39c commit 1756ba94128761cee6bdb90cd24cf62facbf194c
Showing 4 changed files with 72 additions and 0 deletions.
@@ -1,3 +1,16 @@
2010-03-24 Jeremy Moskovich <jeremy@chromium.org>

Reviewed by Jeremy Orlow.

Add some diagnostics to try to track down cause of crash in ArchiveFactory::isArchiveMimeType().

https://bugs.webkit.org/show_bug.cgi?id=36426

No new tests as there is no new functionality.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::finishedLoadingDocument): Make copy of mimeType string to isolate crash.

2010-03-24 Anton Muhin <antonm@chromium.org>

Reviewed by Nate Chapin.
@@ -2812,7 +2812,16 @@ void FrameLoader::finishedLoadingDocument(DocumentLoader* loader)
#endif

// If loading a webarchive, run through webarchive machinery
#if PLATFORM(CHROMIUM)
// https://bugs.webkit.org/show_bug.cgi?id=36426
// FIXME: jeremy@chromium.org - for debugging purposes, should be removed
// before closing the bug.
// Make real copy of the string so we fail here if the responseMIMEType
// string is bad.
const String responseMIMEType = loader->responseMIMEType();
#else
const String& responseMIMEType = loader->responseMIMEType();
#endif

// FIXME: Mac's FrameLoaderClient::finishedLoading() method does work that is required even with Archive loads
// so we still need to call it. Other platforms should only call finishLoading for non-archive loads
@@ -1,3 +1,21 @@
2010-03-24 Jeremy Moskovich <jeremy@chromium.org>

Reviewed by Jeremy Orlow.

Add some diagnostics to try to track down cause of crash in ArchiveFactory::isArchiveMimeType().

https://bugs.webkit.org/show_bug.cgi?id=36426

* src/ResourceHandle.cpp: Track state across ResourceHandle invocations.
(WebCore::ResourceHandleInternal::ResourceHandleInternal):
(WebCore::ResourceHandleInternal::):
(WebCore::ResourceHandleInternal::start):
(WebCore::ResourceHandleInternal::cancel):
(WebCore::ResourceHandleInternal::didReceiveResponse):
(WebCore::ResourceHandleInternal::didReceiveData):
(WebCore::ResourceHandleInternal::didFinishLoading):
(WebCore::ResourceHandleInternal::didFail):

2010-03-24 Jay Campan <jcampan@google.com>

Reviewed by Darin Fisher.
@@ -57,6 +57,7 @@ class ResourceHandleInternal : public WebURLLoaderClient {
: m_request(request)
, m_owner(0)
, m_client(client)
, m_state(CONNECTION_STATE_NEW)
{
}

@@ -74,14 +75,32 @@ class ResourceHandleInternal : public WebURLLoaderClient {
virtual void didFinishLoading(WebURLLoader*);
virtual void didFail(WebURLLoader*, const WebURLError&);

enum ConnectionState {
CONNECTION_STATE_NEW,
CONNECTION_STATE_STARTED,
CONNECTION_STATE_RECEIVED_RESPONSE,
CONNECTION_STATE_RECEIVING_DATA,
CONNECTION_STATE_FINISHED_LOADING,
CONNECTION_STATE_CANCELED,
CONNECTION_STATE_FAILED,
};

ResourceRequest m_request;
ResourceHandle* m_owner;
ResourceHandleClient* m_client;
OwnPtr<WebURLLoader> m_loader;

// Used for sanity checking to make sure we don't experience illegal state
// transitions.
ConnectionState m_state;
};

void ResourceHandleInternal::start()
{
if (!(m_state == CONNECTION_STATE_NEW))
CRASH();
m_state = CONNECTION_STATE_STARTED;

m_loader.set(webKitClient()->createURLLoader());
ASSERT(m_loader.get());

@@ -92,6 +111,7 @@ void ResourceHandleInternal::start()

void ResourceHandleInternal::cancel()
{
m_state = CONNECTION_STATE_CANCELED;
m_loader->cancel();

// Do not make any further calls to the client.
@@ -128,13 +148,20 @@ void ResourceHandleInternal::didReceiveResponse(WebURLLoader*, const WebURLRespo
{
ASSERT(m_client);
ASSERT(!response.isNull());
if (!(m_state == CONNECTION_STATE_STARTED))
CRASH();
m_state = CONNECTION_STATE_RECEIVED_RESPONSE;
m_client->didReceiveResponse(m_owner, response.toResourceResponse());
}

void ResourceHandleInternal::didReceiveData(
WebURLLoader*, const char* data, int dataLength)
{
ASSERT(m_client);
if (!(m_state == CONNECTION_STATE_RECEIVED_RESPONSE
|| m_state == CONNECTION_STATE_RECEIVING_DATA))
CRASH();
m_state = CONNECTION_STATE_RECEIVING_DATA;

// FIXME(yurys): it looks like lengthReceived is always the same as
// dataLength and that the latter parameter can be eliminated.
@@ -145,12 +172,17 @@ void ResourceHandleInternal::didReceiveData(
void ResourceHandleInternal::didFinishLoading(WebURLLoader*)
{
ASSERT(m_client);
if (!(m_state == CONNECTION_STATE_RECEIVED_RESPONSE
|| m_state == CONNECTION_STATE_RECEIVING_DATA))
CRASH();
m_state = CONNECTION_STATE_FINISHED_LOADING;
m_client->didFinishLoading(m_owner);
}

void ResourceHandleInternal::didFail(WebURLLoader*, const WebURLError& error)
{
ASSERT(m_client);
m_state = CONNECTION_STATE_FAILED;
m_client->didFail(m_owner, error);
}

0 comments on commit 1756ba9

Please sign in to comment.