[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
cblu
cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:38:57 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 75b609c6ebf5c0db8e4fd80fd85796dbbbfca61f
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Apr 26 01:24:11 2003 +0000
WebFoundation:
Renamed WebDownload to NSURLDownload and moved it to WebFoundation.
Reviewed by rjw.
* Downloads.subproj/NSBinHexDecoder.h: Added.
* Downloads.subproj/NSBinHexDecoder.m: Added.
(-[NSBinHexDecoder decodeIntoBuffer:size:]):
(-[NSBinHexDecoder pumpCRCTwice]):
(-[NSBinHexDecoder decodeAllIntoBuffer:size:]):
(-[NSBinHexDecoder decodeHeader]):
(-[NSBinHexDecoder setUpSourceForData:]):
(-[NSBinHexDecoder decodeForkWithData:count:CRCCheckFlag:]):
(+[NSBinHexDecoder canDecodeHeaderData:]):
(-[NSBinHexDecoder decodeData:dataForkData:resourceForkData:]):
(-[NSBinHexDecoder finishDecoding]):
(-[NSBinHexDecoder fileAttributes]):
(-[NSBinHexDecoder filename]):
* Downloads.subproj/NSGZipDecoder.h: Added.
* Downloads.subproj/NSGZipDecoder.m: Added.
(+[NSGZipDecoder decodeHeader:headerLength:modificationTime:filename:]):
(+[NSGZipDecoder canDecodeHeaderData:]):
(-[NSGZipDecoder init]):
(-[NSGZipDecoder dealloc]):
(-[NSGZipDecoder decodeData:dataForkData:resourceForkData:]):
(-[NSGZipDecoder finishDecoding]):
(-[NSGZipDecoder fileAttributes]):
(-[NSGZipDecoder filename]):
* Downloads.subproj/NSMacBinaryDecoder.h: Added.
* Downloads.subproj/NSMacBinaryDecoder.m: Added.
(+[NSMacBinaryDecoder canDecodeHeaderData:]):
(-[NSMacBinaryDecoder decodeData:dataForkData:resourceForkData:]):
(-[NSMacBinaryDecoder finishDecoding]):
(-[NSMacBinaryDecoder fileAttributes]):
(-[NSMacBinaryDecoder filename]):
(CRC16):
* Downloads.subproj/NSURLDownload.h: Added.
* Downloads.subproj/NSURLDownload.m: Added.
(+[NSURLDownloadPrivate initialize]):
(-[NSURLDownloadPrivate dealloc]):
(-[NSURLDownload initWithRequest:]):
(-[NSURLDownload _initWithLoadingResource:request:response:delegate:proxy:]):
(+[NSURLDownload _downloadWithLoadingResource:request:response:delegate:proxy:]):
(-[NSURLDownload dealloc]):
(-[NSURLDownload loadWithDelegate:]):
(-[NSURLDownload cancel]):
(-[NSURLDownload path]):
(-[NSURLDownload setPath:]):
(-[NSURLDownload _downloadStarted]):
(-[NSURLDownload _downloadEnded]):
(-[NSURLDownload _setRequest:]):
(-[NSURLDownload _setResponse:]):
(-[NSURLDownload connection:willSendRequest:redirectResponse:]):
(-[NSURLDownload connection:didReceiveResponse:]):
(-[NSURLDownload connection:didReceiveData:]):
(-[NSURLDownload connectionDidFinishLoading:]):
(-[NSURLDownload connection:didFailLoadingWithError:]):
(-[NSURLDownload _pathWithUniqueFilenameForPath:]):
(-[NSURLDownload _createFSRefForPath:]):
(-[NSURLDownload _createFileIfNecessary]):
(-[NSURLDownload _decodeHeaderData:dataForkData:resourceForkData:]):
(-[NSURLDownload _decodeData:dataForkData:resourceForkData:]):
(-[NSURLDownload _decodeData:]):
(-[NSURLDownload _dataIfDoneBufferingData:]):
(-[NSURLDownload _finishDecoding]):
(-[NSURLDownload _writeForkData:isDataFork:]):
(-[NSURLDownload _writeDataForkData:resourceForkData:]):
(-[NSURLDownload _isFileClosed]):
(-[NSURLDownload _didCloseFile:]):
(-[NSURLDownload _closeForkAsync:]):
(-[NSURLDownload _closeForkSync:]):
(-[NSURLDownload _closeFileAsync]):
(-[NSURLDownload _closeFileSync]):
(-[NSURLDownload _didDeleteFile]):
(-[NSURLDownload _deleteFileAsnyc]):
(-[NSURLDownload _closeAndDeleteFileAsync]):
(-[NSURLDownload _cancelWithError:]):
(-[NSURLDownload _cancelWithErrorCode:]):
(-[NSURLDownload _setPath:]):
(-[NSURLDownload _setDirectoryPath:]):
(-[NSURLDownload _currentPath]):
(-[NSURLDownload _errorWithCode:]):
(-[NSURLDownload _dataForkReferenceNumber]):
(-[NSURLDownload _setDataForkReferenceNumber:]):
(-[NSURLDownload _resourceForkReferenceNumber]):
(-[NSURLDownload _setResourceForkReferenceNumber:]):
(-[NSURLDownload _areWritesCancelled]):
(-[NSURLDownload _setWritesCancelled:]):
(-[NSURLDownload _encounteredCloseError]):
(-[NSURLDownload _setEncounteredCloseError:]):
(-[NSURLConnectionDelegateProxy setDelegate:]):
(-[NSURLConnectionDelegateProxy connection:willSendRequest:redirectResponse:]):
(-[NSURLConnectionDelegateProxy connection:didReceiveResponse:]):
(-[NSURLConnectionDelegateProxy connection:didReceiveData:]):
(-[NSURLConnectionDelegateProxy connectionDidFinishLoading:]):
(-[NSURLConnectionDelegateProxy connection:didFailLoadingWithError:]):
(WriteCompletionCallback):
(CloseCompletionCallback):
(DeleteCompletionCallback):
* Downloads.subproj/NSURLDownloadDecoder.h: Added.
* Downloads.subproj/NSURLDownloadPrivate.h: Added.
* English.lproj/Localizable.strings:
* English.lproj/StringsNotToBeLocalized.txt:
* Misc.subproj/WebFoundation.h:
* Misc.subproj/WebNSErrorConstants.h:
* Misc.subproj/WebNSErrorExtras.m:
(WebNSErrorExtrasInit):
* Misc.subproj/WebNSFileManagerExtras.h:
* Misc.subproj/WebNSFileManagerExtras.m:
(-[NSFileManager _web_noteFileChangedAtPath:]):
* WebFoundation-base.exp:
* WebFoundation.pbproj/project.pbxproj:
WebKit:
Renamed WebDownload to NSURLDownload and moved it to WebFoundation.
Reviewed by rjw.
* Downloads.subproj/WebBinHexDecoder.h: Removed.
* Downloads.subproj/WebBinHexDecoder.m: Removed.
* Downloads.subproj/WebDownload.h: Removed.
* Downloads.subproj/WebDownload.m: Removed.
* Downloads.subproj/WebDownloadDecoder.h: Removed.
* Downloads.subproj/WebDownloadPrivate.h: Removed.
* Downloads.subproj/WebGZipDecoder.h: Removed.
* Downloads.subproj/WebGZipDecoder.m: Removed.
* Downloads.subproj/WebMacBinaryDecoder.h: Removed.
* Downloads.subproj/WebMacBinaryDecoder.m: Removed.
* Downloads.subproj/crc16.h: Removed.
* Downloads.subproj/crc16.m: Removed.
* English.lproj/Localizable.strings:
* English.lproj/StringsNotToBeLocalized.txt:
* Misc.subproj/WebKit.h:
* Misc.subproj/WebKitErrors.h:
* Misc.subproj/WebKitErrors.m:
(-[NSError _initWithPluginErrorCode:contentURLString:pluginPageURLString:pluginName:MIMEType:]):
(registerErrors):
* Misc.subproj/WebNSWorkspaceExtras.h: Removed.
* Misc.subproj/WebNSWorkspaceExtras.m: Removed.
* WebKit.exp:
* WebKit.pbproj/project.pbxproj:
* WebView.subproj/WebDataSource.m:
* WebView.subproj/WebDataSourcePrivate.m:
* WebView.subproj/WebMainResourceClient.h:
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient initWithDataSource:]):
(-[WebMainResourceClient continueAfterContentPolicy:response:]):
* WebView.subproj/WebView.h:
* WebView.subproj/WebViewPrivate.m:
(-[WebView _downloadURL:toDirectory:]):
WebBrowser:
Renamed WebDownload to NSURLDownload and moved it to WebFoundation.
Reviewed by rjw.
* DownloadMonitor.h:
* DownloadMonitor.m:
(-[DownloadMonitor download:didStartFromRequest:]):
(-[DownloadMonitor download:didReceiveResponse:]):
(-[DownloadMonitor download:decidePathWithListener:suggestedFilename:]):
(-[DownloadMonitor download:didReceiveDataOfLength:]):
(-[DownloadMonitor downloadShouldDecodeEncodedFile:]):
(-[DownloadMonitor download:didCreateFileAtPath:]):
(-[DownloadMonitor downloadDidFinishDownloading:]):
(-[DownloadMonitor download:didFailDownloadingWithError:]):
(-[DownloadMonitor cancelDownload:withError:]):
(-[DownloadMonitor setEntry:forReloadingDownload:]):
* DownloadProgressEntry.h:
* DownloadProgressEntry.m:
(-[DownloadProgressEntry _setDownload:]):
(-[DownloadProgressEntry reload]):
* WebBookmarkImporter.m:
(-[WebBookmarkImporter initWithPath:]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4195 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 16a24e4..bdd3f0d 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,42 @@
+2003-04-25 Chris Blumenberg <cblu at apple.com>
+
+ Renamed WebDownload to NSURLDownload and moved it to WebFoundation.
+
+ Reviewed by rjw.
+
+ * Downloads.subproj/WebBinHexDecoder.h: Removed.
+ * Downloads.subproj/WebBinHexDecoder.m: Removed.
+ * Downloads.subproj/WebDownload.h: Removed.
+ * Downloads.subproj/WebDownload.m: Removed.
+ * Downloads.subproj/WebDownloadDecoder.h: Removed.
+ * Downloads.subproj/WebDownloadPrivate.h: Removed.
+ * Downloads.subproj/WebGZipDecoder.h: Removed.
+ * Downloads.subproj/WebGZipDecoder.m: Removed.
+ * Downloads.subproj/WebMacBinaryDecoder.h: Removed.
+ * Downloads.subproj/WebMacBinaryDecoder.m: Removed.
+ * Downloads.subproj/crc16.h: Removed.
+ * Downloads.subproj/crc16.m: Removed.
+ * English.lproj/Localizable.strings:
+ * English.lproj/StringsNotToBeLocalized.txt:
+ * Misc.subproj/WebKit.h:
+ * Misc.subproj/WebKitErrors.h:
+ * Misc.subproj/WebKitErrors.m:
+ (-[NSError _initWithPluginErrorCode:contentURLString:pluginPageURLString:pluginName:MIMEType:]):
+ (registerErrors):
+ * Misc.subproj/WebNSWorkspaceExtras.h: Removed.
+ * Misc.subproj/WebNSWorkspaceExtras.m: Removed.
+ * WebKit.exp:
+ * WebKit.pbproj/project.pbxproj:
+ * WebView.subproj/WebDataSource.m:
+ * WebView.subproj/WebDataSourcePrivate.m:
+ * WebView.subproj/WebMainResourceClient.h:
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient initWithDataSource:]):
+ (-[WebMainResourceClient continueAfterContentPolicy:response:]):
+ * WebView.subproj/WebView.h:
+ * WebView.subproj/WebViewPrivate.m:
+ (-[WebView _downloadURL:toDirectory:]):
+
2003-04-25 Richard Williamson <rjw at apple.com>
Final API review changes.
diff --git a/WebKit/Downloads.subproj/WebBinHexDecoder.h b/WebKit/Downloads.subproj/WebBinHexDecoder.h
deleted file mode 100644
index 86933c2..0000000
--- a/WebKit/Downloads.subproj/WebBinHexDecoder.h
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// WebBinHexDecoder.h
-// WebKit
-//
-// Created by Darin Adler on Wed Nov 06 2002.
-// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
- at protocol WebDownloadDecoder;
-
- at interface WebBinHexDecoder : NSObject <WebDownloadDecoder>
-{
- BOOL _sawError;
-
- BOOL _atEnd;
-
- unsigned char _sixBitBuffer[4];
- int _sixBitBufferLength;
-
- unsigned char _byteBuffer[3];
- int _byteBufferLength;
- int _byteBufferOffset;
-
- unsigned char _repeatCharacter;
- int _repeatCount;
-
- BOOL _sawRepeatCharacter;
-
- int _CRC;
-
- const unsigned char *_source;
- const unsigned char *_sourceEnd;
-
- unsigned char _name[64];
- OSType _fileType;
- OSType _fileCreator;
- uint32_t _finderFlags;
- int _dataForkLengthRemaining;
- int _resourceForkLengthRemaining;
-
- int _computedCRC;
- BOOL _haveComputedCRC;
-
- unsigned char _fileCRC[2];
- int _fileCRCLength;
-
- BOOL _dataForkCRCChecked;
- BOOL _resourceForkCRCChecked;
-}
- at end
diff --git a/WebKit/Downloads.subproj/WebBinHexDecoder.m b/WebKit/Downloads.subproj/WebBinHexDecoder.m
deleted file mode 100644
index 410eeba..0000000
--- a/WebKit/Downloads.subproj/WebBinHexDecoder.m
+++ /dev/null
@@ -1,374 +0,0 @@
-//
-// WebBinHexDecoder.m
-// WebKit
-//
-// Created by Darin Adler on Wed Nov 06 2002.
-// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
-//
-
-// This decoder decodes a particular variant of the BinHex format.
-// Specifically, it's the 7-bit format known as Hqx7.
-
-#import "WebBinHexDecoder.h"
-
-#import <WebFoundation/WebAssertions.h>
-#import <WebFoundation/WebNSFileManagerExtras.h>
-
-#define SKIP_CHARACTER 0x40
-#define END_CHARACTER 0x41
-#define BAD_CHARACTER 0x42
-
-static const unsigned char sixBitTable[256] = {
- 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x40, 0x42, 0x42, 0x40, 0x42, 0x42,
- 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
- 0x42, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x42, 0x42,
- 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x42, 0x14, 0x15, 0x41, 0x42, 0x42, 0x42, 0x42, 0x42,
- 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x42,
- 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x42, 0x2C, 0x2D, 0x2E, 0x2F, 0x42, 0x42, 0x42, 0x42,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x42, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x42, 0x42,
- 0x3D, 0x3E, 0x3F, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
- 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
- 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
- 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
- 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
- 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
- 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
- 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
- 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42
-};
-
-#define RUN_LENGTH_CODE 0x90
-
-#define BEFORE_HEADER_LINE "(This file must be converted with BinHex 4.0)"
-
-typedef struct {
- unsigned char name[64];
- unsigned char remainder[19];
-} Header;
-
- at implementation WebBinHexDecoder
-
-- (int)decodeIntoBuffer:(void *)buffer size:(int)bufferSize
-{
- ASSERT(buffer);
- ASSERT(bufferSize);
-
- if (_sawError || _atEnd) {
- return 0;
- }
-
- unsigned char *bufferStart = buffer;
- unsigned char *bufferP = bufferStart;
- unsigned char *bufferEnd = bufferStart + bufferSize;
-
- int sixBitBufferLength = _sixBitBufferLength;
- int byteBufferLength = _byteBufferLength;
- int byteBufferOffset = _byteBufferOffset;
- unsigned char repeatCharacter = _repeatCharacter;
- int repeatCount = _repeatCount;
- BOOL sawRepeatCharacter = _sawRepeatCharacter;
- int CRC = _CRC;
- const unsigned char *source = _source;
- const unsigned char *sourceEnd = _sourceEnd;
-
- for (;;) {
- for (;;) {
- // Empty the repeat count.
- while (repeatCount) {
- unsigned int c = repeatCharacter;
- *bufferP++ = c;
-
- int i;
- for (i = 0; i < 8; i++) {
- c <<= 1;
- if ((CRC <<= 1) & 0x10000) {
- CRC = (CRC & 0xFFFF) ^ 0x1021;
- }
- CRC ^= (c >> 8);
- c &= 0xFF;
- }
-
- repeatCount -= 1;
- if (bufferP == bufferEnd) {
- goto done;
- }
- }
-
- // Empty the byte buffer.
- if (byteBufferOffset == byteBufferLength) {
- break;
- }
- unsigned char byte = _byteBuffer[byteBufferOffset++];
- if (sawRepeatCharacter) {
- if (byte == 0) {
- repeatCount = 1;
- repeatCharacter = RUN_LENGTH_CODE;
- } else {
- repeatCount = byte - 1;
- }
- sawRepeatCharacter = NO;
- } else {
- if (byte == RUN_LENGTH_CODE) {
- sawRepeatCharacter = YES;
- } else {
- repeatCount = 1;
- repeatCharacter = byte;
- }
- }
- }
-
- // Extract six-bit characters, then bytes.
- for (;;) {
- if (source == sourceEnd) {
- goto done;
- }
-
- char sixBits = sixBitTable[*source++];
- switch (sixBits) {
- case SKIP_CHARACTER:
- continue;
- case END_CHARACTER:
- _atEnd = YES;
- break;
- case BAD_CHARACTER:
- _sawError = YES;
- return 0;
- default:
- _sixBitBuffer[sixBitBufferLength++] = sixBits;
- }
-
- // Fill the byte buffer.
- if (sixBitBufferLength == 4 || _atEnd) {
- ASSERT(byteBufferOffset == byteBufferLength);
- _byteBuffer[0] = (_sixBitBuffer[0] << 2 | _sixBitBuffer[1] >> 4);
- _byteBuffer[1] = (_sixBitBuffer[1] << 4 | _sixBitBuffer[2] >> 2);
- _byteBuffer[2] = (_sixBitBuffer[2] << 6 | _sixBitBuffer[3]);
- byteBufferOffset = 0;
- byteBufferLength = (sixBitBufferLength * 6) / 8;
- sixBitBufferLength = 0;
- break;
- }
- }
- }
-
-done:
- _sixBitBufferLength = sixBitBufferLength;
- _byteBufferLength = byteBufferLength;
- _byteBufferOffset = byteBufferOffset;
- _repeatCharacter = repeatCharacter;
- _repeatCount = repeatCount;
- _sawRepeatCharacter = sawRepeatCharacter;
- _CRC = CRC;
-
- _source = source;
-
- return bufferP - bufferStart;
-}
-
-- (void)pumpCRCTwice
-{
- int i;
- for (i = 0; i < 16; i++) {
- if ((_CRC <<= 1) & 0x10000) {
- _CRC = (_CRC & 0xFFFF) ^ 0x1021;
- }
- }
-}
-
-- (void)decodeAllIntoBuffer:(void *)buffer size:(int)size
-{
- int decodedByteCount = [self decodeIntoBuffer:buffer size:size];
- if (decodedByteCount != size) {
- _sawError = YES;
- }
-}
-
-- (void)decodeHeader
-{
- ASSERT(_CRC == 0);
-
- // Find the header line.
- int beforeHeaderLineLength = strlen(BEFORE_HEADER_LINE);
- for (;;) {
- _source = memchr(_source, '(', _sourceEnd - _source);
- if (!_source) {
- _sawError = YES;
- return;
- }
- if (_sourceEnd - _source < beforeHeaderLineLength) {
- _sawError = YES;
- return;
- }
- if (memcmp(_source, BEFORE_HEADER_LINE, beforeHeaderLineLength) == 0) {
- _source += beforeHeaderLineLength;
- break;
- }
- _source += 1;
- }
-
- // Find the colon after it.
- for (;;) {
- if (_source == _sourceEnd) {
- _sawError = YES;
- return;
- }
- unsigned char c = *_source++;
- if (c == ':') {
- break;
- }
- if (c != '\n' && c != '\r') {
- _sawError = YES;
- return;
- }
- }
-
- // Decode.
- Header header;
- [self decodeAllIntoBuffer:&header.name[0] size:1];
- if (header.name[0] == 0 || header.name[0] >= sizeof(header.name)) {
- _sawError = YES;
- return;
- }
- [self decodeAllIntoBuffer:&header.name[1] size:header.name[0]];
- [self decodeAllIntoBuffer:&header.remainder size:sizeof(header.remainder)];
- if (header.remainder[0] != 0) { // version
- _sawError = YES;
- return;
- }
-
- // Compute the CRC.
- [self pumpCRCTwice];
- int computedCRC = _CRC & 0xFFFF;
-
- // Read the CRC from the file.
- unsigned char CRC[2];
- [self decodeAllIntoBuffer:CRC size:2];
- if (computedCRC != ((CRC[0] << 8) | CRC[1])) {
- _sawError = YES;
- return;
- }
-
- // Extract the header fields we care about.
- memcpy(_name, header.name, header.name[0] + 1);
- _fileType = (((((header.remainder[1] << 8) | header.remainder[2]) << 8) | header.remainder[3]) << 8) | header.remainder[4];
- _fileCreator = (((((header.remainder[5] << 8) | header.remainder[6]) << 8) | header.remainder[7]) << 8) | header.remainder[8];
- _finderFlags = (header.remainder[9] << 8) | header.remainder[10];
- _dataForkLengthRemaining = (((((header.remainder[11] << 8) | header.remainder[12]) << 8) | header.remainder[13]) << 8) | header.remainder[14];
- _resourceForkLengthRemaining = (((((header.remainder[15] << 8) | header.remainder[16]) << 8) | header.remainder[17]) << 8) | header.remainder[18];
-
- // Mask off to the only fields in BinHex that we want to respect.
- _finderFlags &= kColor | kIsShared | kHasCustomIcon | kIsStationery | kHasBundle | kIsAlias;
-
- // Reset the CRC so it's ready to compute a fork CRC.
- _CRC = 0;
-}
-
-- (void)setUpSourceForData:(NSData *)data
-{
- _source = [data bytes];
- _sourceEnd = _source + [data length];
-}
-
-- (void)decodeForkWithData:(NSData **)data count:(int *)count CRCCheckFlag:(BOOL *)CRCCheckFlag
-{
- *data = nil;
-
- while (*count) {
- char buffer[8192];
- int maxBytes = MIN(*count, (int)sizeof(buffer));
- int numBytesDecoded = [self decodeIntoBuffer:buffer size:maxBytes];
- if (numBytesDecoded == 0) {
- return;
- }
- ASSERT(!_sawError);
- if (*data == nil) {
- *data = [NSMutableData dataWithBytes:buffer length:numBytesDecoded];
- } else {
- [(NSMutableData *)*data appendBytes:buffer length:numBytesDecoded];
- }
- *count -= numBytesDecoded;
- }
-
- if (!*CRCCheckFlag) {
- // Done reading the fork, now compute the CRC.
- if (!_haveComputedCRC) {
- [self pumpCRCTwice];
- _computedCRC = _CRC & 0xFFFF;
- _haveComputedCRC = YES;
- }
-
- // Done reading the fork, now read the CRC.
- if (_fileCRCLength != 2) {
- int numBytesDecoded = [self decodeIntoBuffer:&_fileCRC[_fileCRCLength] size:(2 - _fileCRCLength)];
- _fileCRCLength += numBytesDecoded;
-
- if (_fileCRCLength == 2) {
- // Check the CRC.
- if (_computedCRC != ((_fileCRC[0] << 8) | _fileCRC[1])) {
- _sawError = YES;
- }
-
- // Set the flag so we know we already checked.
- *CRCCheckFlag = YES;
-
- // Reset the CRC variables so the next fork can use them.
- _CRC = 0;
- _haveComputedCRC = NO;
- _fileCRCLength = 0;
- }
- }
- }
-}
-
-+ (BOOL)canDecodeHeaderData:(NSData *)data
-{
- WebBinHexDecoder *decoder = [[self alloc] init];
- [decoder setUpSourceForData:data];
- [decoder decodeHeader];
- BOOL sawError = decoder->_sawError;
- [decoder release];
- return !sawError;
-}
-
-- (BOOL)decodeData:(NSData *)data dataForkData:(NSData **)dataForkData resourceForkData:(NSData **)resourceForkData
-{
- *dataForkData = nil;
- *resourceForkData = nil;
-
- [self setUpSourceForData:data];
-
- if (_name[0] == 0) {
- [self decodeHeader];
- }
- ASSERT(_sawError || _name[0]);
-
- [self decodeForkWithData:dataForkData count:&_dataForkLengthRemaining CRCCheckFlag:&_dataForkCRCChecked];
- if (_dataForkCRCChecked) {
- [self decodeForkWithData:resourceForkData count:&_resourceForkLengthRemaining CRCCheckFlag:&_resourceForkCRCChecked];
- }
-
- return !_sawError;
-}
-
-- (BOOL)finishDecoding
-{
- ASSERT(!_sawError);
- return _resourceForkCRCChecked;
-}
-
-- (NSDictionary *)fileAttributes
-{
- // FIXME: What about other parts of Finder info? Bundle bit, for example.
- return [NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithUnsignedLong:_fileType], NSFileHFSTypeCode,
- [NSNumber numberWithUnsignedLong:_fileCreator], NSFileHFSCreatorCode,
- [NSNumber numberWithUnsignedShort:_finderFlags], WebFinderFlags,
- nil];
-}
-
-- (NSString *)filename
-{
- return [(NSString *)CFStringCreateWithPascalString(NULL, _name, kCFStringEncodingMacRoman) autorelease];
-}
-
- at end
diff --git a/WebKit/Downloads.subproj/WebDownload.h b/WebKit/Downloads.subproj/WebDownload.h
deleted file mode 100644
index c1d6da6..0000000
--- a/WebKit/Downloads.subproj/WebDownload.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- WebDownload.h
- Copyright 2003, Apple, Inc. All rights reserved.
-
- Public header file.
-*/
-
-#import <Foundation/Foundation.h>
-
- at class NSError;
- at class WebDownloadPrivate;
- at class NSURLRequest;
- at class NSURLResponse;
-
- at protocol WebDownloadDecisionListener;
-
-/*!
- @class WebDownload
- @discussion A WebDownload loads a request and saves the resource to a file. The progress of the download
- is reported via the WebDownloadDelegate protocol. Note: The word "download" is used to refer to the process
- of loading data off a network, decoding the data if necessary and saving the data to a file.
-*/
- at interface WebDownload : NSObject
-{
- @private
- WebDownloadPrivate *_private;
-}
-
-/*!
- @method initWithRequest:
- @abstract Initializes a WebDownload object.
- @param request The request to download. Must not be nil.
-*/
-- initWithRequest:(NSURLRequest *)request;
-
-/*!
- @method loadWithDelegate:
- @abstract Starts the download.
- @param delegate The delegate of the download. Must not be nil.
-*/
-- (void)loadWithDelegate:(id)delegate;
-
-/*!
- @method cancel
- @abstract Cancels the download and deletes the downloaded file.
-*/
-- (void)cancel;
-
- at end
-
-/*!
- @protocol WebDownloadDelegate
- @discussion The WebDownloadDelegate delegate is primarily used to report the progress of the download.
-*/
- at interface NSObject (WebDownloadDelegate)
-
-/*!
- @method download:didStartFromRequest:
- @abstract This method is called immediately after the download has started.
- @param download The download that just started downloading.
- @param request The request that the download started from.
- */
-- (void)download:(WebDownload *)download didStartFromRequest:(NSURLRequest *)request;
-
-/*!
- @method download:willSendRequest:redirectResponse:
- @abstract This method is called whenever the download is about to load a request or if the download
- must load another request because the previous request was redirected.
- @discussion This method is called with a copy of the request that was passed with
- initWithRequest:. This method gives the delegate an opportunity to inspect the request
- that will be used to continue loading the request, and modify it if necessary.
- @param download The download that will send the request.
- @param request The request that will be used to continue loading.
- @result The request to be used; either the request parameter or a replacement. If nil is returned,
- the download is cancelled.
-*/
-- (NSURLRequest *)download:(WebDownload *)download willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse;
-
-/*!
- @method download:didReceiveResponse:
- @abstract This method is called when the download has received a response from the server.
- @param download The download that now has a NSURLResponse available for inspection.
- @param response The NSURLResponse object for the given download.
- @discussion In some rare cases, multiple responses may be received for a single download.
- This occurs with multipart/x-mixed-replace, or "server push". In this case, the client
- should assume that each new response resets progress so far for the resource back to 0,
- and should check the new response for the expected content length.
-*/
-- (void)download:(WebDownload *)download didReceiveResponse:(NSURLResponse *)response;
-
-/*!
- @method download:decidePathWithListener:suggestedFilename:
- @abstract This method is called when enough information has been loaded to decide a path for the download.
- @discussion Once the delegate has decided a path, it should call setPath: on the passed listener object.
- The delegate can either respond immediately, or retain the listener and respond later. This method is not
- called if the download has a predetermined path (i.e. image downloads via drag & drop).
- @param download The download that requests the download path.
- @param filename The suggested filename for deciding the path of the downloaded file. The filename is either
- derived from the last path component of the URL and the MIME type or if the download was encoded,
- it is the filename specified in the encoding.
-*/
-- (void)download:(WebDownload *)download decidePathWithListener:(id <WebDownloadDecisionListener>)listener suggestedFilename:(NSString *)filename;
-
-/*!
- @method download:didReceiveDataOfLength:
- @abstract This method is called when the download has loaded data.
- @discussion This method will be called 1 or more times.
- @param download The download that has received data.
- @param length The length of the received data.
-*/
-- (void)download:(WebDownload *)download didReceiveDataOfLength:(unsigned)length;
-
-/*!
- @method downloadShouldDecodeEncodedFile:
- @abstract This method is called if the download detects that the downloading file is encoded.
- @discussion An encoded file is encoded in MacBinary, BinHex or gzip format.
- This method is not called if the download is not encoded.
- @param download The download that has detected that the downloading file is encoded.
- @result Return YES to decode the file, NO to not decode the file.
-*/
-- (BOOL)downloadShouldDecodeEncodedFile:(WebDownload *)download;
-
-/*!
- @method download:didCreatedFileAtPath:
- @abstract This method is called after the download creates the download file.
- @discussion The filename of path may be different than the path set with setPath:
- so the download does not overwrite an existing file.
- @param download The download that created the downloading file.
- @param path The path of the downloading file.
-*/
-- (void)download:(WebDownload *)download didCreateFileAtPath:(NSString *)path;
-
-/*!
- @method downloadDidFinishDownloading:
- @abstract This method is called when the download has finished downloading.
- @discussion This method is called after all the data has been received and written to disk.
- This method or download:didFailDownloadingWithError: will only be called once.
- @param download The download that has finished downloading.
-*/
-- (void)downloadDidFinishDownloading:(WebDownload *)download;
-
-/*!
- @method download:didFailDownloadingWithError:
- @abstract This method is called when the download has failed.
- @discussion This method is called when the download encounters a network or file I/O related error.
- This method or downloadDidFinishDownloading: will only be called once.
- @param download The download that ended in error.
- @param error The error caused the download to fail.
-*/
-- (void)download:(WebDownload *)download didFailDownloadingWithError:(NSError *)error;
-
- at end
-
-/*!
- @protocol WebDownloadDecisionListener
- @discussion An object that conforms to the WebDownloadDecisionListener protocol is passed
- with the download:decidePathWithListener:suggestedFilename: method of the WebDownloadDelegate protocol.
- There is no need to directly create an object that conforms to this protocol.
-*/
- at protocol WebDownloadDecisionListener <NSObject>
-/*!
- @method setPath:
- @abstract This method should be called when the path of the downloaded file has been decided.
- @param path The path of the downloaded file.
- @discussion If necessary, to avoid overwriting files, "-n" (where "n" is a number) will be appended to the
- filename before the extension. Because of this, use the path passed with download:didCreateFileAtPath:
- when referring to the path of the downloaded file, not the path set with this method.
-*/
--(void)setPath:(NSString *)path;
-
- at end
diff --git a/WebKit/Downloads.subproj/WebDownload.m b/WebKit/Downloads.subproj/WebDownload.m
deleted file mode 100644
index 08e33f7..0000000
--- a/WebKit/Downloads.subproj/WebDownload.m
+++ /dev/null
@@ -1,995 +0,0 @@
-//
-// WebDownload.m
-// WebKit
-//
-// Created by Chris Blumenberg on Thu Apr 11 2002.
-// Copyright (c) 2003 Apple Computer, Inc.
-//
-
-#import <WebKit/WebDownloadPrivate.h>
-
-#import <WebKit/WebBinHexDecoder.h>
-#import <WebKit/WebDownloadDecoder.h>
-#import <WebKit/WebGZipDecoder.h>
-#import <WebKit/WebKitErrorsPrivate.h>
-#import <WebKit/WebKitLogging.h>
-#import <WebKit/WebMacBinaryDecoder.h>
-#import <WebKit/WebMainResourceClient.h>
-#import <WebKit/WebNSWorkspaceExtras.h>
-
-#import <WebFoundation/WebNSErrorExtras.h>
-#import <WebFoundation/WebNSFileManagerExtras.h>
-#import <WebFoundation/WebNSStringExtras.h>
-#import <WebFoundation/NSURLRequest.h>
-#import <WebFoundation/NSURLConnection.h>
-#import <WebFoundation/NSURLResponse.h>
-#import <WebFoundation/NSURLResponsePrivate.h>
-
-typedef struct WebFSForkIOParam
-{
- FSForkIOParam paramBlock;
- WebDownload *download;
- NSData *data;
-} WebFSForkIOParam;
-
-typedef struct WebFSRefParam
-{
- FSRefParam paramBlock;
- WebDownload *download;
-} WebFSRefParam;
-
- at interface WebDownloadPrivate : NSObject
-{
- at public
- NSMutableArray *decoderSequence;
- NSMutableData *bufferedData;
-
- FSRefPtr fileRefPtr;
-
- SInt16 dataForkRefNum;
- SInt16 resourceForkRefNum;
-
- BOOL deleteFile;
- BOOL isDownloading;
- BOOL areWritesCancelled;
- BOOL encounteredCloseError;
-
- NSURLConnection *connection;
- NSURLRequest *request;
- NSURLResponse *response;
- WebResourceDelegateProxy *proxy;
-
- id delegate;
-
- NSString *path;
- NSString *tempPath;
- NSString *directoryPath;
-}
- at end
-
-static NSArray *decoderClasses = nil;
-
-static void WriteCompletionCallback(ParmBlkPtr paramBlock);
-static void CloseCompletionCallback(ParmBlkPtr paramBlock);
-static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
-
- at interface WebDownload (ForwardDeclarations)
-#pragma mark LOADING
-- (void)_downloadStarted;
-- (void)_downloadEnded;
-- (void)_setRequest:(NSURLRequest *)request;
-- (void)_setResponse:(NSURLResponse *)response;
-#pragma mark CREATING
-- (NSString *)_pathWithUniqueFilenameForPath:(NSString *)path;
-- (BOOL)_createFSRefForPath:(NSString *)path;
-- (BOOL)_createFileIfNecessary;
-#pragma mark DECODING
-- (void)_decodeHeaderData:(NSData *)headerData dataForkData:(NSData **)dataForkData resourceForkData:(NSData **)resourceForkData;
-- (BOOL)_decodeData:(NSData *)data dataForkData:(NSData **)dataForkData resourceForkData:(NSData **)resourceForkData;
-- (NSError *)_decodeData:(NSData *)data;
-- (NSData *)_dataIfDoneBufferingData:(NSData *)data;
-- (BOOL)_finishDecoding;
-#pragma mark WRITING
-- (BOOL)_writeForkData:(NSData *)data isDataFork:(BOOL)isDataFork;
-- (NSError *)_writeDataForkData:(NSData *)dataForkData resourceForkData:(NSData *)resourceForkData;
-#pragma mark CLOSING;
-- (BOOL)_isFileClosed;
-- (void)_didCloseFile:(NSError *)error;
-- (void)_closeForkAsync:(SInt16)forkRefNum;
-- (BOOL)_closeForkSync:(SInt16)forkRefNum;
-- (void)_closeFileAsync;
-- (BOOL)_closeFileSync;
-#pragma mark DELETING
-- (void)_didDeleteFile;
-- (void)_deleteFileAsnyc;
-- (void)_closeAndDeleteFileAsync;
-- (void)_cancelWithError:(NSError *)error;
-- (void)_cancelWithErrorCode:(int)code;
-#pragma mark MISC
-- (void)_setDelegate:(id)delegate;
-- (void)_setPath:(NSString *)path;
-- (NSString *)_currentPath;
-- (NSError *)_errorWithCode:(int)code;
-- (SInt16)_dataForkReferenceNumber;
-- (void)_setDataForkReferenceNumber:(SInt16)forkRefNum;
-- (SInt16)_resourceForkReferenceNumber;
-- (void)_setResourceForkReferenceNumber:(SInt16)forkRefNum;
-- (BOOL)_areWritesCancelled;
-- (void)_setWritesCancelled:(BOOL)cancelled;
-- (BOOL)_encounteredCloseError;
-- (void)_setEncounteredCloseError:(BOOL)encounteredCloseError;
- at end
-
- at implementation WebDownloadPrivate
-
-+ (void)initialize
-{
- decoderClasses = [[NSArray arrayWithObjects:
- [WebBinHexDecoder class],
- [WebMacBinaryDecoder class],
- [WebGZipDecoder class],
- nil] retain];
-}
-
-- (void)dealloc
-{
- ASSERT(!connection);
- ASSERT(!delegate);
- ASSERT(!isDownloading);
-
- free(fileRefPtr);
-
- [bufferedData release];
- [decoderSequence release];
- [request release];
- [connection release];
- [response release];
- [proxy setDelegate:nil];
- [proxy release];
- [path release];
- [tempPath release];
- [directoryPath release];
- [super dealloc];
-}
-
- at end
-
- at implementation WebDownload
-
-- initWithRequest:(NSURLRequest *)request
-{
- ASSERT(request);
-
- [super init];
-
- _private = [[WebDownloadPrivate alloc] init];
- _private->request = [request retain];
-
- return self;
-}
-
-- _initWithLoadingResource:(NSURLConnection *)connection
- request:(NSURLRequest *)request
- response:(NSURLResponse *)response
- delegate:(id)delegate
- proxy:(WebResourceDelegateProxy *)proxy
-{
- [super init];
-
- _private = [[WebDownloadPrivate alloc] init];
- [self _downloadStarted];
-
- _private->request = [request retain];
- _private->connection = [connection retain];
- _private->response = [response retain];
- _private->proxy = [proxy retain];
- [self _setDelegate:delegate];
- [_private->proxy setDelegate:self];
-
- // Replay the delegate methods that would be called in the standalone download case.
- if ([_private->delegate respondsToSelector:@selector(download:didStartFromRequest:)]) {
- [_private->delegate download:self didStartFromRequest:_private->request];
- }
-
- if ([_private->delegate respondsToSelector:@selector(download:willSendRequest:redirectResponse:)]) {
- NSURLRequest *request = [_private->delegate download:self willSendRequest:_private->request redirectResponse:nil];
- if (request != _private->request) {
- // If the request is altered, cancel the connection and start a new one.
- [self cancel];
- if (request) {
- [self _setRequest:request];
- [self _setResponse:nil];
- [_private->connection release];
- _private->connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
- [self _downloadStarted];
- }
- return self;
- }
- }
-
- if ([_private->delegate respondsToSelector:@selector(download:didReceiveResponse:)]) {
- [_private->delegate download:self didReceiveResponse:_private->response];
- }
-
- return self;
-}
-
-+ _downloadWithLoadingResource:(NSURLConnection *)connection
- request:(NSURLRequest *)request
- response:(NSURLResponse *)response
- delegate:(id)delegate
- proxy:(WebResourceDelegateProxy *)proxy
-{
- return [[[WebDownload alloc] _initWithLoadingResource:connection
- request:request
- response:response
- delegate:delegate
- proxy:proxy] autorelease];
-}
-
-- (void)dealloc
-{
- [_private release];
- [super dealloc];
-}
-
-- (void)loadWithDelegate:(id)delegate
-{
- if (!_private->isDownloading) {
- [self _setDelegate:delegate];
- // send this synthetic delegate callback since clients expect it, and
- // we no longer send the callback from within NSURLConnection for
- // initial requests.
- NSURLRequest *request = [self connection:nil willSendRequest:_private->request redirectResponse:nil];
- _private->connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
- [self _downloadStarted];
-
- if ([_private->delegate respondsToSelector:@selector(download:didStartFromRequest:)]) {
- [_private->delegate download:self didStartFromRequest:request];
- }
- }
-}
-
-- (void)cancel
-{
- [self _cancelWithError:nil];
-}
-
-- (NSString *)path
-{
- return _private->path;
-}
-
-// setPath: is not public. This is the WebDownloadDecisionListener method.
-- (void)setPath:(NSString *)path
-{
- [self _setPath:path];
-}
-
-#pragma mark LOADING
-
-- (void)_downloadStarted
-{
- if (!_private->isDownloading) {
- _private->isDownloading = YES;
-
- // Retain self while loading so we aren't released during the load.
- [self retain];
- }
-}
-
-- (void)_downloadEnded
-{
- if (_private->isDownloading) {
- _private->isDownloading = NO;
-
- [_private->connection release];
- _private->connection = nil;
-
- [self _setDelegate:nil];
-
- // Balance the retain from when the load started.
- [self release];
- }
-}
-
-- (void)_setRequest:(NSURLRequest *)request
-{
- if (_private->request != request) {
- [_private->request release];
- _private->request = [request retain];
- }
-}
-
-- (void)_setResponse:(NSURLResponse *)response
-{
- if (_private->response != response) {
- [_private->response release];
- _private->response = [response retain];
- }
-}
-
-- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)theRequest redirectResponse:(NSURLResponse *)redirectResponse
-{
- NSURLRequest *request = nil;
-
- if ([_private->delegate respondsToSelector:@selector(download:willSendRequest:redirectResponse:)]) {
- request = [_private->delegate download:self willSendRequest:theRequest redirectResponse:redirectResponse];
- } else {
- request = theRequest;
- }
-
- [self _setRequest:request];
-
- if (!request) {
- [self _downloadEnded];
- }
-
- return request;
-}
-
-- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
-{
- [self _setResponse:response];
-
- if ([_private->delegate respondsToSelector:@selector(download:didReceiveResponse:)]) {
- [_private->delegate download:self didReceiveResponse:response];
- }
-}
-
-- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
-{
- if ([_private->delegate respondsToSelector:@selector(download:didReceiveDataOfLength:)]) {
- [_private->delegate download:self didReceiveDataOfLength:[data length]];
- }
-
- NSError *error = [self _decodeData:[self _dataIfDoneBufferingData:data]];
- if (error) {
- [self _cancelWithError:error];
- }
-}
-
-- (void)connectionDidFinishLoading:(NSURLConnection *)connection
-{
- NSError *error = [self _decodeData:_private->bufferedData];
- [_private->bufferedData release];
- _private->bufferedData = nil;
- if (error) {
- [self _cancelWithError:error];
- return;
- }
-
- if (![self _finishDecoding]) {
- ERROR("Download decoding failed.");
- [self _cancelWithErrorCode:WebKitErrorDownloadDecodingFailedToComplete];
- return;
- }
-
- [self _closeFileAsync];
-}
-
-- (void)connection:(NSURLConnection *)connection didFailLoadingWithError:(NSError *)error
-{
- [self _cancelWithError:error];
-}
-
-#pragma mark CREATING
-
-- (NSString *)_pathWithUniqueFilenameForPath:(NSString *)path
-{
- // "Fix" the filename of the path.
- NSString *filename = [[path lastPathComponent] _web_filenameByFixingIllegalCharacters];
- path = [[path stringByDeletingLastPathComponent] stringByAppendingPathComponent:filename];
-
- NSFileManager *fileManager = [NSFileManager defaultManager];
- if ([fileManager fileExistsAtPath:path]) {
- // Don't overwrite existing files by appending "-n" or "-n.ext" to the filename.
- NSString *pathWithoutExtension = [path stringByDeletingPathExtension];
- NSString *extension = [path pathExtension];
- NSString *pathWithAppendedNumber;
- unsigned i;
-
- for (i = 1; 1; i++) {
- pathWithAppendedNumber = [NSString stringWithFormat:@"%@-%d", pathWithoutExtension, i];
- if (extension && [extension length]) {
- path = [pathWithAppendedNumber stringByAppendingPathExtension:extension];
- } else {
- path = pathWithAppendedNumber;
- }
- if (![fileManager fileExistsAtPath:path]) {
- break;
- }
- }
- }
-
- return path;
-}
-
-- (BOOL)_createFSRefForPath:(NSString *)path
-{
- free(_private->fileRefPtr);
- _private->fileRefPtr = malloc(sizeof(FSRef));
-
- OSErr result = FSPathMakeRef((const UInt8 *)[path fileSystemRepresentation], _private->fileRefPtr, NULL);
- if (result != noErr) {
- ERROR("FSPathMakeRef failed.");
- free(_private->fileRefPtr);
- _private->fileRefPtr = NULL;
- return NO;
- }
-
- return YES;
-}
-
-- (BOOL)_createFileIfNecessary
-{
- if (_private->fileRefPtr) {
- // File is already created.
- return YES;
- }
-
- NSObject <WebDownloadDecoder> *lastDecoder = [_private->decoderSequence lastObject];
- NSMutableDictionary *attributes = [[lastDecoder fileAttributes] mutableCopy];
- NSFileManager *fileManager = [NSFileManager defaultManager];
-
- if (!attributes) {
- attributes = [[NSMutableDictionary alloc] init];
- }
- if (![attributes objectForKey:NSFileCreationDate]) {
- [attributes setObject:[_private->response createdDate] forKey:NSFileCreationDate];
- }
- if (![attributes objectForKey:NSFileModificationDate]) {
- [attributes setObject:[_private->response createdDate] forKey:NSFileModificationDate];
- }
-
- NSString *filename = [[lastDecoder filename] _web_filenameByFixingIllegalCharacters];
- if ([filename length] == 0) {
- filename = [_private->response suggestedFilename];
- }
-
- ASSERT(!_private->path);
-
- NSString *path = nil;
-
- // Check if the directory is predetermined. If not, ask for a path.
- if (_private->directoryPath) {
- path = [_private->directoryPath stringByAppendingPathComponent:filename];
- [self _setPath:path];
- } else {
- if ([_private->delegate respondsToSelector:@selector(download:decidePathWithListener:suggestedFilename:)]) {
- [_private->delegate download:self
- decidePathWithListener:(id <WebDownloadDecisionListener>)self
- suggestedFilename:filename];
- }
- }
-
- if (_private->path) {
- // Path was immeditately set.
- path = _private->path;
- } else {
- // Path wasn't immeditately set. Create the file in /tmp.
- // FIXME: Consider downloading the file to the default download directory or some other location.
- char *pathC = strdup("/tmp/WebKitDownload.XXXXXX");
- if (mktemp(pathC)) {
- _private->tempPath = [[NSString alloc] initWithCString:pathC];
- path = _private->tempPath;
- }
- free(pathC);
- if (!path) {
- ERROR("mktemp failed to create a unique filename in /tmp.");
- return NO;
- }
- }
-
- if (![fileManager _web_createFileAtPath:path contents:nil attributes:attributes]) {
- ERROR("-[NSFileManager _web_createFileAtPath:contents:attributes:] failed.");
- return NO;
- }
-
- if (![self _createFSRefForPath:path]) {
- return NO;
- }
-
- [[NSWorkspace sharedWorkspace] _web_noteFileChangedAtPath:path];
-
- if (_private->path && [_private->delegate respondsToSelector:@selector(download:didCreateFileAtPath:)]) {
- [_private->delegate download:self didCreateFileAtPath:_private->path];
- }
-
- return YES;
-}
-
-
-#pragma mark DECODING
-
-- (void)_decodeHeaderData:(NSData *)headerData
- dataForkData:(NSData **)dataForkData
- resourceForkData:(NSData **)resourceForkData
-{
- ASSERT(headerData);
- ASSERT([headerData length]);
- ASSERT(dataForkData);
- ASSERT(resourceForkData);
-
- unsigned i;
- for (i = 0; i < [decoderClasses count]; i++) {
- Class decoderClass = [decoderClasses objectAtIndex:i];
-
- if ([decoderClass canDecodeHeaderData:headerData]) {
- NSObject <WebDownloadDecoder> *decoder = [[[decoderClass alloc] init] autorelease];
- BOOL didDecode = [decoder decodeData:headerData dataForkData:dataForkData resourceForkData:resourceForkData];
- if (!didDecode) {
- // Though the decoder said it could decode the header, actual decoding failed. Shouldn't happen.
- ERROR("Download decoder \"%s\" failed to decode header even though it claimed to handle it.",
- [[decoder className] lossyCString]);
- continue;
- }
-
- [_private->decoderSequence addObject:decoder];
-
- [self _decodeHeaderData:*dataForkData dataForkData:dataForkData resourceForkData:resourceForkData];
- break;
- }
- }
-}
-
-- (BOOL)_decodeData:(NSData *)data
- dataForkData:(NSData **)dataForkData
- resourceForkData:(NSData **)resourceForkData
-{
- ASSERT(data);
- ASSERT([data length]);
- ASSERT(dataForkData);
- ASSERT(resourceForkData);
-
- if (!_private->decoderSequence) {
- _private->decoderSequence = [[NSMutableArray array] retain];
- [self _decodeHeaderData:data dataForkData:dataForkData resourceForkData:resourceForkData];
-
- if ([_private->decoderSequence count] > 0 &&
- [_private->delegate respondsToSelector:@selector(downloadShouldDecodeEncodedFile:)] &&
- ![_private->delegate downloadShouldDecodeEncodedFile:self]) {
- [_private->decoderSequence removeAllObjects];
- }
- } else {
- unsigned i;
- for (i = 0; i< [_private->decoderSequence count]; i++) {
- NSObject <WebDownloadDecoder> *decoder = [_private->decoderSequence objectAtIndex:i];
- BOOL didDecode = [decoder decodeData:data dataForkData:dataForkData resourceForkData:resourceForkData];
-
- if (!didDecode) {
- return NO;
- }
-
- data = *dataForkData;
- }
- }
-
- if ([_private->decoderSequence count] == 0) {
- *dataForkData = data;
- *resourceForkData = nil;
- }
-
- return YES;
-}
-
-- (NSError *)_decodeData:(NSData *)data
-{
- if ([data length] == 0) {
- return nil;
- }
-
- NSData *dataForkData = nil;
- NSData *resourceForkData = nil;
-
- if (![self _decodeData:data dataForkData:&dataForkData resourceForkData:&resourceForkData]) {
- ERROR("Download decoding failed.");
- return [self _errorWithCode:WebKitErrorDownloadDecodingFailedMidStream];
- }
-
- NSError *error = [self _writeDataForkData:dataForkData resourceForkData:resourceForkData];
- if (error) {
- return error;
- }
-
- return nil;
-}
-
-- (NSData *)_dataIfDoneBufferingData:(NSData *)data
-{
- ASSERT([data length] > 0);
-
- if (!_private->bufferedData) {
- _private->bufferedData = [data mutableCopy];
- } else if ([_private->bufferedData length] == 0) {
- // When bufferedData's length is 0, we're done buffering.
- return data;
- } else {
- // Append new data.
- [_private->bufferedData appendData:data];
- }
-
- if ([_private->bufferedData length] >= WEB_DOWNLOAD_DECODER_MINIMUM_HEADER_LENGTH) {
- // We've have enough now. Make a copy so we can set bufferedData's length to 0,
- // so we're know we're done buffering.
- data = [[_private->bufferedData copy] autorelease];
- [_private->bufferedData release];
- _private->bufferedData = [[NSMutableData alloc] init];
- return data;
- } else {
- // Keep buffering. The header is not big enough to determine the encoding sequence.
- return nil;
- }
-}
-
-- (BOOL)_finishDecoding
-{
- NSObject <WebDownloadDecoder> *decoder;
- unsigned i;
-
- for (i = 0; i < [_private->decoderSequence count]; i++) {
- decoder = [_private->decoderSequence objectAtIndex:i];
- if (![decoder finishDecoding]) {
- return NO;
- }
- }
-
- return YES;
-}
-
-#pragma mark WRITING
-
-- (BOOL)_writeForkData:(NSData *)data isDataFork:(BOOL)isDataFork
-{
- SInt16 *forkRefNum = isDataFork ? &_private->dataForkRefNum : &_private->resourceForkRefNum;
-
- if (*forkRefNum == 0) {
- HFSUniStr255 forkName;
- OSErr result = isDataFork ? FSGetDataForkName(&forkName) : FSGetResourceForkName(&forkName);
- if (result != noErr) {
- ERROR("Couldn't get fork name of download file.");
- return NO;
- }
-
- result = FSOpenFork(_private->fileRefPtr, forkName.length, forkName.unicode, fsWrPerm, forkRefNum);
- if (result != noErr) {
- ERROR("Couldn't open fork of download file.");
- return NO;
- }
- }
-
- data = [data copy];
- WebFSForkIOParam *block = malloc(sizeof(WebFSForkIOParam));
- block->paramBlock.ioCompletion = WriteCompletionCallback;
- block->paramBlock.forkRefNum = *forkRefNum;
- block->paramBlock.positionMode = fsAtMark;
- block->paramBlock.positionOffset = 0;
- block->paramBlock.requestCount = [data length];
- block->paramBlock.buffer = (Ptr)[data bytes];
- block->download = [self retain];
- block->data = data;
- PBWriteForkAsync(&block->paramBlock);
-
- return YES;
-}
-
-- (NSError *)_writeDataForkData:(NSData *)dataForkData resourceForkData:(NSData *)resourceForkData
-{
- if (![self _createFileIfNecessary]) {
- return [self _errorWithCode:WebKitErrorCannotCreateFile];
- }
-
- BOOL didWrite = YES;
-
- if ([dataForkData length]) {
- didWrite = [self _writeForkData:dataForkData isDataFork:YES];
- }
-
- if (didWrite && [resourceForkData length]) {
- didWrite = [self _writeForkData:resourceForkData isDataFork:NO];
- }
-
- if (!didWrite) {
- [self _closeAndDeleteFileAsync];
- return [self _errorWithCode:WebKitErrorCannotWriteToFile];
- }
-
- return nil;
-}
-
-#pragma mark CLOSING
-
-- (BOOL)_isFileClosed
-{
- return (_private->dataForkRefNum == 0 && _private->resourceForkRefNum == 0);
-}
-
-- (void)_didCloseFile:(NSError *)error
-{
- if (_private->deleteFile) {
- [self _deleteFileAsnyc];
- } else if (error) {
- [self _cancelWithError:error];
- } else {
- [[NSWorkspace sharedWorkspace] _web_noteFileChangedAtPath:[self _currentPath]];
- if ([_private->delegate respondsToSelector:@selector(downloadDidFinishDownloading:)]) {
- [_private->delegate downloadDidFinishDownloading:self];
- }
- [self _downloadEnded];
- }
-}
-
-- (void)_closeForkAsync:(SInt16)forkRefNum
-{
- if (forkRefNum) {
- WebFSForkIOParam *block = malloc(sizeof(WebFSForkIOParam));
- block->paramBlock.ioCompletion = CloseCompletionCallback;
- block->paramBlock.forkRefNum = forkRefNum;
- block->download = [self retain];
- PBCloseForkAsync(&block->paramBlock);
- }
-}
-
-- (BOOL)_closeForkSync:(SInt16)forkRefNum
-{
- if (forkRefNum) {
- OSErr error = FSCloseFork(forkRefNum);
- if (error != noErr) {
- ERROR("FSCloseFork failed to close fork of download file with error %d", error);
- return NO;
- }
- }
-
- return YES;
-}
-
-- (void)_closeFileAsync
-{
- [self _closeForkAsync:_private->dataForkRefNum];
- [self _closeForkAsync:_private->resourceForkRefNum];
-}
-
-- (BOOL)_closeFileSync
-{
- BOOL result = YES;
-
- if (![self _closeForkSync:_private->dataForkRefNum]) {
- result = NO;
- }
-
- if (![self _closeForkSync:_private->resourceForkRefNum]) {
- result = NO;
- }
-
- _private->dataForkRefNum = 0;
- _private->resourceForkRefNum = 0;
-
- return result;
-}
-
-#pragma mark DELETING
-
-- (void)_didDeleteFile
-{
- [[NSWorkspace sharedWorkspace] _web_noteFileChangedAtPath:[self _currentPath]];
-}
-
-- (void)_deleteFileAsnyc
-{
- if (_private->fileRefPtr) {
- WebFSRefParam *deleteBlock = malloc(sizeof(WebFSRefParam));
- deleteBlock->paramBlock.ioCompletion = DeleteCompletionCallback;
- deleteBlock->paramBlock.ref = _private->fileRefPtr;
- deleteBlock->download = [self retain];
- PBDeleteObjectAsync(&deleteBlock->paramBlock);
- free(_private->fileRefPtr);
- _private->fileRefPtr = NULL;
- }
-}
-
-- (void)_closeAndDeleteFileAsync
-{
- if ([self _isFileClosed]) {
- [self _deleteFileAsnyc];
- } else {
- [self _closeFileAsync];
- _private->deleteFile = YES;
- }
-}
-
-- (void)_cancelWithError:(NSError *)error
-{
- [_private->connection cancel];
-
- if (error) {
- if ([_private->delegate respondsToSelector:@selector(download:didFailDownloadingWithError:)]) {
- [_private->delegate download:self didFailDownloadingWithError:error];
- }
- }
-
- [self _closeAndDeleteFileAsync];
- [self _downloadEnded];
-}
-
-- (void)_cancelWithErrorCode:(int)code
-{
- [self _cancelWithError:[self _errorWithCode:code]];
-}
-
-#pragma mark MISCELLANEOUS
-
-- (void)_setDelegate:(id)delegate;
-{
- [delegate retain];
- [_private->delegate release];
- _private->delegate = delegate;
-}
-
-- (void)_setPath:(NSString *)path
-{
- ASSERT(path);
- ASSERT(!_private->path);
- ASSERT([path isAbsolutePath]);
-
- // Path has already been set.
- if (_private->path) {
- return;
- }
-
- if (!path || ![path isAbsolutePath]) {
- ERROR("setPath: cannot be called with a nil or non-absolute path.");
- [self cancel];
- return;
- }
-
- // Make sure we don't overwrite an existing file.
- _private->path = [[self _pathWithUniqueFilenameForPath:path] retain];
-
- // FIXME: Moving the downloading file synchronously may block the main thread for a long time
- // if the move is across volumes.
- if (_private->tempPath && ![_private->tempPath isEqualToString:_private->path]) {
- if (![self _closeFileSync]) {
- [self _cancelWithErrorCode:WebKitErrorCannotCloseFile];
- return;
- }
- if (![[NSFileManager defaultManager] movePath:_private->tempPath toPath:_private->path handler:nil]) {
- [self _cancelWithErrorCode:WebKitErrorCannotMoveFile];
- return;
- }
- if (![self _createFSRefForPath:_private->path]) {
- [self _cancelWithErrorCode:WebKitErrorCannotCreateFile];
- return;
- }
-
- [[NSWorkspace sharedWorkspace] _web_noteFileChangedAtPath:_private->path];
-
- if ([_private->delegate respondsToSelector:@selector(download:didCreateFileAtPath:)]) {
- [_private->delegate download:self didCreateFileAtPath:_private->path];
- }
- }
-}
-
-- (void)_setDirectoryPath:(NSString *)directoryPath
-{
- NSString *copy = [directoryPath copy];
- [_private->directoryPath release];
- _private->directoryPath = copy;
-}
-
-- (NSString *)_currentPath
-{
- return _private->path ? _private->path : _private->tempPath;
-}
-
-- (NSError *)_errorWithCode:(int)code
-{
- return [NSError _webKitErrorWithCode:code failingURL:[[_private->request URL] absoluteString]];
-}
-
-- (SInt16)_dataForkReferenceNumber
-{
- return _private->dataForkRefNum;
-}
-
-- (void)_setDataForkReferenceNumber:(SInt16)forkRefNum
-{
- _private->dataForkRefNum = forkRefNum;
-}
-
-- (SInt16)_resourceForkReferenceNumber
-{
- return _private->resourceForkRefNum;
-}
-
-- (void)_setResourceForkReferenceNumber:(SInt16)forkRefNum
-{
- _private->resourceForkRefNum = forkRefNum;
-}
-
-- (BOOL)_areWritesCancelled
-{
- return _private->areWritesCancelled;
-}
-
-- (void)_setWritesCancelled:(BOOL)cancelled
-{
- _private->areWritesCancelled = cancelled;
-}
-
-- (BOOL)_encounteredCloseError
-{
- return _private->encounteredCloseError;
-}
-
-- (void)_setEncounteredCloseError:(BOOL)encounteredCloseError
-{
- _private->encounteredCloseError = encounteredCloseError;
-}
-
- at end
-
-static void WriteCompletionCallback(ParmBlkPtr paramBlock)
-{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- WebFSForkIOParam *block = (WebFSForkIOParam *)paramBlock;
- WebDownload *download = block->download;
-
- if (block->paramBlock.ioResult != noErr && ![download _areWritesCancelled]) {
- ERROR("Writing to fork of download file failed with error: %d", block->paramBlock.ioResult);
- // Prevent multiple errors from being reported by setting the areWritesCancelled boolean.
- [download _setWritesCancelled:YES];
- [download performSelectorOnMainThread:@selector(_cancelWithError:)
- withObject:[download _errorWithCode:WebKitErrorCannotWriteToFile]
- waitUntilDone:NO];
- }
-
- [download release];
- [block->data release];
- [pool release];
- free(block);
-}
-
-static void CloseCompletionCallback(ParmBlkPtr paramBlock)
-{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- WebFSForkIOParam *block = (WebFSForkIOParam *)paramBlock;
- WebDownload *download = block->download;
-
- if (block->paramBlock.ioResult != noErr) {
- ERROR("Closing fork of download file failed with error: %d", block->paramBlock.ioResult);
- [download _setEncounteredCloseError:YES];
- }
-
- if (block->paramBlock.forkRefNum == [download _dataForkReferenceNumber]) {
- [download _setDataForkReferenceNumber:0];
- } else {
- [download _setResourceForkReferenceNumber:0];
- }
-
- if ([download _isFileClosed]) {
- NSError *error = [download _encounteredCloseError] ? [download _errorWithCode:WebKitErrorCannotCloseFile] : nil;
- [download performSelectorOnMainThread:@selector(_didCloseFile:) withObject:error waitUntilDone:NO];
- }
-
- [download release];
- [pool release];
- free(block);
-}
-
-static void DeleteCompletionCallback(ParmBlkPtr paramBlock)
-{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- WebFSRefParam *block = (WebFSRefParam *)paramBlock;
- WebDownload *download = block->download;
-
- if (block->paramBlock.ioResult != noErr) {
- ERROR("Removal of download file failed with error: %d", block->paramBlock.ioResult);
- } else {
- [download performSelectorOnMainThread:@selector(_didDeleteFile) withObject:nil waitUntilDone:NO];
- }
-
- [download release];
- [pool release];
- free(block);
-}
-
diff --git a/WebKit/Downloads.subproj/WebDownloadDecoder.h b/WebKit/Downloads.subproj/WebDownloadDecoder.h
deleted file mode 100644
index 875af21..0000000
--- a/WebKit/Downloads.subproj/WebDownloadDecoder.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * WebDownloadDecoder.h
- * WebKit
- *
- * Created by Chris Blumenberg on Thu Oct 17 2002.
- * Copyright (c) 2002 Apple Computer. All rights reserved.
- *
- */
-
-#include <Foundation/Foundation.h>
-
-#define WEB_DOWNLOAD_DECODER_MINIMUM_HEADER_LENGTH 8192
-
- at protocol WebDownloadDecoder <NSObject>
-
-// Returns YES if the decoder can decode headerData, NO otherwise.
-// Header data is the first 8KB or larger chunk of received data.
-+ (BOOL)canDecodeHeaderData:(NSData *)headerData;
-
-// Decodes data and sets dataForkData and resourceForkData with the decoded data.
-// dataForkData and/or resourceForkData and can be set to nil if there is no data to decode.
-// This method will be called repeatedly with every chunk of received data.
-// Returns YES if no errors have occurred, NO otherwise.
-- (BOOL)decodeData:(NSData *)data dataForkData:(NSData **)dataForkData resourceForkData:(NSData **)resourceForkData;
-
-// Returns YES if decoding successfully finished, NO otherwise.
-- (BOOL)finishDecoding;
-
-// Returns a dictionary of 4 file attributes. The attributes (as defined in NSFileManager.h) are:
-// NSFileModificationDate, NSFileHFSCreatorCode, NSFileHFSTypeCode, NSFileCreationDate
-// fileAttributes is called after finishDecoding.
-- (NSDictionary *)fileAttributes;
-
-// Returns the decoded filename.
-- (NSString *)filename;
-
- at end
-
-
-
diff --git a/WebKit/Downloads.subproj/WebDownloadPrivate.h b/WebKit/Downloads.subproj/WebDownloadPrivate.h
deleted file mode 100644
index befe984..0000000
--- a/WebKit/Downloads.subproj/WebDownloadPrivate.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- WebDownloadPrivate.h
- Copyright 2003, Apple, Inc. All rights reserved.
-
- Private header file.
-*/
-
-#import <WebKit/WebDownload.h>
-
- at class NSURLRequest;
- at class NSURLConnection;
- at class NSURLResponse;
- at class WebResourceDelegateProxy;
-
- at interface WebDownload (WebPrivate)
-+ _downloadWithLoadingResource:(NSURLConnection *)connection
- request:(NSURLRequest *)request
- response:(NSURLResponse *)response
- delegate:(id)delegate
- proxy:(WebResourceDelegateProxy *)proxy;
-- (void)_setDirectoryPath:(NSString *)directoryPath;
- at end
diff --git a/WebKit/Downloads.subproj/WebGZipDecoder.h b/WebKit/Downloads.subproj/WebGZipDecoder.h
deleted file mode 100644
index 8841ca1..0000000
--- a/WebKit/Downloads.subproj/WebGZipDecoder.h
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// WebGZipDecoder.h
-// WebKit
-//
-// Created by Darin Adler on Wed Dec 04 2002.
-// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-#import <zlib.h>
-
- at protocol WebDownloadDecoder;
-
- at interface WebGZipDecoder : NSObject <WebDownloadDecoder>
-{
- z_stream _stream;
- BOOL _streamInitialized;
-
- BOOL _decodedHeader;
- unsigned _modificationTime;
- NSString *_filename;
-
- unsigned _size;
- unsigned _CRC32;
-
- BOOL _finishedInflating;
-
- unsigned char _trailingBytes[8];
- int _trailingBytesLength;
-}
- at end
diff --git a/WebKit/Downloads.subproj/WebGZipDecoder.m b/WebKit/Downloads.subproj/WebGZipDecoder.m
deleted file mode 100644
index ffd0b2b..0000000
--- a/WebKit/Downloads.subproj/WebGZipDecoder.m
+++ /dev/null
@@ -1,248 +0,0 @@
-//
-// WebGZipDecoder.m
-// WebKit
-//
-// Created by Darin Adler on Wed Dec 04 2002.
-// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
-//
-
-#import "WebGZipDecoder.h"
-
-#import <WebFoundation/WebAssertions.h>
-#import <WebKit/WebDownloadDecoder.h>
-
-#define ID1 0x1F
-#define ID2 0x8B
-#define DEFLATE_COMPRESSION_METHOD 8
-
-#define FTEXT 0x01
-#define FHCRC 0x02
-#define FEXTRA 0x04
-#define FNAME 0x08
-#define FCOMMENT 0x10
-#define RESERVED_FLAGS 0xE0
-
- at implementation WebGZipDecoder
-
-+ (BOOL)decodeHeader:(NSData *)headerData headerLength:(int *)headerLength modificationTime:(unsigned *)modificationTime filename:(NSString **)filename
-{
- int headerDataLength = [headerData length];
- int length = 10;
-
- if (headerDataLength < length) {
- return NO;
- }
-
- const unsigned char *bytes = (const unsigned char *)[headerData bytes];
-
- if (bytes[0] != ID1 || bytes[1] != ID2) {
- return NO;
- }
-
- if (bytes[2] != DEFLATE_COMPRESSION_METHOD) {
- return NO;
- }
-
- unsigned char flags = bytes[3];
- if (flags & RESERVED_FLAGS) {
- return NO;
- }
-
- if (flags & FEXTRA) {
- if (headerDataLength < length + 2) {
- return NO;
- }
- length += 2 + (bytes[10] | (bytes[11] << 8));
- if (headerDataLength < length) {
- return NO;
- }
- }
-
- const char *filenameCString = 0;
- if (flags & FNAME) {
- filenameCString = (const char *)&bytes[length];
- while (bytes[length++] != 0) {
- if (headerDataLength < length) {
- return NO;
- }
- }
- } else {
- // The decoder framework won't handle files without filenames well.
- return NO;
- }
-
- if (flags & FCOMMENT) {
- while (bytes[length++] != 0) {
- if (headerDataLength < length) {
- return NO;
- }
- }
- }
-
- if (flags & FHCRC) {
- if (headerDataLength < length + 2) {
- return NO;
- }
- unsigned computedCRC = crc32(0, bytes, length) & 0xFFFF;
- unsigned expectedCRC = bytes[length] + bytes[length + 1];
- if (computedCRC != expectedCRC) {
- return NO;
- }
- length += 2;
- }
-
- if (headerLength) {
- *headerLength = length;
- }
-
- if (modificationTime) {
- *modificationTime = bytes[4] | (bytes[5] << 8) | (bytes[6] << 16) | (bytes[7] << 24);
- }
-
- if (filename) {
- *filename = [(NSString *)CFStringCreateWithCString(NULL, filenameCString, kCFStringEncodingWindowsLatin1) autorelease];
- }
-
- return YES;
-}
-
-+ (BOOL)canDecodeHeaderData:(NSData *)headerData
-{
- return [self decodeHeader:headerData headerLength:NULL modificationTime:NULL filename:NULL];
-}
-
-- (id)init
-{
- self = [super init];
- int error = inflateInit2(&_stream, -15); // window of 15 is standard for gzip, negative number is secret zlib feature to avoid processing header
- if (error != Z_OK) {
- ERROR("failed to initialize zlib, error %d", error);
- [self release];
- return nil;
- }
- _streamInitialized = YES;
- return self;
-}
-
-- (void)dealloc
-{
- if (_streamInitialized)
- inflateEnd(&_stream);
- [_filename release];
- [super dealloc];
-}
-
-- (BOOL)decodeData:(NSData *)data dataForkData:(NSData **)dataForkData resourceForkData:(NSData **)resourceForkData
-{
- ASSERT(data);
- ASSERT([data length]);
- ASSERT(dataForkData);
- ASSERT(resourceForkData);
- ASSERT(_streamInitialized);
-
- *dataForkData = nil;
- *resourceForkData = nil;
-
- int offset = 0;
-
- // Decode the header.
- if (!_decodedHeader) {
- NSString *filename;
- if (![[self class] decodeHeader:data
- headerLength:&offset
- modificationTime:&_modificationTime
- filename:&filename]) {
- return NO;
- }
-
- ASSERT(!_filename);
- _filename = [filename copy];
-
- _decodedHeader = YES;
- }
-
- // Decode the compressed data.
- if (!_finishedInflating) {
- NSMutableData *inflatedData = [NSMutableData data];
- *dataForkData = inflatedData;
-
- _stream.next_in = (char *)[data bytes] + offset;
- _stream.avail_in = [data length] - offset;
-
- while (_stream.avail_in) {
- char outputBuffer[16384];
-
- _stream.next_out = outputBuffer;
- _stream.avail_out = sizeof(outputBuffer);
-
- int result = inflate(&_stream, Z_NO_FLUSH);
-
- int outputLength = sizeof(outputBuffer) - _stream.avail_out;
- _size += outputLength;
- _CRC32 = crc32(_CRC32, outputBuffer, outputLength);
- [inflatedData appendBytes:outputBuffer length:outputLength];
-
- if (result == Z_STREAM_END) {
- _finishedInflating = YES;
- break;
- }
-
- if (result != Z_OK) {
- ERROR("got error from inflate, %d", result);
- return NO;
- }
- }
-
- offset = [data length] - _stream.avail_in;
- }
-
- // Decode the trailer.
- if (_finishedInflating && _trailingBytesLength < 8) {
- int numRemaining = [data length] - offset;
- if (numRemaining) {
- int numToCopy = MIN(numRemaining, 8 - _trailingBytesLength);
- memcpy(_trailingBytes + _trailingBytesLength, (char *)[data bytes] + offset, numToCopy);
- _trailingBytesLength += numToCopy;
- if (_trailingBytesLength == 8) {
- unsigned expectedCRC = _trailingBytes[0] | (_trailingBytes[1] << 8)
- | (_trailingBytes[2] << 16) | (_trailingBytes[3] << 24);
- if (_CRC32 != expectedCRC) {
- ERROR("CRC didn't match, computed %08X, expected %08X", _CRC32, expectedCRC);
- return NO;
- }
- unsigned expectedSize = _trailingBytes[4] | (_trailingBytes[5] << 8)
- | (_trailingBytes[6] << 16) | (_trailingBytes[7] << 24);
- if (_size != expectedSize) {
- ERROR("size didn't match, computed %d, expected %d", _size, expectedSize);
- return NO;
- }
- }
- }
- }
-
- return YES;
-}
-
-- (BOOL)finishDecoding
-{
- ASSERT(_streamInitialized);
- return _finishedInflating && _trailingBytesLength == 8;
-}
-
-- (NSDictionary *)fileAttributes
-{
- ASSERT(_decodedHeader);
- if (_modificationTime == 0) {
- return nil;
- }
- return [NSDictionary dictionaryWithObject:[NSDate dateWithTimeIntervalSinceReferenceDate:NSTimeIntervalSince1970 + _modificationTime]
- forKey:NSFileModificationDate];
-}
-
-- (NSString *)filename
-{
- ASSERT(_decodedHeader);
- return [[_filename copy] autorelease];
-}
-
- at end
diff --git a/WebKit/Downloads.subproj/WebMacBinaryDecoder.h b/WebKit/Downloads.subproj/WebMacBinaryDecoder.h
deleted file mode 100644
index 4cf9193..0000000
--- a/WebKit/Downloads.subproj/WebMacBinaryDecoder.h
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// WebMacBinaryDecoder.h
-//
-// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
- at protocol WebDownloadDecoder;
-
- at interface WebMacBinaryDecoder : NSObject <WebDownloadDecoder>
-{
- int _offset;
-
- unsigned char _name[64];
- ScriptCode _scriptCode;
-
- int _dataForkLength;
- int _resourceForkLength;
- u_int16_t _finderFlags;
- u_int16_t _extendedFinderFlags;
- u_int32_t _creationDate;
- u_int32_t _modificationDate;
- OSType _fileType;
- OSType _fileCreator;
-}
- at end
diff --git a/WebKit/Downloads.subproj/WebMacBinaryDecoder.m b/WebKit/Downloads.subproj/WebMacBinaryDecoder.m
deleted file mode 100644
index b8c1a00..0000000
--- a/WebKit/Downloads.subproj/WebMacBinaryDecoder.m
+++ /dev/null
@@ -1,174 +0,0 @@
-//
-// WebMacBinaryDecoder.m
-//
-// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
-//
-
-// This decoder decodes MacBinary II and might also work for MacBinary III.
-// There's also MacBinary I, which we do not attempt to support.
-
-#import <WebKit/WebMacBinaryDecoder.h>
-
-#import <WebFoundation/WebAssertions.h>
-#import <WebFoundation/WebNSFileManagerExtras.h>
-
-#import <WebKit/WebDownloadDecoder.h>
-
-#import "crc16.h"
-
-#define HEADER_SIZE 128
-
- at implementation WebMacBinaryDecoder
-
-// Returns YES if the decoder can decode headerData, NO otherwise.
-// Header data is the first 8KB or larger chunk of received data.
-+ (BOOL)canDecodeHeaderData:(NSData *)headerData
-{
- if ([headerData length] < HEADER_SIZE) {
- return NO;
- }
- const u_int8_t *header = [headerData bytes];
-
- // Version must be 0, also the zero fill bytes at 74 and 82,
- // and the last two bytes of the header.
- if (header[0] || header[74] || header[82] || header[126] || header[127]) {
- return NO;
- }
-
- // Name length must be a reasonable value (between 1 and 63).
- if (!header[1] || header[1] > 63) {
- return NO;
- }
-
- // And the CRC is the most important check.
- if (((header[124] << 8) | header[125]) == CRC16(header, 124, 0)) {
- // CRC matches, so we have MacBinary II or III.
-
- // Version 129 is MacBinary II, and MacBinary III is compatible.
- // If we see a higher value here, it's something newer that we can't handle.
- if (header[123] > 129) {
- return NO;
- }
-
- return YES;
- }
-
- // MacBinary I doesn't have a CRC. So now we have to see if we have a MacBinary I file.
-
- // Bytes 99-127 must be 0 in MacBinary I (already checked 126 and 127 above).
- int i;
- for (i = 99; i <= 125; i++) {
- if (header[i]) {
- return NO;
- }
- }
-
- // FIXME: The specification recommends also reality-checking the file lengths.
-
- return YES;
-}
-
-// Decodes data and sets dataForkData and resourceForkData with the decoded data.
-// dataForkData and/or resourceForkData and can be set to nil if there is no data to decode.
-// This method will be called repeatedly with every chunk of received data.
-// Returns YES if no errors have occurred, NO otherwise.
-- (BOOL)decodeData:(NSData *)data dataForkData:(NSData **)dataForkData resourceForkData:(NSData **)resourceForkData
-{
- ASSERT(data);
- ASSERT([data length]);
- ASSERT(dataForkData);
- ASSERT(resourceForkData);
- ASSERT(_offset + [data length] >= HEADER_SIZE);
-
- *dataForkData = nil;
- *resourceForkData = nil;
-
- int dataLength = [data length];
-
- // Handle the header by extracting the fields we want, in an endian-independent way.
- if (_offset == 0) {
- const u_int8_t *header = [data bytes];
-
- ASSERT(header[1] < sizeof(_name));
- memcpy(_name, header + 1, header[1] + 1);
-
- _fileType = (((((header[65] << 8) | header[66]) << 8) | header[67]) << 8) | header[68];
- _fileCreator = (((((header[69] << 8) | header[70]) << 8) | header[71]) << 8) | header[72];
- _dataForkLength = (((((header[83] << 8) | header[84]) << 8) | header[85]) << 8) | header[86];
- _resourceForkLength = (((((header[87] << 8) | header[88]) << 8) | header[89]) << 8) | header[90];
- _creationDate = (((((header[91] << 8) | header[92]) << 8) | header[93]) << 8) | header[94];
- _modificationDate = (((((header[95] << 8) | header[96]) << 8) | header[97]) << 8) | header[98];
- _finderFlags = (header[73] << 8) | header[101];
- _extendedFinderFlags = header[107];
-
- // Clear reserved bits or bits not applicable after transfer as defined in Finder.h.
- _finderFlags &= kColor | kIsShared | kHasCustomIcon | kIsStationery | kHasBundle | kIsAlias;
- _extendedFinderFlags &= kExtendedFlagHasCustomBadge | kExtendedFlagHasRoutingInfo;
-
- // MacBinary III.
- if (header[102] == 'm' && header[103] == 'B' && header[104] == 'I' && header[105] == 'N') {
- _scriptCode = header[106];
- }
- }
-
- int dataForkStart = HEADER_SIZE;
- int dataForkEnd = dataForkStart + _dataForkLength;
- int resourceForkStart = (dataForkEnd + 0x7F) & ~0x7F;
- int resourceForkEnd = resourceForkStart + _resourceForkLength;
-
- // Check for a piece of available data fork.
- if (_dataForkLength && _offset < dataForkEnd && _offset + dataLength > dataForkStart) {
- int start = MAX(dataForkStart - _offset, 0);
- int end = MIN(dataForkEnd - _offset, dataLength);
- ASSERT(end > start);
- *dataForkData = [data subdataWithRange:NSMakeRange(start, end - start)];
- }
-
- // Check for a piece of available resource fork.
- if (_resourceForkLength && _offset < resourceForkEnd && _offset + dataLength > resourceForkStart) {
- int start = MAX(resourceForkStart - _offset, 0);
- int end = MIN(resourceForkEnd - _offset, dataLength);
- ASSERT(end > start);
- *resourceForkData = [data subdataWithRange:NSMakeRange(start, end - start)];
- }
-
- _offset += dataLength;
-
- return YES;
-}
-
-// Returns YES if decoding successfully finished, NO otherwise.
-- (BOOL)finishDecoding
-{
- int dataForkStart = HEADER_SIZE;
- int dataForkEnd = dataForkStart + _dataForkLength;
- int resourceForkStart = (dataForkEnd + 0x7F) & ~0x7F;
- int resourceForkEnd = resourceForkStart + _resourceForkLength;
- return _offset >= resourceForkEnd;
-}
-
-// Returns a dictionary of 4 file attributes. The attributes (as defined in NSFileManager.h) are:
-// NSFileModificationDate, NSFileHFSCreatorCode, NSFileHFSTypeCode, NSFileCreationDate
-// fileAttributes is called after finishDecoding.
-- (NSDictionary *)fileAttributes
-{
- ASSERT(_offset >= HEADER_SIZE);
-
- return [NSDictionary dictionaryWithObjectsAndKeys:
- [NSDate dateWithTimeIntervalSinceReferenceDate:kCFAbsoluteTimeIntervalSince1904 + _creationDate], NSFileCreationDate,
- [NSDate dateWithTimeIntervalSinceReferenceDate:kCFAbsoluteTimeIntervalSince1904 + _modificationDate], NSFileModificationDate,
- [NSNumber numberWithUnsignedLong:_fileType], NSFileHFSTypeCode,
- [NSNumber numberWithUnsignedLong:_fileCreator], NSFileHFSCreatorCode,
- [NSNumber numberWithUnsignedShort:_finderFlags], WebFinderFlags,
- [NSNumber numberWithUnsignedShort:_extendedFinderFlags], WebExtendedFinderFlags,
- nil];
-}
-
-- (NSString *)filename
-{
- // FIXME: We pass _scriptCode in here, but does CFString know how to handle all the script
- // codes? What about when we have a bad script code? Is it OK to just return nil here?
- return [(NSString *)CFStringCreateWithPascalString(NULL, _name, _scriptCode) autorelease];
-}
-
- at end
diff --git a/WebKit/Downloads.subproj/crc16.h b/WebKit/Downloads.subproj/crc16.h
deleted file mode 100644
index f4d49a9..0000000
--- a/WebKit/Downloads.subproj/crc16.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef CRC16_H
-#define CRC16_H
-
-#include <sys/types.h>
-
-u_int16_t CRC16(const u_int8_t *p, u_int32_t len, u_int16_t seed);
-
-#endif
diff --git a/WebKit/Downloads.subproj/crc16.m b/WebKit/Downloads.subproj/crc16.m
deleted file mode 100644
index 6d861d6..0000000
--- a/WebKit/Downloads.subproj/crc16.m
+++ /dev/null
@@ -1,54 +0,0 @@
-#include "crc16.h"
-
-static const u_int16_t gMagic[] = {
- 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
- 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
- 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
- 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
- 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
- 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
- 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
- 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
- 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
- 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
- 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
- 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
- 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
- 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
- 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
- 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
- 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
- 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
- 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
- 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
- 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
- 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
- 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
- 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
- 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
- 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
- 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
- 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
- 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
- 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
- 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
- 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
-};
-
-/*
- * CRC16() --
- * Compute the MacBinary II-style CRC for the data pointed to by p, with the
- * crc seeded to seed.
- *
- * Modified by Jim Van Verth to use the magic array for efficiency.
- */
-u_int16_t CRC16(const u_int8_t *p, u_int32_t len, u_int16_t seed)
-{
- u_int16_t crc = seed;
- u_int32_t i;
- for (i = 0; i < len; i++, p++) {
- crc ^= (*p << 8);
- crc = (crc << 8) ^ gMagic[(u_int8_t)(crc >> 8)];
- }
- return crc;
-}
diff --git a/WebKit/English.lproj/Localizable.strings b/WebKit/English.lproj/Localizable.strings
index 32cd24e..c510a5d 100644
Binary files a/WebKit/English.lproj/Localizable.strings and b/WebKit/English.lproj/Localizable.strings differ
diff --git a/WebKit/English.lproj/StringsNotToBeLocalized.txt b/WebKit/English.lproj/StringsNotToBeLocalized.txt
index d93fb0b..f3d2554 100644
--- a/WebKit/English.lproj/StringsNotToBeLocalized.txt
+++ b/WebKit/English.lproj/StringsNotToBeLocalized.txt
@@ -5,20 +5,17 @@
"%.1lf"
"%2d) "
"%@ %@"
-"%@-%d"
"%@/%@"
"%@/Library/Preferences/%@"
"%@:%u"
"%@://%p"
"%d"
-"(This file must be converted with BinHex 4.0)"
","
"/"
"/<!--frame%d-->-->"
"/Library/Internet Plug-Ins"
"/favicon.ico"
"/tmp/SafariPlugInStream.XXXXXX"
-"/tmp/WebKitDownload.XXXXXX"
"/tmp/XXXXXX.tiff"
"0x0"
"1.00"
diff --git a/WebKit/Misc.subproj/WebKit.h b/WebKit/Misc.subproj/WebKit.h
index 334809a..4d2262f 100644
--- a/WebKit/Misc.subproj/WebKit.h
+++ b/WebKit/Misc.subproj/WebKit.h
@@ -6,7 +6,6 @@
#import <WebKit/WebBackForwardList.h>
#import <WebKit/WebDataSource.h>
#import <WebKit/WebDocument.h>
-#import <WebKit/WebDownload.h>
#import <WebKit/WebFrame.h>
#import <WebKit/WebFrameLoadDelegate.h>
#import <WebKit/WebFrameView.h>
diff --git a/WebKit/Misc.subproj/WebKitErrors.h b/WebKit/Misc.subproj/WebKitErrors.h
index 95278e2..b167d69 100644
--- a/WebKit/Misc.subproj/WebKitErrors.h
+++ b/WebKit/Misc.subproj/WebKitErrors.h
@@ -13,27 +13,6 @@ extern NSString * const WebKitErrorPlugInPageURLStringKey;
/*!
@enum
- @description Download and file I/O errors
- @constant WebKitErrorCannotCreateFile
- @constant WebKitErrorCannotOpenFile
- @constant WebKitErrorCannotCloseFile
- @constant WebKitErrorCannotWriteToFile
- @constant WebKitErrorCannotRemoveFile
- @constant WebKitErrorCannotMoveFile
-*/
-enum {
- WebKitErrorCannotCreateFile = 0,
- WebKitErrorCannotOpenFile = 1,
- WebKitErrorCannotCloseFile = 2,
- WebKitErrorCannotWriteToFile = 3,
- WebKitErrorCannotRemoveFile = 4,
- WebKitErrorCannotMoveFile = 5,
- WebKitErrorDownloadDecodingFailedMidStream = 6,
- WebKitErrorDownloadDecodingFailedToComplete = 7,
-};
-
-/*!
- @enum
@description Policy errors
@constant WebKitErrorCannotShowMIMEType
@constant WebKitErrorCannotShowURL
diff --git a/WebKit/Misc.subproj/WebKitErrors.m b/WebKit/Misc.subproj/WebKitErrors.m
index 07a504d..a715fbd 100644
--- a/WebKit/Misc.subproj/WebKitErrors.m
+++ b/WebKit/Misc.subproj/WebKitErrors.m
@@ -20,16 +20,6 @@ NSString * const WebKitErrorMIMETypeKey = @"WebKitErrorMIMETypeKey";
NSString * const WebKitErrorPlugInNameKey = @"WebKitErrorPlugInNameKey";
NSString * const WebKitErrorPlugInPageURLStringKey = @"WebKitErrorPlugInPageURLStringKey";
-// Download and file I/O errors
-#define WebKitErrorDescriptionCannotCreateFile UI_STRING("Cannot create file", "WebKitErrorCannotCreateFile description")
-#define WebKitErrorDescriptionCannotOpenFile UI_STRING("Cannot open file", "WebKitErrorCannotOpenFile description")
-#define WebKitErrorDescriptionCannotCloseFile UI_STRING("Failure occurred while closing file", "WebKitErrorCannotCloseFile description")
-#define WebKitErrorDescriptionCannotWriteToFile UI_STRING("Cannot write file", "WebKitErrorCannotWriteToFile description")
-#define WebKitErrorDescriptionCannotRemoveFile UI_STRING("Cannot remove file", "WebKitErrorCannotRemoveFile description")
-#define WebKitErrorDescriptionCannotMoveFile UI_STRING("Cannot move file", "WebKitErrorCannotMoveFile description")
-#define WebKitErrorDescriptionDownloadDecodingFailedToComplete UI_STRING_KEY("Download decoding failed", "Download decoding failed (at end)", "WebKitErrorDownloadDecodingFailedToComplete description")
-#define WebKitErrorDescriptionDownloadDecodingFailedMidStream UI_STRING_KEY("Download decoding failed", "Download decoding failed (midstream)", "WebKitErrorDownloadDecodingFailedMidStream description")
-
// Policy errors
#define WebKitErrorDescriptionCannotShowMIMEType UI_STRING("Cannot show content with specified mime type", "WebKitErrorCannotShowMIMEType description")
#define WebKitErrorDescriptionCannotShowURL UI_STRING("Cannot show URL", "WebKitErrorCannotShowURL description")
@@ -64,6 +54,8 @@ static void registerErrors(void);
pluginName:(NSString *)pluginName
MIMEType:(NSString *)MIMEType
{
+ [[self class] _registerWebKitErrors];
+
NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] init];
if (contentURLString) {
[userInfo setObject:contentURLString forKey:NSErrorFailingURLKey];
@@ -96,16 +88,6 @@ static void registerErrors()
pool = [[NSAutoreleasePool alloc] init];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
- // Download and file I/O errors
- WebKitErrorDescriptionCannotCreateFile, [NSNumber numberWithInt: WebKitErrorCannotCreateFile],
- WebKitErrorDescriptionCannotOpenFile, [NSNumber numberWithInt: WebKitErrorCannotOpenFile],
- WebKitErrorDescriptionCannotCloseFile, [NSNumber numberWithInt: WebKitErrorCannotCloseFile],
- WebKitErrorDescriptionCannotWriteToFile, [NSNumber numberWithInt: WebKitErrorCannotWriteToFile],
- WebKitErrorDescriptionCannotRemoveFile, [NSNumber numberWithInt: WebKitErrorCannotRemoveFile],
- WebKitErrorDescriptionCannotMoveFile, [NSNumber numberWithInt: WebKitErrorCannotMoveFile],
- WebKitErrorDescriptionDownloadDecodingFailedToComplete, [NSNumber numberWithInt: WebKitErrorDownloadDecodingFailedToComplete],
- WebKitErrorDescriptionDownloadDecodingFailedMidStream, [NSNumber numberWithInt: WebKitErrorDownloadDecodingFailedMidStream],
-
// Policy errors
WebKitErrorDescriptionCannotShowMIMEType, [NSNumber numberWithInt: WebKitErrorCannotShowMIMEType],
WebKitErrorDescriptionCannotShowURL, [NSNumber numberWithInt: WebKitErrorCannotShowURL],
diff --git a/WebKit/Misc.subproj/WebNSWorkspaceExtras.h b/WebKit/Misc.subproj/WebNSWorkspaceExtras.h
deleted file mode 100644
index be82fdb..0000000
--- a/WebKit/Misc.subproj/WebNSWorkspaceExtras.h
+++ /dev/null
@@ -1,19 +0,0 @@
-//
-// WebNSWorkspaceExtras.h
-// WebKit
-//
-// Created by Chris Blumenberg on Wed Dec 18 2002.
-// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-
- at interface NSWorkspace (WebNSWorkspaceExtras)
-
-// Notifies the Finder (or any other app that cares) that we added, removed or changed the attributes of a file.
-// This method is better than calling noteFileSystemChanged: because noteFileSystemChanged: sends 2 apple events
-// both with a 60 second timeout. This method returns immediately.
-- (void)_web_noteFileChangedAtPath:(NSString *)path;
-
- at end
diff --git a/WebKit/Misc.subproj/WebNSWorkspaceExtras.m b/WebKit/Misc.subproj/WebNSWorkspaceExtras.m
deleted file mode 100644
index 67d1677..0000000
--- a/WebKit/Misc.subproj/WebNSWorkspaceExtras.m
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// WebNSWorkspaceExtras.m
-// WebKit
-//
-// Created by Chris Blumenberg on Wed Dec 18 2002.
-// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
-//
-
-#import "WebNSWorkspaceExtras.h"
-
-#import <WebFoundation/WebAssertions.h>
-
- at implementation NSWorkspace (WebNSWorkspaceExtras)
-
-- (void)_web_noteFileChangedAtPath:(NSString *)path
-{
- ASSERT(path);
-
- NSString *directoryPath = [path stringByDeletingLastPathComponent];
- const char *dirRep = [directoryPath fileSystemRepresentation];
-
- // Send the notificaition that directory contents have changed.
- FNNotifyByPath(dirRep, kFNDirectoryModifiedMessage, kNilOptions);
-
- // Send a Finder event so the file attributes (including icon) update in the Finder.
-
- // Make the Finder the target of the event.
- OSType finderSignature = 'MACS';
- NSAppleEventDescriptor *target;
- target = [NSAppleEventDescriptor descriptorWithDescriptorType:typeApplSignature
- bytes:&finderSignature
- length:sizeof(OSType)];
-
- // Make the event.
- NSAppleEventDescriptor *event;
- event = [NSAppleEventDescriptor appleEventWithEventClass:kAEFinderSuite
- eventID:kAESync
- targetDescriptor:target
- returnID:0
- transactionID:0];
-
- const char *fileRep = [path fileSystemRepresentation];
- FSRef fref;
- OSStatus error = FSPathMakeRef(fileRep, &fref, NULL);
- if(error){
- return;
- }
-
- AliasHandle alias;
- error = FSNewAlias(NULL, &fref, &alias);
- if(error){
- return;
- }
-
- // Make the file the direct object of the event.
- NSAppleEventDescriptor *aliasDesc;
- aliasDesc = [NSAppleEventDescriptor descriptorWithDescriptorType:typeAlias
- bytes:*alias
- length:GetHandleSize((Handle)alias)];
- [event setParamDescriptor:aliasDesc forKeyword:keyDirectObject];
-
- DisposeHandle((Handle)alias);
-
- // Since we don't care about the result, send the event without waiting for a reply.
- // This allows us to continue without having to block until we receive the reply.
- AESendMessage([event aeDesc], NULL, kAENoReply, 0);
-}
-
-
- at end
diff --git a/WebKit/WebKit.exp b/WebKit/WebKit.exp
index ae7b8f7..02ee2c7 100644
--- a/WebKit/WebKit.exp
+++ b/WebKit/WebKit.exp
@@ -3,7 +3,6 @@
.objc_class_name_WebDataSource
.objc_class_name_WebDebugDOMNode
.objc_class_name_WebDefaultPolicyDelegate
-.objc_class_name_WebDownload
.objc_class_name_WebDynamicScrollBarsView
.objc_class_name_WebFormDelegate
.objc_class_name_WebFrame
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 2f0a26f..d0007f7 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -89,7 +89,6 @@
children = (
F52CA6C002DF9D78018635CA,
F57D194A034E732C01A80180,
- 832E269E036F952E005E2B4F,
25A8176801B5474B0ECA149E,
254DC334016E1D3F0ECA149E,
F8CA15B4029A399401000122,
@@ -113,7 +112,6 @@
F738C9E903FAD3DF0321FBE0,
F738C9EA03FAD3DF0321FBE0,
F738C9EB03FAD3DF0321FBE0,
- 936F62C1039DF33B008635CE,
);
isa = PBXGroup;
name = "Frameworks and Libraries";
@@ -191,12 +189,6 @@
657D8FA6036669FC00FA1ED0,
657D8FA7036669FF00FA1ED0,
657D8FA803666A0200FA1ED0,
- 9316400E0379832D008635CE,
- 832E26A2036F95CA005E2B4F,
- 832E26A5036F9614005E2B4F,
- 936F62BF039DF0BF008635CE,
- 83413E8F0375BCD3004719BE,
- 83413E8E0375BCD3004719BE,
39446096020F50ED0ECA1767,
F520FB1B0221DEFD01C1A525,
39446097020F50ED0ECA1767,
@@ -282,8 +274,6 @@
35081DAA02B6D4E40ACA2ACA,
35081DAC02B6D4E40ACA2ACA,
516F297003A6C45A00CA2D3A,
- 832B2D1603B10990009CF105,
- 8324709A03F32305003026AC,
2D36FD5F03F78F9E00A80166,
F7EBEEAF03F9DBA103CA0DE6,
F7EBEEB103F9DBA103CA0DE6,
@@ -326,11 +316,6 @@
F57D1954034E734901A80180,
F57D1956034E734901A80180,
F57D195A034E734901A80180,
- 9316400F0379832D008635CE,
- 832E26A6036F9614005E2B4F,
- 936F62C0039DF0BF008635CE,
- 83413E900375BCD3004719BE,
- 83413E8A0375BCBE004719BE,
394460A8020F50ED0ECA1767,
F520FB1C0221DEFD01C1A525,
394460A9020F50ED0ECA1767,
@@ -402,7 +387,6 @@
F5F81C3C02B67C26018635CA,
35081DAB02B6D4E40ACA2ACA,
35081DAD02B6D4E40ACA2ACA,
- 832B2D1703B10990009CF105,
2D81DAB503EB0B2D00A80166,
F7FE6303040C27B003CA0DE6,
F7FE6304040C27B103CA0DE6,
@@ -430,7 +414,6 @@
F5C287BB02846DCD018635CA,
F5C287BC02846DCD018635CA,
F5C287BD02846DCD018635CA,
- 936F62C2039DF33B008635CE,
F738CA5703FAD3DF0321FBE0,
F738CA5803FAD3DF0321FBE0,
F738CA5903FAD3DF0321FBE0,
@@ -511,8 +494,6 @@
F508946A02B71D59018A9CD4,
9345DDAE0365FB27008635CE,
9345DDAF0365FB27008635CE,
- 832B2D1403B10990009CF105,
- 832B2D1503B10990009CF105,
F560BEBC030DAF4401C1A526,
F560BEBD030DAF4401C1A526,
F59668C802AD2923018635CA,
@@ -1702,101 +1683,6 @@
//832
//833
//834
- 8324709903F32305003026AC = {
- fileEncoding = 4;
- isa = PBXFileReference;
- path = WebDownloadPrivate.h;
- refType = 4;
- };
- 8324709A03F32305003026AC = {
- fileRef = 8324709903F32305003026AC;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 832B2D1403B10990009CF105 = {
- fileEncoding = 30;
- isa = PBXFileReference;
- path = WebNSWorkspaceExtras.h;
- refType = 4;
- };
- 832B2D1503B10990009CF105 = {
- fileEncoding = 30;
- isa = PBXFileReference;
- path = WebNSWorkspaceExtras.m;
- refType = 4;
- };
- 832B2D1603B10990009CF105 = {
- fileRef = 832B2D1403B10990009CF105;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 832B2D1703B10990009CF105 = {
- fileRef = 832B2D1503B10990009CF105;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 832E269E036F952E005E2B4F = {
- children = (
- 83413E8B0375BCD3004719BE,
- 83413E890375BCBE004719BE,
- 9316400C0379832D008635CE,
- 9316400D0379832D008635CE,
- 832E26A3036F9614005E2B4F,
- 832E26A4036F9614005E2B4F,
- 832E26A1036F95CA005E2B4F,
- 8324709903F32305003026AC,
- 936F62BD039DF0BF008635CE,
- 936F62BE039DF0BF008635CE,
- 83413E8C0375BCD3004719BE,
- 83413E8D0375BCD3004719BE,
- );
- isa = PBXGroup;
- name = Downloads;
- path = Downloads.subproj;
- refType = 4;
- };
- 832E26A1036F95CA005E2B4F = {
- fileEncoding = 30;
- isa = PBXFileReference;
- path = WebDownloadDecoder.h;
- refType = 4;
- };
- 832E26A2036F95CA005E2B4F = {
- fileRef = 832E26A1036F95CA005E2B4F;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 832E26A3036F9614005E2B4F = {
- fileEncoding = 30;
- isa = PBXFileReference;
- path = WebDownload.h;
- refType = 4;
- };
- 832E26A4036F9614005E2B4F = {
- fileEncoding = 30;
- isa = PBXFileReference;
- path = WebDownload.m;
- refType = 4;
- };
- 832E26A5036F9614005E2B4F = {
- fileRef = 832E26A3036F9614005E2B4F;
- isa = PBXBuildFile;
- settings = {
- ATTRIBUTES = (
- Public,
- );
- };
- };
- 832E26A6036F9614005E2B4F = {
- fileRef = 832E26A4036F9614005E2B4F;
- isa = PBXBuildFile;
- settings = {
- };
- };
83402EF6035A588900BE770A = {
fileEncoding = 4;
isa = PBXFileReference;
@@ -1833,54 +1719,6 @@
settings = {
};
};
- 83413E890375BCBE004719BE = {
- fileEncoding = 30;
- isa = PBXFileReference;
- path = crc16.m;
- refType = 4;
- };
- 83413E8A0375BCBE004719BE = {
- fileRef = 83413E890375BCBE004719BE;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 83413E8B0375BCD3004719BE = {
- fileEncoding = 30;
- isa = PBXFileReference;
- path = crc16.h;
- refType = 4;
- };
- 83413E8C0375BCD3004719BE = {
- fileEncoding = 30;
- isa = PBXFileReference;
- path = WebMacBinaryDecoder.h;
- refType = 4;
- };
- 83413E8D0375BCD3004719BE = {
- fileEncoding = 30;
- isa = PBXFileReference;
- path = WebMacBinaryDecoder.m;
- refType = 4;
- };
- 83413E8E0375BCD3004719BE = {
- fileRef = 83413E8B0375BCD3004719BE;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 83413E8F0375BCD3004719BE = {
- fileRef = 83413E8C0375BCD3004719BE;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 83413E900375BCD3004719BE = {
- fileRef = 83413E8D0375BCD3004719BE;
- isa = PBXBuildFile;
- settings = {
- };
- };
83730F9803FB1E660004736E = {
fileEncoding = 4;
isa = PBXFileReference;
@@ -2149,30 +1987,6 @@
settings = {
};
};
- 9316400C0379832D008635CE = {
- fileEncoding = 4;
- isa = PBXFileReference;
- path = WebBinHexDecoder.h;
- refType = 4;
- };
- 9316400D0379832D008635CE = {
- fileEncoding = 4;
- isa = PBXFileReference;
- path = WebBinHexDecoder.m;
- refType = 4;
- };
- 9316400E0379832D008635CE = {
- fileRef = 9316400C0379832D008635CE;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 9316400F0379832D008635CE = {
- fileRef = 9316400D0379832D008635CE;
- isa = PBXBuildFile;
- settings = {
- };
- };
931A72D203265920008635CE = {
fileEncoding = 4;
isa = PBXFileReference;
@@ -2327,42 +2141,6 @@
settings = {
};
};
- 936F62BD039DF0BF008635CE = {
- fileEncoding = 4;
- isa = PBXFileReference;
- path = WebGZipDecoder.h;
- refType = 4;
- };
- 936F62BE039DF0BF008635CE = {
- fileEncoding = 4;
- isa = PBXFileReference;
- path = WebGZipDecoder.m;
- refType = 4;
- };
- 936F62BF039DF0BF008635CE = {
- fileRef = 936F62BD039DF0BF008635CE;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 936F62C0039DF0BF008635CE = {
- fileRef = 936F62BE039DF0BF008635CE;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 936F62C1039DF33B008635CE = {
- isa = PBXExecutableFileReference;
- name = libz.dylib;
- path = /usr/lib/libz.dylib;
- refType = 0;
- };
- 936F62C2039DF33B008635CE = {
- fileRef = 936F62C1039DF33B008635CE;
- isa = PBXBuildFile;
- settings = {
- };
- };
93AEB17D032C1735008635CE = {
fileEncoding = 4;
isa = PBXFileReference;
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index 9c22849..37b6100 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -7,7 +7,6 @@
#import <WebKit/WebDataProtocol.h>
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDocument.h>
-#import <WebKit/WebDownload.h>
#import <WebKit/WebException.h>
#import <WebKit/WebFramePrivate.h>
#import <WebKit/WebHTMLRepresentation.h>
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 1d27d8f..2245f0c 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -7,7 +7,6 @@
#import <WebKit/WebBridge.h>
#import <WebKit/WebDataProtocol.h>
#import <WebKit/WebDocument.h>
-#import <WebKit/WebDownload.h>
#import <WebKit/WebException.h>
#import <WebKit/WebFrameLoadDelegate.h>
#import <WebKit/WebFramePrivate.h>
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.h b/WebKit/WebView.subproj/WebMainResourceClient.h
index 6846a26..6a27872 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.h
+++ b/WebKit/WebView.subproj/WebMainResourceClient.h
@@ -10,23 +10,17 @@
#import <WebKit/WebBaseResourceHandleDelegate.h>
+ at class NSURLConnectionDelegateProxy;
@class WebPolicyDecisionListener;
@class WebDataSource;
- at interface WebResourceDelegateProxy : NSObject
-{
- id delegate;
-}
-- (void)setDelegate:(id)theDelegate;
- at end
-
@interface WebMainResourceClient : WebBaseResourceHandleDelegate
{
int _contentLength; // for logging only
int _bytesReceived; // for logging only
WebPolicyDecisionListener *listener;
NSURLResponse *policyResponse;
- WebResourceDelegateProxy *proxy;
+ NSURLConnectionDelegateProxy *proxy;
}
- initWithDataSource:(WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 8793c96..1b729b0 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -12,16 +12,15 @@
#import <WebFoundation/WebNSURLExtras.h>
#import <WebFoundation/NSURLConnection.h>
#import <WebFoundation/NSURLConnectionPrivate.h>
+#import <WebFoundation/NSURLDownloadPrivate.h>
#import <WebFoundation/NSURLRequest.h>
#import <WebFoundation/NSURLRequestPrivate.h>
#import <WebFoundation/NSURLResponse.h>
#import <WebFoundation/NSURLResponsePrivate.h>
-
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDefaultPolicyDelegate.h>
#import <WebKit/WebDocument.h>
-#import <WebKit/WebDownloadPrivate.h>
#import <WebKit/WebFrameLoadDelegate.h>
#import <WebKit/WebFrameView.h>
#import <WebKit/WebFramePrivate.h>
@@ -42,7 +41,7 @@
if (self) {
[self setDataSource:ds];
- proxy = [[WebResourceDelegateProxy alloc] init];
+ proxy = [[NSURLConnectionDelegateProxy alloc] init];
[proxy setDelegate:self];
}
@@ -171,11 +170,11 @@
case WebPolicyDownload:
[proxy setDelegate:nil];
- [WebDownload _downloadWithLoadingResource:connection
- request:request
- response:r
- delegate:[self downloadDelegate]
- proxy:proxy];
+ [NSURLDownload _downloadWithLoadingResource:connection
+ request:request
+ response:r
+ delegate:[self downloadDelegate]
+ proxy:proxy];
[proxy release];
proxy = nil;
[self receivedError:[self interruptForPolicyChangeError]];
@@ -325,41 +324,3 @@
@end
- at implementation WebResourceDelegateProxy
-
-- (void)setDelegate:(id)theDelegate
-{
- delegate = theDelegate;
-}
-
-- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse
-{
- ASSERT(delegate);
- return [delegate connection:connection willSendRequest:request redirectResponse:redirectResponse];
-}
-
-- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
-{
- ASSERT(delegate);
- [delegate connection:connection didReceiveResponse:response];
-}
-
-- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
-{
- ASSERT(delegate);
- [delegate connection:connection didReceiveData:data];
-}
-
-- (void)connectionDidFinishLoading:(NSURLConnection *)connection
-{
- ASSERT(delegate);
- [delegate connectionDidFinishLoading:connection];
-}
-
-- (void)connection:(NSURLConnection *)connection didFailLoadingWithError:(NSError *)error
-{
- ASSERT(delegate);
- [delegate connection:connection didFailLoadingWithError:error];
-}
-
- at end
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.h b/WebKit/WebView.subproj/WebMainResourceLoader.h
index 6846a26..6a27872 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.h
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.h
@@ -10,23 +10,17 @@
#import <WebKit/WebBaseResourceHandleDelegate.h>
+ at class NSURLConnectionDelegateProxy;
@class WebPolicyDecisionListener;
@class WebDataSource;
- at interface WebResourceDelegateProxy : NSObject
-{
- id delegate;
-}
-- (void)setDelegate:(id)theDelegate;
- at end
-
@interface WebMainResourceClient : WebBaseResourceHandleDelegate
{
int _contentLength; // for logging only
int _bytesReceived; // for logging only
WebPolicyDecisionListener *listener;
NSURLResponse *policyResponse;
- WebResourceDelegateProxy *proxy;
+ NSURLConnectionDelegateProxy *proxy;
}
- initWithDataSource:(WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 8793c96..1b729b0 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -12,16 +12,15 @@
#import <WebFoundation/WebNSURLExtras.h>
#import <WebFoundation/NSURLConnection.h>
#import <WebFoundation/NSURLConnectionPrivate.h>
+#import <WebFoundation/NSURLDownloadPrivate.h>
#import <WebFoundation/NSURLRequest.h>
#import <WebFoundation/NSURLRequestPrivate.h>
#import <WebFoundation/NSURLResponse.h>
#import <WebFoundation/NSURLResponsePrivate.h>
-
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDefaultPolicyDelegate.h>
#import <WebKit/WebDocument.h>
-#import <WebKit/WebDownloadPrivate.h>
#import <WebKit/WebFrameLoadDelegate.h>
#import <WebKit/WebFrameView.h>
#import <WebKit/WebFramePrivate.h>
@@ -42,7 +41,7 @@
if (self) {
[self setDataSource:ds];
- proxy = [[WebResourceDelegateProxy alloc] init];
+ proxy = [[NSURLConnectionDelegateProxy alloc] init];
[proxy setDelegate:self];
}
@@ -171,11 +170,11 @@
case WebPolicyDownload:
[proxy setDelegate:nil];
- [WebDownload _downloadWithLoadingResource:connection
- request:request
- response:r
- delegate:[self downloadDelegate]
- proxy:proxy];
+ [NSURLDownload _downloadWithLoadingResource:connection
+ request:request
+ response:r
+ delegate:[self downloadDelegate]
+ proxy:proxy];
[proxy release];
proxy = nil;
[self receivedError:[self interruptForPolicyChangeError]];
@@ -325,41 +324,3 @@
@end
- at implementation WebResourceDelegateProxy
-
-- (void)setDelegate:(id)theDelegate
-{
- delegate = theDelegate;
-}
-
-- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse
-{
- ASSERT(delegate);
- return [delegate connection:connection willSendRequest:request redirectResponse:redirectResponse];
-}
-
-- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
-{
- ASSERT(delegate);
- [delegate connection:connection didReceiveResponse:response];
-}
-
-- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
-{
- ASSERT(delegate);
- [delegate connection:connection didReceiveData:data];
-}
-
-- (void)connectionDidFinishLoading:(NSURLConnection *)connection
-{
- ASSERT(delegate);
- [delegate connectionDidFinishLoading:connection];
-}
-
-- (void)connection:(NSURLConnection *)connection didFailLoadingWithError:(NSError *)error
-{
- ASSERT(delegate);
- [delegate connection:connection didFailLoadingWithError:error];
-}
-
- at end
diff --git a/WebKit/WebView.subproj/WebView.h b/WebKit/WebView.subproj/WebView.h
index 05ff816..cc40259 100644
--- a/WebKit/WebView.subproj/WebView.h
+++ b/WebKit/WebView.subproj/WebView.h
@@ -11,9 +11,9 @@
@class WebHistoryItem;
@class WebViewPrivate;
@class WebDataSource;
- at class WebDownload;
@class WebFrame;
@class NSURLConnection;
+ at class NSURLDownload;
@class WebPreferences;
@class WebFrameView;
@@ -123,16 +123,16 @@ extern NSString *WebElementLinkLabelKey; // NSString of the text within the anch
/*!
@method setDownloadDelegate:
- @abstract Set the WebView's WebDownloadDelegate.
- @discussion The download delegate is retained by WebDownload when any downloads are in progress.
- @param delegate The WebDownloadDelegate to set as the download delegate.
+ @abstract Set the WebView's NSURLDownloadDelegate.
+ @discussion The download delegate is retained by NSURLDownload when any downloads are in progress.
+ @param delegate The NSURLDownloadDelegate to set as the download delegate.
*/
- (void)setDownloadDelegate: (id)delegate;
/*!
@method downloadDelegate
- @abstract Return the WebView's WebDownloadDelegate.
- @result The WebView's WebDownloadDelegate.
+ @abstract Return the WebView's NSURLDownloadDelegate.
+ @result The WebView's NSURLDownloadDelegate.
*/
- (id)downloadDelegate;
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index 01cf327..3ae2cdd 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -10,7 +10,6 @@
#import <WebKit/WebDefaultPolicyDelegate.h>
#import <WebKit/WebDefaultResourceLoadDelegate.h>
#import <WebKit/WebDefaultUIDelegate.h>
-#import <WebKit/WebDownloadPrivate.h>
#import <WebKit/WebFormDelegatePrivate.h>
#import <WebKit/WebFrameLoadDelegate.h>
#import <WebKit/WebFramePrivate.h>
@@ -29,6 +28,7 @@
#import <WebFoundation/WebNSDataExtras.h>
#import <WebFoundation/WebNSStringExtras.h>
#import <WebFoundation/NSURLConnection.h>
+#import <WebFoundation/NSURLDownloadPrivate.h>
#import <WebFoundation/NSURLRequest.h>
#import <WebCore/WebCoreSettings.h>
@@ -229,7 +229,7 @@
ASSERT(URL);
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:URL];
- WebDownload *download = [[WebDownload alloc] initWithRequest:request];
+ NSURLDownload *download = [[NSURLDownload alloc] initWithRequest:request];
[request release];
if (directory != nil && [directory isAbsolutePath]) {
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list