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

Unified Diff: third_party/WebKit/Source/modules/fetch/Headers.cpp

Issue 2840193002: fetch: Align RequestInit's |headers| with the spec. (Closed)
Patch Set: Use using, not typedef 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/fetch/Headers.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/Headers.cpp b/third_party/WebKit/Source/modules/fetch/Headers.cpp
index 8c3be952f1cb7a18b35277e31c130830ab09f4cf..85f7b18d77b9d1b5296046d2e2572744d961f562 100644
--- a/third_party/WebKit/Source/modules/fetch/Headers.cpp
+++ b/third_party/WebKit/Source/modules/fetch/Headers.cpp
@@ -52,23 +52,13 @@ Headers* Headers::Create(ExceptionState&) {
return new Headers;
}
-Headers* Headers::Create(
- const ByteStringSequenceSequenceOrByteStringByteStringRecordOrHeaders& init,
- ExceptionState& exception_state) {
+Headers* Headers::Create(const HeadersInit& init,
+ ExceptionState& exception_state) {
// "The Headers(|init|) constructor, when invoked, must run these steps:"
// "1. Let |headers| be a new Headers object whose guard is "none".
Headers* headers = Create(exception_state);
// "2. If |init| is given, fill headers with |init|. Rethrow any exception."
- if (init.isByteStringSequenceSequence()) {
- headers->FillWith(init.getAsByteStringSequenceSequence(), exception_state);
- } else if (init.isByteStringByteStringRecord()) {
- headers->FillWith(init.getAsByteStringByteStringRecord(), exception_state);
- } else if (init.isHeaders()) {
- // This branch will not be necessary once http://crbug.com/690428 is fixed.
- headers->FillWith(init.getAsHeaders(), exception_state);
- } else {
- NOTREACHED();
- }
+ headers->FillWith(init, exception_state);
// "3. Return |headers|."
return headers;
}
@@ -228,6 +218,21 @@ void Headers::FillWith(const Headers* object, ExceptionState& exception_state) {
}
}
+void Headers::FillWith(const HeadersInit& init,
+ ExceptionState& exception_state) {
+ DCHECK_EQ(header_list_->size(), 0U);
+ if (init.isByteStringSequenceSequence()) {
+ FillWith(init.getAsByteStringSequenceSequence(), exception_state);
+ } else if (init.isByteStringByteStringRecord()) {
+ FillWith(init.getAsByteStringByteStringRecord(), exception_state);
+ } else if (init.isHeaders()) {
+ // This branch will not be necessary once http://crbug.com/690428 is fixed.
+ FillWith(init.getAsHeaders(), exception_state);
+ } else {
+ NOTREACHED();
+ }
+}
+
void Headers::FillWith(const Vector<Vector<String>>& object,
ExceptionState& exception_state) {
DCHECK(!header_list_->size());
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/Headers.h ('k') | third_party/WebKit/Source/modules/fetch/Request.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698