blob: 2dfdfbe8f7cb482200f91d019028109d8af55e36 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
/* eslint-env mozilla/frame-script */
"use strict";
function getCookieService() {
return Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
}
function getCookies(cs) {
let cookies = [];
for (let cookie of cs.cookies) {
cookies.push({
host: cookie.host,
path: cookie.path,
name: cookie.name,
value: cookie.value,
expires: cookie.expires,
});
}
return cookies;
}
function removeAllCookies(cs) {
cs.removeAll();
}
addMessageListener("init", _ => {
let cs = getCookieService();
removeAllCookies(cs);
sendAsyncMessage("init:return");
});
addMessageListener("getCookies", _ => {
let cs = getCookieService();
let cookies = getCookies(cs);
removeAllCookies(cs);
sendAsyncMessage("getCookies:return", { cookies });
});
addMessageListener("shutdown", _ => {
let cs = getCookieService();
removeAllCookies(cs);
sendAsyncMessage("shutdown:return");
});
|