diff options
author | joshia@google.com <joshia@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-17 17:25:57 +0000 |
---|---|---|
committer | joshia@google.com <joshia@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-17 17:25:57 +0000 |
commit | 9ae1f71009b7157673e0f34432304cdcddcccbf9 (patch) | |
tree | b08fbea4e6d38a0c9ce40a7d6958dbba95ca0aaa | |
parent | 1d9039259dc741ec1a0d19dbd13545b4601d1ea8 (diff) | |
download | chromium_src-9ae1f71009b7157673e0f34432304cdcddcccbf9.zip chromium_src-9ae1f71009b7157673e0f34432304cdcddcccbf9.tar.gz chromium_src-9ae1f71009b7157673e0f34432304cdcddcccbf9.tar.bz2 |
Fix post url layout test.
Needed to change the following:
* PluginHost::SetPostData: make the state machine parse post
data without any header fields
* If NPN_PostUrl is called without content-type, set the default
content type to 'application/x-www-form-urlencoded'
* Fix a silly bug in post url logic.
BUG=2858
Review URL: http://codereview.chromium.org/7612
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3535 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/glue/plugins/plugin_host.cc | 9 | ||||
-rw-r--r-- | webkit/glue/webplugin_impl.cc | 4 | ||||
-rw-r--r-- | webkit/tools/layout_tests/test_lists/tests_fixable.txt | 3 |
3 files changed, 9 insertions, 7 deletions
diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc index 421775d..a3e4232 100644 --- a/webkit/glue/plugins/plugin_host.cc +++ b/webkit/glue/plugins/plugin_host.cc @@ -162,7 +162,7 @@ bool PluginHost::SetPostData(const char *buf, // enum { INPUT_COLON=0, INPUT_NEWLINE, INPUT_NULL, INPUT_OTHER }; enum { GETNAME, GETVALUE, GETDATA, DONE, ERR }; - int statemachine[3][4] = { { GETVALUE, GETDATA, ERR, GETNAME }, + int statemachine[3][4] = { { GETVALUE, GETDATA, GETDATA, GETNAME }, { GETVALUE, GETNAME, DONE, GETVALUE }, { GETDATA, GETDATA, DONE, GETDATA } }; std::string name, value; @@ -216,8 +216,9 @@ bool PluginHost::SetPostData(const char *buf, break; case GETDATA: { - // Finished headers, now get body. - start = ptr + 1; + // Finished headers, now get body + if (*ptr) + start = ptr + 1; size_t previous_size = body->size(); size_t new_body_size = length - static_cast<int>(start - buf); body->resize(previous_size + new_body_size); @@ -444,7 +445,7 @@ static NPError PostURLNotify(NPP id, DCHECK(file_url.SchemeIsFile()); net::FileURLToFilePath(file_url, &file_path); } else { - std::wstring file_path = base::SysNativeMBToWide(file_path_ascii); + file_path = base::SysNativeMBToWide(file_path_ascii); } file_util::FileInfo post_file_info = {0}; diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc index 3c1cc0b..4c25943 100644 --- a/webkit/glue/webplugin_impl.cc +++ b/webkit/glue/webplugin_impl.cc @@ -366,6 +366,10 @@ bool WebPluginImpl::SetPostData(WebCore::ResourceRequest* request, request->addHTTPHeaderField(webkit_glue::StdStringToString(names[i]), webkit_glue::StdStringToString(values[i])); + WebCore::String content_type = request->httpContentType(); + if (content_type.isEmpty()) + request->setHTTPContentType("application/x-www-form-urlencoded"); + RefPtr<WebCore::FormData> data = WebCore::FormData::create(); if (body.size()) data->appendData(&body.front(), body.size()); diff --git a/webkit/tools/layout_tests/test_lists/tests_fixable.txt b/webkit/tools/layout_tests/test_lists/tests_fixable.txt index e15792a..538032a 100644 --- a/webkit/tools/layout_tests/test_lists/tests_fixable.txt +++ b/webkit/tools/layout_tests/test_lists/tests_fixable.txt @@ -175,9 +175,6 @@ V8 | KJS # LayoutTests/fast/repaint/bugzilla-6473.html = PASS | FAIL // Bug 982608: test had a wrong result for one condition V8 | KJS # LayoutTests/plugins/destroy-stream-twice.html = FAIL -// http://crbug.com/2858 : no support for postURL with file data. -V8 | KJS # LayoutTests/http/tests/plugins/post-url-file.html = FAIL - // This test has been modified and placed in pending, so we ignore the original // until we get our modification into WebKit. V8 | KJS # LayoutTests/security/block-test.html = PASS | FAIL |