+t2006-10-29 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - eliminate use of NSArray to carry form data around
+
+ * WebCore.exp:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bridge/mac/FormDataMac.h: Removed.
+ * bridge/mac/FormDataMac.mm: Removed.
+ * bridge/mac/FrameMac.h:
+ * bridge/mac/WebCoreFrameBridge.h:
+ * bridge/mac/WebCoreFrameBridge.mm:
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::submit):
+ * loader/FormData.h:
+ (WebCore::FormData::isEmpty):
+ * loader/mac/FrameLoader.h:
+ * loader/mac/FrameLoader.mm:
+ (WebCore::FrameLoader::load):
+ (WebCore::FrameLoader::post):
+ (WebCore::FrameLoader::loadEmptyDocumentSynchronously):
+ (WebCore::FrameLoader::loadResourceSynchronously):
+ * loader/mac/LoaderFunctionsMac.mm:
+ (WebCore::ServeSynchronousRequest):
+ * loader/mac/WebFormDataStream.h:
+ * loader/mac/WebFormDataStream.m:
+ (WebCore::pairRetain):
+ (WebCore::pairRelease):
+ (WebCore::pairEqual):
+ (WebCore::pairHash):
+ (WebCore::closeCurrentStream):
+ (WebCore::scheduleWithPair):
+ (WebCore::advanceCurrentStream):
+ (WebCore::openNextStream):
+ (WebCore::formCreate):
+ (WebCore::formFinalize):
+ (WebCore::formOpen):
+ (WebCore::formRead):
+ (WebCore::formCanRead):
+ (WebCore::formClose):
+ (WebCore::formSchedule):
+ (WebCore::formUnschedule):
+ (WebCore::formEventCallback):
+ (WebCore::setHTTPBody):
+ * loader/mac/WebSubresourceLoader.h:
+ * loader/mac/WebSubresourceLoader.mm:
+ (WebCore::SubresourceLoader::create):
+ * platform/network/mac/ResourceLoaderMac.mm:
+
2006-10-29 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
_urlOriginalDataAsString
_urlWithData
_urlWithDataRelativeToURL
-_webSetHTTPBody
_wkCGContextGetShouldSmoothFonts
_wkClearGlyphVector
_wkConvertCharToGlyphs
93F199EC08245E59001E9ABC /* XSLStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F24A06D18A7E004A6FA3 /* XSLStyleSheet.h */; };
93F199ED08245E59001E9ABC /* XSLTProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F24C06D18A7E004A6FA3 /* XSLTProcessor.h */; };
93F199EE08245E59001E9ABC /* FormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 93ABCE5E06E1A42E0085925B /* FormData.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 93F199EF08245E59001E9ABC /* FormDataMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B641F206E28C5C0055F610 /* FormDataMac.h */; };
93F199F008245E59001E9ABC /* WebCoreView.h in Headers */ = {isa = PBXBuildFile; fileRef = BE855F7F0701E83500239769 /* WebCoreView.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F199F108245E59001E9ABC /* WebDashboardRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = 5150C2A10702629000AF642C /* WebDashboardRegion.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F19A1808245E59001E9ABC /* DeprecatedCString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F58784D502DE375901EA4122 /* DeprecatedCString.cpp */; };
93F19B0308245E59001E9ABC /* XSLStyleSheet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC06F24906D18A7E004A6FA3 /* XSLStyleSheet.cpp */; };
93F19B0408245E59001E9ABC /* XSLTProcessor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC06F24B06D18A7E004A6FA3 /* XSLTProcessor.cpp */; };
93F19B0508245E59001E9ABC /* FormData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93ABCE5D06E1A42E0085925B /* FormData.cpp */; };
- 93F19B0608245E59001E9ABC /* FormDataMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93B641F106E28C5C0055F610 /* FormDataMac.mm */; };
93F19B0708245E59001E9ABC /* WebCoreView.m in Sources */ = {isa = PBXBuildFile; fileRef = BE8560510701F91100239769 /* WebCoreView.m */; };
93F19B0808245E59001E9ABC /* WebDashboardRegion.m in Sources */ = {isa = PBXBuildFile; fileRef = 5150C2A50702629800AF642C /* WebDashboardRegion.m */; };
93F19B1308245E59001E9ABC /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5C2869302846DCD018635CA /* ApplicationServices.framework */; };
656D371E0ADBA5DE00A4554D /* WebDocumentLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebDocumentLoader.h; sourceTree = "<group>"; };
656D371F0ADBA5DE00A4554D /* WebDocumentLoader.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = WebDocumentLoader.mm; sourceTree = "<group>"; };
656D37200ADBA5DE00A4554D /* WebFormDataStream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebFormDataStream.h; sourceTree = "<group>"; };
- 656D37210ADBA5DE00A4554D /* WebFormDataStream.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WebFormDataStream.m; sourceTree = "<group>"; };
+ 656D37210ADBA5DE00A4554D /* WebFormDataStream.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = WebFormDataStream.m; sourceTree = "<group>"; };
656D37220ADBA5DE00A4554D /* WebFormState.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebFormState.h; sourceTree = "<group>"; };
656D37230ADBA5DE00A4554D /* WebFormState.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = WebFormState.mm; sourceTree = "<group>"; };
656D37240ADBA5DE00A4554D /* FrameLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FrameLoader.h; sourceTree = "<group>"; };
93AE23200AAB521B00CD8A35 /* TextEncodingRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextEncodingRegistry.cpp; sourceTree = "<group>"; };
93B0FD880A759BED0080AD44 /* StringImplMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = StringImplMac.mm; sourceTree = "<group>"; };
93B0FD890A759BED0080AD44 /* StringMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = StringMac.mm; sourceTree = "<group>"; };
- 93B641F106E28C5C0055F610 /* FormDataMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FormDataMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
- 93B641F206E28C5C0055F610 /* FormDataMac.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = FormDataMac.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
93B70D4109EB0C7C009D8468 /* JSXMLHttpRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequest.cpp; sourceTree = "<group>"; };
93B70D4209EB0C7C009D8468 /* JSXMLHttpRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSXMLHttpRequest.h; sourceTree = "<group>"; };
93B70D4509EB0C7C009D8468 /* JSXSLTProcessor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSXSLTProcessor.cpp; sourceTree = "<group>"; };
55998A5D052B59CC0017A6C1 /* AXObjectCacheMac.mm */,
BCEA4945097F0F770094C9E4 /* BrowserExtensionMac.h */,
BCEA4946097F0F770094C9E4 /* BrowserExtensionMac.mm */,
- 93B641F206E28C5C0055F610 /* FormDataMac.h */,
- 93B641F106E28C5C0055F610 /* FormDataMac.mm */,
65BF023B0974819000C43196 /* FrameMac.h */,
65BF023C0974819000C43196 /* FrameMac.mm */,
9380F68609A143B2001FDB34 /* FrameViewMac.mm */,
93F199EC08245E59001E9ABC /* XSLStyleSheet.h in Headers */,
93F199ED08245E59001E9ABC /* XSLTProcessor.h in Headers */,
93F199EE08245E59001E9ABC /* FormData.h in Headers */,
- 93F199EF08245E59001E9ABC /* FormDataMac.h in Headers */,
93F199F008245E59001E9ABC /* WebCoreView.h in Headers */,
93F199F108245E59001E9ABC /* WebDashboardRegion.h in Headers */,
550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */,
93F19B0308245E59001E9ABC /* XSLStyleSheet.cpp in Sources */,
93F19B0408245E59001E9ABC /* XSLTProcessor.cpp in Sources */,
93F19B0508245E59001E9ABC /* FormData.cpp in Sources */,
- 93F19B0608245E59001E9ABC /* FormDataMac.mm in Sources */,
93F19B0708245E59001E9ABC /* WebCoreView.m in Sources */,
93F19B0808245E59001E9ABC /* WebDashboardRegion.m in Sources */,
550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */,
+++ /dev/null
-/*
- * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-namespace WebCore {
-
- class FormData;
-
- NSArray *arrayFromFormData(const FormData&);
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#import "FormDataMac.h"
-
-#import <wtf/Assertions.h>
-#import "FormData.h"
-
-namespace WebCore {
-
-NSArray *arrayFromFormData(const FormData &d)
-{
- size_t n = d.elements().size();
- NSMutableArray *a = [NSMutableArray arrayWithCapacity:n];
- for (size_t i = 0; i < n; ++i) {
- const FormDataElement& e = d.elements()[i];
- if (e.m_type == FormDataElement::data)
- [a addObject:[NSData dataWithBytes:e.m_data.data() length:e.m_data.size()]];
- else {
- ASSERT(e.m_type == FormDataElement::encodedFile);
- [a addObject:e.m_filename];
- }
- }
- return a;
-}
-
-}
virtual Plugin* createPlugin(Element*, const KURL&,
const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType);
- void clear(bool clearWindowProperties = true);
+ virtual void clear(bool clearWindowProperties = true);
void setBridge(WebCoreFrameBridge* p);
WebCoreFrameBridge* bridge() const { return _bridge; }
+
virtual void setView(FrameView*);
virtual void frameDetached();
bool passSubframeEventToSubframe(MouseEventWithHitTestResults&, Frame* subframePart);
bool passWheelEventToWidget(Widget*);
- NSString* searchForLabelsAboveCell(RegularExpression* regExp, HTMLTableCellElement* cell);
+ NSString* searchForLabelsAboveCell(RegularExpression*, HTMLTableCellElement*);
NSString* searchForLabelsBeforeElement(NSArray* labels, Element* element);
NSString* matchLabelsAgainstElement(NSArray* labels, Element* element);
- (NSURL*)originalRequestURL;
- (void)frameDetached;
- (void)receivedData:(NSData *)data textEncodingName:(NSString *)textEncodingName;
-- (NSData *)syncLoadResourceWithMethod:(NSString *)method URL:(NSURL *)URL customHeaders:(NSDictionary *)requestHeaders postData:(NSArray *)postData finalURL:(NSURL **)finalNSURL responseHeaders:(NSDictionary **)responseHeaderDict statusCode:(int *)statusCode;
@end
[self addData:data];
}
-- (NSData *)syncLoadResourceWithMethod:(NSString *)method URL:(NSURL *)URL customHeaders:(NSDictionary *)requestHeaders postData:(NSArray *)postData finalURL:(NSURL **)finalURL responseHeaders:(NSDictionary **)responseHeaderDict statusCode:(int *)statusCode
-{
- // Since this is a subresource, we can load any URL (we ignore the return value).
- // But we still want to know whether we should hide the referrer or not, so we call the canLoadURL method.
- String referrer = m_frame->referrer();
- bool hideReferrer;
- m_frame->loader()->canLoad(URL, referrer, hideReferrer);
- if (hideReferrer)
- referrer = String();
-
- NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:URL];
- [request setTimeoutInterval:10];
-
- // setHTTPMethod is not called for GET requests to work around <rdar://4464032>.
- if (![method isEqualToString:@"GET"])
- [request setHTTPMethod:method];
-
- if (postData)
- webSetHTTPBody(request, postData);
-
- NSEnumerator *e = [requestHeaders keyEnumerator];
- NSString *key;
- while ((key = (NSString *)[e nextObject]) != nil) {
- [request addValue:[requestHeaders objectForKey:key] forHTTPHeaderField:key];
- }
-
- if (isConditionalRequest(request))
- [request setCachePolicy:NSURLRequestReloadIgnoringCacheData];
- else
- [request setCachePolicy:[m_frame->loader()->documentLoader()->request() cachePolicy]];
-
- if (!referrer.isNull())
- setHTTPReferrer(request, referrer);
-
- [request setMainDocumentURL:[m_frame->page()->mainFrame()->loader()->documentLoader()->request() URL]];
- [request setValue:m_frame->loader()->client()->userAgent([request URL]) forHTTPHeaderField:@"User-Agent"];
-
- NSError *error = nil;
- id identifier = nil;
- NSURLRequest *newRequest = m_frame->loader()->requestFromDelegate(request, identifier, error);
-
- NSURLResponse *response = nil;
- NSData *result = nil;
- if (error == nil) {
- ASSERT(newRequest != nil);
- result = [NSURLConnection sendSynchronousRequest:newRequest returningResponse:&response error:&error];
- }
-
- if (error == nil) {
- *finalURL = [response URL];
- if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
- NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
- *responseHeaderDict = [httpResponse allHeaderFields];
- *statusCode = [httpResponse statusCode];
- } else {
- *responseHeaderDict = [NSDictionary dictionary];
- *statusCode = 200;
- }
- } else {
- *finalURL = URL;
- *responseHeaderDict = [NSDictionary dictionary];
- if ([error domain] == NSURLErrorDomain)
- *statusCode = [error code];
- else
- *statusCode = 404;
- }
-
- m_frame->loader()->sendRemainingDelegateMessages(identifier, response, [result length], error);
- [request release];
-
- return result;
-}
-
// -------------------
- (FrameMac*)_frame
return m_doingsubmit;
}
-void HTMLFormElement::submit( bool activateSubmitButton )
+void HTMLFormElement::submit(bool activateSubmitButton)
{
FrameView *view = document()->view();
Frame *frame = document()->frame();
frame->clearRecordedFormValues();
for (unsigned i = 0; i < formElements.size(); ++i) {
HTMLGenericFormElement* current = formElements[i];
- // Our app needs to get form values for password fields for doing password autocomplete,
- // so we are more lenient in pushing values, and let the app decide what to save when.
if (current->hasLocalName(inputTag)) {
- HTMLInputElement *input = static_cast<HTMLInputElement*>(current);
+ HTMLInputElement* input = static_cast<HTMLInputElement*>(current);
if (input->isTextField()) {
- frame->recordFormValue(input->name().deprecatedString(), input->value().deprecatedString(), this);
+ frame->recordFormValue(input->name(), input->value(), this);
if (input->renderer() && input->inputType() == HTMLInputElement::SEARCH)
static_cast<RenderLineEdit*>(input->renderer())->addSearchResult();
}
}
-
if (needButtonActivation) {
if (current->isActivatedSubmit())
needButtonActivation = false;
void flatten(Vector<char>&) const; // omits files
String flattenToString() const; // omits files
+ bool isEmpty() const { return m_elements.isEmpty(); }
const Vector<FormDataElement>& elements() const { return m_elements; }
private:
#ifdef __OBJC__
-@class WebCoreFrameBridge;
@class WebCorePageState;
-@class NSArray;
+@class NSData;
@class NSDate;
-@class NSURL;
-@class NSURLConnection;
-@class NSURLRequest;
-@class NSURLResponse;
@class NSDictionary;
-@class NSEvent;
@class NSError;
-@class NSData;
+@class NSEvent;
@class NSMutableURLRequest;
+@class NSURL;
@class NSURLAuthenticationChallenge;
+@class NSURLConnection;
+@class NSURLRequest;
+@class NSURLResponse;
@protocol WebCoreResourceLoader;
@protocol WebCoreResourceHandle;
#else
-class WebCoreFrameBridge;
class WebCorePageState;
-class NSArray;
+class NSData;
class NSDate;
-class NSURL;
-class NSURLConnection;
-class NSURLRequest;
-class NSURLResponse;
class NSDictionary;
-class NSEvent;
class NSError;
-class NSData;
+class NSEvent;
class NSMutableURLRequest;
+class NSURL;
class NSURLAuthenticationChallenge;
+class NSURLConnection;
+class NSURLRequest;
+class NSURLResponse;
#endif // __OBJC__
class DocumentLoader;
class Element;
+ class FormData;
class FormState;
class Frame;
class FrameLoadRequest;
class FrameLoaderClient;
+ class KURL;
class MainResourceLoader;
+ class ResourceRequest;
class String;
class SubresourceLoader;
class WebResourceLoader;
void safeLoad(NSURL *);
void load(const FrameLoadRequest&, bool userGesture, NSEvent* triggeringEvent,
Element* submitForm, const HashMap<String, String>& formValues);
- void load(NSURL *, const String& referrer, FrameLoadType, const String& target, NSEvent *event,
- Element* form, const HashMap<String, String>& formValues);
- void post(NSURL *, const String& referrer, const String& target, NSArray *postData, const String& contentType, NSEvent *,
- Element* form, const HashMap<String, String>&);
+ void load(NSURL *, const String& referrer, FrameLoadType, const String& target,
+ NSEvent *event, Element* form, const HashMap<String, String>& formValues);
+ void post(NSURL *, const String& referrer, const String& target,
+ const FormData&, const String& contentType,
+ NSEvent *, Element* form, const HashMap<String, String>&);
void load(NSURLRequest *);
void load(NSURLRequest *, const String& frameName);
void load(NSURLRequest *, NSDictionary *triggeringAaction, FrameLoadType, PassRefPtr<FormState>);
bool canLoad(NSURL *, const String& referrer, bool& hideReferrer);
+ void loadResourceSynchronously(const ResourceRequest&,
+ KURL& finalURL, NSDictionary *& responseHeaders, int& statusCode, Vector<char>& data);
+
// Also not cool.
void stopLoadingPlugIns();
void stopLoadingSubresources();
#import "Document.h"
#import "DOMElementInternal.h"
#import "Element.h"
-#import "FormDataMac.h"
#import "FrameLoadRequest.h"
#import "FrameMac.h"
#import "FramePrivate.h"
(request.m_frameName.length() ? (NSString *)request.m_frameName : nil), triggeringEvent, submitForm, formValues);
} else
post(request.m_request.url().getNSURL(), referrer, (request.m_frameName.length() ? (NSString *)request.m_frameName : nil),
- arrayFromFormData(request.m_request.httpBody()), request.m_request.httpContentType(), triggeringEvent, submitForm, formValues);
+ request.m_request.httpBody(), request.m_request.httpContentType(), triggeringEvent, submitForm, formValues);
if (targetFrame && targetFrame != m_frame)
[Mac(targetFrame)->bridge() activateWindow];
sendRemainingDelegateMessages(identifier, response, length, error);
}
-void FrameLoader::post(NSURL *URL, const String& referrer, const String& frameName, NSArray *postData,
+void FrameLoader::post(NSURL *URL, const String& referrer, const String& frameName, const FormData& formData,
const String& contentType, NSEvent *event, Element* form, const HashMap<String, String>& formValues)
{
// When posting, use the NSURLRequestReloadIgnoringCacheData load flag.
setHTTPReferrer(request, referrer);
[request setHTTPMethod:@"POST"];
- webSetHTTPBody(request, postData);
+ setHTTPBody(request, formData);
[request setValue:contentType forHTTPHeaderField:@"Content-Type"];
NSDictionary *action = actionInformation(FrameLoadTypeStandard, true, event, URL);
{
NSURL *url = [[NSURL alloc] initWithString:@""];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
- m_frame->loader()->load(request);
+ load(request);
[request release];
[url release];
}
+void FrameLoader::loadResourceSynchronously(const ResourceRequest& request,
+ KURL& finalURL, NSDictionary *& responseHeaders, int& statusCode, Vector<char>& data)
+{
+#if 0
+ NSDictionary *headerDict = nil;
+ const HTTPHeaderMap& requestHeaders = request.httpHeaderFields();
+
+ if (!requestHeaders.isEmpty())
+ headerDict = [NSDictionary _webcore_dictionaryWithHeaderMap:requestHeaders];
+
+ FormData postData;
+ if (!request.httpBody().elements().isEmpty())
+ postData = request.httpBody();
+ Vector<char> results([resultData length]);
+
+ memcpy(results.data(), [resultData bytes], [resultData length]);
+#endif
+
+ NSURL *URL = request.url().getNSURL();
+
+ // Since this is a subresource, we can load any URL (we ignore the return value).
+ // But we still want to know whether we should hide the referrer or not, so we call the canLoadURL method.
+ String referrer = m_frame->referrer();
+ bool hideReferrer;
+ canLoad(URL, referrer, hideReferrer);
+ if (hideReferrer)
+ referrer = String();
+
+ NSMutableURLRequest *initialRequest = [[NSMutableURLRequest alloc] initWithURL:URL];
+ [initialRequest setTimeoutInterval:10];
+
+ [initialRequest setHTTPMethod:request.httpMethod()];
+
+ if (!request.httpBody().isEmpty())
+ setHTTPBody(initialRequest, request.httpBody());
+
+ HTTPHeaderMap::const_iterator end = request.httpHeaderFields().end();
+ for (HTTPHeaderMap::const_iterator it = request.httpHeaderFields().begin(); it != end; ++it)
+ [initialRequest addValue:it->second forHTTPHeaderField:it->first];
+
+ if (isConditionalRequest(initialRequest))
+ [initialRequest setCachePolicy:NSURLRequestReloadIgnoringCacheData];
+ else
+ [initialRequest setCachePolicy:[documentLoader()->request() cachePolicy]];
+
+ if (!referrer.isNull())
+ setHTTPReferrer(initialRequest, referrer);
+
+ [initialRequest setMainDocumentURL:[m_frame->page()->mainFrame()->loader()->documentLoader()->request() URL]];
+ [initialRequest setValue:client()->userAgent(URL) forHTTPHeaderField:@"User-Agent"];
+
+ NSError *error = nil;
+ id identifier = nil;
+ NSURLRequest *newRequest = requestFromDelegate(initialRequest, identifier, error);
+
+ NSURLResponse *response = nil;
+ NSData *result = nil;
+ if (error == nil) {
+ ASSERT(newRequest != nil);
+ result = [NSURLConnection sendSynchronousRequest:newRequest returningResponse:&response error:&error];
+ }
+
+ [initialRequest release];
+
+ if (error == nil) {
+ finalURL = [response URL];
+ if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
+ NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
+ responseHeaders = [httpResponse allHeaderFields];
+ statusCode = [httpResponse statusCode];
+ } else {
+ responseHeaders = [NSDictionary dictionary];
+ statusCode = 200;
+ }
+ } else {
+ finalURL = URL;
+ responseHeaders = [NSDictionary dictionary];
+ if ([error domain] == NSURLErrorDomain)
+ statusCode = [error code];
+ else
+ statusCode = 404;
+ }
+
+ sendRemainingDelegateMessages(identifier, response, [result length], error);
+
+ data.resize([result length]);
+ memcpy(data.data(), [result bytes], [result length]);
+}
+
void FrameLoader::setClient(FrameLoaderClient* client)
{
ASSERT(client);
#import "FrameLoader.h"
#import "FrameMac.h"
#import "FormData.h"
-#import "FormDataMac.h"
#import "FrameLoader.h"
#import "Logging.h"
#import "Request.h"
if (!frame)
return Vector<char>();
- WebCoreFrameBridge *bridge = frame->bridge();
-
frame->didTellBridgeAboutLoad(request.url().url());
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- NSDictionary *headerDict = nil;
- const HTTPHeaderMap& requestHeaders = request.httpHeaderFields();
-
- if (!requestHeaders.isEmpty())
- headerDict = [NSDictionary _webcore_dictionaryWithHeaderMap:requestHeaders];
-
- NSArray *postData = nil;
- if (!request.httpBody().elements().isEmpty())
- postData = arrayFromFormData(request.httpBody());
-
- NSURL *finalNSURL = nil;
NSDictionary *responseHeaderDict = nil;
int statusCode = 0;
- NSData *resultData = [bridge syncLoadResourceWithMethod:request.httpMethod() URL:request.url().getNSURL() customHeaders:headerDict postData:postData finalURL:&finalNSURL responseHeaders:&responseHeaderDict statusCode:&statusCode];
+ Vector<char> result;
+ frame->loader()->loadResourceSynchronously(request, finalURL, responseHeaderDict, statusCode, result);
- finalURL = finalNSURL;
responseHeaders = DeprecatedString::fromNSString(HeaderStringFromDictionary(responseHeaderDict, statusCode));
- Vector<char> results([resultData length]);
-
- memcpy(results.data(), [resultData bytes], [resultData length]);
-
- return results;
+ return result;
END_BLOCK_OBJC_EXCEPTIONS;
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-@class NSArray;
@class NSMutableURLRequest;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void webSetHTTPBody(NSMutableURLRequest *request, NSArray *formData);
-
-#ifdef __cplusplus
+namespace WebCore {
+ class FormData;
+ void setHTTPBody(NSMutableURLRequest *, const FormData&);
}
-#endif
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#import "config.h"
#import "WebFormDataStream.h"
-#import <sys/types.h>
+#import "CString.h"
+#import "FormData.h"
+#import "WebCoreSystemInterface.h"
#import <sys/stat.h>
-
+#import <sys/types.h>
#import <wtf/Assertions.h>
-#import "WebCoreSystemInterface.h"
-static void formEventCallback(CFReadStreamRef stream, CFStreamEventType type, void *context);
+namespace WebCore {
-typedef struct {
+static void formEventCallback(CFReadStreamRef stream, CFStreamEventType type, void* context);
+
+struct FormStreamFields {
CFMutableSetRef scheduledRunLoopPairs;
- CFMutableArrayRef formDataArray;
+ Vector<FormDataElement> remainingElements; // in reverse order
CFReadStreamRef currentStream;
- CFDataRef currentData;
+ char* currentData;
CFReadStreamRef formStream;
-} FormStreamFields;
+};
-typedef struct {
+struct SchedulePair {
CFRunLoopRef runLoop;
CFStringRef mode;
-} SchedulePair;
+};
-static const void *pairRetain(CFAllocatorRef alloc, const void *value)
+static const void* pairRetain(CFAllocatorRef alloc, const void* value)
{
- const SchedulePair *pair = (const SchedulePair *)value;
+ const SchedulePair* pair = static_cast<const SchedulePair*>(value);
- SchedulePair *result = CFAllocatorAllocate(alloc, sizeof(SchedulePair), 0);
+ SchedulePair* result = new SchedulePair;
CFRetain(pair->runLoop);
result->runLoop = pair->runLoop;
result->mode = CFStringCreateCopy(alloc, pair->mode);
return result;
}
-static void pairRelease(CFAllocatorRef alloc, const void *value)
+static void pairRelease(CFAllocatorRef alloc, const void* value)
{
- const SchedulePair *pair = (const SchedulePair *)value;
+ const SchedulePair* pair = static_cast<const SchedulePair*>(value);
CFRelease(pair->runLoop);
CFRelease(pair->mode);
- CFAllocatorDeallocate(alloc, (void *)pair);
+ delete pair;
}
-static Boolean pairEqual(const void *a, const void *b)
+static Boolean pairEqual(const void* a, const void* b)
{
- const SchedulePair *pairA = (const SchedulePair *)a;
- const SchedulePair *pairB = (const SchedulePair *)b;
+ const SchedulePair* pairA = static_cast<const SchedulePair*>(a);
+ const SchedulePair* pairB = static_cast<const SchedulePair*>(b);
return pairA->runLoop == pairB->runLoop && CFEqual(pairA->mode, pairB->mode);
}
-static CFHashCode pairHash(const void *value)
+static CFHashCode pairHash(const void* value)
{
- const SchedulePair *pair = (const SchedulePair *)value;
+ const SchedulePair* pair = static_cast<const SchedulePair*>(value);
- return ((CFHashCode)pair->runLoop) ^ CFHash(pair->mode);
+ return (CFHashCode)pair->runLoop ^ CFHash(pair->mode);
}
static void closeCurrentStream(FormStreamFields *form)
form->currentStream = NULL;
}
if (form->currentData) {
- CFRelease(form->currentData);
- form->currentData = NULL;
+ fastFree(form->currentData);
+ form->currentData = 0;
}
}
-static void scheduleWithPair(const void *value, void *context)
+static void scheduleWithPair(const void* value, void* context)
{
- const SchedulePair *pair = (const SchedulePair *)value;
+ const SchedulePair* pair = static_cast<const SchedulePair*>(value);
CFReadStreamRef stream = (CFReadStreamRef)context;
CFReadStreamScheduleWithRunLoop(stream, pair->runLoop, pair->mode);
{
closeCurrentStream(form);
- // Handle the case where we're at the end of the array.
- if (CFArrayGetCount(form->formDataArray) == 0) {
+ if (form->remainingElements.isEmpty())
return;
- }
// Create the new stream.
- CFAllocatorRef alloc = CFGetAllocator(form->formDataArray);
- CFTypeRef nextInput = CFArrayGetValueAtIndex(form->formDataArray, 0);
- if (CFGetTypeID(nextInput) == CFDataGetTypeID()) {
- // nextInput is a CFData containing an absolute path
- CFDataRef data = (CFDataRef)nextInput;
- form->currentStream = CFReadStreamCreateWithBytesNoCopy(alloc, CFDataGetBytePtr(data), CFDataGetLength(data), kCFAllocatorNull);
+ FormDataElement& nextInput = form->remainingElements.last();
+ if (nextInput.m_type == FormDataElement::data) {
+ size_t size = nextInput.m_data.size();
+ char* data = nextInput.m_data.releaseBuffer();
+ form->currentStream = CFReadStreamCreateWithBytesNoCopy(0, reinterpret_cast<const UInt8*>(data), size, kCFAllocatorNull);
form->currentData = data;
- CFRetain(data);
} else {
- // nextInput is a CFString containing an absolute path
- CFStringRef path = (CFStringRef)nextInput;
- CFURLRef fileURL = CFURLCreateWithFileSystemPath(alloc, path, kCFURLPOSIXPathStyle, FALSE);
- form->currentStream = CFReadStreamCreateWithFile(alloc, fileURL);
+ CFStringRef filename = nextInput.m_filename.createCFString();
+ CFURLRef fileURL = CFURLCreateWithFileSystemPath(0, filename, kCFURLPOSIXPathStyle, FALSE);
+ CFRelease(filename);
+ form->currentStream = CFReadStreamCreateWithFile(0, fileURL);
CFRelease(fileURL);
}
- CFArrayRemoveValueAtIndex(form->formDataArray, 0);
+ form->remainingElements.removeLast();
// Set up the callback.
CFStreamClientContext context = { 0, form, NULL, NULL, NULL };
CFSetApplyFunction(form->scheduledRunLoopPairs, scheduleWithPair, form->currentStream);
}
-static void openNextStream(FormStreamFields *form)
+static void openNextStream(FormStreamFields* form)
{
// Skip over any streams we can't open.
// For some purposes we might want to return an error, but the current NSURLConnection
// can't really do anything useful with an error at this point, so this is better.
advanceCurrentStream(form);
- while (form->currentStream && !CFReadStreamOpen(form->currentStream)) {
+ while (form->currentStream && !CFReadStreamOpen(form->currentStream))
advanceCurrentStream(form);
- }
}
-static void *formCreate(CFReadStreamRef stream, void *context)
+static void* formCreate(CFReadStreamRef stream, void* context)
{
- CFArrayRef formDataArray = (CFArrayRef)context;
+ const FormData* formData = static_cast<const FormData*>(context);
CFSetCallBacks runLoopAndModeCallBacks = { 0, pairRetain, pairRelease, NULL, pairEqual, pairHash };
- CFAllocatorRef alloc = CFGetAllocator(stream);
- FormStreamFields *newInfo = CFAllocatorAllocate(alloc, sizeof(FormStreamFields), 0);
- newInfo->scheduledRunLoopPairs = CFSetCreateMutable(alloc, 0, &runLoopAndModeCallBacks);
- newInfo->formDataArray = CFArrayCreateMutableCopy(alloc, CFArrayGetCount(formDataArray), formDataArray);
+ FormStreamFields* newInfo = new FormStreamFields;
+ newInfo->scheduledRunLoopPairs = CFSetCreateMutable(0, 0, &runLoopAndModeCallBacks);
newInfo->currentStream = NULL;
- newInfo->currentData = NULL;
+ newInfo->currentData = 0;
newInfo->formStream = stream; // Don't retain. That would create a reference cycle.
+
+ // Append in reverse order since we remove elements from the end.
+ size_t size = formData->elements().size();
+ newInfo->remainingElements.reserveCapacity(size);
+ for (size_t i = 0; i < size; ++i)
+ newInfo->remainingElements.append(formData->elements()[size - i - 1]);
+
return newInfo;
}
-static void formFinalize(CFReadStreamRef stream, void *context)
+static void formFinalize(CFReadStreamRef stream, void* context)
{
- FormStreamFields *form = (FormStreamFields *)context;
+ FormStreamFields* form = static_cast<FormStreamFields*>(context);
- closeCurrentStream(context);
+ closeCurrentStream(form);
CFRelease(form->scheduledRunLoopPairs);
- CFRelease(form->formDataArray);
- CFAllocatorDeallocate(CFGetAllocator(stream), context);
+ delete form;
}
-static Boolean formOpen(CFReadStreamRef stream, CFStreamError *error, Boolean *openComplete, void *context)
+static Boolean formOpen(CFReadStreamRef stream, CFStreamError* error, Boolean* openComplete, void* context)
{
- FormStreamFields *form = (FormStreamFields *)context;
+ FormStreamFields* form = static_cast<FormStreamFields*>(context);
openNextStream(form);
return TRUE;
}
-static CFIndex formRead(CFReadStreamRef stream, UInt8 *buffer, CFIndex bufferLength, CFStreamError *error, Boolean *atEOF, void *context)
+static CFIndex formRead(CFReadStreamRef stream, UInt8* buffer, CFIndex bufferLength, CFStreamError* error, Boolean* atEOF, void* context)
{
- FormStreamFields *form = (FormStreamFields *)context;
+ FormStreamFields* form = static_cast<FormStreamFields*>(context);
while (form->currentStream) {
CFIndex bytesRead = CFReadStreamRead(form->currentStream, buffer, bufferLength);
return 0;
}
-static Boolean formCanRead(CFReadStreamRef stream, void *context)
+static Boolean formCanRead(CFReadStreamRef stream, void* context)
{
- FormStreamFields *form = (FormStreamFields *)context;
+ FormStreamFields* form = static_cast<FormStreamFields*>(context);
while (form->currentStream && CFReadStreamGetStatus(form->currentStream) == kCFStreamStatusAtEnd) {
openNextStream(form);
return CFReadStreamHasBytesAvailable(form->currentStream);
}
-static void formClose(CFReadStreamRef stream, void *context)
+static void formClose(CFReadStreamRef stream, void* context)
{
- FormStreamFields *form = (FormStreamFields *)context;
+ FormStreamFields* form = static_cast<FormStreamFields*>(context);
closeCurrentStream(form);
}
-static void formSchedule(CFReadStreamRef stream, CFRunLoopRef runLoop, CFStringRef runLoopMode, void *context)
+static void formSchedule(CFReadStreamRef stream, CFRunLoopRef runLoop, CFStringRef runLoopMode, void* context)
{
- FormStreamFields *form = (FormStreamFields *)context;
+ FormStreamFields* form = static_cast<FormStreamFields*>(context);
- if (form->currentStream) {
+ if (form->currentStream)
CFReadStreamScheduleWithRunLoop(form->currentStream, runLoop, runLoopMode);
- }
SchedulePair pair = { runLoop, runLoopMode };
CFSetAddValue(form->scheduledRunLoopPairs, &pair);
}
-static void formUnschedule(CFReadStreamRef stream, CFRunLoopRef runLoop, CFStringRef runLoopMode, void *context)
+static void formUnschedule(CFReadStreamRef stream, CFRunLoopRef runLoop, CFStringRef runLoopMode, void* context)
{
- FormStreamFields *form = (FormStreamFields *)context;
+ FormStreamFields* form = static_cast<FormStreamFields*>(context);
- if (form->currentStream) {
+ if (form->currentStream)
CFReadStreamUnscheduleFromRunLoop(form->currentStream, runLoop, runLoopMode);
- }
SchedulePair pair = { runLoop, runLoopMode };
CFSetRemoveValue(form->scheduledRunLoopPairs, &pair);
}
-static void formEventCallback(CFReadStreamRef stream, CFStreamEventType type, void *context)
+static void formEventCallback(CFReadStreamRef stream, CFStreamEventType type, void* context)
{
- FormStreamFields *form = (FormStreamFields *)context;
+ FormStreamFields* form = static_cast<FormStreamFields*>(context);
switch (type) {
case kCFStreamEventHasBytesAvailable:
}
}
-void webSetHTTPBody(NSMutableURLRequest *request, NSArray *formData)
+void setHTTPBody(NSMutableURLRequest *request, const FormData& formData)
{
- size_t count = [formData count];
+ size_t count = formData.elements().size();
// Handle the common special case of one piece of form data, with no files.
if (count == 1) {
- id d = [formData objectAtIndex:0];
- if ([d isKindOfClass:[NSData class]]) {
- [request setHTTPBody:(NSData *)d];
+ const FormDataElement& element = formData.elements()[0];
+ if (element.m_type == FormDataElement::data) {
+ NSData *data = [[NSData alloc] initWithBytes:element.m_data.data() length:element.m_data.size()];
+ [request setHTTPBody:data];
+ [data release];
return;
}
}
// Precompute the content length so NSURLConnection doesn't use chunked mode.
long long length = 0;
- unsigned i;
- for (i = 0; i < count; ++i) {
- id data = [formData objectAtIndex:i];
- if ([data isKindOfClass:[NSData class]]) {
- NSData *d = data;
- length += [d length];
- } else if ([data isKindOfClass:[NSString class]]) {
- NSString *s = data;
+ for (size_t i = 0; i < count; ++i) {
+ const FormDataElement& element = formData.elements()[i];
+ if (element.m_type == FormDataElement::data)
+ length += element.m_data.size();
+ else {
struct stat sb;
- int statResult = stat([s fileSystemRepresentation], &sb);
- if (statResult == 0 && (sb.st_mode & S_IFMT) == S_IFREG) {
+ int statResult = stat(element.m_filename.utf8(), &sb);
+ if (statResult == 0 && (sb.st_mode & S_IFMT) == S_IFREG)
length += sb.st_size;
- }
- } else {
- LOG_ERROR("item in form data array is neither NSData nor NSString");
- return;
}
}
[request setValue:[NSString stringWithFormat:@"%lld", length] forHTTPHeaderField:@"Content-Length"];
// Create and set the stream.
- CFReadStreamRef stream = wkCreateCustomCFReadStream(formCreate, formFinalize, formOpen, formRead, formCanRead, formClose, formSchedule, formUnschedule, formData);
+ CFReadStreamRef stream = wkCreateCustomCFReadStream(formCreate, formFinalize,
+ formOpen, formRead, formCanRead, formClose, formSchedule, formUnschedule,
+ const_cast<FormData*>(&formData));
[request setHTTPBodyStream:(NSInputStream *)stream];
CFRelease(stream);
}
+
+}
namespace WebCore {
+ class FormData;
class String;
class ResourceLoader;
class ResourceRequest;
#import "LoaderFunctions.h"
#import "LoaderNSURLExtras.h"
#import "LoaderNSURLRequestExtras.h"
-#import "FormDataMac.h"
#import "ResourceLoader.h"
#import "WebCoreFrameBridge.h"
#import "WebCoreSystemInterface.h"
// FIXME: Because of <rdar://problem/4803505>, the method has to be set before the body.
[newRequest setHTTPMethod:request.httpMethod()];
- if (!request.httpBody().elements().isEmpty())
- webSetHTTPBody(newRequest, arrayFromFormData(request.httpBody()));
+ if (!request.httpBody().isEmpty())
+ setHTTPBody(newRequest, request.httpBody());
wkSupportsMultipartXMixedReplace(newRequest);
#import "FrameLoader.h"
#import "FrameMac.h"
#import "KURL.h"
-#import "FormDataMac.h"
#import "LoaderFunctions.h"
#import "Logging.h"
#import "WebCoreFrameBridge.h"
+2006-10-29 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - eliminate use of NSArray to carry form data around
+ (the code in this framework was actually using the NSArray to hold a single
+ NSData anyway, so I just went back to an NSData for now)
+
+ * History/WebHistoryItem.m:
+ (-[WebHistoryItem _setFormInfoFromRequest:]):
+ (-[WebHistoryItem formData]):
+ * History/WebHistoryItemPrivate.h:
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::dispatchWillSubmitForm):
+ * WebView/WebFrame.mm:
+ (-[WebFrame _loadItem:withLoadType:]):
+
2006-10-28 Darin Adler <darin@apple.com>
Reviewed by Maciej.
BOOL alwaysAttemptToUsePageCache;
int visitCount;
// info used to repost form data
- NSArray *formData;
+ NSData *formData;
NSString *formContentType;
NSString *formReferrer;
// info used to support RSS feeds
- (void)_setFormInfoFromRequest:(NSURLRequest *)request
{
- NSArray *newData = nil;
+ NSData *newData = nil;
NSString *newContentType = nil;
NSString *newReferrer = nil;
if ([[request HTTPMethod] _webkit_isCaseInsensitiveEqualToString:@"POST"]) {
// FIXME: Eventually we have to make this smart enough to handle the case where
// we have a stream for the body to handle the "data interspersed with files" feature.
- NSData *body = [request HTTPBody];
- if (body) {
- body = [body copy];
- newData = [[NSArray alloc] initWithObjects:body, nil];
- [body release];
- }
-
+ newData = [[request HTTPBody] copy];
newContentType = [[request _web_HTTPContentType] copy];
newReferrer = [[request _web_HTTPReferrer] copy];
}
_private->formReferrer = newReferrer;
}
-- (NSArray *)formData
+- (NSData *)formData
{
return _private->formData;
}
- (NSPoint)scrollPoint;
- (NSArray *)documentState;
- (BOOL)isTargetItem;
-- (NSArray *)formData;
+- (NSData *)formData;
- (NSString *)formContentType;
- (NSString *)formReferrer;
- (NSString *)RSSFeedReferrer;
NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] initWithCapacity:formState->values().size()];
HashMap<String, String>::const_iterator end = formState->values().end();
for (HashMap<String, String>::const_iterator it = formState->values().begin(); it != end; ++it)
- [dictionary setObject:it->second forKey:it->first];
+ if (!it->first.isNull() && !it->second.isNull())
+ [dictionary setObject:it->second forKey:it->first];
[formDelegate frame:m_webFrame.get()
sourceFrame:kit(formState->sourceFrame())
NSURL *itemURL = [item URL];
NSURL *itemOriginalURL = [NSURL _web_URLWithDataAsString:[item originalURLString]];
NSURL *currentURL = [[[self dataSource] request] URL];
- NSArray *formData = [item formData];
+ NSData *formData = [item formData];
// Are we navigating to an anchor within the page?
// Note if we have child frames we do a real reload, since the child frames might not
if (formData) {
[request setHTTPMethod:@"POST"];
[request _web_setHTTPReferrer:[item formReferrer]];
- webSetHTTPBody(request, formData);
+ [request setHTTPBody:formData];
[request _web_setHTTPContentType:[item formContentType]];
// Slight hack to test if the NSURL cache contains the page we're going to. We want