[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 12:26:43 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit ccb69b2ba2527c7a4d0fc023c87e6711924a6009
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Aug 23 22:12:03 2010 +0000
2010-08-23 Patrick Gansterer <paroga at paroga.com>
Reviewed by Adam Roben.
Move filehandling into fileLoadTimer callback
https://bugs.webkit.org/show_bug.cgi?id=43714
Also add mimetype detection for local files.
* platform/network/ResourceHandleInternal.h:
(WebCore::ResourceHandleInternal::ResourceHandleInternal):
* platform/network/win/ResourceHandleWin.cpp:
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::fileLoadTimer):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65835 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e7f7106..7425b04 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-08-23 Patrick Gansterer <paroga at paroga.com>
+
+ Reviewed by Adam Roben.
+
+ Move filehandling into fileLoadTimer callback
+ https://bugs.webkit.org/show_bug.cgi?id=43714
+
+ Also add mimetype detection for local files.
+
+ * platform/network/ResourceHandleInternal.h:
+ (WebCore::ResourceHandleInternal::ResourceHandleInternal):
+ * platform/network/win/ResourceHandleWin.cpp:
+ (WebCore::ResourceHandle::start):
+ (WebCore::ResourceHandle::fileLoadTimer):
+
2010-08-23 Iain Merrick <husky at google.com>
Reviewed by Steve Block.
diff --git a/WebCore/platform/network/ResourceHandleInternal.h b/WebCore/platform/network/ResourceHandleInternal.h
index 7b6e960..24b00bf 100644
--- a/WebCore/platform/network/ResourceHandleInternal.h
+++ b/WebCore/platform/network/ResourceHandleInternal.h
@@ -92,7 +92,6 @@ namespace WebCore {
, m_connection(0)
#endif
#if USE(WININET)
- , m_fileHandle(INVALID_HANDLE_VALUE)
, m_fileLoadTimer(loader, &ResourceHandle::fileLoadTimer)
, m_resourceHandle(0)
, m_secondaryHandle(0)
@@ -170,7 +169,6 @@ namespace WebCore {
bool m_needsSiteSpecificQuirks;
#endif
#if USE(WININET)
- HANDLE m_fileHandle;
Timer<ResourceHandle> m_fileLoadTimer;
HINTERNET m_resourceHandle;
HINTERNET m_secondaryHandle;
diff --git a/WebCore/platform/network/win/ResourceHandleWin.cpp b/WebCore/platform/network/win/ResourceHandleWin.cpp
index 63c84a9..5cc42b1 100644
--- a/WebCore/platform/network/win/ResourceHandleWin.cpp
+++ b/WebCore/platform/network/win/ResourceHandleWin.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2010 Patrick Gansterer <paroga at paroga.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -333,20 +334,6 @@ bool ResourceHandle::start(Frame* frame)
{
ref();
if (request().url().isLocalFile()) {
- String path = request().url().path();
- // windows does not enjoy a leading slash on paths
- if (path[0] == '/')
- path = path.substring(1);
- // FIXME: This is wrong. Need to use wide version of this call.
- d->m_fileHandle = CreateFileA(path.utf8().data(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-
- // FIXME: perhaps this error should be reported asynchronously for
- // consistency.
- if (d->m_fileHandle == INVALID_HANDLE_VALUE) {
- delete this;
- return false;
- }
-
d->m_fileLoadTimer.startOneShot(0.0);
return true;
} else {
@@ -409,9 +396,29 @@ bool ResourceHandle::start(Frame* frame)
}
}
-void ResourceHandle::fileLoadTimer(Timer<ResourceHandle>* timer)
+void ResourceHandle::fileLoadTimer(Timer<ResourceHandle>*)
{
+ RefPtr<ResourceHandle> protector(this);
+ deref(); // balances ref in start
+
+ String fileName = firstRequest().url().fileSystemPath();
+ HANDLE fileHandle = CreateFileW(fileName.charactersWithNullTermination(), GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+
+ if (fileHandle == INVALID_HANDLE_VALUE) {
+ client()->didFail(this, ResourceError());
+ return;
+ }
+
ResourceResponse response;
+
+ int dotPos = fileName.reverseFind('.');
+ int slashPos = fileName.reverseFind('/');
+
+ if (slashPos < dotPos && dotPos != -1) {
+ String ext = fileName.substring(dotPos + 1);
+ response.setMimeType(MIMETypeRegistry::getMIMETypeForExtension(ext));
+ }
+
client()->didReceiveResponse(this, response);
bool result = false;
@@ -420,16 +427,13 @@ void ResourceHandle::fileLoadTimer(Timer<ResourceHandle>* timer)
do {
const int bufferSize = 8192;
char buffer[bufferSize];
- result = ReadFile(d->m_fileHandle, &buffer, bufferSize, &bytesRead, NULL);
+ result = ReadFile(fileHandle, &buffer, bufferSize, &bytesRead, 0);
if (result && bytesRead)
client()->didReceiveData(this, buffer, bytesRead, 0);
- // Check for end of file.
+ // Check for end of file.
} while (result && bytesRead);
- // FIXME: handle errors better
-
- CloseHandle(d->m_fileHandle);
- d->m_fileHandle = INVALID_HANDLE_VALUE;
+ CloseHandle(fileHandle);
client()->didFinishLoading(this);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list