OLD | NEW |
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/fetch/FetchUtils.h" | 10 #include "core/fetch/FetchUtils.h" |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 } | 706 } |
707 | 707 |
708 webRequest.setReferrer( | 708 webRequest.setReferrer( |
709 m_request->referrerString(), | 709 m_request->referrerString(), |
710 static_cast<WebReferrerPolicy>(m_request->getReferrerPolicy())); | 710 static_cast<WebReferrerPolicy>(m_request->getReferrerPolicy())); |
711 // FIXME: How can we set isReload properly? What is the correct place to load | 711 // FIXME: How can we set isReload properly? What is the correct place to load |
712 // it in to the Request object? We should investigate the right way to plumb | 712 // it in to the Request object? We should investigate the right way to plumb |
713 // this information in to here. | 713 // this information in to here. |
714 } | 714 } |
715 | 715 |
| 716 String Request::contentType() const { |
| 717 String result; |
| 718 m_request->headerList()->get(HTTPNames::Content_Type, result); |
| 719 return result; |
| 720 } |
| 721 |
716 String Request::mimeType() const { | 722 String Request::mimeType() const { |
717 return m_request->mimeType(); | 723 return m_request->mimeType(); |
718 } | 724 } |
719 | 725 |
720 void Request::refreshBody(ScriptState* scriptState) { | 726 void Request::refreshBody(ScriptState* scriptState) { |
721 v8::Local<v8::Value> bodyBuffer = toV8(this->bodyBuffer(), scriptState); | 727 v8::Local<v8::Value> bodyBuffer = toV8(this->bodyBuffer(), scriptState); |
722 v8::Local<v8::Value> request = toV8(this, scriptState); | 728 v8::Local<v8::Value> request = toV8(this, scriptState); |
723 if (request.IsEmpty()) { | 729 if (request.IsEmpty()) { |
724 // |toV8| can return an empty handle when the worker is terminating. | 730 // |toV8| can return an empty handle when the worker is terminating. |
725 // We don't want the renderer to crash in such cases. | 731 // We don't want the renderer to crash in such cases. |
726 // TODO(yhirano): Delete this block after the graceful shutdown | 732 // TODO(yhirano): Delete this block after the graceful shutdown |
727 // mechanism is introduced. | 733 // mechanism is introduced. |
728 return; | 734 return; |
729 } | 735 } |
730 DCHECK(request->IsObject()); | 736 DCHECK(request->IsObject()); |
731 V8HiddenValue::setHiddenValue( | 737 V8HiddenValue::setHiddenValue( |
732 scriptState, request.As<v8::Object>(), | 738 scriptState, request.As<v8::Object>(), |
733 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); | 739 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); |
734 } | 740 } |
735 | 741 |
736 DEFINE_TRACE(Request) { | 742 DEFINE_TRACE(Request) { |
737 Body::trace(visitor); | 743 Body::trace(visitor); |
738 visitor->trace(m_request); | 744 visitor->trace(m_request); |
739 visitor->trace(m_headers); | 745 visitor->trace(m_headers); |
740 } | 746 } |
741 | 747 |
742 } // namespace blink | 748 } // namespace blink |
OLD | NEW |