Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: third_party/WebKit/Source/modules/fetch/Request.cpp

Issue 2292763002: [Fetch API] Implement Request.formData and Response.formData. (Closed)
Patch Set: More global-interface-listing*-expected.txt, urlencoded-parser-expected.txt Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/fetch/Request.h" 5 #include "modules/fetch/Request.h"
6 6
7 #include "bindings/core/v8/Dictionary.h" 7 #include "bindings/core/v8/Dictionary.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/ExecutionContext.h" 9 #include "core/dom/ExecutionContext.h"
10 #include "core/loader/ThreadableLoader.h" 10 #include "core/loader/ThreadableLoader.h"
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 static_cast<WebReferrerPolicy>(request_->GetReferrerPolicy())); 745 static_cast<WebReferrerPolicy>(request_->GetReferrerPolicy()));
746 // FIXME: How can we set isReload properly? What is the correct place to load 746 // FIXME: How can we set isReload properly? What is the correct place to load
747 // it in to the Request object? We should investigate the right way to plumb 747 // it in to the Request object? We should investigate the right way to plumb
748 // this information in to here. 748 // this information in to here.
749 } 749 }
750 750
751 String Request::MimeType() const { 751 String Request::MimeType() const {
752 return request_->MimeType(); 752 return request_->MimeType();
753 } 753 }
754 754
755 String Request::ContentType() const {
756 String result;
757 request_->HeaderList()->Get(HTTPNames::Content_Type, result);
758 return result;
759 }
760
755 void Request::RefreshBody(ScriptState* script_state) { 761 void Request::RefreshBody(ScriptState* script_state) {
756 v8::Local<v8::Value> request = ToV8(this, script_state); 762 v8::Local<v8::Value> request = ToV8(this, script_state);
757 if (request.IsEmpty()) { 763 if (request.IsEmpty()) {
758 // |toV8| can return an empty handle when the worker is terminating. 764 // |toV8| can return an empty handle when the worker is terminating.
759 // We don't want the renderer to crash in such cases. 765 // We don't want the renderer to crash in such cases.
760 // TODO(yhirano): Delete this block after the graceful shutdown 766 // TODO(yhirano): Delete this block after the graceful shutdown
761 // mechanism is introduced. 767 // mechanism is introduced.
762 return; 768 return;
763 } 769 }
764 DCHECK(request->IsObject()); 770 DCHECK(request->IsObject());
765 v8::Local<v8::Value> body_buffer = ToV8(this->BodyBuffer(), script_state); 771 v8::Local<v8::Value> body_buffer = ToV8(this->BodyBuffer(), script_state);
766 V8PrivateProperty::GetInternalBodyBuffer(script_state->GetIsolate()) 772 V8PrivateProperty::GetInternalBodyBuffer(script_state->GetIsolate())
767 .Set(request.As<v8::Object>(), body_buffer); 773 .Set(request.As<v8::Object>(), body_buffer);
768 } 774 }
769 775
770 DEFINE_TRACE(Request) { 776 DEFINE_TRACE(Request) {
771 Body::Trace(visitor); 777 Body::Trace(visitor);
772 visitor->Trace(request_); 778 visitor->Trace(request_);
773 visitor->Trace(headers_); 779 visitor->Trace(headers_);
774 } 780 }
775 781
776 } // namespace blink 782 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/Request.h ('k') | third_party/WebKit/Source/modules/fetch/Response.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698