summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-05-27 10:11:50 +0200
committerGitHub <noreply@github.com>2018-05-27 10:11:50 +0200
commitd65ac8d5e0b6073a2ec467068b8b340efc562b69 (patch)
treeed6f37c46d5049b38b4a558f2fd7bf4d77c8743f
parent3f215e15fb60f5b62b7f1cd3771ac7ecc9326d1a (diff)
parent96357e8a7f9719dc088e26644028feebaee9f2fb (diff)
downloadUXP-d65ac8d5e0b6073a2ec467068b8b340efc562b69.tar
UXP-d65ac8d5e0b6073a2ec467068b8b340efc562b69.tar.gz
UXP-d65ac8d5e0b6073a2ec467068b8b340efc562b69.tar.lz
UXP-d65ac8d5e0b6073a2ec467068b8b340efc562b69.tar.xz
UXP-d65ac8d5e0b6073a2ec467068b8b340efc562b69.zip
Merge pull request #390 from janekptacijarabaci/dom_fetch_credentials_1
Make fetch() use "same-origin" credentials by default
-rw-r--r--dom/fetch/Request.cpp2
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_cors.js4
-rw-r--r--dom/tests/mochitest/fetch/test_request.js4
-rw-r--r--testing/web-platform/tests/fetch/api/request/request-init-003.sub.html2
-rw-r--r--testing/web-platform/tests/fetch/api/request/request-structure.html2
5 files changed, 7 insertions, 7 deletions
diff --git a/dom/fetch/Request.cpp b/dom/fetch/Request.cpp
index bc17afae3..c119a503e 100644
--- a/dom/fetch/Request.cpp
+++ b/dom/fetch/Request.cpp
@@ -327,7 +327,7 @@ Request::Constructor(const GlobalObject& aGlobal,
RequestCache fallbackCache = RequestCache::EndGuard_;
if (aInput.IsUSVString()) {
fallbackMode = RequestMode::Cors;
- fallbackCredentials = RequestCredentials::Omit;
+ fallbackCredentials = RequestCredentials::Same_origin;
fallbackCache = RequestCache::Default;
}
diff --git a/dom/tests/mochitest/fetch/test_fetch_cors.js b/dom/tests/mochitest/fetch/test_fetch_cors.js
index ac83d050d..f375ce73f 100644
--- a/dom/tests/mochitest/fetch/test_fetch_cors.js
+++ b/dom/tests/mochitest/fetch/test_fetch_cors.js
@@ -64,9 +64,9 @@ function testSameOriginCredentials() {
withCred: "same-origin",
},
{
- // Default mode is "omit".
+ // Default mode is "same-origin".
pass: 1,
- noCookie: 1,
+ cookie: cookieStr,
},
{
pass: 1,
diff --git a/dom/tests/mochitest/fetch/test_request.js b/dom/tests/mochitest/fetch/test_request.js
index badad61b9..5be361a46 100644
--- a/dom/tests/mochitest/fetch/test_request.js
+++ b/dom/tests/mochitest/fetch/test_request.js
@@ -6,7 +6,7 @@ function testDefaultCtor() {
is(req.context, "fetch", "Default context is fetch.");
is(req.referrer, "about:client", "Default referrer is `client` which serializes to about:client.");
is(req.mode, "cors", "Request mode for string input is cors");
- is(req.credentials, "omit", "Default Request credentials is omit");
+ is(req.credentials, "same-origin", "Default Request credentials is same-origin");
is(req.cache, "default", "Default Request cache is default");
var req = new Request(req);
@@ -16,7 +16,7 @@ function testDefaultCtor() {
is(req.context, "fetch", "Default context is fetch.");
is(req.referrer, "about:client", "Default referrer is `client` which serializes to about:client.");
is(req.mode, "cors", "Request mode string input is cors");
- is(req.credentials, "omit", "Default Request credentials is omit");
+ is(req.credentials, "same-origin", "Default Request credentials is same-origin");
is(req.cache, "default", "Default Request cache is default");
}
diff --git a/testing/web-platform/tests/fetch/api/request/request-init-003.sub.html b/testing/web-platform/tests/fetch/api/request/request-init-003.sub.html
index 8860d6074..1f95c5ae9 100644
--- a/testing/web-platform/tests/fetch/api/request/request-init-003.sub.html
+++ b/testing/web-platform/tests/fetch/api/request/request-init-003.sub.html
@@ -44,7 +44,7 @@
"referrer" : "http://{{host}}:{{ports[http][0]}}/",
"referrerPolicy" : "",
"mode" : "cors",
- "credentials" : "omit",
+ "credentials" : "same-origin",
"cache" : "default",
"redirect" : "follow",
"integrity" : "",
diff --git a/testing/web-platform/tests/fetch/api/request/request-structure.html b/testing/web-platform/tests/fetch/api/request/request-structure.html
index cbe6cee99..9494689c7 100644
--- a/testing/web-platform/tests/fetch/api/request/request-structure.html
+++ b/testing/web-platform/tests/fetch/api/request/request-structure.html
@@ -82,7 +82,7 @@
break;
case "credentials":
- defaultValue = "omit";
+ defaultValue = "same-origin";
newValue = "cors";
break;