Index: third_party/WebKit/Source/modules/fetch/Request.cpp |
diff --git a/third_party/WebKit/Source/modules/fetch/Request.cpp b/third_party/WebKit/Source/modules/fetch/Request.cpp |
index 6cc792b88301ee34dc12b0111f299471192655fa..3b55ebbaa7169e91fbb9546bcc74076d58894cd9 100644 |
--- a/third_party/WebKit/Source/modules/fetch/Request.cpp |
+++ b/third_party/WebKit/Source/modules/fetch/Request.cpp |
@@ -162,9 +162,14 @@ Request* Request::createRequestWithRequestOrString(ScriptState* scriptState, Req |
} |
- // "17. Let |mode| be |init|'s mode member if it is present, and |
+ // "16. Let |mode| be |init|'s mode member if it is present, and |
// |fallbackMode| otherwise." |
+ // "17.If mode is "navigate", throw a TypeError. |
// "18. If |mode| is non-null, set |request|'s mode to |mode|." |
+ if (init.mode == "navigate") { |
+ exceptionState.throwTypeError("Cannot construct a Request with a Request mode as navigate."); |
+ return nullptr; |
+ } |
if (init.mode == "same-origin") { |
request->setMode(WebURLRequest::FetchRequestModeSameOrigin); |
} else if (init.mode == "no-cors") { |
@@ -490,6 +495,8 @@ String Request::mode() const |
// "The mode attribute's getter must return the value corresponding to the |
// first matching statement, switching on request's mode:" |
switch (m_request->mode()) { |
+ case WebURLRequest::FetchRequestModeNavigate: |
+ return "navigate"; |
case WebURLRequest::FetchRequestModeSameOrigin: |
return "same-origin"; |
case WebURLRequest::FetchRequestModeNoCORS: |