Skip to content

Commit 3c95402

Browse files
committed
Rubber stamped by Eric.
- add new files to build, fix link stubs. * WebCore.vcproj/WebCore/WebCore.vcproj: * platform/win/TemporaryLinkStubs.cpp: (KWQKCookieJar::cookieEnabled): (WebCore::TransferJob::retrieveCharset): (WebCore::TransferJob::assembleResponseHeaders): (WebCore::TransferJob::~TransferJob): * platform/win/TransferJobWin.cpp: Added. Canonical link: https://commits.webkit.org/11089@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@13115 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 3a23ce5 commit 3c95402

4 files changed

Lines changed: 177 additions & 10 deletions

File tree

WebCore/ChangeLog

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
2006-03-03 Maciej Stachowiak <mjs@apple.com>
2+
3+
Rubber stamped by Eric.
4+
5+
- add new files to build, fix link stubs.
6+
7+
* WebCore.vcproj/WebCore/WebCore.vcproj:
8+
* platform/win/TemporaryLinkStubs.cpp:
9+
(KWQKCookieJar::cookieEnabled):
10+
(WebCore::TransferJob::retrieveCharset):
11+
(WebCore::TransferJob::assembleResponseHeaders):
12+
(WebCore::TransferJob::~TransferJob):
13+
* platform/win/TransferJobWin.cpp: Added.
14+
115
2006-03-03 Maciej Stachowiak <mjs@apple.com>
216

317
- add file I forgot in my last commit.

WebCore/WebCore.vcproj/WebCore/WebCore.vcproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,22 @@
17681768
RelativePath="..\..\platform\Timer.h"
17691769
>
17701770
</File>
1771+
<File
1772+
RelativePath="..\..\platform\TransferJob.cpp"
1773+
>
1774+
</File>
1775+
<File
1776+
RelativePath="..\..\platform\TransferJob.h"
1777+
>
1778+
</File>
1779+
<File
1780+
RelativePath="..\..\platform\TransferJobClient.h"
1781+
>
1782+
</File>
1783+
<File
1784+
RelativePath="..\..\platform\TransferJobInternal.h"
1785+
>
1786+
</File>
17711787
<File
17721788
RelativePath="..\..\platform\WheelEvent.h"
17731789
>

WebCore/platform/win/TemporaryLinkStubs.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "KWQSlider.h"
1818
#include "Cursor.h"
1919
#include "loader.h"
20-
#include "KWQKJobClasses.h"
2120
#include "FrameView.h"
2221
#include "KWQScrollBar.h"
2322
#include "KWQObject.h"
@@ -35,6 +34,7 @@
3534
#include "render_theme.h"
3635
#include "FrameWin.h"
3736
#include "BrowserExtensionWin.h"
37+
#include "TransferJob.h"
3838

3939
using namespace WebCore;
4040

@@ -198,13 +198,6 @@ void KWQFindSentenceBoundary(QChar const*,int,int,int*,int*) { notImplemented();
198198
int KWQFindNextWordFromIndex(QChar const*,int,int,bool) { notImplemented(); return 0; }
199199
void KWQFindWordBoundary(QChar const*,int,int,int*,int*) { notImplemented(); }
200200
bool KWQKCookieJar::cookieEnabled() { notImplemented(); return false; }
201-
void WebCore::TransferJob::kill() { notImplemented(); }
202-
void WebCore::TransferJob::addMetaData(KXMLCore::HashMap<String,String> const&) { notImplemented(); }
203-
QString WebCore::TransferJob::queryMetaData(QString const&) const { notImplemented(); return QString(); }
204-
int WebCore::TransferJob::error() const { notImplemented(); return 0; }
205-
QString WebCore::TransferJob::errorText() const { notImplemented(); return "Houston, we have a problem."; }
206-
bool WebCore::TransferJob::isErrorPage() const { notImplemented(); return 0; }
207-
WebCore::TransferJob::TransferJob(WebCore::TransferJobClient*, const String&, KURL const&,WebCore::FormData const&) { notImplemented(); }
208201
PluginInfo*PlugInInfoStore::createPluginInfoForPluginAtIndex(unsigned) { notImplemented(); return 0;}
209202
unsigned PlugInInfoStore::pluginCount() const { notImplemented(); return 0; }
210203
void WebCore::refreshPlugins(bool) { notImplemented(); }
@@ -282,6 +275,9 @@ void QComboBox::setFont(WebCore::Font const&) { notImplemented(); }
282275
void QTextEdit::setFont(WebCore::Font const&) { notImplemented(); }
283276
void QTextEdit::setWritingDirection(enum WebCore::TextDirection) { notImplemented(); }
284277
GraphicsContext::GraphicsContext() { notImplemented(); }
278+
void WebCore::TransferJob::retrieveCharset() const { notImplemented(); }
279+
void WebCore::TransferJob::assembleResponseHeaders(void)const { notImplemented(); }
280+
WebCore::TransferJob::~TransferJob(void) { notImplemented(); }
285281

286282
// Completely empty stubs (mostly to allow DRT to run):
287283
bool WebCore::historyContains(QString const&) { return false; }
@@ -340,8 +336,6 @@ int ScrollView::contentsWidth() const { return 1000; }
340336
void ScrollView::viewportToContents(int x1, int y1, int& x2, int& y2) { x2 = x1; y2 = y1; }
341337
void ScrollView::setStaticBackground(bool) { }
342338

343-
TransferJob::TransferJob(WebCore::TransferJobClient*,const String&,KURL const&) { }
344-
void TransferJob::addMetaData(QString const&,QString const&) { }
345339
bool TransferJob::start(class WebCore::DocLoader *){ return false; }
346340

347341
Font const& GraphicsContext::font() const { return localFont; }
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/*
2+
* Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21+
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
#import "config.h"
27+
#import "TransferJob.h"
28+
29+
#import "TransferJobInternal.h"
30+
31+
#import "FoundationExtras.h"
32+
#import "KURL.h"
33+
#import "KWQExceptions.h"
34+
#import "KWQLoader.h"
35+
#import "Logging.h"
36+
#import "KWQResourceLoader.h"
37+
#import "formdata.h"
38+
#import "MacFrame.h"
39+
#import "WebCoreFrameBridge.h"
40+
#import "DocLoader.h"
41+
#import "KWQFormData.h"
42+
#import "KWQLoader.h"
43+
44+
namespace WebCore {
45+
46+
TransferJobInternal::~TransferJobInternal()
47+
{
48+
KWQRelease(response);
49+
KWQRelease(loader);
50+
}
51+
52+
TransferJob::~TransferJob()
53+
{
54+
// This will cancel the handle, and who knows what that could do
55+
KWQ_BLOCK_EXCEPTIONS;
56+
[d->loader jobWillBeDeallocated];
57+
KWQ_UNBLOCK_EXCEPTIONS;
58+
delete d;
59+
}
60+
61+
bool TransferJob::start(DocLoader* docLoader)
62+
{
63+
MacFrame *frame = Mac(docLoader->frame());
64+
65+
if (!frame) {
66+
delete this;
67+
return false;
68+
}
69+
70+
WebCoreFrameBridge* bridge = frame->bridge();
71+
72+
frame->didTellBridgeAboutLoad(url().url());
73+
74+
KWQ_BLOCK_EXCEPTIONS;
75+
KWQResourceLoader* resourceLoader = [[KWQResourceLoader alloc] initWithJob:this];
76+
77+
id <WebCoreResourceHandle> handle;
78+
79+
NSDictionary* headerDict = nil;
80+
QString headerString = queryMetaData("customHTTPHeader");
81+
82+
if (!headerString.isEmpty())
83+
headerDict = [NSDictionary _webcore_dictionaryWithHeaderString:headerString.getNSString()];
84+
85+
if (postData().count() > 0) {
86+
handle = [bridge startLoadingResource:resourceLoader withMethod:method() URL:url().getNSURL() customHeaders:headerDict
87+
postData:arrayFromFormData(postData())];
88+
} else {
89+
handle = [bridge startLoadingResource:resourceLoader withMethod:method() URL:url().getNSURL() customHeaders:headerDict];
90+
}
91+
[resourceLoader setHandle:handle];
92+
[resourceLoader release];
93+
return handle != nil;
94+
KWQ_UNBLOCK_EXCEPTIONS;
95+
96+
return true;
97+
}
98+
99+
void TransferJob::assembleResponseHeaders() const
100+
{
101+
if (!d->assembledResponseHeaders) {
102+
if ([d->response isKindOfClass:[NSHTTPURLResponse class]]) {
103+
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)d->response;
104+
NSDictionary *headers = [httpResponse allHeaderFields];
105+
d->responseHeaders = QString::fromNSString(KWQHeaderStringFromDictionary(headers, [httpResponse statusCode]));
106+
}
107+
d->assembledResponseHeaders = true;
108+
}
109+
}
110+
111+
void TransferJob::retrieveCharset() const
112+
{
113+
if (!d->retrievedCharset) {
114+
NSString *charset = [d->response textEncodingName];
115+
if (charset)
116+
d->metaData.set("charset", charset);
117+
d->retrievedCharset = true;
118+
}
119+
}
120+
121+
void TransferJob::setLoader(KWQResourceLoader *loader)
122+
{
123+
KWQRetain(loader);
124+
KWQRelease(d->loader);
125+
d->loader = loader;
126+
}
127+
128+
void TransferJob::receivedResponse(NSURLResponse* response)
129+
{
130+
d->assembledResponseHeaders = false;
131+
d->retrievedCharset = false;
132+
d->response = response;
133+
KWQRetain(d->response);
134+
if (d->client)
135+
d->client->receivedResponse(this, response);
136+
}
137+
138+
void TransferJob::cancel()
139+
{
140+
[d->loader jobCanceledLoad];
141+
}
142+
143+
} // namespace WebCore

0 commit comments

Comments
 (0)