Commit 908cf2a7 authored by darin's avatar darin

Reviewed by Ken.

	- fixed 3143781 -- submitting the same form twice doesn't work properly
	(example at directory.apple.com)

        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::submitForm): Only run the "don't submit the same
	form twice" logic when the form is one that affects the frame that the form is in.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 60414e6b
2003-01-13 Darin Adler <darin@apple.com>
Reviewed by Ken.
- fixed 3143781 -- submitting the same form twice doesn't work properly
(example at directory.apple.com)
* kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::submitForm): Only run the "don't submit the same
form twice" logic when the form is one that affects the frame that the form is in.
2003-01-12 Darin Adler <darin@apple.com>
* WebCorePrefix.h: Needed to touch this file since we now have plain C source (expat).
......
2003-01-13 Darin Adler <darin@apple.com>
Reviewed by Ken.
- fixed 3143781 -- submitting the same form twice doesn't work properly
(example at directory.apple.com)
* kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::submitForm): Only run the "don't submit the same
form twice" logic when the form is one that affects the frame that the form is in.
2003-01-12 Darin Adler <darin@apple.com>
* WebCorePrefix.h: Needed to touch this file since we now have plain C source (expat).
......
......@@ -183,22 +183,37 @@ void KWQKHTMLPart::openURLRequest(const KURL &url, const URLArgs &args)
void KWQKHTMLPart::submitForm(const KURL &url, const URLArgs &args)
{
// we do not want to submit more than one form, nor do we want to submit a single form more than once
// this flag prevents these from happening
// note that the flag is reset in setView()
// since this part may get reused if it is pulled from the b/f cache
if (_formSubmittedFlag) {
return;
WebCoreBridge *target = bridgeForFrameName(args.frameName);
KHTMLPart *targetPart = [target part];
// The form multi-submit logic here is only right when we are submitting a form that affects this frame.
// Eventually when we find a better fix we can remove this altogether.
bool willReplaceThisFrame = false;
for (KHTMLPart *p = this; p; p = p->parentPart()) {
if (p == targetPart) {
willReplaceThisFrame = true;
break;
}
}
if (willReplaceThisFrame) {
// We do not want to submit more than one form from the same page,
// nor do we want to submit a single form more than once.
// This flag prevents these from happening.
// Note that the flag is reset in setView()
// since this part may get reused if it is pulled from the b/f cache.
if (_formSubmittedFlag) {
return;
}
_formSubmittedFlag = true;
}
_formSubmittedFlag = true;
if (!args.doPost()) {
[bridgeForFrameName(args.frameName) loadURL:url.url().getNSString() reload:args.reload
[target loadURL:url.url().getNSString() reload:args.reload
triggeringEvent:_currentEvent isFormSubmission:YES];
} else {
QString contentType = args.contentType();
ASSERT(contentType.startsWith("Content-Type: "));
[bridgeForFrameName(args.frameName) postWithURL:url.url().getNSString()
[target postWithURL:url.url().getNSString()
data:[NSData dataWithBytes:args.postData.data() length:args.postData.size()]
contentType:contentType.mid(14).getNSString() triggeringEvent:_currentEvent];
}
......@@ -272,9 +287,9 @@ void KWQKHTMLPart::setView(KHTMLView *view, bool weOwnIt)
setWidget(view);
_ownsView = weOwnIt;
// only one form submission is allowed per view of a part
// since this part may be getting reused as a result of being
// pulled from the back/forward cache, reset this flag
// Only one form submission is allowed per view of a part.
// Since this part may be getting reused as a result of being
// pulled from the back/forward cache, reset this flag.
_formSubmittedFlag = false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment