Bug 1486703 - Display correct hostOnly values in storage inspector;r=miker

Differential Revision: https://phabricator.services.mozilla.com/D4712

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Julian Descottes 2018-09-07 10:41:42 +00:00
Родитель 5de11b6599
Коммит 7be03c4f9e
7 изменённых файлов: 45 добавлений и 19 удалений

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

@ -41,6 +41,7 @@ tags = usercontextid
[browser_storage_cookies_domain_port.js]
[browser_storage_cookies_edit.js]
[browser_storage_cookies_edit_keyboard.js]
[browser_storage_cookies_hostOnly.js]
[browser_storage_cookies_samesite.js]
skip-if = true # Bug 1448484 - sameSite1 is "Unset" - Got undefined, expected Unset
[browser_storage_cookies_tab_navigation.js]

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

@ -0,0 +1,26 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// Test that the HostOnly values displayed in the table are correct.
add_task(async function() {
await openTabAndSetupStorage(MAIN_DOMAIN + "storage-complex-values.html");
gUI.tree.expandAll();
showColumn("hostOnly", true);
const c1id = getCookieId("c1", "test1.example.org", "/browser");
await selectTableItem(c1id);
checkCell(c1id, "hostOnly", "true");
const c2id = getCookieId("cs2", ".example.org", "/");
await selectTableItem(c2id);
checkCell(c2id, "hostOnly", "false");
await finishTests();
});

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

@ -51,9 +51,9 @@ const COOKIE_KEY_MAP = {
path: "Path",
host: "Domain",
expires: "Expires",
hostOnly: "HostOnly",
isSecure: "Secure",
isHttpOnly: "HttpOnly",
isDomain: "HostOnly",
creationTime: "CreationTime",
lastAccessed: "LastAccessed"
};
@ -755,8 +755,7 @@ class StorageUI {
}
const cookieProp = COOKIE_KEY_MAP[prop] || prop;
// The pseduo property of HostOnly refers to converse of isDomain property
rawObject[cookieProp] = (prop === "isDomain") ? !item[prop] : item[prop];
rawObject[cookieProp] = item[prop];
}
itemVar.populate(rawObject, {sorted: true});
itemVar.twisty = true;

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

@ -561,7 +561,7 @@ StorageActors.createActor({
// - do -
lastAccessed: cookie.lastAccessed / 1000,
value: new LongStringActor(this.conn, cookie.value || ""),
isDomain: cookie.isDomain,
hostOnly: !cookie.isDomain,
isSecure: cookie.isSecure,
isHttpOnly: cookie.isHttpOnly,
sameSite: this.getSameSiteStringFromCookie(cookie)
@ -686,7 +686,7 @@ StorageActors.createActor({
{ name: "lastAccessed", editable: false, hidden: false },
{ name: "creationTime", editable: false, hidden: true },
{ name: "value", editable: true, hidden: false },
{ name: "isDomain", editable: false, hidden: true },
{ name: "hostOnly", editable: false, hidden: true },
{ name: "isSecure", editable: true, hidden: true },
{ name: "isHttpOnly", editable: true, hidden: false },
{ name: "sameSite", editable: false, hidden: false }

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

@ -19,7 +19,7 @@ const TESTDATA = {
expires: 0,
path: "/",
host: "test1.example.org",
isDomain: false,
hostOnly: true,
isSecure: false,
},
{
@ -28,7 +28,7 @@ const TESTDATA = {
expires: 0,
path: "/path2/",
host: "test1.example.org",
isDomain: false,
hostOnly: true,
isSecure: false,
},
{
@ -37,7 +37,7 @@ const TESTDATA = {
expires: 0,
path: "/path3/",
host: "test1.example.org",
isDomain: false,
hostOnly: true,
isSecure: false,
}
]
@ -89,7 +89,7 @@ var testCookiesObjects = async function(index, hosts, cookiesActor) {
is(item.path, toMatch.path, "The path matches.");
is(item.host, toMatch.host, "The host matches.");
is(item.isSecure, toMatch.isSecure, "The isSecure value matches.");
is(item.isDomain, toMatch.isDomain, "The isDomain value matches.");
is(item.hostOnly, toMatch.hostOnly, "The hostOnly value matches.");
break;
}
}

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

@ -17,7 +17,7 @@ const storeMap = {
expires: 2000000000000,
path: "/browser",
host: "test1.example.org",
isDomain: false,
hostOnly: true,
isSecure: false,
},
{
@ -26,7 +26,7 @@ const storeMap = {
path: "/",
host: ".example.org",
expires: 0,
isDomain: true,
hostOnly: false,
isSecure: false,
},
{
@ -35,7 +35,7 @@ const storeMap = {
expires: 2000000001000,
path: "/",
host: "test1.example.org",
isDomain: false,
hostOnly: true,
isSecure: true,
}
],
@ -47,7 +47,7 @@ const storeMap = {
path: "/",
host: ".example.org",
expires: 0,
isDomain: true,
hostOnly: false,
isSecure: false,
},
{
@ -56,7 +56,7 @@ const storeMap = {
path: "/browser/devtools/server/tests/browser/",
host: "sectest1.example.org",
expires: 0,
isDomain: false,
hostOnly: true,
isSecure: false,
}
],
@ -68,7 +68,7 @@ const storeMap = {
host: ".example.org",
path: "/",
expires: 0,
isDomain: true,
hostOnly: false,
isSecure: true,
},
{
@ -77,7 +77,7 @@ const storeMap = {
path: "/",
host: ".example.org",
expires: 0,
isDomain: true,
hostOnly: false,
isSecure: false,
},
{
@ -86,7 +86,7 @@ const storeMap = {
path: "/browser/devtools/server/tests/browser/",
host: "sectest1.example.org",
expires: 0,
isDomain: false,
hostOnly: true,
isSecure: false,
}
]
@ -372,7 +372,7 @@ var testCookiesObjects = async function(index, hosts, cookiesActor) {
is(item.path, toMatch.path, "The path matches.");
is(item.host, toMatch.host, "The host matches.");
is(item.isSecure, toMatch.isSecure, "The isSecure value matches.");
is(item.isDomain, toMatch.isDomain, "The isDomain value matches.");
is(item.hostOnly, toMatch.hostOnly, "The hostOnly value matches.");
break;
}
}

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

@ -45,7 +45,7 @@ types.addDictType("cookieobject", {
value: "longstring",
path: "nullable:string",
host: "string",
isDomain: "boolean",
hostOnly: "boolean",
isSecure: "boolean",
isHttpOnly: "boolean",
creationTime: "number",