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

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: 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
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 String Request::url() const 206 String Request::url() const
207 { 207 {
208 // The url attribute's getter must return request's url, serialized with the exclude fragment flag set. 208 // The url attribute's getter must return request's url, serialized with the exclude fragment flag set.
209 if (!m_request->url().hasFragmentIdentifier()) 209 if (!m_request->url().hasFragmentIdentifier())
210 return m_request->url(); 210 return m_request->url();
211 KURL url(m_request->url()); 211 KURL url(m_request->url());
212 url.removeFragmentIdentifier(); 212 url.removeFragmentIdentifier();
213 return url; 213 return url;
214 } 214 }
215 215
216 PassRefPtrWillBeRawPtr<FetchBodyStream> Request::body(ExecutionContext* context)
217 {
218 if (!m_request->blobDataHandle())
219 return nullptr;
220 if (!m_fetchBodyStream)
221 m_fetchBodyStream = FetchBodyStream::create(context, m_request->blobData Handle());
222 return m_fetchBodyStream;
223 }
224
225
216 String Request::referrer() const 226 String Request::referrer() const
217 { 227 {
218 // "The referrer attribute's getter must return the empty string if 228 // "The referrer attribute's getter must return the empty string if
219 // request's referrer is none, and request's referrer, serialized, 229 // request's referrer is none, and request's referrer, serialized,
220 // otherwise." 230 // otherwise."
221 return m_request->referrer().referrer().referrer; 231 return m_request->referrer().referrer().referrer;
222 } 232 }
223 233
224 String Request::mode() const 234 String Request::mode() const
225 { 235 {
(...skipping 26 matching lines...) Expand all
252 return "include"; 262 return "include";
253 } 263 }
254 ASSERT_NOT_REACHED(); 264 ASSERT_NOT_REACHED();
255 return ""; 265 return "";
256 } 266 }
257 267
258 void Request::trace(Visitor* visitor) 268 void Request::trace(Visitor* visitor)
259 { 269 {
260 visitor->trace(m_request); 270 visitor->trace(m_request);
261 visitor->trace(m_headers); 271 visitor->trace(m_headers);
272 visitor->trace(m_fetchBodyStream);
262 } 273 }
263 274
264 } // namespace blink 275 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698