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

Side by Side Diff: Source/modules/serviceworkers/Request.cpp

Issue 475533005: [ServiceWorker] Add support of FetchEvent's request.body. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 4 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
« no previous file with comments | « Source/modules/serviceworkers/Request.h ('k') | Source/modules/serviceworkers/Request.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "Request.h" 6 #include "Request.h"
7 7
8 #include "bindings/core/v8/Dictionary.h" 8 #include "bindings/core/v8/Dictionary.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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 String Request::url() const 205 String Request::url() const
206 { 206 {
207 // The url attribute's getter must return request's url, serialized with the exclude fragment flag set. 207 // The url attribute's getter must return request's url, serialized with the exclude fragment flag set.
208 if (!m_request->url().hasFragmentIdentifier()) 208 if (!m_request->url().hasFragmentIdentifier())
209 return m_request->url(); 209 return m_request->url();
210 KURL url(m_request->url()); 210 KURL url(m_request->url());
211 url.removeFragmentIdentifier(); 211 url.removeFragmentIdentifier();
212 return url; 212 return url;
213 } 213 }
214 214
215 PassRefPtrWillBeRawPtr<FetchBodyStream> Request::body(ExecutionContext* context)
216 {
217 if (!m_request->blobDataHandle())
218 return nullptr;
219 if (!m_fetchBodyStream)
220 m_fetchBodyStream = FetchBodyStream::create(context, m_request->blobData Handle());
221 return m_fetchBodyStream;
222 }
223
224
215 String Request::referrer() const 225 String Request::referrer() const
216 { 226 {
217 // "The referrer attribute's getter must return the empty string if 227 // "The referrer attribute's getter must return the empty string if
218 // request's referrer is none, and request's referrer, serialized, 228 // request's referrer is none, and request's referrer, serialized,
219 // otherwise." 229 // otherwise."
220 return m_request->referrer().referrer().referrer; 230 return m_request->referrer().referrer().referrer;
221 } 231 }
222 232
223 String Request::mode() const 233 String Request::mode() const
224 { 234 {
(...skipping 26 matching lines...) Expand all
251 return "include"; 261 return "include";
252 } 262 }
253 ASSERT_NOT_REACHED(); 263 ASSERT_NOT_REACHED();
254 return ""; 264 return "";
255 } 265 }
256 266
257 void Request::trace(Visitor* visitor) 267 void Request::trace(Visitor* visitor)
258 { 268 {
259 visitor->trace(m_request); 269 visitor->trace(m_request);
260 visitor->trace(m_headers); 270 visitor->trace(m_headers);
271 visitor->trace(m_fetchBodyStream);
261 } 272 }
262 273
263 } // namespace blink 274 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/Request.h ('k') | Source/modules/serviceworkers/Request.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698