Skip to content
Permalink
Browse files
2010-04-13 Jeremy Moskovich <jeremy@chromium.org>
        Reviewed by David Levin.

        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-04-13  Jeremy Moskovich  <jeremy@chromium.org>

        Reviewed by David Levin.

        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/48808@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@57520 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eseidel committed Apr 13, 2010
1 parent b9dfc47 commit 8a54b89349540871bc3ca83e96eec9143006232e
Showing 4 changed files with 72 additions and 0 deletions.
@@ -1,3 +1,16 @@
2010-04-13 Jeremy Moskovich <jeremy@chromium.org>

Reviewed by David Levin.

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-04-13 Abhishek Arya <inferno@chromium.org>

Reviewed by Adam Barth.
@@ -2870,7 +2870,15 @@ 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: 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-04-13 Jeremy Moskovich <jeremy@chromium.org>

Reviewed by David Levin.

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-04-13 Mikhail Naganov <mnaganov@chromium.org>

Unreviewed Chromium build fix: pin to a newer V8 revision (4386).
@@ -57,6 +57,7 @@ class ResourceHandleInternal : public WebURLLoaderClient {
: m_request(request)
, m_owner(0)
, m_client(client)
, m_state(ConnectionStateNew)
{
}

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

enum ConnectionState {
ConnectionStateNew,
ConnectionStateStarted,
ConnectionStateReceivedResponse,
ConnectionStateReceivingData,
ConnectionStateFinishedLoading,
ConnectionStateCanceled,
ConnectionStateFailed,
};

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 != ConnectionStateNew)
CRASH();
m_state = ConnectionStateStarted;

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

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

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

// Do not make any further calls to the client.
@@ -128,13 +148,22 @@ void ResourceHandleInternal::didReceiveResponse(WebURLLoader*, const WebURLRespo
{
ASSERT(m_client);
ASSERT(!response.isNull());
bool isMultipart = response.isMultipartPayload();
bool isValidStateTransition = (m_state == ConnectionStateStarted || m_state == ConnectionStateReceivedResponse);
// In the case of multipart loads, calls to didReceiveData & didReceiveResponse can be interleaved.
if (!isMultipart && !isValidStateTransition)
CRASH();
m_state = ConnectionStateReceivedResponse;
m_client->didReceiveResponse(m_owner, response.toResourceResponse());
}

void ResourceHandleInternal::didReceiveData(
WebURLLoader*, const char* data, int dataLength)
{
ASSERT(m_client);
if (m_state != ConnectionStateReceivedResponse && m_state != ConnectionStateReceivingData)
CRASH();
m_state = ConnectionStateReceivingData;

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

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

0 comments on commit 8a54b89

Please sign in to comment.