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:
janekptacijarabaci 2018-03-04 01:58:43 +01:00 committed by Roy Tam
commit 1c0e05bca2
4 changed files with 40 additions and 4 deletions

View file

@ -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);
}