mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 06:48:38 +09:00
moebius#337: Added option to remove all session cookies for a specific domain
Issue #31 https://github.com/MoonchildProductions/moebius/pull/337
This commit is contained in:
parent
555cdbdacb
commit
e688e88257
11 changed files with 186 additions and 34 deletions
|
|
@ -628,6 +628,12 @@ StorageActors.createActor({
|
|||
.originAttributes);
|
||||
}),
|
||||
|
||||
removeAllSessionCookies: Task.async(function* (host, domain) {
|
||||
let doc = this.storageActor.document;
|
||||
this.removeAllSessionCookies(host, domain, doc.nodePrincipal
|
||||
.originAttributes);
|
||||
}),
|
||||
|
||||
maybeSetupChildProcess() {
|
||||
cookieHelpers.onCookieChanged = this.onCookieChanged.bind(this);
|
||||
|
||||
|
|
@ -644,6 +650,8 @@ StorageActors.createActor({
|
|||
cookieHelpers.removeCookie.bind(cookieHelpers);
|
||||
this.removeAllCookies =
|
||||
cookieHelpers.removeAllCookies.bind(cookieHelpers);
|
||||
this.removeAllSessionCookies =
|
||||
cookieHelpers.removeAllSessionCookies.bind(cookieHelpers);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -667,6 +675,8 @@ StorageActors.createActor({
|
|||
callParentProcess.bind(null, "removeCookie");
|
||||
this.removeAllCookies =
|
||||
callParentProcess.bind(null, "removeAllCookies");
|
||||
this.removeAllSessionCookies =
|
||||
callParentProcess.bind(null, "removeAllSessionCookies");
|
||||
|
||||
addMessageListener("debug:storage-cookie-request-child",
|
||||
cookieHelpers.handleParentRequest);
|
||||
|
|
@ -853,7 +863,8 @@ var cookieHelpers = {
|
|||
if (hostMatches(cookie.host, host) &&
|
||||
(!opts.name || cookie.name === opts.name) &&
|
||||
(!opts.domain || cookie.host === opts.domain) &&
|
||||
(!opts.path || cookie.path === opts.path)) {
|
||||
(!opts.path || cookie.path === opts.path) &&
|
||||
(!opts.session || (!cookie.expires && !cookie.maxAge))) {
|
||||
Services.cookies.remove(
|
||||
cookie.host,
|
||||
cookie.name,
|
||||
|
|
@ -875,6 +886,10 @@ var cookieHelpers = {
|
|||
this._removeCookies(host, { domain, originAttributes });
|
||||
},
|
||||
|
||||
removeAllSessionCookies(host, domain, originAttributes) {
|
||||
this._removeCookies(host, { domain, originAttributes, session: true });
|
||||
},
|
||||
|
||||
addCookieObservers() {
|
||||
Services.obs.addObserver(cookieHelpers, "cookie-changed", false);
|
||||
return null;
|
||||
|
|
@ -951,6 +966,12 @@ var cookieHelpers = {
|
|||
let originAttributes = msg.data.args[2];
|
||||
return cookieHelpers.removeAllCookies(host, domain, originAttributes);
|
||||
}
|
||||
case "removeAllSessionCookies": {
|
||||
let host = msg.data.args[0];
|
||||
let domain = msg.data.args[1];
|
||||
let originAttributes = msg.data.args[2];
|
||||
return cookieHelpers.removeAllSessionCookies(host, domain, originAttributes);
|
||||
}
|
||||
default:
|
||||
console.error("ERR_DIRECTOR_PARENT_UNKNOWN_METHOD", msg.json.method);
|
||||
throw new Error("ERR_DIRECTOR_PARENT_UNKNOWN_METHOD");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue