+2008-12-22 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ Add WML HTTP layout tests and an initital set of results.
+ Allow to reuse the existing WMLTestCase.js framework from another
+ LayoutTests/ top-level directory - modify TEMPLATE.html & WMLTestCase.js.
+
+ * http/tests/wml: Added.
+ * http/tests/wml/go-task-get-method-accept-charset-expected.txt: Added.
+ * http/tests/wml/go-task-get-method-accept-charset.html: Added.
+ * http/tests/wml/go-task-get-method-expected.txt: Added.
+ * http/tests/wml/go-task-get-method.html: Added.
+ * http/tests/wml/go-task-post-method-accept-charset-expected.txt: Added.
+ * http/tests/wml/go-task-post-method-accept-charset.html: Added.
+ * http/tests/wml/go-task-post-method-expected.txt: Added.
+ * http/tests/wml/go-task-post-method.html: Added.
+ * http/tests/wml/resources: Added.
+ * http/tests/wml/resources/TEMPLATE.html: Added.
+ * http/tests/wml/resources/answer-utf8.cgi: Added.
+ * http/tests/wml/resources/answer.cgi: Added.
+ * http/tests/wml/resources/go-task-get-method-accept-charset.js: Added.
+ * http/tests/wml/resources/go-task-get-method.js: Added.
+ * http/tests/wml/resources/go-task-post-method-accept-charset.js: Added.
+ * http/tests/wml/resources/go-task-post-method.js: Added.
+ * wml/go-task-animation.html:
+ * wml/go-task-get-method-external-deck-with-href.html:
+ * wml/go-task-get-method-external-deck.html:
+ * wml/go-task-get-method-same-deck.html:
+ * wml/resources/TEMPLATE.html:
+ * wml/resources/WMLTestCase.js:
+ * wml/variable-reference-invalid-character.html:
+ * wml/variable-reference-valid.html:
+
2008-12-19 Zan Dobersek <zandobersek@gmail.com>
Reviewed by Holger Freyther.
--- /dev/null
+WML http navigation layout tests - using XHTML scripting
+
+
+Tests GET method of <go> element - accept-charset attribute
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+This page was requested with an HTTP GET
+
+The query parameters are: var1=Text%20with%20whitespace;var2=Text%20with%20non-latin1%20characters%3A%20Sch%C3%B6n%2C%20da%C3%9F%20es%20%C3%84%26Ouml%3B%C3%9C%20gibt%21
+Form content var1: 'Text with whitespace'
+Form content var2: 'Text with non-latin1 characters: Schön, daß es ÄÖÜ gibt!'
+
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script>var relativePathToLayoutTests = "../../..";</script>
+<script src="../../../wml/resources/WMLTestCase.js"></script>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<h1>WML http navigation layout tests - using XHTML scripting</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/go-task-get-method-accept-charset.js" charset="utf8"></script>
+</body>
+</html>
--- /dev/null
+WML http navigation layout tests - using XHTML scripting
+
+
+Tests GET method of <go> element
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+This page was requested with an HTTP GET
+
+The query parameters are: var1=Text%20with%20whitespace;var2=Text%20with%20entities%3A%20%26auml%3B%20and%20%26ouml%3B
+Form content var1: 'Text with whitespace'
+Form content var2: 'Text with entities: ä and ö'
+
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script>var relativePathToLayoutTests = "../../..";</script>
+<script src="../../../wml/resources/WMLTestCase.js"></script>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<h1>WML http navigation layout tests - using XHTML scripting</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/go-task-get-method.js" charset="utf8"></script>
+</body>
+</html>
--- /dev/null
+WML http navigation layout tests - using XHTML scripting
+
+
+Tests POST method of <go> element - accept-charset attribute
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+This page was requested with an HTTP POST
+
+The query parameters are: var1=Text%20with%20whitespace;var2=Text%20with%20non-latin1%20characters%3A%20Sch%C3%B6n%2C%20da%C3%9F%20es%20%C3%84%26Ouml%3B%C3%9C%20gibt%21
+Form content var1: 'Text with whitespace'
+Form content var2: 'Text with non-latin1 characters: Schön, daß es ÄÖÜ gibt!'
+
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script>var relativePathToLayoutTests = "../../..";</script>
+<script src="../../../wml/resources/WMLTestCase.js"></script>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<h1>WML http navigation layout tests - using XHTML scripting</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/go-task-post-method-accept-charset.js" charset="utf8"></script>
+</body>
+</html>
--- /dev/null
+WML http navigation layout tests - using XHTML scripting
+
+
+Tests POST method of <go> element
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+This page was requested with an HTTP POST
+
+The query parameters are: var1=Text%20with%20whitespace;var2=Text%20with%20entities%3A%20%26auml%3B%20and%20%26ouml%3B
+Form content var1: 'Text with whitespace'
+Form content var2: 'Text with entities: ä and ö'
+
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script>var relativePathToLayoutTests = "../../..";</script>
+<script src="../../../wml/resources/WMLTestCase.js"></script>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<h1>WML http navigation layout tests - using XHTML scripting</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/go-task-post-method.js" charset="utf8"></script>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script>var relativePathToLayoutTests = "../../..";</script>
+<script src="../../../wml/resources/WMLTestCase.js"></script>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<h1>WML http navigation layout tests - using XHTML scripting</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="YOUR_JS_FILE_HERE" charset="utf8"></script>
+</body>
+</html>
--- /dev/null
+#!/usr/bin/perl -w
+
+use CGI;
+
+$query = new CGI;
+$method = $query->request_method();
+$queryString = $query->query_string;
+$var1 = $query->param("var1");
+$var2 = $query->param("var2");
+
+print "Content-type: text/html;charset=utf-8\r\n";
+print "Cache-Control: no-store, no-cache, must-revalidate\r\n";
+print "\r\n";
+
+print <<HERE_DOC_END;
+<html>
+<body>
+This page was requested with an HTTP $method<br/><br/>
+The query parameters are: $queryString<br/>
+Form content var1: '$var1'<br/>
+Form content var2: '$var2'<br/>
+</body>
+</html>
+HERE_DOC_END
--- /dev/null
+#!/usr/bin/perl -w
+
+use CGI;
+
+$query = new CGI;
+$method = $query->request_method();
+$queryString = $query->query_string;
+$var1 = $query->param("var1");
+$var2 = $query->param("var2");
+
+print "Content-type: text/html\r\n";
+print "Cache-Control: no-store, no-cache, must-revalidate\r\n";
+print "\r\n";
+
+print <<HERE_DOC_END;
+<html>
+<body>
+This page was requested with an HTTP $method<br/><br/>
+The query parameters are: $queryString<br/>
+Form content var1: '$var1'<br/>
+Form content var2: '$var2'<br/>
+</body>
+</html>
+HERE_DOC_END
--- /dev/null
+// [Name] go-task-get-method-accept-charset.js
+
+createWMLTestCase("Tests GET method of <go> element - accept-charset attribute", false);
+
+function setupTestDocument() {
+ var cardElement = testDocument.documentElement.firstChild;
+
+ var anchorElement = createWMLElement("anchor");
+ anchorElement.appendChild(testDocument.createTextNode("Start test"));
+ cardElement.appendChild(anchorElement);
+
+ var goElement = createWMLElement("go");
+ goElement.setAttribute("method", "GET");
+ goElement.setAttribute("accept-charset", "utf-8");
+ goElement.setAttribute("href", "http://127.0.0.1:8000/wml/resources/answer-utf8.cgi");
+
+ var postfieldElement1 = createWMLElement("postfield");
+ postfieldElement1.setAttribute("name", "var1");
+ postfieldElement1.setAttribute("value", "Text with whitespace");
+ goElement.appendChild(postfieldElement1);
+
+ var postfieldElement2 = createWMLElement("postfield");
+ postfieldElement2.setAttribute("name", "var2");
+ postfieldElement2.setAttribute("value", "Text with non-latin1 characters: Schön, daß es ÄÖÜ gibt!");
+ goElement.appendChild(postfieldElement2);
+
+ anchorElement.appendChild(goElement);
+}
+
+function prepareTest() {
+ startTest(25, 15);
+}
+
+function executeTest() {
+ completeTest();
+}
+
+var successfullyParsed = true;
--- /dev/null
+// [Name] go-task-get-method.js
+
+createWMLTestCase("Tests GET method of <go> element", false);
+
+function setupTestDocument() {
+ var cardElement = testDocument.documentElement.firstChild;
+
+ var anchorElement = createWMLElement("anchor");
+ anchorElement.appendChild(testDocument.createTextNode("Start test"));
+ cardElement.appendChild(anchorElement);
+
+ var goElement = createWMLElement("go");
+ goElement.setAttribute("method", "GET");
+ goElement.setAttribute("href", "http://127.0.0.1:8000/wml/resources/answer.cgi");
+
+ var postfieldElement1 = createWMLElement("postfield");
+ postfieldElement1.setAttribute("name", "var1");
+ postfieldElement1.setAttribute("value", "Text with whitespace");
+ goElement.appendChild(postfieldElement1);
+
+ var postfieldElement2 = createWMLElement("postfield");
+ postfieldElement2.setAttribute("name", "var2");
+ postfieldElement2.setAttribute("value", "Text with entities: ä and ö");
+ goElement.appendChild(postfieldElement2);
+
+ anchorElement.appendChild(goElement);
+}
+
+function prepareTest() {
+ startTest(25, 15);
+}
+
+function executeTest() {
+ completeTest();
+}
+
+var successfullyParsed = true;
--- /dev/null
+// [Name] go-task-post-method-accept-charset.js
+
+createWMLTestCase("Tests POST method of <go> element - accept-charset attribute", false);
+
+function setupTestDocument() {
+ var cardElement = testDocument.documentElement.firstChild;
+
+ var anchorElement = createWMLElement("anchor");
+ anchorElement.appendChild(testDocument.createTextNode("Start test"));
+ cardElement.appendChild(anchorElement);
+
+ var goElement = createWMLElement("go");
+ goElement.setAttribute("method", "POST");
+ goElement.setAttribute("accept-charset", "utf-8");
+ goElement.setAttribute("href", "http://127.0.0.1:8000/wml/resources/answer-utf8.cgi");
+
+ var postfieldElement1 = createWMLElement("postfield");
+ postfieldElement1.setAttribute("name", "var1");
+ postfieldElement1.setAttribute("value", "Text with whitespace");
+ goElement.appendChild(postfieldElement1);
+
+ var postfieldElement2 = createWMLElement("postfield");
+ postfieldElement2.setAttribute("name", "var2");
+ postfieldElement2.setAttribute("value", "Text with non-latin1 characters: Schön, daß es ÄÖÜ gibt!");
+ goElement.appendChild(postfieldElement2);
+
+ anchorElement.appendChild(goElement);
+}
+
+function prepareTest() {
+ startTest(25, 15);
+}
+
+function executeTest() {
+ completeTest();
+}
+
+var successfullyParsed = true;
--- /dev/null
+// [Name] go-task-post-method.js
+
+createWMLTestCase("Tests POST method of <go> element", false);
+
+function setupTestDocument() {
+ var cardElement = testDocument.documentElement.firstChild;
+
+ var anchorElement = createWMLElement("anchor");
+ anchorElement.appendChild(testDocument.createTextNode("Start test"));
+ cardElement.appendChild(anchorElement);
+
+ var goElement = createWMLElement("go");
+ goElement.setAttribute("method", "POST");
+ goElement.setAttribute("href", "http://127.0.0.1:8000/wml/resources/answer.cgi");
+
+ var postfieldElement1 = createWMLElement("postfield");
+ postfieldElement1.setAttribute("name", "var1");
+ postfieldElement1.setAttribute("value", "Text with whitespace");
+ goElement.appendChild(postfieldElement1);
+
+ var postfieldElement2 = createWMLElement("postfield");
+ postfieldElement2.setAttribute("name", "var2");
+ postfieldElement2.setAttribute("value", "Text with entities: ä and ö");
+ goElement.appendChild(postfieldElement2);
+
+ anchorElement.appendChild(goElement);
+}
+
+function prepareTest() {
+ startTest(25, 15);
+}
+
+function executeTest() {
+ completeTest();
+}
+
+var successfullyParsed = true;
<html>
<head>
<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
+<script>var relativePathToLayoutTests = "..";</script>
<script src="resources/WMLTestCase.js"></script>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<html>
<head>
<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
+<script>var relativePathToLayoutTests = "..";</script>
<script src="resources/WMLTestCase.js"></script>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<html>
<head>
<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
+<script>var relativePathToLayoutTests = "..";</script>
<script src="resources/WMLTestCase.js"></script>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<html>
<head>
<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
+<script>var relativePathToLayoutTests = "..";</script>
<script src="resources/WMLTestCase.js"></script>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<html>
<head>
<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
+<script>var relativePathToLayoutTests = "..";</script>
<script src="resources/WMLTestCase.js"></script>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
var defaultTest = true;
if (testName == null) {
defaultTest = false;
- testName = "resources/test-document.wml";
+ testName = relativePathToLayoutTests + "/wml/resources/test-document.wml";
}
description(desc);
window.setTimeout("layoutTestController.notifyDone()", 0);
};
- script.src = "../fast/js/resources/js-test-post.js";
+ script.src = relativePathToLayoutTests + "/fast/js/resources/js-test-post.js";
successfullyParsed = true;
bodyElement.appendChild(script);
<html>
<head>
<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
+<script>var relativePathToLayoutTests = "..";</script>
<script src="resources/WMLTestCase.js"></script>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<html>
<head>
<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
+<script>var relativePathToLayoutTests = "..";</script>
<script src="resources/WMLTestCase.js"></script>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
-2008-12-20 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com>
+2008-12-22 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ Fixes: https://bugs.webkit.org/show_bug.cgi?id=22638
+
+ Add POST method support to WMLGoElement. GET & POST over HTTP
+ covered by a new set of WML HTTP layout tests.
+
+ Tests: http/tests/wml/go-task-get-method-accept-charset.html
+ http/tests/wml/go-task-get-method.html
+ http/tests/wml/go-task-post-method-accept-charset.html
+ http/tests/wml/go-task-post-method.html
+
+ * wml/WMLGoElement.cpp:
+ (WebCore::WMLGoElement::WMLGoElement):
+ (WebCore::WMLGoElement::registerPostfieldElement):
+ (WebCore::WMLGoElement::parseMappedAttribute):
+ (WebCore::WMLGoElement::executeTask):
+ (WebCore::WMLGoElement::preparePOSTRequest):
+ (WebCore::WMLGoElement::prepareGETRequest):
+ (WebCore::WMLGoElement::createFormData):
+ * wml/WMLGoElement.h:
+ * wml/WMLPostfieldElement.cpp:
+ (WebCore::encodedString):
+ (WebCore::WMLPostfieldElement::encodeData):
+ * wml/WMLPostfieldElement.h:
+
+2008-12-21 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com>
Reviewed by Darin Adler and George Staikos.
#if ENABLE(WML)
#include "WMLGoElement.h"
+#include "CString.h"
+#include "FormData.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "HTMLNames.h"
#include "ResourceRequest.h"
+#include "TextEncoding.h"
#include "WMLCardElement.h"
#include "WMLDocument.h"
#include "WMLNames.h"
WMLGoElement::WMLGoElement(const QualifiedName& tagName, Document* doc)
: WMLTaskElement(tagName, doc)
- , m_contentType("application/x-www-form-urlencoded")
- , m_isMultiPart(false)
- , m_isPostMethod(false)
{
}
void WMLGoElement::registerPostfieldElement(WMLPostfieldElement* postfield)
{
- m_postfieldElements.add(postfield);
+ m_postfieldElements.append(postfield);
}
void WMLGoElement::parseMappedAttribute(MappedAttribute* attr)
{
- if (attr->name() == HTMLNames::methodAttr) {
- const AtomicString& value = attr->value();
-
- if (value == "POST")
- m_isPostMethod = true;
- else if (value == "GET")
- m_isPostMethod = false;
- } else if (attr->name() == HTMLNames::enctypeAttr)
- parseContentType(parseValueSubstitutingVariableReferences(attr->value()));
+ if (attr->name() == HTMLNames::methodAttr)
+ m_formDataBuilder.parseMethodType(attr->value());
+ else if (attr->name() == HTMLNames::enctypeAttr)
+ m_formDataBuilder.parseEncodingType(parseValueSubstitutingVariableReferences(attr->value()));
else if (attr->name() == HTMLNames::accept_charsetAttr)
- m_acceptCharset = parseValueForbiddingVariableReferences(attr->value());
+ m_formDataBuilder.setAcceptCharset(parseValueForbiddingVariableReferences(attr->value()));
else
WMLTaskElement::parseMappedAttribute(attr);
}
String cacheControl = getAttribute(cache_controlAttr);
- if (m_isPostMethod)
+ if (m_formDataBuilder.isPostMethod())
preparePOSTRequest(request, inSameDeck, cacheControl);
- else {
- // Eventually display error message?
- if (m_isMultiPart)
- return;
-
+ else
prepareGETRequest(request, url);
- }
// Set HTTP cache-control header if needed
if (!cacheControl.isEmpty()) {
loader->load(request);
}
-void WMLGoElement::parseContentType(const String& type)
-{
- if (type.contains("multipart", false) || type.contains("form-data", false)) {
- m_contentType = "multipart/form-data";
- m_isMultiPart = true;
- } else {
- m_contentType = "application/x-www-form-urlencoded";
- m_isMultiPart = false;
- }
-}
-
void WMLGoElement::preparePOSTRequest(ResourceRequest& request, bool inSameDeck, const String& cacheControl)
{
request.setHTTPMethod("POST");
return;
}
- // FIXME: Implement POST method.
- /*
RefPtr<FormData> data;
- if (m_isMultiPart) { // multipart/form-data
- Vector<char> boundary;
- getUniqueBoundaryString(boundary);
- data = createFormData(loader, boundary.data());
- request.setHTTPContentType(m_contentType + "; boundary=" + boundary.data());
+ if (m_formDataBuilder.isMultiPartForm()) { // multipart/form-data
+ Vector<char> boundary = m_formDataBuilder.generateUniqueBoundaryString();
+ data = createFormData(boundary.data());
+ request.setHTTPContentType(m_formDataBuilder.encodingType() + "; boundary=" + boundary.data());
} else {
// text/plain or application/x-www-form-urlencoded
- data = createFormData(loader, 0);
- request.setHTTPContentType(m_contentType);
+ data = createFormData(CString());
+ request.setHTTPContentType(m_formDataBuilder.encodingType());
}
request.setHTTPBody(data.get());
- */
}
void WMLGoElement::prepareGETRequest(ResourceRequest& request, const KURL& url)
{
- String queryString;
+ request.setHTTPMethod("GET");
- HashSet<WMLPostfieldElement*>::iterator it = m_postfieldElements.begin();
- HashSet<WMLPostfieldElement*>::iterator end = m_postfieldElements.end();
+ // Eventually display error message?
+ if (m_formDataBuilder.isMultiPartForm())
+ return;
- for (; it != end; ++it) {
- WMLPostfieldElement* postfield = (*it);
+ RefPtr<FormData> data = createFormData(CString());
- if (!queryString.isEmpty())
- queryString += "&";
+ KURL remoteURL(url);
+ remoteURL.setQuery(data->flattenToString());
+ request.setURL(remoteURL);
+}
- queryString += encodeWithURLEscapeSequences(postfield->name()) + "m" +
- encodeWithURLEscapeSequences(postfield->value());
- }
+PassRefPtr<FormData> WMLGoElement::createFormData(const CString& boundary)
+{
+ CString key;
+ CString value;
- KURL remoteURL(url);
- remoteURL.setQuery(queryString);
+ Vector<char> encodedData;
+ TextEncoding encoding = m_formDataBuilder.dataEncoding(document()).encodingForFormSubmission();
- request.setURL(remoteURL);
- request.setHTTPMethod("GET");
+ Vector<WMLPostfieldElement*>::iterator it = m_postfieldElements.begin();
+ Vector<WMLPostfieldElement*>::iterator end = m_postfieldElements.end();
+
+ RefPtr<FormData> result = FormData::create();
+ for (; it != end; ++it) {
+ (*it)->encodeData(encoding, key, value);
+
+ if (m_formDataBuilder.isMultiPartForm()) {
+ Vector<char> header;
+ m_formDataBuilder.beginMultiPartHeader(header, boundary, key);
+ m_formDataBuilder.finishMultiPartHeader(header);
+ result->appendData(header.data(), header.size());
+
+ if (size_t dataSize = value.length())
+ result->appendData(value.data(), dataSize);
+
+ result->appendData("\r\n", 2);
+ } else
+ m_formDataBuilder.addKeyValuePairAsFormData(encodedData, key, value);
+ }
+ if (m_formDataBuilder.isMultiPartForm())
+ m_formDataBuilder.addBoundaryToMultiPartHeader(encodedData, boundary, true);
+ result->appendData(encodedData.data(), encodedData.size());
+ return result;
}
}
#define WMLGoElement_h
#if ENABLE(WML)
+#include "FormDataBuilder.h"
#include "WMLTaskElement.h"
namespace WebCore {
+class FormData;
class ResourceRequest;
class WMLPostfieldElement;
virtual void executeTask(Event*);
private:
- void parseContentType(const String&);
-
void preparePOSTRequest(ResourceRequest&, bool inSameDeck, const String& cacheControl);
void prepareGETRequest(ResourceRequest&, const KURL&);
- HashSet<WMLPostfieldElement*> m_postfieldElements;
-
- String m_contentType;
- String m_acceptCharset;
+ PassRefPtr<FormData> createFormData(const CString& boundary);
- bool m_isMultiPart;
- bool m_isPostMethod;
+ Vector<WMLPostfieldElement*> m_postfieldElements;
+ FormDataBuilder m_formDataBuilder;
};
}
#if ENABLE(WML)
#include "WMLPostfieldElement.h"
+#include "CString.h"
+#include "TextEncoding.h"
#include "HTMLNames.h"
#include "WMLDocument.h"
#include "WMLGoElement.h"
static_cast<WMLGoElement*>(parent)->registerPostfieldElement(this);
}
+static inline CString encodedString(const TextEncoding& encoding, const String& data)
+{
+ return encoding.encode(data.characters(), data.length(), EntitiesForUnencodables);
+}
+
+void WMLPostfieldElement::encodeData(const TextEncoding& encoding, CString& name, CString& value)
+{
+ name = encodedString(encoding, m_name);
+ value = encodedString(encoding, m_value);
+}
+
}
#endif
#if ENABLE(WML)
#include "WMLElement.h"
-#include <wtf/HashSet.h>
-
namespace WebCore {
class WMLPostfieldElement : public WMLElement {
String name() const { return m_name; }
String value() const { return m_value; }
+ // Encode name() and value() in a CString using the passed encoding
+ void encodeData(const TextEncoding&, CString& name, CString& value);
+
private:
String m_name;
String m_value;
+2008-12-22 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ Ignore http/tests/wml, if no WML support is present.
+ Add http/tests/wml to list of HTTP tests, allowed to access local resources.
+
+ * Scripts/run-webkit-tests:
+
2008-12-19 David Levin <levin@chromium.org>
Reviewed by Mark Rowe.
if (checkWebCoreWMLSupport(0)) {
$supportedFileExtensions{'wml'} = 1;
} else {
+ $ignoredDirectories{'http/tests/wml'} = 1;
$ignoredDirectories{'fast/wml'} = 1;
$ignoredDirectories{'wml'} = 1;
}
print OUT "$testPath$suffixExpectedHash\n";
} else {
openHTTPDIfNeeded();
- if ($test !~ /^http\/tests\/local\// && $test !~ /^http\/tests\/ssl\// && $test !~ /^http\/tests\/media\//) {
+ if ($test !~ /^http\/tests\/local\// && $test !~ /^http\/tests\/ssl\// && $test !~ /^http\/tests\/wml\// && $test !~ /^http\/tests\/media\//) {
my $path = canonpath($test);
$path =~ s/^http\/tests\///;
print OUT "http://127.0.0.1:$httpdPort/$path$suffixExpectedHash\n";