mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
moebius#346: Storage Inspector should trim port from hosts for cookies
Issue #31 https://github.com/MoonchildProductions/moebius/pull/346
This commit is contained in:
parent
b95939dd3c
commit
1c0e05bca2
4 changed files with 40 additions and 4 deletions
|
|
@ -27,6 +27,7 @@ support-files =
|
|||
[browser_storage_cookies_add.js]
|
||||
[browser_storage_cookies_delete_all.js]
|
||||
[browser_storage_cookies_domain.js]
|
||||
[browser_storage_cookies_domain_port.js]
|
||||
[browser_storage_cookies_edit.js]
|
||||
[browser_storage_cookies_edit_keyboard.js]
|
||||
[browser_storage_cookies_tab_navigation.js]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
/* 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/. */
|
||||
|
||||
/* import-globals-from ../../framework/test/shared-head.js */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test that cookies with domain equal to full host name and port are listed.
|
||||
// E.g., ".example.org:8000" vs. example.org:8000).
|
||||
|
||||
add_task(function* () {
|
||||
yield openTabAndSetupStorage(MAIN_DOMAIN_WITH_PORT + "storage-cookies.html");
|
||||
|
||||
yield checkState([
|
||||
[
|
||||
["cookies", "http://test1.example.org:8000"],
|
||||
[
|
||||
getCookieId("test1", ".test1.example.org", "/browser"),
|
||||
getCookieId("test2", "test1.example.org", "/browser"),
|
||||
getCookieId("test3", ".test1.example.org", "/browser"),
|
||||
getCookieId("test4", "test1.example.org", "/browser"),
|
||||
getCookieId("test5", ".test1.example.org", "/browser")
|
||||
]
|
||||
],
|
||||
]);
|
||||
|
||||
yield finishTests();
|
||||
});
|
||||
|
|
@ -22,6 +22,7 @@ const DEBUGGERLOG_PREF = "devtools.debugger.log";
|
|||
const CACHES_ON_HTTP_PREF = "dom.caches.testing.enabled";
|
||||
const PATH = "browser/devtools/client/storage/test/";
|
||||
const MAIN_DOMAIN = "http://test1.example.org/" + PATH;
|
||||
const MAIN_DOMAIN_WITH_PORT = "http://test1.example.org:8000/" + PATH;
|
||||
const ALT_DOMAIN = "http://sectest1.example.org/" + PATH;
|
||||
const ALT_DOMAIN_SECURED = "https://sectest1.example.org:443/" + PATH;
|
||||
|
||||
|
|
|
|||
|
|
@ -494,7 +494,7 @@ StorageActors.createActor({
|
|||
return host == null;
|
||||
}
|
||||
|
||||
host = trimHttpHttps(host);
|
||||
host = trimHttpHttpsPort(host);
|
||||
|
||||
if (cookie.host.startsWith(".")) {
|
||||
return ("." + host).endsWith(cookie.host);
|
||||
|
|
@ -761,7 +761,7 @@ var cookieHelpers = {
|
|||
host = "";
|
||||
}
|
||||
|
||||
host = trimHttpHttps(host);
|
||||
host = trimHttpHttpsPort(host);
|
||||
|
||||
let cookies = Services.cookies.getCookiesFromHost(host, originAttributes);
|
||||
let store = [];
|
||||
|
|
@ -897,7 +897,7 @@ var cookieHelpers = {
|
|||
opts.path = split[2];
|
||||
}
|
||||
|
||||
host = trimHttpHttps(host);
|
||||
host = trimHttpHttpsPort(host);
|
||||
|
||||
function hostMatches(cookieHost, matchHost) {
|
||||
if (cookieHost == null) {
|
||||
|
|
@ -2452,7 +2452,12 @@ exports.setupParentProcessForIndexedDB = function ({ mm, prefix }) {
|
|||
/**
|
||||
* General helpers
|
||||
*/
|
||||
function trimHttpHttps(url) {
|
||||
function trimHttpHttpsPort(url) {
|
||||
let match = url.match(/(.+):\d+$/);
|
||||
|
||||
if (match) {
|
||||
url = match[1];
|
||||
}
|
||||
if (url.startsWith("http://")) {
|
||||
return url.substr(7);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue