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 "config.h" | 5 #include "config.h" |
6 #include "modules/fetch/FetchManager.h" | 6 #include "modules/fetch/FetchManager.h" |
7 | 7 |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
(...skipping 16 matching lines...) Expand all Loading... | |
27 #include "modules/fetch/BodyStreamBuffer.h" | 27 #include "modules/fetch/BodyStreamBuffer.h" |
28 #include "modules/fetch/CompositeDataConsumerHandle.h" | 28 #include "modules/fetch/CompositeDataConsumerHandle.h" |
29 #include "modules/fetch/DataConsumerHandleUtil.h" | 29 #include "modules/fetch/DataConsumerHandleUtil.h" |
30 #include "modules/fetch/FetchFormDataConsumerHandle.h" | 30 #include "modules/fetch/FetchFormDataConsumerHandle.h" |
31 #include "modules/fetch/FetchRequestData.h" | 31 #include "modules/fetch/FetchRequestData.h" |
32 #include "modules/fetch/Response.h" | 32 #include "modules/fetch/Response.h" |
33 #include "modules/fetch/ResponseInit.h" | 33 #include "modules/fetch/ResponseInit.h" |
34 #include "platform/network/ResourceError.h" | 34 #include "platform/network/ResourceError.h" |
35 #include "platform/network/ResourceRequest.h" | 35 #include "platform/network/ResourceRequest.h" |
36 #include "platform/network/ResourceResponse.h" | 36 #include "platform/network/ResourceResponse.h" |
37 #include "platform/weborigin/SchemeRegistry.h" | |
37 #include "platform/weborigin/SecurityOrigin.h" | 38 #include "platform/weborigin/SecurityOrigin.h" |
38 #include "public/platform/WebURLRequest.h" | 39 #include "public/platform/WebURLRequest.h" |
39 #include "wtf/HashSet.h" | 40 #include "wtf/HashSet.h" |
40 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
41 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
42 | 43 |
43 namespace blink { | 44 namespace blink { |
44 | 45 |
45 namespace { | 46 namespace { |
46 | 47 |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 if (m_loader) { | 434 if (m_loader) { |
434 m_loader->cancel(); | 435 m_loader->cancel(); |
435 m_loader.clear(); | 436 m_loader.clear(); |
436 } | 437 } |
437 } | 438 } |
438 | 439 |
439 void FetchManager::Loader::performBasicFetch() | 440 void FetchManager::Loader::performBasicFetch() |
440 { | 441 { |
441 // "To perform a basic fetch using |request|, switch on |request|'s url's | 442 // "To perform a basic fetch using |request|, switch on |request|'s url's |
442 // scheme, and run the associated steps:" | 443 // scheme, and run the associated steps:" |
443 if (m_request->url().protocolIsInHTTPFamily()) { | 444 if (SchemeRegistry::shouldTreatURLSchemeAsAllowingServiceWorkers(m_request-> url().protocol())) { |
444 // "Return the result of performing an HTTP fetch using |request|." | 445 // "Return the result of performing an HTTP fetch using |request|." |
445 performHTTPFetch(false, false); | 446 performHTTPFetch(false, false); |
446 } else { | 447 } else { |
447 // FIXME: implement other protocols. | 448 // FIXME: implement other protocols. |
448 performNetworkError("Fetch API cannot load " + m_request->url().string() + ". URL scheme \"" + m_request->url().protocol() + "\" is not supported."); | 449 performNetworkError("Fetch API cannot load " + m_request->url().string() + ". URL scheme \"" + m_request->url().protocol() + "\" is not supported."); |
449 } | 450 } |
450 } | 451 } |
451 | 452 |
452 void FetchManager::Loader::performNetworkError(const String& message) | 453 void FetchManager::Loader::performNetworkError(const String& message) |
453 { | 454 { |
454 failed(message); | 455 failed(message); |
455 } | 456 } |
456 | 457 |
457 void FetchManager::Loader::performHTTPFetch(bool corsFlag, bool corsPreflightFla g) | 458 void FetchManager::Loader::performHTTPFetch(bool corsFlag, bool corsPreflightFla g) |
458 { | 459 { |
459 ASSERT(m_request->url().protocolIsInHTTPFamily()); | 460 ASSERT(SchemeRegistry::ShouldTreatURLShemeAsAllowingServiceWorkers(m_request ->url().procol())); |
tyoshino (SeeGerritForStatus)
2015/08/25 05:16:48
Maybe just WIP. But
Sheme -> Scheme
Should -> sho
not at google - send to devlin
2015/08/25 19:58:50
Yeah epic typos here :-)
| |
460 // CORS preflight fetch procedure is implemented inside DocumentThreadableLo ader. | 461 // CORS preflight fetch procedure is implemented inside DocumentThreadableLo ader. |
461 | 462 |
462 // "1. Let |HTTPRequest| be a copy of |request|, except that |HTTPRequest|'s | 463 // "1. Let |HTTPRequest| be a copy of |request|, except that |HTTPRequest|'s |
463 // body is a tee of |request|'s body." | 464 // body is a tee of |request|'s body." |
464 // We use ResourceRequest class for HTTPRequest. | 465 // We use ResourceRequest class for HTTPRequest. |
465 // FIXME: Support body. | 466 // FIXME: Support body. |
466 ResourceRequest request(m_request->url()); | 467 ResourceRequest request(m_request->url()); |
467 request.setRequestContext(m_request->context()); | 468 request.setRequestContext(m_request->context()); |
468 request.setHTTPMethod(m_request->method()); | 469 request.setHTTPMethod(m_request->method()); |
469 const Vector<OwnPtr<FetchHeaderList::Header>>& list = m_request->headerList( )->list(); | 470 const Vector<OwnPtr<FetchHeaderList::Header>>& list = m_request->headerList( )->list(); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
598 | 599 |
599 DEFINE_TRACE(FetchManager) | 600 DEFINE_TRACE(FetchManager) |
600 { | 601 { |
601 #if ENABLE(OILPAN) | 602 #if ENABLE(OILPAN) |
602 visitor->trace(m_executionContext); | 603 visitor->trace(m_executionContext); |
603 visitor->trace(m_loaders); | 604 visitor->trace(m_loaders); |
604 #endif | 605 #endif |
605 } | 606 } |
606 | 607 |
607 } // namespace blink | 608 } // namespace blink |
OLD | NEW |