From b53ba78d324c844a2a77da9acf4628c0b12ed90f Mon Sep 17 00:00:00 2001 From: Kershaw Chang Date: Wed, 15 May 2019 20:36:09 +0000 Subject: [PATCH] Bug 1546041 - Throw TypeError if mode is Navigate r=baku According to spec, we should throw TypeError if the mode is Navigate. Differential Revision: https://phabricator.services.mozilla.com/D31245 --HG-- extra : moz-landing-system : lando --- dom/fetch/Request.cpp | 8 +++++--- .../meta/fetch/api/request/request-error.html.ini | 3 --- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/dom/fetch/Request.cpp b/dom/fetch/Request.cpp index dcc800fde7aa..fe65bf59ba0e 100644 --- a/dom/fetch/Request.cpp +++ b/dom/fetch/Request.cpp @@ -322,9 +322,11 @@ already_AddRefed Request::Constructor(const GlobalObject& aGlobal, ? aInit.mCredentials.Value() : fallbackCredentials; - if (mode == RequestMode::Navigate || - (aInit.IsAnyMemberPresent() && - request->Mode() == RequestMode::Navigate)) { + if (mode == RequestMode::Navigate) { + aRv.ThrowTypeError(NS_LITERAL_STRING("navigate")); + return nullptr; + } + if (aInit.IsAnyMemberPresent() && request->Mode() == RequestMode::Navigate) { mode = RequestMode::Same_origin; } diff --git a/testing/web-platform/meta/fetch/api/request/request-error.html.ini b/testing/web-platform/meta/fetch/api/request/request-error.html.ini index b8da81855247..b74d414a242d 100644 --- a/testing/web-platform/meta/fetch/api/request/request-error.html.ini +++ b/testing/web-platform/meta/fetch/api/request/request-error.html.ini @@ -2,9 +2,6 @@ [RequestInit's window is not null] expected: FAIL - [RequestInit's mode is navigate] - expected: FAIL - [RequestInit's mode is no-cors and integrity is not empty] expected: FAIL