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

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

Issue 329853012: [ServiceWorker] Make Request class better conformance with the spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase and fix test Created 6 years, 5 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 "FetchManager.h" 6 #include "FetchManager.h"
7 7
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "bindings/core/v8/V8ThrowException.h" 10 #include "bindings/core/v8/V8ThrowException.h"
11 #include "core/dom/ExceptionCode.h" 11 #include "core/dom/ExceptionCode.h"
12 #include "core/fileapi/Blob.h" 12 #include "core/fileapi/Blob.h"
13 #include "core/loader/ThreadableLoader.h" 13 #include "core/loader/ThreadableLoader.h"
14 #include "core/loader/ThreadableLoaderClient.h" 14 #include "core/loader/ThreadableLoaderClient.h"
15 #include "core/xml/XMLHttpRequest.h"
15 #include "modules/serviceworkers/Response.h" 16 #include "modules/serviceworkers/Response.h"
16 #include "modules/serviceworkers/ResponseInit.h" 17 #include "modules/serviceworkers/ResponseInit.h"
17 #include "platform/network/ResourceRequest.h" 18 #include "platform/network/ResourceRequest.h"
18 #include "wtf/HashSet.h" 19 #include "wtf/HashSet.h"
19 20
20 namespace WebCore { 21 namespace WebCore {
21 22
22 class FetchManager::Loader : public ThreadableLoaderClient { 23 class FetchManager::Loader : public ThreadableLoaderClient {
23 public: 24 public:
24 Loader(ExecutionContext*, FetchManager*, PassRefPtr<ScriptPromiseResolver>, PassOwnPtr<ResourceRequest>); 25 Loader(ExecutionContext*, FetchManager*, PassRefPtr<ScriptPromiseResolver>, PassOwnPtr<ResourceRequest>);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 OwnPtr<Loader> loader(adoptPtr(new Loader(m_executionContext, this, resolver .release(), request))); 168 OwnPtr<Loader> loader(adoptPtr(new Loader(m_executionContext, this, resolver .release(), request)));
168 (*m_loaders.add(loader.release()).storedValue)->start(); 169 (*m_loaders.add(loader.release()).storedValue)->start();
169 return promise; 170 return promise;
170 } 171 }
171 172
172 void FetchManager::onLoaderFinished(Loader* loader) 173 void FetchManager::onLoaderFinished(Loader* loader)
173 { 174 {
174 m_loaders.remove(loader); 175 m_loaders.remove(loader);
175 } 176 }
176 177
178 bool FetchManager::isSimpleMethod(const String& method)
179 {
180 // "A simple method is a method that is `GET`, `HEAD`, or `POST`."
181 return isOnAccessControlSimpleRequestMethodWhitelist(method);
182 }
183
184 bool FetchManager::isForbiddenMethod(const String& method)
185 {
186 // "A forbidden method is a method that is a byte case-insensitive match for one of `CONNECT`, `TRACE`, and `TRACK`."
187 return !XMLHttpRequest::isAllowedHTTPMethod(method);
188 }
189
190 bool FetchManager::isUsefulMethod(const String& method)
191 {
192 // "A useful method is a method that is not a forbidden method."
193 // "A forbidden method is a method that is a byte case-insensitive match for one of `CONNECT`, `TRACE`, and `TRACK`."
194 return XMLHttpRequest::isAllowedHTTPMethod(method);
195 }
196
197
falken 2014/07/03 10:05:32 extra newline
horo 2014/07/03 12:40:29 Done.
177 } // namespace WebCore 198 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698