Bug 976073 - Part 2: Modify errors from try server, r=jdm

This commit is contained in:
amy 2016-11-09 17:26:03 +08:00
Родитель a58ca1d174
Коммит c48ec5eaa8
8 изменённых файлов: 11 добавлений и 105 удалений

Просмотреть файл

@ -19,7 +19,7 @@ let cookieExpiresTime2 = 2000000001000;
document.cookie = "c1=foobar; expires=" +
new Date(cookieExpiresTime1).toGMTString() + "; path=/browser";
document.cookie = "cs2=sessionCookie; path=/; domain=" + partialHostname;
document.cookie = "c3=foobar-2; secure=true; expires=" +
document.cookie = "c3=foobar-2; expires=" +
new Date(cookieExpiresTime2).toGMTString() + "; path=/";
// ... and some local storage items ..
localStorage.setItem("ls1", "foobar");

Просмотреть файл

@ -9,7 +9,7 @@ Iframe for testing multiple host detetion in storage actor
<body>
<script>
"use strict";
document.cookie = "uc1=foobar; domain=.example.org; path=/; secure=true";
document.cookie = "uc1=foobar; domain=.example.org; path=/";
localStorage.setItem("iframe-u-ls1", "foobar");
sessionStorage.setItem("iframe-u-ss1", "foobar1");
sessionStorage.setItem("iframe-u-ss2", "foobar2");

Просмотреть файл

@ -35,7 +35,7 @@ const storeMap = {
path: "/",
host: "test1.example.org",
isDomain: false,
isSecure: true,
isSecure: false,
},
{
name: "uc1",
@ -344,7 +344,14 @@ function testCookies(cookiesActor) {
var testCookiesObjects = Task.async(function* (index, hosts, cookiesActor) {
let host = Object.keys(hosts)[index];
let matchItems = data => {
is(data.total, storeMap.cookies[host].length,
let cookiesLength = 0;
for (let secureCookie of storeMap.cookies[host]) {
if (secureCookie.isSecure) {
++cookiesLength;
}
}
// Any secure cookies did not get stored in the database.
is(data.total, storeMap.cookies[host].length - cookiesLength,
"Number of cookies in host " + host + " matches");
for (let item of data.data) {
let found = false;

Просмотреть файл

@ -14815,18 +14815,10 @@
"path": "cookies/secure/set-from-dom.https.sub.html",
"url": "/cookies/secure/set-from-dom.https.sub.html"
},
{
"path": "cookies/secure/set-from-dom.sub.html",
"url": "/cookies/secure/set-from-dom.sub.html"
},
{
"path": "cookies/secure/set-from-http.https.sub.html",
"url": "/cookies/secure/set-from-http.https.sub.html"
},
{
"path": "cookies/secure/set-from-http.sub.html",
"url": "/cookies/secure/set-from-http.sub.html"
},
{
"path": "cookies/secure/set-from-ws.https.sub.html",
"url": "/cookies/secure/set-from-ws.https.sub.html"

Просмотреть файл

@ -1,5 +0,0 @@
[set-from-dom.sub.html]
type: testharness
['secure' cookie not sent in HTTP request]
expected: FAIL

Просмотреть файл

@ -1,5 +0,0 @@
[set-from-http.sub.html]
type: testharness
['secure' cookie not sent in HTTP request]
expected: FAIL

Просмотреть файл

@ -1,47 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Set 'secure' cookie from `document.cookie` on a non-secure page</title>
<meta name=help href="https://tools.ietf.org/html/draft-west-leave-secure-cookies-alone">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/cookies/resources/testharness-helpers.js"></script>
</head>
<body>
<div id=log></div>
<script>
var tests = [
[
"'secure' cookie not set in `document.cookie`",
function () {
var originalCookie = document.cookie;
document.cookie = "secure_from_nonsecure_dom=1; secure; path=/";
assert_equals(document.cookie, originalCookie);
this.done();
}
],
[
"'secure' cookie not sent in HTTP request",
function () {
document.cookie = "secure_from_nonsecure_dom=1; secure; path=/";
fetch("https://{{host}}:{{ports[https][0]}}/cookies/resources/echo-json.py", { "credentials": "include" })
.then(this.step_func(function (r) {
return r.json();
}))
.then(this.step_func_done(function (j) {
assert_equals(j["secure_from_nonsecure_dom"], undefined);
}));
}
]
];
function clearKnownCookie() {
document.cookie = "secure_from_nonsecure_dom=0; Secure; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/";
}
executeTestsSerially(tests, clearKnownCookie, clearKnownCookie);
</script>
</body>
</html>

Просмотреть файл

@ -1,36 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Set 'secure' cookie from `Set-Cookie` HTTP header on a non-secure page</title>
<meta name=help href="https://tools.ietf.org/html/draft-west-leave-secure-cookies-alone">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/cookies/resources/testharness-helpers.js"></script>
</head>
<body>
<div id=log></div>
<script>
function clearKnownCookie() {
document.cookie = "secure_from_nonsecure_http=0; Secure; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/";
}
test(function () {
assert_equals(document.cookie.match(/secure_from_nonsecure_http=1/), null);
}, "'secure' cookie not present in `document.cookie`");
promise_test(function (t) {
t.add_cleanup(clearKnownCookie);
return fetch("https://{{host}}:{{ports[https][0]}}/cookies/resources/echo-json.py",
{ "credentials": "include" })
.then(function (r) {
return r.json();
})
.then(function (j) {
assert_equals(j["secure_from_nonsecure_http"], undefined);
});
}, "'secure' cookie not sent in HTTP request");
</script>
</body>
</html>