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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/Request.cpp

Issue 2823203003: Replace ASSERT_NOT_REACHED with NOTREACHED in modules/fetch (Closed)
Patch Set: Created 3 years, 8 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 "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 "bindings/core/v8/V8PrivateProperty.h" 8 #include "bindings/core/v8/V8PrivateProperty.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/dom/ExecutionContext.h" 10 #include "core/dom/ExecutionContext.h"
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 return "track"; 574 return "track";
575 case WebURLRequest::kRequestContextVideo: 575 case WebURLRequest::kRequestContextVideo:
576 return "video"; 576 return "video";
577 case WebURLRequest::kRequestContextWorker: 577 case WebURLRequest::kRequestContextWorker:
578 return "worker"; 578 return "worker";
579 case WebURLRequest::kRequestContextXMLHttpRequest: 579 case WebURLRequest::kRequestContextXMLHttpRequest:
580 return "xmlhttprequest"; 580 return "xmlhttprequest";
581 case WebURLRequest::kRequestContextXSLT: 581 case WebURLRequest::kRequestContextXSLT:
582 return "xslt"; 582 return "xslt";
583 } 583 }
584 ASSERT_NOT_REACHED(); 584 NOTREACHED();
585 return ""; 585 return "";
586 } 586 }
587 587
588 String Request::referrer() const { 588 String Request::referrer() const {
589 // "The referrer attribute's getter must return the empty string if 589 // "The referrer attribute's getter must return the empty string if
590 // request's referrer is no referrer, "about:client" if request's referrer 590 // request's referrer is no referrer, "about:client" if request's referrer
591 // is client and request's referrer, serialized, otherwise." 591 // is client and request's referrer, serialized, otherwise."
592 DCHECK_EQ(FetchRequestData::NoReferrerString(), AtomicString()); 592 DCHECK_EQ(FetchRequestData::NoReferrerString(), AtomicString());
593 DCHECK_EQ(FetchRequestData::ClientReferrerString(), 593 DCHECK_EQ(FetchRequestData::ClientReferrerString(),
594 AtomicString("about:client")); 594 AtomicString("about:client"));
(...skipping 11 matching lines...) Expand all
606 case kReferrerPolicyNever: 606 case kReferrerPolicyNever:
607 return "no-referrer"; 607 return "no-referrer";
608 case kReferrerPolicyOrigin: 608 case kReferrerPolicyOrigin:
609 return "origin"; 609 return "origin";
610 case kReferrerPolicyOriginWhenCrossOrigin: 610 case kReferrerPolicyOriginWhenCrossOrigin:
611 return "origin-when-cross-origin"; 611 return "origin-when-cross-origin";
612 case kReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin: 612 case kReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin:
613 DCHECK(RuntimeEnabledFeatures::reducedReferrerGranularityEnabled()); 613 DCHECK(RuntimeEnabledFeatures::reducedReferrerGranularityEnabled());
614 return "no-referrer-when-downgrade-origin-when-cross-origin"; 614 return "no-referrer-when-downgrade-origin-when-cross-origin";
615 } 615 }
616 ASSERT_NOT_REACHED(); 616 NOTREACHED();
617 return String(); 617 return String();
618 } 618 }
619 619
620 String Request::mode() const { 620 String Request::mode() const {
621 // "The mode attribute's getter must return the value corresponding to the 621 // "The mode attribute's getter must return the value corresponding to the
622 // first matching statement, switching on request's mode:" 622 // first matching statement, switching on request's mode:"
623 switch (request_->Mode()) { 623 switch (request_->Mode()) {
624 case WebURLRequest::kFetchRequestModeSameOrigin: 624 case WebURLRequest::kFetchRequestModeSameOrigin:
625 return "same-origin"; 625 return "same-origin";
626 case WebURLRequest::kFetchRequestModeNoCORS: 626 case WebURLRequest::kFetchRequestModeNoCORS:
627 return "no-cors"; 627 return "no-cors";
628 case WebURLRequest::kFetchRequestModeCORS: 628 case WebURLRequest::kFetchRequestModeCORS:
629 case WebURLRequest::kFetchRequestModeCORSWithForcedPreflight: 629 case WebURLRequest::kFetchRequestModeCORSWithForcedPreflight:
630 return "cors"; 630 return "cors";
631 case WebURLRequest::kFetchRequestModeNavigate: 631 case WebURLRequest::kFetchRequestModeNavigate:
632 return "navigate"; 632 return "navigate";
633 } 633 }
634 ASSERT_NOT_REACHED(); 634 NOTREACHED();
635 return ""; 635 return "";
636 } 636 }
637 637
638 String Request::credentials() const { 638 String Request::credentials() const {
639 // "The credentials attribute's getter must return the value corresponding 639 // "The credentials attribute's getter must return the value corresponding
640 // to the first matching statement, switching on request's credentials 640 // to the first matching statement, switching on request's credentials
641 // mode:" 641 // mode:"
642 switch (request_->Credentials()) { 642 switch (request_->Credentials()) {
643 case WebURLRequest::kFetchCredentialsModeOmit: 643 case WebURLRequest::kFetchCredentialsModeOmit:
644 return "omit"; 644 return "omit";
645 case WebURLRequest::kFetchCredentialsModeSameOrigin: 645 case WebURLRequest::kFetchCredentialsModeSameOrigin:
646 return "same-origin"; 646 return "same-origin";
647 case WebURLRequest::kFetchCredentialsModeInclude: 647 case WebURLRequest::kFetchCredentialsModeInclude:
648 return "include"; 648 return "include";
649 case WebURLRequest::kFetchCredentialsModePassword: 649 case WebURLRequest::kFetchCredentialsModePassword:
650 return "password"; 650 return "password";
651 } 651 }
652 ASSERT_NOT_REACHED(); 652 NOTREACHED();
653 return ""; 653 return "";
654 } 654 }
655 655
656 String Request::cache() const { 656 String Request::cache() const {
657 // "The cache attribute's getter must return request's cache mode." 657 // "The cache attribute's getter must return request's cache mode."
658 switch (request_->CacheMode()) { 658 switch (request_->CacheMode()) {
659 case WebURLRequest::kFetchRequestCacheModeDefault: 659 case WebURLRequest::kFetchRequestCacheModeDefault:
660 return "default"; 660 return "default";
661 case WebURLRequest::kFetchRequestCacheModeNoStore: 661 case WebURLRequest::kFetchRequestCacheModeNoStore:
662 return "no-store"; 662 return "no-store";
(...skipping 13 matching lines...) Expand all
676 String Request::redirect() const { 676 String Request::redirect() const {
677 // "The redirect attribute's getter must return request's redirect mode." 677 // "The redirect attribute's getter must return request's redirect mode."
678 switch (request_->Redirect()) { 678 switch (request_->Redirect()) {
679 case WebURLRequest::kFetchRedirectModeFollow: 679 case WebURLRequest::kFetchRedirectModeFollow:
680 return "follow"; 680 return "follow";
681 case WebURLRequest::kFetchRedirectModeError: 681 case WebURLRequest::kFetchRedirectModeError:
682 return "error"; 682 return "error";
683 case WebURLRequest::kFetchRedirectModeManual: 683 case WebURLRequest::kFetchRedirectModeManual:
684 return "manual"; 684 return "manual";
685 } 685 }
686 ASSERT_NOT_REACHED(); 686 NOTREACHED();
687 return ""; 687 return "";
688 } 688 }
689 689
690 String Request::integrity() const { 690 String Request::integrity() const {
691 return request_->Integrity(); 691 return request_->Integrity();
692 } 692 }
693 693
694 Request* Request::clone(ScriptState* script_state, 694 Request* Request::clone(ScriptState* script_state,
695 ExceptionState& exception_state) { 695 ExceptionState& exception_state) {
696 if (IsBodyLocked() || bodyUsed()) { 696 if (IsBodyLocked() || bodyUsed()) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 .Set(request.As<v8::Object>(), body_buffer); 763 .Set(request.As<v8::Object>(), body_buffer);
764 } 764 }
765 765
766 DEFINE_TRACE(Request) { 766 DEFINE_TRACE(Request) {
767 Body::Trace(visitor); 767 Body::Trace(visitor);
768 visitor->Trace(request_); 768 visitor->Trace(request_);
769 visitor->Trace(headers_); 769 visitor->Trace(headers_);
770 } 770 }
771 771
772 } // namespace blink 772 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/FetchManager.cpp ('k') | third_party/WebKit/Source/modules/fetch/Response.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698