summaryrefslogtreecommitdiffstats
path: root/devtools/server
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-02 16:38:25 +0100
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-02 16:38:25 +0100
commit26e53627d6922b3b965afd76fc5d72e3cc1d9ba5 (patch)
treef894fd8f5077620e694058995b180c6d1c60dca6 /devtools/server
parentf0175fb7abd0aad3054236fb1a0cc430c6d05db9 (diff)
downloadUXP-26e53627d6922b3b965afd76fc5d72e3cc1d9ba5.tar
UXP-26e53627d6922b3b965afd76fc5d72e3cc1d9ba5.tar.gz
UXP-26e53627d6922b3b965afd76fc5d72e3cc1d9ba5.tar.lz
UXP-26e53627d6922b3b965afd76fc5d72e3cc1d9ba5.tar.xz
UXP-26e53627d6922b3b965afd76fc5d72e3cc1d9ba5.zip
moebius#337: Added option to remove all session cookies for a specific domain
Issue #31 https://github.com/MoonchildProductions/moebius/pull/337
Diffstat (limited to 'devtools/server')
-rw-r--r--devtools/server/actors/storage.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/devtools/server/actors/storage.js b/devtools/server/actors/storage.js
index 6d069939d..6d1e2dc99 100644
--- a/devtools/server/actors/storage.js
+++ b/devtools/server/actors/storage.js
@@ -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");