mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 09:45:41 +00:00
3a5c05e76f
Differential Revision: https://phabricator.services.mozilla.com/D3733 --HG-- extra : rebase_source : c0fac176d7b3d840c4dbb14f8d95ccfc7f83a5a8 extra : histedit_source : a92c40117d0808a3ad68c972f622a7a42c9ae8ba
18 lines
526 B
JavaScript
18 lines
526 B
JavaScript
addMessageListener("getCookieFromManager", ({ host, path }) => {
|
|
let cm = Cc["@mozilla.org/cookiemanager;1"]
|
|
.getService(Ci.nsICookieManager);
|
|
let values = [];
|
|
path = path.substring(0, path.lastIndexOf("/") + 1);
|
|
for (let cookie of cm.enumerator) {
|
|
if (!cookie) {
|
|
break;
|
|
}
|
|
if (host != cookie.host || path != cookie.path) {
|
|
continue;
|
|
}
|
|
values.push(cookie.name + "=" + cookie.value);
|
|
}
|
|
|
|
sendAsyncMessage("getCookieFromManager:return", { cookie: values.join("; ") });
|
|
});
|